activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andytay...@apache.org
Subject [05/51] [partial] activemq-6 git commit: ACTIVEMQ6-2 Update to HQ master
Date Tue, 11 Nov 2014 11:00:35 GMT
http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/JMSQueueControlTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/JMSQueueControlTest.java b/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/JMSQueueControlTest.java
index f78509e..2d6b052 100644
--- a/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/JMSQueueControlTest.java
+++ b/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/JMSQueueControlTest.java
@@ -18,8 +18,12 @@ import javax.jms.Message;
 import javax.jms.MessageConsumer;
 import javax.jms.MessageProducer;
 import javax.jms.Session;
+import javax.management.Notification;
 import javax.naming.Context;
+
+import java.util.ArrayList;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
@@ -31,9 +35,11 @@ import org.hornetq.api.core.client.ClientProducer;
 import org.hornetq.api.core.client.ClientSession;
 import org.hornetq.api.core.client.ClientSessionFactory;
 import org.hornetq.api.core.client.ServerLocator;
+import org.hornetq.api.core.management.ObjectNameBuilder;
 import org.hornetq.api.jms.HornetQJMSClient;
 import org.hornetq.api.jms.JMSFactoryType;
 import org.hornetq.api.jms.management.JMSQueueControl;
+import org.hornetq.api.jms.management.JMSServerControl;
 import org.hornetq.core.config.Configuration;
 import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
 import org.hornetq.core.server.HornetQServer;
@@ -43,6 +49,7 @@ import org.hornetq.jms.client.HornetQConnectionFactory;
 import org.hornetq.jms.client.HornetQDestination;
 import org.hornetq.jms.client.HornetQQueue;
 import org.hornetq.jms.server.impl.JMSServerManagerImpl;
+import org.hornetq.jms.server.management.JMSNotificationType;
 import org.hornetq.tests.integration.management.ManagementControlHelper;
 import org.hornetq.tests.integration.management.ManagementTestBase;
 import org.hornetq.tests.unit.util.InVMNamingContext;
