Subject: RE: CMEAddressActivatedEvent and CMEAddressDeactivatedEvent share Type valu
Replied by: Yaw-Ming Chen on 27-03-2012 01:51:52 PM
Yes, it's a bug, Will raise a case.
Thanks
This document was generated from CDN thread
Created by: Kyle Tuffley on 27-03-2012 12:40:33 PM
Hello,
I found an issue with the CMEAddressDeactivatedEvent. I am using a CMECSTAListener to recieve CMEEvents. I am using the events, if the event is of type CMENotification, to monitor calls and to keep a phone inventory of devices and thier statuses. We can clearly see that CMENotification.Type.ADDRESS_ACTIVATED is 2004 and CMENotification.Type.ADDRESS_DEACTIVATED = 2005. But the CMEAddressActivatedEvent object Type and the CMEAddressDeactivatedEvent object Type share the same Type.
I found this issue while writting unit tests using PowerMock and junit
Sample code:
@Test
public void testOnNotificationAddressEvent() throws Exception {
CMECSTAAbstractSession session = new CMECSTASessionImpl();
String phoneName = "SEP1234";
CMEProvider provider = PowerMock.createNiceMock(CMEProvider.class);
CMELocalAddress addr = new CMELocalAddress(provider, 5, phoneName);
session.setAddress(addr);
CMEAddressDeactivatedEvent deactivatedEvent = new CMEAddressDeactivatedEvent(new Object(), session);
CMEAddressActivatedEvent activatedEvent = new CMEAddressActivatedEvent(new Object(), session);
assertEquals(deactivatedEvent.getType(), activatedEvent.getType());
}