Exemplo n.º 1
0
 protected void removeAllMessages(final String queueName, final int index) throws Exception {
   ManagementService managementService = server0.getManagementService();
   if (index == 1) {
     managementService = server1.getManagementService();
   }
   JMSQueueControl queueControl =
       (JMSQueueControl) managementService.getResource(ResourceNames.JMS_QUEUE + queueName);
   queueControl.removeMessages(null);
 }
Exemplo n.º 2
0
 protected void checkNoSubscriptions(final Topic topic, final int index) throws Exception {
   ManagementService managementService = server0.getManagementService();
   if (index == 1) {
     managementService = server1.getManagementService();
   }
   TopicControl topicControl =
       (TopicControl)
           managementService.getResource(ResourceNames.JMS_TOPIC + topic.getTopicName());
   Assert.assertEquals(0, topicControl.getSubscriptionCount());
 }
Exemplo n.º 3
0
  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(NotificationType.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(NotificationType.BRIDGE_STARTED, notif.getType());
    Assert.assertEquals(
        bridgeControl.getName(),
        notif.getProperties().getSimpleStringProperty(new SimpleString("name")).toString());
  }
Exemplo n.º 4
0
  public boolean checkEmpty(final Queue queue, final int index) throws Exception {
    ManagementService managementService = server0.getManagementService();
    if (index == 1) {
      managementService = server1.getManagementService();
    }
    JMSQueueControl queueControl =
        (JMSQueueControl)
            managementService.getResource(ResourceNames.JMS_QUEUE + queue.getQueueName());

    Long messageCount = queueControl.getMessageCount();

    if (messageCount > 0) {
      queueControl.removeMessages(null);
    }
    return true;
  }
Exemplo n.º 5
0
 private AddressControl getAddressControl(
     final OperationContext context, final ModelNode operation) {
   final String addressName =
       PathAddress.pathAddress(operation.require(OP_ADDR)).getLastElement().getValue();
   final ServiceName hqServiceName =
       MessagingServices.getHornetQServiceName(
           PathAddress.pathAddress(operation.get(ModelDescriptionConstants.OP_ADDR)));
   ServiceController<?> hqService = context.getServiceRegistry(false).getService(hqServiceName);
   HornetQServer hqServer = HornetQServer.class.cast(hqService.getValue());
   return AddressControl.class.cast(
       hqServer.getManagementService().getResource(ResourceNames.CORE_ADDRESS + addressName));
 }