@@ -90,7 +97,7 @@ public class JMSQueueControlTest extends ManagementTestBase
    {
       JMSQueueControl queueControl = createManagementControl();
 
-      Assert.assertEquals(0, queueControl.getMessageCount());
+      Assert.assertEquals(0, getMessageCount(queueControl));
       Assert.assertEquals(0, queueControl.getConsumerCount());
 
       Connection connection = JMSUtil.createConnection(InVMConnectorFactory.class.getName());
@@ -104,16 +111,16 @@ public class JMSQueueControlTest extends ManagementTestBase
 
       JMSUtil.sendMessages(queue, 2);
 
-      Assert.assertEquals(2, queueControl.getMessageCount());
-      Assert.assertEquals(2, queueControl.getMessagesAdded());
+      Assert.assertEquals(2, getMessageCount(queueControl));
+      Assert.assertEquals(2, getMessagesAdded(queueControl));
 
       connection.start();
 
       Assert.assertNotNull(consumer.receive(500));
       Assert.assertNotNull(consumer.receive(500));
 
-      Assert.assertEquals(0, queueControl.getMessageCount());
-      Assert.assertEquals(2, queueControl.getMessagesAdded());
+      Assert.assertEquals(0, getMessageCount(queueControl));
+      Assert.assertEquals(2, getMessagesAdded(queueControl));
 
       consumer.close();
 
@@ -127,11 +134,11 @@ public class JMSQueueControlTest extends ManagementTestBase
    {
       JMSQueueControl queueControl = createManagementControl();
 
-      Assert.assertEquals(0, queueControl.getMessageCount());
+      Assert.assertEquals(0, getMessageCount(queueControl));
 
       String[] ids = JMSUtil.sendMessages(queue, 2);
 
-      Assert.assertEquals(2, queueControl.getMessageCount());
+      Assert.assertEquals(2, getMessageCount(queueControl));
 
       Map<String, Object>[] data = queueControl.listMessages(null);
       Assert.assertEquals(2, data.length);
@@ -150,11 +157,11 @@ public class JMSQueueControlTest extends ManagementTestBase
    {
       JMSQueueControl queueControl = createManagementControl();
 
-      Assert.assertEquals(0, queueControl.getMessageCount());
+      Assert.assertEquals(0, getMessageCount(queueControl));
 
       String[] ids = JMSUtil.sendMessages(queue, 2);
 
-      Assert.assertEquals(2, queueControl.getMessageCount());
+      Assert.assertEquals(2, getMessageCount(queueControl));
 
       String jsonString = queueControl.listMessagesAsJSON(null);
       Assert.assertNotNull(jsonString);
@@ -176,11 +183,11 @@ public class JMSQueueControlTest extends ManagementTestBase
    {
       JMSQueueControl queueControl = createManagementControl();
 
-      Assert.assertEquals(0, queueControl.getMessageCount());
+      Assert.assertEquals(0, getMessageCount(queueControl));
 
       JMSUtil.sendMessages(queue, 2);
 
-      Assert.assertEquals(2, queueControl.getMessageCount());
+      Assert.assertEquals(2, getMessageCount(queueControl));
 
       Map<String, Object>[] data = queueControl.listMessages(null);
       Assert.assertEquals(2, data.length);
@@ -197,7 +204,7 @@ public class JMSQueueControlTest extends ManagementTestBase
 
       queueControl.removeMessage(messageID.toString());
 
-      Assert.assertEquals(1, queueControl.getMessageCount());
+      Assert.assertEquals(1, getMessageCount(queueControl));
    }
 
    @Test
@@ -207,7 +214,7 @@ public class JMSQueueControlTest extends ManagementTestBase
 
       JMSQueueControl queueControl = createManagementControl();
 
-      Assert.assertEquals(0, queueControl.getMessageCount());
+      Assert.assertEquals(0, getMessageCount(queueControl));
 
       try
       {
@@ -224,15 +231,15 @@ public class JMSQueueControlTest extends ManagementTestBase
    {
       JMSQueueControl queueControl = createManagementControl();
 
-      Assert.assertEquals(0, queueControl.getMessageCount());
+      Assert.assertEquals(0, getMessageCount(queueControl));
 
       JMSUtil.sendMessages(queue, 2);
 
-      Assert.assertEquals(2, queueControl.getMessageCount());
+      Assert.assertEquals(2, getMessageCount(queueControl));
 
       queueControl.removeMessages(null);
 
-      Assert.assertEquals(0, queueControl.getMessageCount());
+      Assert.assertEquals(0, getMessageCount(queueControl));
 
       Connection connection = JMSUtil.createConnection(InVMConnectorFactory.class.getName());
       connection.start();
@@ -248,7 +255,7 @@ public class JMSQueueControlTest extends ManagementTestBase
    {
       JMSQueueControl queueControl = createManagementControl();
 
-      Assert.assertEquals(0, queueControl.getMessageCount());
+      Assert.assertEquals(0, getMessageCount(queueControl));
 
       Connection conn = createConnection();
 
@@ -263,12 +270,12 @@ public class JMSQueueControlTest extends ManagementTestBase
       message.setStringProperty("foo", "baz");
       producer.send(message);
 
-      Assert.assertEquals(2, queueControl.getMessageCount());
+      Assert.assertEquals(2, getMessageCount(queueControl));
 
       int removedMatchingMessagesCount = queueControl.removeMessages("foo = 'bar'");
       Assert.assertEquals(1, removedMatchingMessagesCount);
 
-      Assert.assertEquals(1, queueControl.getMessageCount());
+      Assert.assertEquals(1, getMessageCount(queueControl));
 
       conn.start();
       MessageConsumer consumer = JMSUtil.createConsumer(conn, queue);
@@ -286,7 +293,7 @@ public class JMSQueueControlTest extends ManagementTestBase
 
       JMSUtil.sendMessages(queue, 1);
 
-      Assert.assertEquals(1, queueControl.getMessageCount());
+      Assert.assertEquals(1, getMessageCount(queueControl));
 
       Map<String, Object>[] data = queueControl.listMessages(null);
       // retrieve the first message info
@@ -317,7 +324,7 @@ public class JMSQueueControlTest extends ManagementTestBase
 
       String[] messageIDs = JMSUtil.sendMessages(queue, 1);
 
-      Assert.assertEquals(1, queueControl.getMessageCount());
+      Assert.assertEquals(1, getMessageCount(queueControl));
 
       try
       {
@@ -371,11 +378,11 @@ public class JMSQueueControlTest extends ManagementTestBase
       Message msg_2 = JMSUtil.sendMessageWithProperty(session, queue, key, unmatchingValue);
 
       JMSQueueControl queueControl = createManagementControl();
-      Assert.assertEquals(2, queueControl.getMessageCount());
+      Assert.assertEquals(2, getMessageCount(queueControl));
 
       int changedMessagesCount = queueControl.changeMessagesPriority(filter, newPriority);
       Assert.assertEquals(1, changedMessagesCount);
-      Assert.assertEquals(2, queueControl.getMessageCount());
+      Assert.assertEquals(2, getMessageCount(queueControl));
 
       connection.start();
       MessageConsumer consumer = session.createConsumer(queue);
@@ -463,13 +470,13 @@ public class JMSQueueControlTest extends ManagementTestBase
 
       String[] messageIDs = JMSUtil.sendMessages(queue, 1);
 
-      Assert.assertEquals(1, queueControl.getMessageCount());
-      Assert.assertEquals(0, expiryQueueControl.getMessageCount());
+      Assert.assertEquals(1, getMessageCount(queueControl));
+      Assert.assertEquals(0, getMessageCount(expiryQueueControl));
 
       Assert.assertTrue(queueControl.expireMessage(messageIDs[0]));
 
-      Assert.assertEquals(0, queueControl.getMessageCount());
-      Assert.assertEquals(1, expiryQueueControl.getMessageCount());
+      Assert.assertEquals(0, getMessageCount(queueControl));
+      Assert.assertEquals(1, getMessageCount(expiryQueueControl));
 
       Connection connection = JMSUtil.createConnection(InVMConnectorFactory.class.getName());
       connection.start();
@@ -517,11 +524,11 @@ public class JMSQueueControlTest extends ManagementTestBase
       connection.close();
 
       JMSQueueControl queueControl = createManagementControl();
-      Assert.assertEquals(2, queueControl.getMessageCount());
+      Assert.assertEquals(2, getMessageCount(queueControl));
 
       int expiredMessagesCount = queueControl.expireMessages(filter);
       Assert.assertEquals(1, expiredMessagesCount);
-      Assert.assertEquals(1, queueControl.getMessageCount());
+      Assert.assertEquals(1, getMessageCount(queueControl));
 
       // consume the unmatched message from queue
       JMSUtil.consumeMessages(1, queue);
@@ -543,7 +550,7 @@ public class JMSQueueControlTest extends ManagementTestBase
       JMSUtil.sendMessageWithProperty(session, queue, key, unmatchingValue);
       JMSUtil.sendMessageWithProperty(session, queue, key, matchingValue);
 
-      Assert.assertEquals(3, queueControl.getMessageCount());
+      Assert.assertEquals(3, getMessageCount(queueControl));
 
       Assert.assertEquals(2, queueControl.countMessages(key + " =" + matchingValue));
       Assert.assertEquals(1, queueControl.countMessages(key + " =" + unmatchingValue));
@@ -608,15 +615,15 @@ public class JMSQueueControlTest extends ManagementTestBase
       JMSQueueControl queueControl = createManagementControl();
       JMSQueueControl dlqControl = ManagementControlHelper.createJMSQueueControl(dlq, mbeanServer);
 
-      Assert.assertEquals(2, queueControl.getMessageCount());
-      Assert.assertEquals(0, dlqControl.getMessageCount());
+      Assert.assertEquals(2, getMessageCount(queueControl));
+      Assert.assertEquals(0, getMessageCount(dlqControl));
 
       queueControl.setDeadLetterAddress(dlq.getAddress());
 
       boolean movedToDeadLetterAddress = queueControl.sendMessageToDeadLetterAddress(message.getJMSMessageID());
       Assert.assertTrue(movedToDeadLetterAddress);
-      Assert.assertEquals(1, queueControl.getMessageCount());
-      Assert.assertEquals(1, dlqControl.getMessageCount());
+      Assert.assertEquals(1, getMessageCount(queueControl));
+      Assert.assertEquals(1, getMessageCount(dlqControl));
 
       // check there is a single message to consume from queue
       JMSUtil.consumeMessages(1, queue);
@@ -667,15 +674,15 @@ public class JMSQueueControlTest extends ManagementTestBase
       JMSQueueControl queueControl = createManagementControl();
       JMSQueueControl dlqControl = ManagementControlHelper.createJMSQueueControl(dlq, mbeanServer);
 
-      Assert.assertEquals(2, queueControl.getMessageCount());
-      Assert.assertEquals(0, dlqControl.getMessageCount());
+      Assert.assertEquals(2, getMessageCount(queueControl));
+      Assert.assertEquals(0, getMessageCount(dlqControl));
 
       queueControl.setDeadLetterAddress(dlq.getAddress());
 
       int deadMessageCount = queueControl.sendMessagesToDeadLetterAddress(filter);
       Assert.assertEquals(1, deadMessageCount);
-      Assert.assertEquals(1, queueControl.getMessageCount());
-      Assert.assertEquals(1, dlqControl.getMessageCount());
+      Assert.assertEquals(1, getMessageCount(queueControl));
+      Assert.assertEquals(1, getMessageCount(dlqControl));
 
       conn.start();
       MessageConsumer consumer = sess.createConsumer(queue);
@@ -704,12 +711,12 @@ public class JMSQueueControlTest extends ManagementTestBase
       JMSUtil.sendMessages(queue, 2);
 
       JMSQueueControl queueControl = createManagementControl();
-      Assert.assertEquals(2, queueControl.getMessageCount());
+      Assert.assertEquals(2, getMessageCount(queueControl));
 
       // moved all messages to otherQueue
       int movedMessagesCount = queueControl.moveMessages(null, otherQueueName);
       Assert.assertEquals(2, movedMessagesCount);
-      Assert.assertEquals(0, queueControl.getMessageCount());
+      Assert.assertEquals(0, getMessageCount(queueControl));
 
       // check there is no message to consume from queue
       JMSUtil.consumeMessages(0, queue);
@@ -756,12 +763,12 @@ public class JMSQueueControlTest extends ManagementTestBase
       JMSUtil.sendMessageWithProperty(session, queue, key, unmatchingValue);
 
       JMSQueueControl queueControl = createManagementControl();
-      Assert.assertEquals(2, queueControl.getMessageCount());
+      Assert.assertEquals(2, getMessageCount(queueControl));
 
       // moved matching messages to otherQueue
       int movedMessagesCount = queueControl.moveMessages(filter, otherQueueName);
       Assert.assertEquals(1, movedMessagesCount);
-      Assert.assertEquals(1, queueControl.getMessageCount());
+      Assert.assertEquals(1, getMessageCount(queueControl));
 
       connection.start();
       MessageConsumer consumer = session.createConsumer(queue);
@@ -788,11 +795,11 @@ public class JMSQueueControlTest extends ManagementTestBase
       String[] messageIDs = JMSUtil.sendMessages(queue, 1);
 
       JMSQueueControl queueControl = createManagementControl();
-      Assert.assertEquals(1, queueControl.getMessageCount());
+      Assert.assertEquals(1, getMessageCount(queueControl));
 
       boolean moved = queueControl.moveMessage(messageIDs[0], otherQueueName);
       Assert.assertTrue(moved);
-      Assert.assertEquals(0, queueControl.getMessageCount());
+      Assert.assertEquals(0, getMessageCount(queueControl));
 
       JMSUtil.consumeMessages(0, queue);
       JMSUtil.consumeMessages(1, otherQueue);
@@ -837,7 +844,7 @@ public class JMSQueueControlTest extends ManagementTestBase
       JMSQueueControl otherQueueControl = ManagementControlHelper.createJMSQueueControl((HornetQQueue) otherQueue,
                                                                                         mbeanServer);
 
-      Assert.assertEquals(10, queueControl.getMessageCount());
+      Assert.assertEquals(10, getMessageCount(queueControl));
 
       int moved = queueControl.moveMessages(null, otherQueueName, true);
 
@@ -872,9 +879,9 @@ public class JMSQueueControlTest extends ManagementTestBase
 
       locator.close();
 
-      Assert.assertEquals(0, queueControl.getMessageCount());
+      Assert.assertEquals(0, getMessageCount(queueControl));
 
-      Assert.assertEquals(0, otherQueueControl.getMessageCount());
+      Assert.assertEquals(0, getMessageCount(otherQueueControl));
 
       serverManager.destroyQueue(otherQueueName);
    }
@@ -923,7 +930,7 @@ public class JMSQueueControlTest extends ManagementTestBase
       JMSQueueControl otherQueueControl = ManagementControlHelper.createJMSQueueControl((HornetQQueue) otherQueue,
                                                                                         mbeanServer);
 
-      Assert.assertEquals(10, queueControl.getMessageCount());
+      Assert.assertEquals(10, getMessageCount(queueControl));
 
       for (int i = 0; i < 10; i++)
       {
@@ -959,9 +966,9 @@ public class JMSQueueControlTest extends ManagementTestBase
 
       locator.close();
 
-      Assert.assertEquals(0, queueControl.getMessageCount());
+      Assert.assertEquals(0, getMessageCount(queueControl));
 
-      Assert.assertEquals(0, otherQueueControl.getMessageCount());
+      Assert.assertEquals(0, getMessageCount(otherQueueControl));
 
       serverManager.destroyQueue(otherQueueName);
    }
@@ -994,8 +1001,8 @@ public class JMSQueueControlTest extends ManagementTestBase
       JMSQueueControl otherQueueControl = ManagementControlHelper.createJMSQueueControl((HornetQQueue) otherQueue,
                                                                                         mbeanServer);
 
-      Assert.assertEquals(1, queueControl.getMessageCount());
-      Assert.assertEquals(1, otherQueueControl.getMessageCount());
+      Assert.assertEquals(1, getMessageCount(queueControl));
+      Assert.assertEquals(1, getMessageCount(otherQueueControl));
 
       int moved = queueControl.moveMessages(null, otherQueueName, true);
 
@@ -1027,9 +1034,9 @@ public class JMSQueueControlTest extends ManagementTestBase
 
       locator.close();
 
-      Assert.assertEquals(0, queueControl.getMessageCount());
+      Assert.assertEquals(0, getMessageCount(queueControl));
 
-      Assert.assertEquals(0, otherQueueControl.getMessageCount());
+      Assert.assertEquals(0, getMessageCount(otherQueueControl));
 
       serverManager.destroyQueue(otherQueueName);
    }
@@ -1043,7 +1050,7 @@ public class JMSQueueControlTest extends ManagementTestBase
       serverManager.createQueue(false, otherQueueName, null, true, otherQueueName);
 
       JMSQueueControl queueControl = createManagementControl();
-      Assert.assertEquals(0, queueControl.getMessageCount());
+      Assert.assertEquals(0, getMessageCount(queueControl));
 
       try
       {
@@ -1170,7 +1177,7 @@ public class JMSQueueControlTest extends ManagementTestBase
       String[] messageIDs = JMSUtil.sendMessages(queue, 1);
 
       JMSQueueControl queueControl = createManagementControl();
-      Assert.assertEquals(1, queueControl.getMessageCount());
+      Assert.assertEquals(1, getMessageCount(queueControl));
 
       try
       {
@@ -1259,6 +1266,46 @@ public class JMSQueueControlTest extends ManagementTestBase
       assertTrue(newBindingAdded);
    }
 
+   //make sure notifications are always received no matter whether
+   //a Queue is created via JMSServerControl or by JMSServerManager directly.
+   @Test
+   public void testCreateQueueNotification() throws Exception
+   {
+      JMSUtil.JMXListener listener = new JMSUtil.JMXListener();
+      this.mbeanServer.addNotificationListener(ObjectNameBuilder.DEFAULT.getJMSServerObjectName(), listener, null, null);
+
+      List<String> connectors = new ArrayList<String>();
+      connectors.add("invm");
+
+      String testQueueName = "newQueue";
+      serverManager.createQueue(true, testQueueName, null, true, testQueueName);
+
+      Notification notif = listener.getNotification();
+
+      assertEquals(JMSNotificationType.QUEUE_CREATED.toString(), notif.getType());
+      assertEquals(testQueueName, notif.getMessage());
+
+      this.serverManager.destroyQueue(testQueueName);
+
+      notif = listener.getNotification();
+      assertEquals(JMSNotificationType.QUEUE_DESTROYED.toString(), notif.getType());
+      assertEquals(testQueueName, notif.getMessage());
+
+      JMSServerControl control = ManagementControlHelper.createJMSServerControl(mbeanServer);
+
+      control.createQueue(testQueueName);
+
+      notif = listener.getNotification();
+      assertEquals(JMSNotificationType.QUEUE_CREATED.toString(), notif.getType());
+      assertEquals(testQueueName, notif.getMessage());
+
+      control.destroyQueue(testQueueName);
+
+      notif = listener.getNotification();
+      assertEquals(JMSNotificationType.QUEUE_DESTROYED.toString(), notif.getType());
+      assertEquals(testQueueName, notif.getMessage());
+   }
+
    // Package protected ---------------------------------------------
 
    // Protected -----------------------------------------------------
@@ -1269,11 +1316,9 @@ public class JMSQueueControlTest extends ManagementTestBase
    {
       super.setUp();
 
-      Configuration conf = createBasicConfig();
-      conf.setSecurityEnabled(false);
-      conf.setJMXManagementEnabled(true);
-      conf.getAcceptorConfigurations().add(new TransportConfiguration(INVM_ACCEPTOR_FACTORY));
-      conf.setFileDeploymentEnabled(false);
+      Configuration conf = createBasicConfig()
+         .addAcceptorConfiguration(new TransportConfiguration(INVM_ACCEPTOR_FACTORY))
+         .setFileDeploymentEnabled(false);
       server = createServer(this.getName().contains("WithRealData"), conf, mbeanServer);
 
       serverManager = new JMSServerManagerImpl(server);

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/JMSQueueControlUsingJMSTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/JMSQueueControlUsingJMSTest.java b/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/JMSQueueControlUsingJMSTest.java
index 6b833d5..13c8cb7 100644
--- a/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/JMSQueueControlUsingJMSTest.java
+++ b/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/JMSQueueControlUsingJMSTest.java
@@ -89,6 +89,20 @@ public class JMSQueueControlUsingJMSTest extends JMSQueueControlTest
 
       return new JMSQueueControl()
       {
+
+         @Override
+         public void flushExecutor()
+         {
+            try
+            {
+               proxy.invokeOperation("flushExecutor");
+            }
+            catch (Exception e)
+            {
+               throw new RuntimeException(e.getMessage(), e);
+            }
+         }
+
          public boolean changeMessagePriority(final String messageID, final int newPriority) throws Exception
          {
             return (Boolean)proxy.invokeOperation("changeMessagePriority", messageID, newPriority);

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/JMSServerControl2Test.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/JMSServerControl2Test.java b/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/JMSServerControl2Test.java
index 93e8b26..1395a81 100644
--- a/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/JMSServerControl2Test.java
+++ b/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/JMSServerControl2Test.java
@@ -29,6 +29,7 @@ import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
 import org.hornetq.api.core.TransportConfiguration;
+import org.hornetq.api.core.management.QueueControl;
 import org.hornetq.api.jms.HornetQJMSClient;
 import org.hornetq.api.jms.management.JMSConnectionInfo;
 import org.hornetq.api.jms.management.JMSConsumerInfo;
@@ -76,10 +77,8 @@ public class JMSServerControl2Test extends ManagementTestBase
 
    private void startHornetQServer(final String acceptorFactory) throws Exception
    {
-      Configuration conf = createBasicConfig();
-      conf.setSecurityEnabled(false);
-      conf.setJMXManagementEnabled(true);
-      conf.getAcceptorConfigurations().add(new TransportConfiguration(acceptorFactory));
+      Configuration conf = createBasicConfig()
+         .addAcceptorConfiguration(new TransportConfiguration(acceptorFactory));
       server = addServer(HornetQServers.newHornetQServer(conf, mbeanServer, true));
       server.start();
 
@@ -128,6 +127,42 @@ public class JMSServerControl2Test extends ManagementTestBase
    }
 
    @Test
+   public void testCloseConsumerConnectionsForAddressForInVM() throws Exception
+   {
+      doCloseConsumerConnectionsForAddress(InVMAcceptorFactory.class.getName(), InVMConnectorFactory.class.getName());
+   }
+
+   @Test
+   public void testCloseConsumerConnectionsForAddressForNetty() throws Exception
+   {
+      doCloseConsumerConnectionsForAddress(NettyAcceptorFactory.class.getName(), NettyConnectorFactory.class.getName());
+   }
+
+   @Test
+   public void testCloseConsumerConnectionsForWildcardAddressForInVM() throws Exception
+   {
+      doCloseConsumerConnectionsForWildcardAddress(InVMAcceptorFactory.class.getName(), InVMConnectorFactory.class.getName());
+   }
+
+   @Test
+   public void testCloseConsumerConnectionsForWildcardAddressForNetty() throws Exception
+   {
+      doCloseConsumerConnectionsForWildcardAddress(NettyAcceptorFactory.class.getName(), NettyConnectorFactory.class.getName());
+   }
+
+   @Test
+   public void testCloseConnectionsForUserForInVM() throws Exception
+   {
+      doCloseConnectionsForUser(InVMAcceptorFactory.class.getName(), InVMConnectorFactory.class.getName());
+   }
+
+   @Test
+   public void testCloseConnectionsForUserForNetty() throws Exception
+   {
+      doCloseConnectionsForUser(NettyAcceptorFactory.class.getName(), NettyConnectorFactory.class.getName());
+   }
+
+   @Test
    public void testListSessionsForInVM() throws Exception
    {
       doListSessions(InVMAcceptorFactory.class.getName(), InVMConnectorFactory.class.getName());
@@ -1023,6 +1058,261 @@ public class JMSServerControl2Test extends ManagementTestBase
       }
    }
 
+   private void doCloseConsumerConnectionsForAddress(final String acceptorFactory, final String connectorFactory) throws Exception
+   {
+      String queueName = RandomUtil.randomString();
+      String queueName2 = RandomUtil.randomString();
+
+      try
+      {
+         startHornetQServer(acceptorFactory);
+         serverManager.createQueue(false, queueName, null, true, queueName);
+         Queue queue = HornetQJMSClient.createQueue(queueName);
+         serverManager.createQueue(false, queueName2, null, true, queueName2);
+         Queue queue2 = HornetQJMSClient.createQueue(queueName2);
+
+         JMSServerControl control = createManagementControl();
+         QueueControl queueControl = createManagementControl("jms.queue." + queueName, "jms.queue." + queueName);
+         QueueControl queueControl2 = createManagementControl("jms.queue." + queueName2, "jms.queue." + queueName2);
+
+         Assert.assertEquals(0, server.getConnectionCount());
+         Assert.assertEquals(0, control.listRemoteAddresses().length);
+         Assert.assertEquals(0, queueControl.getConsumerCount());
+         Assert.assertEquals(0, queueControl2.getConsumerCount());
+
+         ConnectionFactory cf = JMSUtil.createFactory(connectorFactory,
+                                                      JMSServerControl2Test.CONNECTION_TTL,
+                                                      JMSServerControl2Test.PING_PERIOD);
+         Connection connection = cf.createConnection();
+         Session session = connection.createSession();
+         MessageConsumer messageConsumer = session.createConsumer(queue);
+
+         Connection connection2 = cf.createConnection();
+         Session session2 = connection2.createSession();
+         MessageConsumer messageConsumer2 = session2.createConsumer(queue2);
+
+         Assert.assertEquals(2, server.getConnectionCount());
+
+         String[] remoteAddresses = control.listRemoteAddresses();
+         Assert.assertEquals(2, remoteAddresses.length);
+
+         Assert.assertEquals(1, queueControl.getConsumerCount());
+         Assert.assertEquals(1, queueControl2.getConsumerCount());
+
+         final CountDownLatch exceptionLatch = new CountDownLatch(1);
+         connection.setExceptionListener(new ExceptionListener()
+         {
+            public void onException(final JMSException e)
+            {
+               exceptionLatch.countDown();
+            }
+         });
+
+         Assert.assertTrue(control.closeConsumerConnectionsForAddress("jms.queue." + queueName));
+
+         boolean gotException = exceptionLatch.await(2 * JMSServerControl2Test.CONNECTION_TTL, TimeUnit.MILLISECONDS);
+         Assert.assertTrue("did not received the expected JMSException", gotException);
+
+         remoteAddresses = control.listRemoteAddresses();
+         Assert.assertEquals("got " + Arrays.asList(remoteAddresses), 1, remoteAddresses.length);
+         Assert.assertEquals(1, server.getConnectionCount());
+
+         Assert.assertEquals(0, queueControl.getConsumerCount());
+         Assert.assertEquals(1, queueControl2.getConsumerCount());
+
+         connection2.close();
+      }
+      finally
+      {
+         if (serverManager != null)
+         {
+            serverManager.stop();
+         }
+
+         if (server != null)
+         {
+            server.stop();
+         }
+      }
+   }
+
+   private void doCloseConsumerConnectionsForWildcardAddress(final String acceptorFactory, final String connectorFactory) throws Exception
+   {
+      String queueName1 = "x." + RandomUtil.randomString();
+      String queueName2 = "x." + RandomUtil.randomString();
+      String queueName3 = "y." + RandomUtil.randomString();
+
+      try
+      {
+         startHornetQServer(acceptorFactory);
+         serverManager.createQueue(false, queueName1, null, true, queueName1);
+         Queue queue = HornetQJMSClient.createQueue(queueName1);
+         serverManager.createQueue(false, queueName2, null, true, queueName2);
+         Queue queue2 = HornetQJMSClient.createQueue(queueName2);
+         serverManager.createQueue(false, queueName3, null, true, queueName3);
+         Queue queue3 = HornetQJMSClient.createQueue(queueName3);
+
+         JMSServerControl control = createManagementControl();
+         QueueControl queueControl = createManagementControl("jms.queue." + queueName1, "jms.queue." + queueName1);
+         QueueControl queueControl2 = createManagementControl("jms.queue." + queueName2, "jms.queue." + queueName2);
+         QueueControl queueControl3 = createManagementControl("jms.queue." + queueName3, "jms.queue." + queueName3);
+
+         Assert.assertEquals(0, server.getConnectionCount());
+         Assert.assertEquals(0, control.listRemoteAddresses().length);
+         Assert.assertEquals(0, queueControl.getConsumerCount());
+         Assert.assertEquals(0, queueControl2.getConsumerCount());
+         Assert.assertEquals(0, queueControl3.getConsumerCount());
+
+         ConnectionFactory cf = JMSUtil.createFactory(connectorFactory,
+                                                      JMSServerControl2Test.CONNECTION_TTL,
+                                                      JMSServerControl2Test.PING_PERIOD);
+         Connection connection = cf.createConnection();
+         Session session = connection.createSession();
+         MessageConsumer messageConsumer = session.createConsumer(queue);
+
+         Connection connection2 = cf.createConnection();
+         Session session2 = connection2.createSession();
+         MessageConsumer messageConsumer2 = session2.createConsumer(queue2);
+
+         Connection connection3 = cf.createConnection();
+         Session session3 = connection3.createSession();
+         MessageConsumer messageConsumer3 = session3.createConsumer(queue3);
+
+         Assert.assertEquals(3, server.getConnectionCount());
+
+         String[] remoteAddresses = control.listRemoteAddresses();
+         Assert.assertEquals(3, remoteAddresses.length);
+
+         Assert.assertEquals(1, queueControl.getConsumerCount());
+         Assert.assertEquals(1, queueControl2.getConsumerCount());
+         Assert.assertEquals(1, queueControl3.getConsumerCount());
+
+         final CountDownLatch exceptionLatch = new CountDownLatch(2);
+         connection.setExceptionListener(new ExceptionListener()
+         {
+            public void onException(final JMSException e)
+            {
+               exceptionLatch.countDown();
+            }
+         });
+
+         connection2.setExceptionListener(new ExceptionListener()
+         {
+            public void onException(final JMSException e)
+            {
+               exceptionLatch.countDown();
+            }
+         });
+
+         Assert.assertTrue(control.closeConsumerConnectionsForAddress("jms.queue.x.#"));
+
+         boolean gotException = exceptionLatch.await(2 * JMSServerControl2Test.CONNECTION_TTL, TimeUnit.MILLISECONDS);
+         Assert.assertTrue("did not received the expected JMSException", gotException);
+
+         remoteAddresses = control.listRemoteAddresses();
+         Assert.assertEquals("got " + Arrays.asList(remoteAddresses), 1, remoteAddresses.length);
+         Assert.assertEquals(1, server.getConnectionCount());
+
+         Assert.assertEquals(0, queueControl.getConsumerCount());
+         Assert.assertEquals(0, queueControl2.getConsumerCount());
+         Assert.assertEquals(1, queueControl3.getConsumerCount());
+
+         connection.close();
+         connection2.close();
+         connection3.close();
+      }
+      finally
+      {
+         if (serverManager != null)
+         {
+            serverManager.stop();
+         }
+
+         if (server != null)
+         {
+            server.stop();
+         }
+      }
+   }
+
+   private void doCloseConnectionsForUser(final String acceptorFactory, final String connectorFactory) throws Exception
+   {
+      String queueName = RandomUtil.randomString();
+      String queueName2 = RandomUtil.randomString();
+
+      try
+      {
+         startHornetQServer(acceptorFactory);
+         serverManager.createQueue(false, queueName, null, true, queueName);
+         Queue queue = HornetQJMSClient.createQueue(queueName);
+         serverManager.createQueue(false, queueName2, null, true, queueName2);
+         Queue queue2 = HornetQJMSClient.createQueue(queueName2);
+
+         JMSServerControl control = createManagementControl();
+         QueueControl queueControl = createManagementControl("jms.queue." + queueName, "jms.queue." + queueName);
+         QueueControl queueControl2 = createManagementControl("jms.queue." + queueName2, "jms.queue." + queueName2);
+
+         Assert.assertEquals(0, server.getConnectionCount());
+         Assert.assertEquals(0, control.listRemoteAddresses().length);
+         Assert.assertEquals(0, queueControl.getConsumerCount());
+         Assert.assertEquals(0, queueControl2.getConsumerCount());
+
+         ConnectionFactory cf = JMSUtil.createFactory(connectorFactory,
+                                                      JMSServerControl2Test.CONNECTION_TTL,
+                                                      JMSServerControl2Test.PING_PERIOD);
+         Connection connection = cf.createConnection("fakeUser", "fakePassword");
+         Session session = connection.createSession();
+         MessageConsumer messageConsumer = session.createConsumer(queue);
+
+         Connection connection2 = cf.createConnection();
+         Session session2 = connection2.createSession();
+         MessageConsumer messageConsumer2 = session2.createConsumer(queue2);
+
+         Assert.assertEquals(2, server.getConnectionCount());
+
+         String[] remoteAddresses = control.listRemoteAddresses();
+         Assert.assertEquals(2, remoteAddresses.length);
+
+         Assert.assertEquals(1, queueControl.getConsumerCount());
+         Assert.assertEquals(1, queueControl2.getConsumerCount());
+
+         final CountDownLatch exceptionLatch = new CountDownLatch(1);
+         connection.setExceptionListener(new ExceptionListener()
+         {
+            public void onException(final JMSException e)
+            {
+               exceptionLatch.countDown();
+            }
+         });
+
+         Assert.assertTrue(control.closeConnectionsForUser("fakeUser"));
+
+         boolean gotException = exceptionLatch.await(2 * JMSServerControl2Test.CONNECTION_TTL, TimeUnit.MILLISECONDS);
+         Assert.assertTrue("did not received the expected JMSException", gotException);
+
+         remoteAddresses = control.listRemoteAddresses();
+         Assert.assertEquals("got " + Arrays.asList(remoteAddresses), 1, remoteAddresses.length);
+         Assert.assertEquals(1, server.getConnectionCount());
+
+         Assert.assertEquals(0, queueControl.getConsumerCount());
+         Assert.assertEquals(1, queueControl2.getConsumerCount());
+
+         connection2.close();
+      }
+      finally
+      {
+         if (serverManager != null)
+         {
+            serverManager.stop();
+         }
+
+         if (server != null)
+         {
+            server.stop();
+         }
+      }
+   }
+
    // Inner classes -------------------------------------------------
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/JMSServerControlRestartTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/JMSServerControlRestartTest.java b/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/JMSServerControlRestartTest.java
index d8148fc..b6885f8 100644
--- a/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/JMSServerControlRestartTest.java
+++ b/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/JMSServerControlRestartTest.java
@@ -146,12 +146,12 @@ public class JMSServerControlRestartTest extends ManagementTestBase
 
    private JMSServerManager createJMSServer() throws Exception
    {
-      Configuration conf = createDefaultConfig();
-      conf.setSecurityEnabled(false);
-      conf.setJMXManagementEnabled(true);
-      conf.setPersistenceEnabled(true);
-      conf.setJournalType(JournalType.NIO);
-      conf.getAcceptorConfigurations().add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
+      Configuration conf = createDefaultConfig()
+         .setSecurityEnabled(false)
+         .setJMXManagementEnabled(true)
+         .setPersistenceEnabled(true)
+         .setJournalType(JournalType.NIO)
+         .addAcceptorConfiguration(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
       HornetQServer server = HornetQServers.newHornetQServer(conf, mbeanServer);
 
       context = new InVMNamingContext();

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/JMSServerControlTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/JMSServerControlTest.java b/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/JMSServerControlTest.java
index 3cc8651..d7eefef 100644
--- a/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/JMSServerControlTest.java
+++ b/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/JMSServerControlTest.java
@@ -363,6 +363,112 @@ public class JMSServerControlTest extends ManagementTestBase
       }
    }
 
+   @Test
+   public void testDestroyQueueWithConsumersWithoutForcingTheConsumersToClose() throws Exception
+   {
+      String queueJNDIBinding = RandomUtil.randomString();
+      String queueName = RandomUtil.randomString();
+
+      UnitTestCase.checkNoBinding(context, queueJNDIBinding);
+      checkNoResource(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName));
+
+      JMSServerControl control = createManagementControl();
+      control.createQueue(queueName, queueJNDIBinding);
+
+      UnitTestCase.checkBinding(context, queueJNDIBinding);
+      checkResource(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName));
+
+      HornetQConnectionFactory cf = new HornetQConnectionFactory(false, new TransportConfiguration(INVM_CONNECTOR_FACTORY));
+      HornetQConnection connection = (HornetQConnection) cf.createConnection();
+      connection.start();
+      try
+      {
+         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         MessageProducer producer = session.createProducer(HornetQJMSClient.createQueue(queueName));
+         producer.send(session.createTextMessage());
+         // create a consumer will create a Core queue bound to the topic address
+         HornetQMessageConsumer cons = (HornetQMessageConsumer) session.createConsumer(HornetQJMSClient.createQueue(queueName));
+
+         try
+         {
+            control.destroyQueue(queueName, false);
+            fail();
+         }
+         catch (Exception e)
+         {
+            assertTrue(e.getMessage().startsWith("HQ119025"));
+         }
+
+         UnitTestCase.checkBinding(context, queueJNDIBinding);
+         checkResource(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName));
+
+         Assert.assertNotNull(fakeJMSStorageManager.destinationMap.get(queueName));
+
+         assertFalse(cons.isClosed());
+
+         assertNotNull(cons.receive(5000));
+      }
+      finally
+      {
+         if (connection != null)
+         {
+            connection.close();
+         }
+      }
+   }
+
+
+   @Test
+   public void testDestroyTopicWithConsumersWithoutForcingTheConsumersToClose() throws Exception
+   {
+      String topicJNDIBinding = RandomUtil.randomString();
+      String topicName = RandomUtil.randomString();
+
+      UnitTestCase.checkNoBinding(context, topicJNDIBinding);
+      checkNoResource(ObjectNameBuilder.DEFAULT.getJMSTopicObjectName(topicName));
+
+      JMSServerControl control = createManagementControl();
+      control.createTopic(topicName, topicJNDIBinding);
+
+      UnitTestCase.checkBinding(context, topicJNDIBinding);
+      checkResource(ObjectNameBuilder.DEFAULT.getJMSTopicObjectName(topicName));
+
+      HornetQConnectionFactory cf = new HornetQConnectionFactory(false, new TransportConfiguration(INVM_CONNECTOR_FACTORY));
+      HornetQConnection connection = (HornetQConnection) cf.createConnection();
+      connection.start();
+      try
+      {
+         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         // create a consumer will create a Core queue bound to the topic address
+         HornetQMessageConsumer cons = (HornetQMessageConsumer) session.createConsumer(HornetQJMSClient.createTopic(topicName));
+         MessageProducer producer = session.createProducer(HornetQJMSClient.createTopic(topicName));
+         producer.send(session.createTextMessage());
+
+         try
+         {
+            control.destroyTopic(topicName, false);
+            fail();
+         }
+         catch (Exception e)
+         {
+            assertTrue(e.getMessage().startsWith("HQ119025"));
+         }
+
+         UnitTestCase.checkBinding(context, topicJNDIBinding);
+         checkResource(ObjectNameBuilder.DEFAULT.getJMSTopicObjectName(topicName));
+         assertFalse(cons.isClosed());
+
+         assertNotNull(cons.receive(5000));
+      }
+      finally
+      {
+         if (connection != null)
+         {
+            connection.close();
+         }
+      }
+   }
+
 
    @Test
    public void testDestroyTopicWithConsumers() throws Exception
@@ -791,6 +897,23 @@ public class JMSServerControlTest extends ManagementTestBase
    }
 
    @Test
+   public void testDestroyConnectionFactoryWithNullBindings() throws Exception
+   {
+      // Create Connection Factory with Null Bindings
+      JMSServerControl control = createManagementControl();
+      control.createConnectionFactory("test-cf", // Name
+                                      false,     // HA
+                                      false,     // Use Discovery?
+                                      1,         // ConnectionFactory Type
+                                      "invm",    // Connector Names
+                                      null);     // JNDI Bindings
+
+      control.destroyConnectionFactory("test-cf");
+
+      assertTrue(control.getConnectionFactoryNames().length == 0);
+   }
+
+   @Test
    public void testListPreparedTransactionDetails() throws Exception
    {
       Xid xid = newXID();
@@ -935,15 +1058,12 @@ public class JMSServerControlTest extends ManagementTestBase
     */
    protected void startServer() throws Exception
    {
-      Configuration conf = createBasicConfig();
-      conf.setSecurityEnabled(false);
-      conf.setJMXManagementEnabled(true);
-      conf.setPersistenceEnabled(true);
-
-      conf.getAcceptorConfigurations().add(new TransportConfiguration(NETTY_ACCEPTOR_FACTORY));
-      conf.getAcceptorConfigurations().add(new TransportConfiguration(INVM_ACCEPTOR_FACTORY));
-      conf.getConnectorConfigurations().put("netty", new TransportConfiguration(NETTY_CONNECTOR_FACTORY));
-      conf.getConnectorConfigurations().put("invm", new TransportConfiguration(INVM_CONNECTOR_FACTORY));
+      Configuration conf = createBasicConfig()
+         .setPersistenceEnabled(true)
+         .addAcceptorConfiguration(new TransportConfiguration(NETTY_ACCEPTOR_FACTORY))
+         .addAcceptorConfiguration(new TransportConfiguration(INVM_ACCEPTOR_FACTORY))
+         .addConnectorConfiguration("netty", new TransportConfiguration(NETTY_CONNECTOR_FACTORY))
+         .addConnectorConfiguration("invm", new TransportConfiguration(INVM_CONNECTOR_FACTORY));
 
       server = addServer(HornetQServers.newHornetQServer(conf, mbeanServer, true));
 
@@ -1131,4 +1251,4 @@ public class JMSServerControlTest extends ManagementTestBase
       }
    }
 
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/JMSServerControlUsingJMSTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/JMSServerControlUsingJMSTest.java b/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/JMSServerControlUsingJMSTest.java
index 435cf56..13c3c91 100644
--- a/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/JMSServerControlUsingJMSTest.java
+++ b/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/JMSServerControlUsingJMSTest.java
@@ -184,6 +184,16 @@ public class JMSServerControlUsingJMSTest extends JMSServerControlTest
             return (Boolean)proxy.invokeOperation("closeConnectionsForAddress", ipAddress);
          }
 
+         public boolean closeConsumerConnectionsForAddress(final String address) throws Exception
+         {
+            return (Boolean)proxy.invokeOperation("closeConsumerConnectionsForAddress", address);
+         }
+
+         public boolean closeConnectionsForUser(final String userName) throws Exception
+         {
+            return (Boolean)proxy.invokeOperation("closeConnectionsForUser", userName);
+         }
+
          public boolean createQueue(final String name) throws Exception
          {
             return (Boolean)proxy.invokeOperation("createQueue", name);

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/JMSUtil.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/JMSUtil.java b/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/JMSUtil.java
index 1b870ee..ede6476 100644
--- a/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/JMSUtil.java
+++ b/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/JMSUtil.java
@@ -25,11 +25,13 @@ import javax.jms.MessageProducer;
 import javax.jms.Session;
 import javax.jms.Topic;
 import javax.jms.TopicSubscriber;
+import javax.management.Notification;
+import javax.management.NotificationListener;
+
 import java.util.Collection;
 import java.util.Set;
 
 import org.junit.Assert;
-
 import org.hornetq.api.core.HornetQException;
 import org.hornetq.api.core.TransportConfiguration;
 import org.hornetq.api.core.client.ClientSession;
@@ -343,4 +345,20 @@ public class JMSUtil
          }
       }
    }
+
+   public static class JMXListener implements NotificationListener
+   {
+      private Notification notif;
+
+      @Override
+      public void handleNotification(Notification notification, Object handback)
+      {
+         notif = notification;
+      }
+
+      public Notification getNotification()
+      {
+         return notif;
+      }
+   }
 }

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/TopicControlTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/TopicControlTest.java b/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/TopicControlTest.java
index acc0ad9..d4deaeb 100644
--- a/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/TopicControlTest.java
+++ b/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/TopicControlTest.java
@@ -19,19 +19,28 @@ import javax.jms.MessageProducer;
 import javax.jms.Session;
 import javax.jms.TextMessage;
 import javax.jms.TopicSubscriber;
