use of org.apache.activemq.artemis.api.core.management.BridgeControl in project activemq-artemis by apache.
the class BridgeControlTest method testNotifications.
@Test
public void testNotifications() throws Exception {
SimpleNotificationService.Listener notifListener = new SimpleNotificationService.Listener();
BridgeControl bridgeControl = createBridgeControl(bridgeConfig.getName(), mbeanServer);
server_0.getManagementService().addNotificationListener(notifListener);
Assert.assertEquals(0, notifListener.getNotifications().size());
bridgeControl.stop();
Assert.assertEquals(1, notifListener.getNotifications().size());
Notification notif = notifListener.getNotifications().get(0);
Assert.assertEquals(CoreNotificationType.BRIDGE_STOPPED, notif.getType());
Assert.assertEquals(bridgeControl.getName(), notif.getProperties().getSimpleStringProperty(new SimpleString("name")).toString());
bridgeControl.start();
Assert.assertEquals(2, notifListener.getNotifications().size());
notif = notifListener.getNotifications().get(1);
Assert.assertEquals(CoreNotificationType.BRIDGE_STARTED, notif.getType());
Assert.assertEquals(bridgeControl.getName(), notif.getProperties().getSimpleStringProperty(new SimpleString("name")).toString());
}
Aggregations