Search in sources :

Example 6 with BridgeControl

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());
}
Also used : BridgeControl(org.apache.activemq.artemis.api.core.management.BridgeControl) SimpleNotificationService(org.apache.activemq.artemis.tests.integration.SimpleNotificationService) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) Notification(org.apache.activemq.artemis.core.server.management.Notification) Test(org.junit.Test)

Aggregations

BridgeControl (org.apache.activemq.artemis.api.core.management.BridgeControl)6 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)4 Test (org.junit.Test)4 JsonObject (javax.json.JsonObject)1 ObjectName (javax.management.ObjectName)1 ClientConsumer (org.apache.activemq.artemis.api.core.client.ClientConsumer)1 ClientMessage (org.apache.activemq.artemis.api.core.client.ClientMessage)1 ClientProducer (org.apache.activemq.artemis.api.core.client.ClientProducer)1 ClientSession (org.apache.activemq.artemis.api.core.client.ClientSession)1 ClientSessionFactory (org.apache.activemq.artemis.api.core.client.ClientSessionFactory)1 ServerLocator (org.apache.activemq.artemis.api.core.client.ServerLocator)1 ActiveMQServerControl (org.apache.activemq.artemis.api.core.management.ActiveMQServerControl)1 BridgeControlImpl (org.apache.activemq.artemis.core.management.impl.BridgeControlImpl)1 Notification (org.apache.activemq.artemis.core.server.management.Notification)1 SimpleNotificationService (org.apache.activemq.artemis.tests.integration.SimpleNotificationService)1