+import javax.management.Notification;
+
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Map;
 
 import org.hornetq.api.core.TransportConfiguration;
+import org.hornetq.api.core.management.ObjectNameBuilder;
 import org.hornetq.api.jms.HornetQJMSClient;
+import org.hornetq.api.jms.management.JMSServerControl;
 import org.hornetq.api.jms.management.SubscriptionInfo;
 import org.hornetq.api.jms.management.TopicControl;
 import org.hornetq.core.config.Configuration;
+import org.hornetq.core.postoffice.Binding;
+import org.hornetq.core.postoffice.impl.LocalQueueBinding;
 import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
 import org.hornetq.core.server.HornetQServer;
 import org.hornetq.core.server.HornetQServers;
 import org.hornetq.jms.client.HornetQDestination;
 import org.hornetq.jms.client.HornetQTopic;
 import org.hornetq.jms.server.impl.JMSServerManagerImpl;
+import org.hornetq.jms.server.management.JMSNotificationType;
 import org.hornetq.tests.integration.management.ManagementControlHelper;
 import org.hornetq.tests.integration.management.ManagementTestBase;
 import org.hornetq.tests.unit.util.InVMNamingContext;
@@ -201,6 +210,21 @@ public class TopicControlTest extends ManagementTestBase
    }
 
    @Test
