use of alma.alarmsystem.clients.test.utils.AlrmStatListenerForTesting in project ACS by ACS-Community.
the class AlarmCategoryClientTest method setUp.
/**
* @see extends ComponentClientTestCase
*/
public void setUp() throws Exception {
super.setUp();
categoryClient = new AlarmCategoryClient(getContainerServices());
assertNotNull(categoryClient);
AlarmFilter filter = new AlarmFilter(null, null, 2, 2);
filteredLister = new AlarmListenerForTesting("Filtered_listener");
assertNotNull(filteredLister);
categoryClient.addAlarmListener(this);
categoryClient.addAlarmListener(filteredLister, filter);
statListener = new AlrmStatListenerForTesting();
assertNotNull(statListener);
categoryClient.addStatsListener(statListener);
alarmsReceived = new Vector<Alarm>();
}
use of alma.alarmsystem.clients.test.utils.AlrmStatListenerForTesting in project ACS by ACS-Community.
the class AlarmListenerContainerTest method testAddRemoveStatListeners.
/**
* Test add.remove statistics listeners
*
* @throws Exception
*/
public void testAddRemoveStatListeners() throws Exception {
assertEquals(0, container.getStatListenersSize());
assertEquals(0, container.getAlarmListenersSize());
AlrmStatListenerForTesting stat1 = new AlrmStatListenerForTesting();
assertTrue(container.addStatsListener(stat1));
assertEquals(0, container.getAlarmListenersSize());
assertEquals(1, container.getStatListenersSize());
AlrmStatListenerForTesting stat2 = new AlrmStatListenerForTesting();
assertTrue(container.addStatsListener(stat2));
assertEquals(0, container.getAlarmListenersSize());
assertEquals(2, container.getStatListenersSize());
assertTrue(container.removeStatListener(stat2));
assertEquals(0, container.getAlarmListenersSize());
assertEquals(1, container.getStatListenersSize());
AlrmStatListenerForTesting notExistsentStatL = new AlrmStatListenerForTesting();
assertFalse(container.removeStatListener(notExistsentStatL));
assertEquals(0, container.getAlarmListenersSize());
assertEquals(1, container.getStatListenersSize());
assertTrue(container.removeStatListener(stat1));
assertEquals(0, container.getAlarmListenersSize());
assertEquals(0, container.getStatListenersSize());
}
use of alma.alarmsystem.clients.test.utils.AlrmStatListenerForTesting in project ACS by ACS-Community.
the class AlarmListenerContainerTest method testDispatchStats.
/**
* Test the dispatching of statistics
*/
public void testDispatchStats() throws Exception {
AlarmStatistics stats = new AlarmStatistics();
assertNotNull(stats);
AlrmStatListenerForTesting stat1 = new AlrmStatListenerForTesting();
assertTrue(container.addStatsListener(stat1));
AlrmStatListenerForTesting stat2 = new AlrmStatListenerForTesting();
assertTrue(container.addStatsListener(stat2));
assertEquals(2, container.getStatListenersSize());
assertEquals(0, stat1.numActivationNoifies);
assertEquals(0, stat1.numReductionNofies);
assertEquals(0, stat2.numActivationNoifies);
assertEquals(0, stat2.numReductionNofies);
final int numNotifies = 10;
for (int t = 1; t < numNotifies + 1; t++) {
container.dispatchStatistics(stats);
assertEquals(t, stat1.numActivationNoifies);
assertEquals(t, stat1.numReductionNofies);
assertEquals(t, stat2.numActivationNoifies);
assertEquals(t, stat2.numReductionNofies);
}
}
Aggregations