+   public void testListSubscriptionsAsJSONWithHierarchicalTopics() throws Exception
+   {
+      serverManager.createTopic(false, "my.jms.#", "jms/all");
+      serverManager.createTopic(false, "my.jms.A", "jms/A");
+      HornetQTopic myTopic = (HornetQTopic) HornetQJMSClient.createTopic("my.jms.A");
+
+      TopicControl topicControl = ManagementControlHelper.createTopicControl(myTopic, mbeanServer);
+      String jsonString = topicControl.listDurableSubscriptionsAsJSON();
+      SubscriptionInfo[] infos = SubscriptionInfo.from(jsonString);
+      Assert.assertEquals(1, infos.length);
+      Assert.assertEquals("HornetQ", infos[0].getClientID());
+      Assert.assertEquals("HornetQ", infos[0].getName());
+   }
+
+   @Test
    public void testCountMessagesForSubscription() throws Exception
    {
       String key = "key";
@@ -216,6 +240,11 @@ public class TopicControlTest extends ManagementTestBase
       JMSUtil.sendMessageWithProperty(session, topic, key, unmatchingValue);
       JMSUtil.sendMessageWithProperty(session, topic, key, matchingValue);
 
+      for (Binding binding : server.getPostOffice().getBindingsForAddress(topic.getSimpleAddress()).getBindings())
+      {
+         ((LocalQueueBinding)binding).getQueue().flushExecutor();
+      }
+
       TopicControl topicControl = createManagementControl();
 
       Assert.assertEquals(3, topicControl.getMessageCount());
@@ -517,6 +546,46 @@ public class TopicControlTest extends ManagementTestBase
       connection_3.close();
    }
 
+   //make sure notifications are always received no matter whether
+   //a Topic is created via JMSServerControl or by JMSServerManager directly.
+   @Test
+   public void testCreateTopicNotification() throws Exception
+   {
+      JMSUtil.JMXListener listener = new JMSUtil.JMXListener();
+      this.mbeanServer.addNotificationListener(ObjectNameBuilder.DEFAULT.getJMSServerObjectName(), listener, null, null);
+
+      List<String> connectors = new ArrayList<String>();
+      connectors.add("invm");
+
+      String testTopicName = "newTopic";
+      serverManager.createTopic(true, testTopicName, testTopicName);
+
+      Notification notif = listener.getNotification();
+
+      assertEquals(JMSNotificationType.TOPIC_CREATED.toString(), notif.getType());
+      assertEquals(testTopicName, notif.getMessage());
+
+      this.serverManager.destroyTopic(testTopicName);
+
+      notif = listener.getNotification();
+      assertEquals(JMSNotificationType.TOPIC_DESTROYED.toString(), notif.getType());
+      assertEquals(testTopicName, notif.getMessage());
+
+      JMSServerControl control = ManagementControlHelper.createJMSServerControl(mbeanServer);
+
+      control.createTopic(testTopicName);
+
+      notif = listener.getNotification();
+      assertEquals(JMSNotificationType.TOPIC_CREATED.toString(), notif.getType());
+      assertEquals(testTopicName, notif.getMessage());
+
+      control.destroyTopic(testTopicName);
+
+      notif = listener.getNotification();
+      assertEquals(JMSNotificationType.TOPIC_DESTROYED.toString(), notif.getType());
+      assertEquals(testTopicName, notif.getMessage());
+   }
+
    // Package protected ---------------------------------------------
 
    // Protected -----------------------------------------------------
@@ -527,11 +596,8 @@ public class TopicControlTest extends ManagementTestBase
    {
       super.setUp();
 
-      Configuration conf = createBasicConfig();
-      conf.setSecurityEnabled(false);
-      conf.setJMXManagementEnabled(true);
-      conf.getAcceptorConfigurations()
-         .add(new TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory"));
+      Configuration conf = createBasicConfig()
+         .addAcceptorConfiguration(new TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory"));
       server = HornetQServers.newHornetQServer(conf, mbeanServer, false);
       server.start();
 

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/TopicControlUsingJMSTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/TopicControlUsingJMSTest.java b/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/TopicControlUsingJMSTest.java
index 3bf01c0..e0d3bbe 100644
--- a/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/TopicControlUsingJMSTest.java
+++ b/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/TopicControlUsingJMSTest.java
@@ -437,11 +437,8 @@ public class TopicControlUsingJMSTest extends ManagementTestBase
    {
       super.setUp();
 
-      Configuration conf = createBasicConfig();
-      conf.setSecurityEnabled(false);
-      conf.setJMXManagementEnabled(true);
-      conf.getAcceptorConfigurations()
-          .add(new TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory"));
+      Configuration conf = createBasicConfig()
+         .addAcceptorConfiguration(new TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory"));
       server = HornetQServers.newHornetQServer(conf, mbeanServer, false);
       server.start();
 

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/tests/integration-tests/src/test/java/org/hornetq/tests/integration/journal/NIOJournalCompactTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/hornetq/tests/integration/journal/NIOJournalCompactTest.java b/tests/integration-tests/src/test/java/org/hornetq/tests/integration/journal/NIOJournalCompactTest.java
index 903fcc2..a0f7b0d 100644
--- a/tests/integration-tests/src/test/java/org/hornetq/tests/integration/journal/NIOJournalCompactTest.java
+++ b/tests/integration-tests/src/test/java/org/hornetq/tests/integration/journal/NIOJournalCompactTest.java
@@ -1768,14 +1768,12 @@ public class NIOJournalCompactTest extends JournalImplTestBase
    @Test
    public void testStressDeletesNoSync() throws Exception
    {
-      Configuration config = createBasicConfig();
-      config.setJournalFileSize(100 * 1024);
-      config.setJournalSyncNonTransactional(false);
-      config.setJournalSyncTransactional(false);
-//      config.setJournalBufferTimeout_NIO(2000000000);
-//      config.setJournalBufferTimeout_AIO(2000000000);
-      config.setJournalCompactMinFiles(0);
-      config.setJournalCompactPercentage(0);
+      Configuration config = createBasicConfig()
+         .setJournalFileSize(100 * 1024)
+         .setJournalSyncNonTransactional(false)
+         .setJournalSyncTransactional(false)
+         .setJournalCompactMinFiles(0)
+         .setJournalCompactPercentage(0);
 
       final AtomicInteger errors = new AtomicInteger(0);
 

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/AcceptorControlTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/AcceptorControlTest.java b/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/AcceptorControlTest.java
index 77f8e09..b55023b 100644
--- a/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/AcceptorControlTest.java
+++ b/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/AcceptorControlTest.java
@@ -17,7 +17,6 @@ import org.junit.Test;
 import java.util.HashMap;
 
 import org.junit.Assert;
-
 import org.hornetq.api.core.HornetQException;
 import org.hornetq.api.core.SimpleString;
 import org.hornetq.api.core.TransportConfiguration;
@@ -25,7 +24,7 @@ import org.hornetq.api.core.client.ClientSession;
 import org.hornetq.api.core.client.ClientSessionFactory;
 import org.hornetq.api.core.client.ServerLocator;
 import org.hornetq.api.core.management.AcceptorControl;
-import org.hornetq.api.core.management.NotificationType;
+import org.hornetq.api.core.management.CoreNotificationType;
 import org.hornetq.core.config.Configuration;
 import org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory;
 import org.hornetq.core.server.HornetQServer;
@@ -57,10 +56,8 @@ public class AcceptorControlTest extends ManagementTestBase
                                                                          new HashMap<String, Object>(),
                                                                          RandomUtil.randomString());
 
-      Configuration conf = createBasicConfig();
-      conf.setSecurityEnabled(false);
-      conf.setJMXManagementEnabled(true);
-      conf.getAcceptorConfigurations().add(acceptorConfig);
+      Configuration conf = createBasicConfig()
+         .addAcceptorConfiguration(acceptorConfig);
       HornetQServer service = createServer(false, conf, mbeanServer);
       service.start();
 
@@ -76,10 +73,8 @@ public class AcceptorControlTest extends ManagementTestBase
       TransportConfiguration acceptorConfig = new TransportConfiguration(InVMAcceptorFactory.class.getName(),
                                                                          new HashMap<String, Object>(),
                                                                          RandomUtil.randomString());
-      Configuration conf = createBasicConfig();
-      conf.setSecurityEnabled(false);
-      conf.setJMXManagementEnabled(true);
-      conf.getAcceptorConfigurations().add(acceptorConfig);
+      Configuration conf = createBasicConfig()
+         .addAcceptorConfiguration(acceptorConfig);
       HornetQServer service = createServer(false, conf, mbeanServer);
       service.start();
 
@@ -137,10 +132,8 @@ public class AcceptorControlTest extends ManagementTestBase
       TransportConfiguration acceptorConfig = new TransportConfiguration(InVMAcceptorFactory.class.getName(),
                                                                          new HashMap<String, Object>(),
                                                                          RandomUtil.randomString());
-      Configuration conf = createBasicConfig();
-      conf.setSecurityEnabled(false);
-      conf.setJMXManagementEnabled(true);
-      conf.getAcceptorConfigurations().add(acceptorConfig);
+      Configuration conf = createBasicConfig()
+         .addAcceptorConfiguration(acceptorConfig);
       HornetQServer service = createServer(false, conf, mbeanServer);
       service.start();
 
@@ -156,7 +149,7 @@ public class AcceptorControlTest extends ManagementTestBase
 
       Assert.assertEquals(1, notifListener.getNotifications().size());
       Notification notif = notifListener.getNotifications().get(0);
-      Assert.assertEquals(NotificationType.ACCEPTOR_STOPPED, notif.getType());
+      Assert.assertEquals(CoreNotificationType.ACCEPTOR_STOPPED, notif.getType());
       Assert.assertEquals(InVMAcceptorFactory.class.getName(),
                           notif.getProperties().getSimpleStringProperty(new SimpleString("factory")).toString());
 
@@ -164,7 +157,7 @@ public class AcceptorControlTest extends ManagementTestBase
 
       Assert.assertEquals(2, notifListener.getNotifications().size());
       notif = notifListener.getNotifications().get(1);
-      Assert.assertEquals(NotificationType.ACCEPTOR_STARTED, notif.getType());
+      Assert.assertEquals(CoreNotificationType.ACCEPTOR_STARTED, notif.getType());
       Assert.assertEquals(InVMAcceptorFactory.class.getName(),
                           notif.getProperties().getSimpleStringProperty(new SimpleString("factory")).toString());
    }

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/AddressControlTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/AddressControlTest.java b/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/AddressControlTest.java
index b792140..562e695 100644
--- a/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/AddressControlTest.java
+++ b/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/AddressControlTest.java
@@ -309,10 +309,8 @@ public class AddressControlTest extends ManagementTestBase
    {
       super.setUp();
 
-      Configuration conf = createBasicConfig();
-      conf.setSecurityEnabled(false);
-      conf.setJMXManagementEnabled(true);
-      conf.getAcceptorConfigurations().add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
+      Configuration conf = createBasicConfig()
+         .addAcceptorConfiguration(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
       server = createServer(false, conf, mbeanServer);
       server.start();
 

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/AddressControlUsingCoreTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/AddressControlUsingCoreTest.java b/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/AddressControlUsingCoreTest.java
index 61ee30e..ef5a2e0 100644
--- a/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/AddressControlUsingCoreTest.java
+++ b/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/AddressControlUsingCoreTest.java
@@ -183,10 +183,8 @@ public class AddressControlUsingCoreTest extends ManagementTestBase
    {
       super.setUp();
 
-      Configuration conf = createBasicConfig();
-      conf.setSecurityEnabled(false);
-      conf.setJMXManagementEnabled(true);
-      conf.getAcceptorConfigurations().add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
+      Configuration conf = createBasicConfig()
+         .addAcceptorConfiguration(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
       server = createServer(false, conf, mbeanServer);
       server.start();
 

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/BridgeControlTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/BridgeControlTest.java b/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/BridgeControlTest.java
index 63233ca..11acdb2 100644
--- a/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/BridgeControlTest.java
+++ b/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/BridgeControlTest.java
@@ -12,7 +12,6 @@
  */
 package org.hornetq.tests.integration.management;
 import org.junit.Before;
-
 import org.junit.Test;
 
 import java.util.ArrayList;
@@ -24,13 +23,10 @@ import javax.management.MBeanServer;
 import javax.management.MBeanServerFactory;
 
 import org.junit.Assert;
-
-import org.hornetq.api.config.HornetQDefaultConfiguration;
 import org.hornetq.api.core.SimpleString;
 import org.hornetq.api.core.TransportConfiguration;
-import org.hornetq.api.core.client.HornetQClient;
 import org.hornetq.api.core.management.BridgeControl;
-import org.hornetq.api.core.management.NotificationType;
+import org.hornetq.api.core.management.CoreNotificationType;
 import org.hornetq.api.core.management.ObjectNameBuilder;
 import org.hornetq.core.config.BridgeConfiguration;
 import org.hornetq.core.config.Configuration;
@@ -108,7 +104,7 @@ public class BridgeControlTest extends ManagementTestBase
 
       Assert.assertEquals(1, notifListener.getNotifications().size());
       Notification notif = notifListener.getNotifications().get(0);
-      Assert.assertEquals(NotificationType.BRIDGE_STOPPED, notif.getType());
+      Assert.assertEquals(CoreNotificationType.BRIDGE_STOPPED, notif.getType());
       Assert.assertEquals(bridgeControl.getName(), notif.getProperties()
                                                         .getSimpleStringProperty(new SimpleString("name"))
                                                         .toString());
@@ -117,7 +113,7 @@ public class BridgeControlTest extends ManagementTestBase
 
       Assert.assertEquals(2, notifListener.getNotifications().size());
       notif = notifListener.getNotifications().get(1);
-      Assert.assertEquals(NotificationType.BRIDGE_STARTED, notif.getType());
+      Assert.assertEquals(CoreNotificationType.BRIDGE_STARTED, notif.getType());
       Assert.assertEquals(bridgeControl.getName(), notif.getProperties()
                                                         .getSimpleStringProperty(new SimpleString("name"))
                                                         .toString());
@@ -139,49 +135,41 @@ public class BridgeControlTest extends ManagementTestBase
                                                                           acceptorParams,
                                                                           RandomUtil.randomString());
 
-      CoreQueueConfiguration sourceQueueConfig = new CoreQueueConfiguration(RandomUtil.randomString(),
-                                                                    RandomUtil.randomString(),
-                                                                    null,
-                                                                    false);
-      CoreQueueConfiguration targetQueueConfig = new CoreQueueConfiguration(RandomUtil.randomString(),
-                                                                    RandomUtil.randomString(),
-                                                                    null,
-                                                                    false);
+      CoreQueueConfiguration sourceQueueConfig = new CoreQueueConfiguration()
+         .setAddress(RandomUtil.randomString())
+         .setName(RandomUtil.randomString())
+         .setDurable(false);
+      CoreQueueConfiguration targetQueueConfig = new CoreQueueConfiguration()
+         .setAddress(RandomUtil.randomString())
+         .setName(RandomUtil.randomString())
+         .setDurable(false);
       List<String> connectors = new ArrayList<String>();
       connectors.add(connectorConfig.getName());
-      bridgeConfig = new BridgeConfiguration(RandomUtil.randomString(),
-                                             sourceQueueConfig.getName(),
-                                             targetQueueConfig.getAddress(),
-                                             null,
-                                             null,
-                                             HornetQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE,
-                                             HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
-                                             HornetQClient.DEFAULT_CONNECTION_TTL,
-                                             RandomUtil.randomPositiveLong(),
-                                             HornetQClient.DEFAULT_MAX_RETRY_INTERVAL,
-                                             RandomUtil.randomDouble(),
-                                             RandomUtil.randomPositiveInt(),
-                                             RandomUtil.randomPositiveInt(),
-                                             RandomUtil.randomPositiveInt(),
-                                             RandomUtil.randomBoolean(),
-                                             RandomUtil.randomPositiveInt(),
-                                             connectors,
-                                             false,
-                                       HornetQDefaultConfiguration.getDefaultClusterUser(), CLUSTER_PASSWORD);
-
-      Configuration conf_1 = createBasicConfig();
-      conf_1.setSecurityEnabled(false);
-      conf_1.setJMXManagementEnabled(true);
-      conf_1.getAcceptorConfigurations().add(acceptorConfig);
-      conf_1.getQueueConfigurations().add(targetQueueConfig);
-
-      Configuration conf_0 = createBasicConfig();
-      conf_0.setSecurityEnabled(false);
-      conf_0.setJMXManagementEnabled(true);
-      conf_0.getAcceptorConfigurations().add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
-      conf_0.getConnectorConfigurations().put(connectorConfig.getName(), connectorConfig);
-      conf_0.getQueueConfigurations().add(sourceQueueConfig);
-      conf_0.getBridgeConfigurations().add(bridgeConfig);
+
+
+      Configuration conf_1 = createBasicConfig()
+         .addAcceptorConfiguration(acceptorConfig)
+         .addQueueConfiguration(targetQueueConfig);
+
+      bridgeConfig = new BridgeConfiguration()
+         .setName(RandomUtil.randomString())
+         .setQueueName(sourceQueueConfig.getName())
+         .setForwardingAddress(targetQueueConfig.getAddress())
+         .setRetryInterval(RandomUtil.randomPositiveLong())
+         .setRetryIntervalMultiplier(RandomUtil.randomDouble())
+         .setInitialConnectAttempts(RandomUtil.randomPositiveInt())
+         .setReconnectAttempts(RandomUtil.randomPositiveInt())
+         .setReconnectAttemptsOnSameNode(RandomUtil.randomPositiveInt())
+         .setUseDuplicateDetection(RandomUtil.randomBoolean())
+         .setConfirmationWindowSize(RandomUtil.randomPositiveInt())
+         .setStaticConnectors(connectors)
+         .setPassword(CLUSTER_PASSWORD);
+
+      Configuration conf_0 = createBasicConfig()
+         .addAcceptorConfiguration(new TransportConfiguration(InVMAcceptorFactory.class.getName()))
+         .addConnectorConfiguration(connectorConfig.getName(), connectorConfig)
+         .addQueueConfiguration(sourceQueueConfig)
+         .addBridgeConfiguration(bridgeConfig);
 
       server_1 = HornetQServers.newHornetQServer(conf_1, MBeanServerFactory.createMBeanServer(), false);
       addServer(server_1);

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/BridgeControlUsingCoreTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/BridgeControlUsingCoreTest.java b/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/BridgeControlUsingCoreTest.java
index 17752f4..8ee4e78 100644
--- a/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/BridgeControlUsingCoreTest.java
+++ b/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/BridgeControlUsingCoreTest.java
@@ -24,7 +24,6 @@ import javax.management.MBeanServerFactory;
 
 import org.junit.Assert;
 
-import org.hornetq.api.config.HornetQDefaultConfiguration;
 import org.hornetq.api.core.TransportConfiguration;
 import org.hornetq.api.core.client.ClientSession;
 import org.hornetq.api.core.client.ClientSessionFactory;
@@ -133,50 +132,38 @@ public class BridgeControlUsingCoreTest extends ManagementTestBase
                                                                           acceptorParams,
                                                                           RandomUtil.randomString());
 
-      CoreQueueConfiguration sourceQueueConfig = new CoreQueueConfiguration(RandomUtil.randomString(),
-                                                                    RandomUtil.randomString(),
-                                                                    null,
-                                                                    false);
-      CoreQueueConfiguration targetQueueConfig = new CoreQueueConfiguration(RandomUtil.randomString(),
-                                                                    RandomUtil.randomString(),
-                                                                    null,
-                                                                    false);
+      CoreQueueConfiguration sourceQueueConfig = new CoreQueueConfiguration()
+         .setAddress(RandomUtil.randomString())
+         .setName(RandomUtil.randomString())
+         .setDurable(false);
+      CoreQueueConfiguration targetQueueConfig = new CoreQueueConfiguration()
+         .setAddress(RandomUtil.randomString())
+         .setName(RandomUtil.randomString())
+         .setDurable(false);
       List<String> connectors = new ArrayList<String>();
       connectors.add(connectorConfig.getName());
-      bridgeConfig = new BridgeConfiguration(RandomUtil.randomString(),
-                                             sourceQueueConfig.getName(),
-                                             targetQueueConfig.getAddress(),
-                                             null,
-                                             null,
-                                             HornetQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE,
-                                             HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
-                                             HornetQClient.DEFAULT_CONNECTION_TTL,
-                                             RandomUtil.randomPositiveLong(),
-                                             HornetQClient.DEFAULT_MAX_RETRY_INTERVAL,
-                                             RandomUtil.randomDouble(),
-                                             RandomUtil.randomPositiveInt(),
-                                             RandomUtil.randomPositiveInt(),
-                                             RandomUtil.randomPositiveInt(),
-                                             RandomUtil.randomBoolean(),
-                                             RandomUtil.randomPositiveInt(),
-                                             connectors,
-                                             false,
-                                             HornetQDefaultConfiguration.getDefaultClusterUser(),
-                                             HornetQDefaultConfiguration.getDefaultClusterPassword());
-
-      Configuration conf_1 = createBasicConfig();
-      conf_1.setSecurityEnabled(false);
-      conf_1.setJMXManagementEnabled(true);
-      conf_1.getAcceptorConfigurations().add(acceptorConfig);
-      conf_1.getQueueConfigurations().add(targetQueueConfig);
-
-      Configuration conf_0 = createBasicConfig();
-      conf_0.setSecurityEnabled(false);
-      conf_0.setJMXManagementEnabled(true);
-      conf_0.getAcceptorConfigurations().add(new TransportConfiguration(INVM_ACCEPTOR_FACTORY));
-      conf_0.getConnectorConfigurations().put(connectorConfig.getName(), connectorConfig);
-      conf_0.getQueueConfigurations().add(sourceQueueConfig);
-      conf_0.getBridgeConfigurations().add(bridgeConfig);
+      bridgeConfig = new BridgeConfiguration()
+         .setName(RandomUtil.randomString())
+         .setQueueName(sourceQueueConfig.getName())
+         .setForwardingAddress(targetQueueConfig.getAddress())
+         .setRetryInterval(RandomUtil.randomPositiveLong())
+         .setRetryIntervalMultiplier(RandomUtil.randomDouble())
+         .setInitialConnectAttempts(RandomUtil.randomPositiveInt())
+         .setReconnectAttempts(RandomUtil.randomPositiveInt())
+         .setReconnectAttemptsOnSameNode(RandomUtil.randomPositiveInt())
+         .setUseDuplicateDetection(RandomUtil.randomBoolean())
+         .setConfirmationWindowSize(RandomUtil.randomPositiveInt())
+         .setStaticConnectors(connectors);
+
+      Configuration conf_1 = createBasicConfig()
+         .addAcceptorConfiguration(acceptorConfig)
+         .addQueueConfiguration(targetQueueConfig);
+
+      Configuration conf_0 = createBasicConfig()
+         .addAcceptorConfiguration(new TransportConfiguration(INVM_ACCEPTOR_FACTORY))
+         .addConnectorConfiguration(connectorConfig.getName(), connectorConfig)
+         .addQueueConfiguration(sourceQueueConfig)
+         .addBridgeConfiguration(bridgeConfig);
 
       server_1 = addServer(HornetQServers.newHornetQServer(conf_1, MBeanServerFactory.createMBeanServer(), false));
       server_1.start();

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/BroadcastGroupControlTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/BroadcastGroupControlTest.java b/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/BroadcastGroupControlTest.java
index 026ffe2..9c4364e 100644
--- a/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/BroadcastGroupControlTest.java
+++ b/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/BroadcastGroupControlTest.java
@@ -42,10 +42,14 @@ public class BroadcastGroupControlTest extends ManagementTestBase
 
    public static BroadcastGroupConfiguration randomBroadcastGroupConfiguration(final List<String> connectorInfos)
    {
-      return new BroadcastGroupConfiguration(RandomUtil.randomString(),
-                                             RandomUtil.randomPositiveInt(),
-                                             connectorInfos,
-                                             new UDPBroadcastGroupConfiguration("231.7.7.7", 1199, null, 1198));
+      return new BroadcastGroupConfiguration()
+         .setName(RandomUtil.randomString())
+         .setBroadcastPeriod(RandomUtil.randomPositiveInt())
+         .setConnectorInfos(connectorInfos)
+         .setEndpointFactoryConfiguration(new UDPBroadcastGroupConfiguration()
+            .setGroupAddress("231.7.7.7")
+            .setGroupPort(1199)
+            .setLocalBindPort(1198));
    }
 
    public static Pair<String, String> randomPair()
@@ -65,12 +69,10 @@ public class BroadcastGroupControlTest extends ManagementTestBase
       connectorInfos.add(connectorConfiguration.getName());
       BroadcastGroupConfiguration broadcastGroupConfig = BroadcastGroupControlTest.randomBroadcastGroupConfiguration(connectorInfos);
 
-      Configuration conf = createBasicConfig();
-      conf.setSecurityEnabled(false);
-      conf.setJMXManagementEnabled(true);
-      conf.getConnectorConfigurations().put(connectorConfiguration.getName(), connectorConfiguration);
-      conf.getBroadcastGroupConfigurations().add(broadcastGroupConfig);
-      conf.getAcceptorConfigurations().add(new TransportConfiguration(INVM_ACCEPTOR_FACTORY));
+      Configuration conf = createBasicConfig()
+         .addConnectorConfiguration(connectorConfiguration.getName(), connectorConfiguration)
+         .addBroadcastGroupConfiguration(broadcastGroupConfig)
+         .addAcceptorConfiguration(new TransportConfiguration(INVM_ACCEPTOR_FACTORY));
       service = addServer(HornetQServers.newHornetQServer(conf, mbeanServer, false));
       service.start();
 
@@ -105,12 +107,10 @@ public class BroadcastGroupControlTest extends ManagementTestBase
       connectorInfos.add(connectorConfiguration.getName());
       BroadcastGroupConfiguration broadcastGroupConfig = BroadcastGroupControlTest.randomBroadcastGroupConfiguration(connectorInfos);
 
-      Configuration conf = createBasicConfig();
-      conf.setSecurityEnabled(false);
-      conf.setJMXManagementEnabled(true);
-      conf.getConnectorConfigurations().put(connectorConfiguration.getName(), connectorConfiguration);
-      conf.getBroadcastGroupConfigurations().add(broadcastGroupConfig);
-      conf.getAcceptorConfigurations().add(new TransportConfiguration(INVM_ACCEPTOR_FACTORY));
+      Configuration conf = createBasicConfig()
+         .addConnectorConfiguration(connectorConfiguration.getName(), connectorConfiguration)
+         .addBroadcastGroupConfiguration(broadcastGroupConfig)
+         .addAcceptorConfiguration(new TransportConfiguration(INVM_ACCEPTOR_FACTORY));
       service = addServer(HornetQServers.newHornetQServer(conf, mbeanServer, false));
       service.start();
 


Mime
View raw message