[jboss-cvs] JBoss Messaging SVN: r6122 - in trunk/tests: src/org/jboss/messaging/tests/integration/jms/management and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Mar 20 05:33:55 EDT 2009


Author: jmesnil
Date: 2009-03-20 05:33:55 -0400 (Fri, 20 Mar 2009)
New Revision: 6122

Added:
   trunk/tests/src/org/jboss/messaging/tests/integration/management/AddressControlUsingCoreTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/management/CoreMessagingProxy.java
   trunk/tests/src/org/jboss/messaging/tests/integration/management/ManagementTestBase.java
   trunk/tests/src/org/jboss/messaging/tests/integration/management/MessagingServerControlUsingCoreTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/management/QueueControlUsingCoreTest.java
Removed:
   trunk/tests/src/org/jboss/messaging/tests/integration/management/core/
Modified:
   trunk/tests/joram-tests/src/org/jboss/test/jms/JBossMessagingAdmin.java
   trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/JMSQueueControlTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/JMSServerControl2Test.java
   trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/JMSServerControlTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/TopicControlTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/management/AcceptorControlTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/management/AddressControlTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/management/BridgeControlTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/management/BroadcastGroupControlTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/management/DiscoveryGroupControlTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/management/ManagementServiceImplTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/management/MessagingServerControlTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/management/QueueControlTest.java
Log:
management integration tests

* refactored tests by using common base class ManagementTestBase

Modified: trunk/tests/joram-tests/src/org/jboss/test/jms/JBossMessagingAdmin.java
===================================================================
--- trunk/tests/joram-tests/src/org/jboss/test/jms/JBossMessagingAdmin.java	2009-03-20 09:06:02 UTC (rev 6121)
+++ trunk/tests/joram-tests/src/org/jboss/test/jms/JBossMessagingAdmin.java	2009-03-20 09:33:55 UTC (rev 6122)
@@ -22,25 +22,6 @@
 
 package org.jboss.test.jms;
 
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_ACK_BATCH_SIZE;
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_AUTO_GROUP;
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_ACKNOWLEDGE;
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CALL_TIMEOUT;
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME;
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONNECTION_TTL;
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONSUMER_MAX_RATE;
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONSUMER_WINDOW_SIZE;
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MAX_CONNECTIONS;
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MAX_RETRIES_AFTER_FAILOVER;
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MAX_RETRIES_BEFORE_FAILOVER;
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MIN_LARGE_MESSAGE_SIZE;
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PING_PERIOD;
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE;
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PRODUCER_MAX_RATE;
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL;
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL_MULTIPLIER;
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_SEND_WINDOW_SIZE;
-
 import java.io.BufferedReader;
 import java.io.InputStreamReader;
 import java.io.OutputStreamWriter;
@@ -63,7 +44,6 @@
 import org.jboss.messaging.core.management.ObjectNames;
 import org.jboss.messaging.core.security.impl.SecurityStoreImpl;
 import org.jboss.messaging.integration.transports.netty.NettyConnectorFactory;
-import org.jboss.messaging.tests.integration.management.core.CoreMessagingProxy;
 import org.jboss.messaging.tests.util.SpawnedVMSupport;
 import org.objectweb.jtests.jms.admin.Admin;
 

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/JMSQueueControlTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/JMSQueueControlTest.java	2009-03-20 09:06:02 UTC (rev 6121)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/JMSQueueControlTest.java	2009-03-20 09:33:55 UTC (rev 6122)
@@ -52,8 +52,6 @@
 import javax.jms.MessageConsumer;
 import javax.jms.MessageProducer;
 import javax.jms.Session;
-import javax.management.MBeanServer;
-import javax.management.MBeanServerFactory;
 import javax.management.openmbean.CompositeData;
 import javax.management.openmbean.TabularData;
 import javax.naming.Context;
@@ -71,8 +69,8 @@
 import org.jboss.messaging.jms.server.impl.JMSServerManagerImpl;
 import org.jboss.messaging.jms.server.management.JMSQueueControlMBean;
 import org.jboss.messaging.tests.integration.management.ManagementControlHelper;
+import org.jboss.messaging.tests.integration.management.ManagementTestBase;
 import org.jboss.messaging.tests.unit.util.InVMContext;
-import org.jboss.messaging.tests.util.UnitTestCase;
 import org.jboss.messaging.utils.SimpleString;
 
 /**
@@ -84,7 +82,7 @@
  *
  *
  */
-public class JMSQueueControlTest extends UnitTestCase
+public class JMSQueueControlTest extends ManagementTestBase
 {
    // Constants -----------------------------------------------------
 
@@ -96,8 +94,6 @@
 
    protected JBossQueue queue;
 
-   private MBeanServer mbeanServer;
-
    protected Context context;
 
    // Static --------------------------------------------------------
@@ -665,7 +661,6 @@
    {
       super.setUp();
 
-      mbeanServer = MBeanServerFactory.createMBeanServer();
       Configuration conf = new ConfigurationImpl();
       conf.setSecurityEnabled(false);
       conf.setJMXManagementEnabled(true);

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/JMSServerControl2Test.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/JMSServerControl2Test.java	2009-03-20 09:06:02 UTC (rev 6121)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/JMSServerControl2Test.java	2009-03-20 09:33:55 UTC (rev 6122)
@@ -22,7 +22,6 @@
 
 package org.jboss.messaging.tests.integration.jms.management;
 
-import static org.jboss.messaging.tests.integration.management.ManagementControlHelper.createJMSServerControl;
 import static org.jboss.messaging.tests.util.RandomUtil.randomString;
 
 import java.util.concurrent.CountDownLatch;
@@ -33,9 +32,6 @@
 import javax.jms.ExceptionListener;
 import javax.jms.JMSException;
 import javax.jms.Session;
-import javax.management.MBeanServer;
-import javax.management.MBeanServerFactory;
-import javax.management.ObjectName;
 
 import org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl;
 import org.jboss.messaging.core.config.Configuration;
@@ -52,8 +48,8 @@
 import org.jboss.messaging.jms.server.impl.JMSServerManagerImpl;
 import org.jboss.messaging.jms.server.management.JMSServerControlMBean;
 import org.jboss.messaging.tests.integration.management.ManagementControlHelper;
+import org.jboss.messaging.tests.integration.management.ManagementTestBase;
 import org.jboss.messaging.tests.unit.util.InVMContext;
-import org.jboss.messaging.tests.util.UnitTestCase;
 
 /**
  * A QueueControlTest
@@ -64,7 +60,7 @@
  *
  *
  */
-public class JMSServerControl2Test extends UnitTestCase
+public class JMSServerControl2Test extends ManagementTestBase
 {
    // Constants -----------------------------------------------------
 
@@ -72,15 +68,12 @@
 
    // Attributes ----------------------------------------------------
 
-   private MBeanServer mbeanServer;
-
    private InVMContext context;
 
    // Static --------------------------------------------------------
 
    private MessagingService startMessagingService(String acceptorFactory) throws Exception
    {
-      mbeanServer = MBeanServerFactory.createMBeanServer();
       Configuration conf = new ConfigurationImpl();
       conf.setSecurityEnabled(false);
       conf.setJMXManagementEnabled(true);
@@ -98,7 +91,6 @@
 
    private MessagingService startMessagingService(int discoveryPort) throws Exception
    {
-      mbeanServer = MBeanServerFactory.createMBeanServer();
       Configuration conf = new ConfigurationImpl();
       conf.setSecurityEnabled(false);
       conf.setJMXManagementEnabled(true);
@@ -133,7 +125,7 @@
 
          service = startMessagingService(8765);
 
-         checkNoBinding(cfJNDIBinding);
+         checkNoBinding(context, cfJNDIBinding);
 
          JMSServerControlMBean control = createManagementControl();
          control.createConnectionFactory(cfName,
@@ -166,7 +158,7 @@
                                          ClientSessionFactoryImpl.DEFAULT_MAX_RETRIES_AFTER_FAILOVER,
                                          cfJNDIBinding);
 
-         Object o = checkBinding(cfJNDIBinding);
+         Object o = checkBinding(context, cfJNDIBinding);
          assertTrue(o instanceof ConnectionFactory);
          ConnectionFactory cf = (ConnectionFactory)o;
          Connection connection = cf.createConnection();
@@ -460,35 +452,7 @@
          }
       }
    }
-
-   private void checkNoBinding(String binding)
-   {
-      try
-      {
-         context.lookup(binding);
-         fail("there must be no resource to look up for " + binding);
-      }
-      catch (Exception e)
-      {
-      }
-   }
-
-   private Object checkBinding(String binding) throws Exception
-   {
-      Object o = context.lookup(binding);
-      assertNotNull(o);
-      return o;
-   }
-
-   private void checkNoResource(ObjectName on)
-   {
-      assertFalse(mbeanServer.isRegistered(on));
-   }
-
-   private void checkResource(ObjectName on)
-   {
-      assertTrue(mbeanServer.isRegistered(on));
-   }
+   
    // Inner classes -------------------------------------------------
 
 }
\ No newline at end of file

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/JMSServerControlTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/JMSServerControlTest.java	2009-03-20 09:06:02 UTC (rev 6121)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/JMSServerControlTest.java	2009-03-20 09:33:55 UTC (rev 6122)
@@ -32,9 +32,6 @@
 import javax.jms.ConnectionFactory;
 import javax.jms.Queue;
 import javax.jms.Topic;
-import javax.management.MBeanServer;
-import javax.management.MBeanServerFactory;
-import javax.management.ObjectName;
 
 import org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl;
 import org.jboss.messaging.core.config.Configuration;
@@ -50,8 +47,8 @@
 import org.jboss.messaging.jms.server.management.ConnectionFactoryControlMBean;
 import org.jboss.messaging.jms.server.management.JMSServerControlMBean;
 import org.jboss.messaging.tests.integration.management.ManagementControlHelper;
+import org.jboss.messaging.tests.integration.management.ManagementTestBase;
 import org.jboss.messaging.tests.unit.util.InVMContext;
-import org.jboss.messaging.tests.util.UnitTestCase;
 
 /**
  * A QueueControlTest
@@ -62,7 +59,7 @@
  *
  *
  */
-public class JMSServerControlTest extends UnitTestCase
+public class JMSServerControlTest extends ManagementTestBase
 {
    // Constants -----------------------------------------------------
 
@@ -70,8 +67,6 @@
 
    // Attributes ----------------------------------------------------
 
-   private MBeanServer mbeanServer;
-
    protected InVMContext context;
 
    protected MessagingServiceImpl service;
@@ -94,13 +89,13 @@
       String queueJNDIBinding = randomString();
       String queueName = randomString();
 
-      checkNoBinding(queueJNDIBinding);
+      checkNoBinding(context, queueJNDIBinding);
       checkNoResource(ObjectNames.getJMSQueueObjectName(queueName));
 
       JMSServerControlMBean control = createManagementControl();
       control.createQueue(queueName, queueJNDIBinding);
 
-      Object o = checkBinding(queueJNDIBinding);
+      Object o = checkBinding(context, queueJNDIBinding);
       assertTrue(o instanceof Queue);
       Queue queue = (Queue)o;
       assertEquals(queueName, queue.getQueueName());
@@ -113,18 +108,18 @@
       String queueJNDIBinding = randomString();
       String queueName = randomString();
 
-      checkNoBinding(queueJNDIBinding);
+      checkNoBinding(context, queueJNDIBinding);
       checkNoResource(ObjectNames.getJMSQueueObjectName(queueName));
 
       JMSServerControlMBean control = createManagementControl();
       control.createQueue(queueName, queueJNDIBinding);
 
-      checkBinding(queueJNDIBinding);
+      checkBinding(context, queueJNDIBinding);
       checkResource(ObjectNames.getJMSQueueObjectName(queueName));
 
       control.destroyQueue(queueName);
 
-      checkNoBinding(queueJNDIBinding);
+      checkNoBinding(context, queueJNDIBinding);
       checkNoResource(ObjectNames.getJMSQueueObjectName(queueName));
 
    }
@@ -134,13 +129,13 @@
       String topicJNDIBinding = randomString();
       String topicName = randomString();
 
-      checkNoBinding(topicJNDIBinding);
+      checkNoBinding(context, topicJNDIBinding);
       checkNoResource(ObjectNames.getJMSTopicObjectName(topicName));
 
       JMSServerControlMBean control = createManagementControl();
       control.createTopic(topicName, topicJNDIBinding);
 
-      Object o = checkBinding(topicJNDIBinding);
+      Object o = checkBinding(context, topicJNDIBinding);
       assertTrue(o instanceof Topic);
       Topic topic = (Topic)o;
       assertEquals(topicName, topic.getTopicName());
@@ -152,18 +147,18 @@
       String topicJNDIBinding = randomString();
       String topicName = randomString();
 
-      checkNoBinding(topicJNDIBinding);
+      checkNoBinding(context, topicJNDIBinding);
       checkNoResource(ObjectNames.getJMSTopicObjectName(topicName));
 
       JMSServerControlMBean control = createManagementControl();
       control.createTopic(topicName, topicJNDIBinding);
 
-      checkBinding(topicJNDIBinding);
+      checkBinding(context, topicJNDIBinding);
       checkResource(ObjectNames.getJMSTopicObjectName(topicName));
 
       control.destroyTopic(topicName);
 
-      checkNoBinding(topicJNDIBinding);
+      checkNoBinding(context, topicJNDIBinding);
       checkNoResource(ObjectNames.getJMSTopicObjectName(topicName));
    }
 
@@ -172,13 +167,13 @@
       String cfJNDIBinding = randomString();
       String cfName = randomString();
 
-      checkNoBinding(cfJNDIBinding);
+      checkNoBinding(context, cfJNDIBinding);
       checkNoResource(ObjectNames.getConnectionFactoryObjectName(cfName));
 
       JMSServerControlMBean control = createManagementControl();
       control.createConnectionFactory(cfName, InVMConnectorFactory.class.getName(), cfJNDIBinding);
 
-      Object o = checkBinding(cfJNDIBinding);
+      Object o = checkBinding(context, cfJNDIBinding);
       assertTrue(o instanceof ConnectionFactory);
       ConnectionFactory cf = (ConnectionFactory)o;
       Connection connection = cf.createConnection();
@@ -195,7 +190,7 @@
       boolean blockOnNonPersistentSend = randomBoolean();
       boolean blockOnPersistentSend = randomBoolean();
 
-      checkNoBinding(cfJNDIBinding);
+      checkNoBinding(context, cfJNDIBinding);
       checkNoResource(ObjectNames.getConnectionFactoryObjectName(cfName));
 
       JMSServerControlMBean control = createManagementControl();
@@ -207,7 +202,7 @@
                                       preAcknowledge,
                                       cfJNDIBinding);
 
-      Object o = checkBinding(cfJNDIBinding);
+      Object o = checkBinding(context, cfJNDIBinding);
       assertTrue(o instanceof ConnectionFactory);
       ConnectionFactory cf = (ConnectionFactory)o;
       Connection connection = cf.createConnection();
@@ -248,7 +243,7 @@
       boolean blockOnNonPersistentSend = randomBoolean();
       boolean blockOnPersistentSend = randomBoolean();
 
-      checkNoBinding(cfJNDIBinding);
+      checkNoBinding(context, cfJNDIBinding);
       checkNoResource(ObjectNames.getConnectionFactoryObjectName(cfName));
 
       JMSServerControlMBean control = createManagementControl();
@@ -279,7 +274,7 @@
                                       maxRetriesAfterFailover,
                                       cfJNDIBinding);
 
-      Object o = checkBinding(cfJNDIBinding);
+      Object o = checkBinding(context, cfJNDIBinding);
       assertTrue(o instanceof ConnectionFactory);
       ConnectionFactory cf = (ConnectionFactory)o;
       Connection connection = cf.createConnection();
@@ -317,13 +312,13 @@
       String cfJNDIBinding = randomString();
       String cfName = randomString();
 
-      checkNoBinding(cfJNDIBinding);
+      checkNoBinding(context, cfJNDIBinding);
       checkNoResource(ObjectNames.getConnectionFactoryObjectName(cfName));
 
       JMSServerControlMBean control = createManagementControl();
       control.createConnectionFactory(cfName, InVMConnectorFactory.class.getName(), cfJNDIBinding);
 
-      Object o = checkBinding(cfJNDIBinding);
+      Object o = checkBinding(context, cfJNDIBinding);
       assertTrue(o instanceof ConnectionFactory);
       ConnectionFactory cf = (ConnectionFactory)o;
       Connection connection = cf.createConnection();
@@ -332,7 +327,7 @@
 
       control.destroyConnectionFactory(cfName);
 
-      checkNoBinding(cfJNDIBinding);
+      checkNoBinding(context, cfJNDIBinding);
       checkNoResource(ObjectNames.getConnectionFactoryObjectName(cfName));
    }
 
@@ -345,7 +340,6 @@
    {
       super.setUp();
 
-      mbeanServer = MBeanServerFactory.createMBeanServer();
       Configuration conf = new ConfigurationImpl();
       conf.setSecurityEnabled(false);
       conf.setJMXManagementEnabled(true);
@@ -374,35 +368,6 @@
 
    // Private -------------------------------------------------------
 
-   private void checkNoBinding(String binding)
-   {
-      try
-      {
-         context.lookup(binding);
-         fail("there must be no resource to look up for " + binding);
-      }
-      catch (Exception e)
-      {
-      }
-   }
-
-   private Object checkBinding(String binding) throws Exception
-   {
-      Object o = context.lookup(binding);
-      assertNotNull(o);
-      return o;
-   }
-
-   private void checkNoResource(ObjectName on)
-   {
-      assertFalse(mbeanServer.isRegistered(on));
-   }
-
-   private void checkResource(ObjectName on)
-   {
-      assertTrue(mbeanServer.isRegistered(on));
-   }
-
    // Inner classes -------------------------------------------------
 
 }
\ No newline at end of file

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/TopicControlTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/TopicControlTest.java	2009-03-20 09:06:02 UTC (rev 6121)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/TopicControlTest.java	2009-03-20 09:33:55 UTC (rev 6122)
@@ -41,6 +41,7 @@
 import org.jboss.messaging.jms.JBossTopic;
 import org.jboss.messaging.jms.server.impl.JMSServerManagerImpl;
 import org.jboss.messaging.jms.server.management.TopicControlMBean;
+import org.jboss.messaging.tests.integration.management.ManagementTestBase;
 import org.jboss.messaging.tests.util.UnitTestCase;
 
 /**
@@ -52,7 +53,7 @@
  *
  *
  */
-public class TopicControlTest extends UnitTestCase
+public class TopicControlTest extends ManagementTestBase
 {
 
    // Constants -----------------------------------------------------
@@ -69,8 +70,6 @@
 
    protected JBossTopic topic;
 
-   private MBeanServer mbeanServer;
-
    // Static --------------------------------------------------------
 
    // Constructors --------------------------------------------------
@@ -302,7 +301,6 @@
    {
       super.setUp();
       
-      mbeanServer = MBeanServerFactory.createMBeanServer();
       Configuration conf = new ConfigurationImpl();
       conf.setSecurityEnabled(false);
       conf.setJMXManagementEnabled(true);

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/management/AcceptorControlTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/AcceptorControlTest.java	2009-03-20 09:06:02 UTC (rev 6121)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/AcceptorControlTest.java	2009-03-20 09:33:55 UTC (rev 6122)
@@ -27,9 +27,6 @@
 
 import java.util.HashMap;
 
-import javax.management.MBeanServer;
-import javax.management.MBeanServerFactory;
-
 import org.jboss.messaging.core.client.ClientSession;
 import org.jboss.messaging.core.client.ClientSessionFactory;
 import org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl;
@@ -42,7 +39,6 @@
 import org.jboss.messaging.core.server.MessagingService;
 import org.jboss.messaging.integration.transports.netty.NettyAcceptorFactory;
 import org.jboss.messaging.integration.transports.netty.NettyConnectorFactory;
-import org.jboss.messaging.tests.util.UnitTestCase;
 
 /**
  * A AcceptorControlTest
@@ -53,7 +49,7 @@
  *
  *
  */
-public class AcceptorControlTest extends UnitTestCase
+public class AcceptorControlTest extends ManagementTestBase
 {
 
    // Constants -----------------------------------------------------
@@ -74,7 +70,6 @@
                                                                          new HashMap<String, Object>(),
                                                                          randomString());
 
-      MBeanServer mbeanServer = MBeanServerFactory.createMBeanServer();
       Configuration conf = new ConfigurationImpl();
       conf.setSecurityEnabled(false);
       conf.setJMXManagementEnabled(true);
@@ -93,7 +88,6 @@
       TransportConfiguration acceptorConfig = new TransportConfiguration(NettyAcceptorFactory.class.getName(),
                                                                          new HashMap<String, Object>(),
                                                                          randomString());
-      MBeanServer mbeanServer = MBeanServerFactory.createMBeanServer();
       Configuration conf = new ConfigurationImpl();
       conf.setSecurityEnabled(false);
       conf.setJMXManagementEnabled(true);
@@ -145,6 +139,7 @@
 
       super.tearDown();
    }
+   
    // Private -------------------------------------------------------
 
    // Inner classes -------------------------------------------------

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/management/AddressControlTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/AddressControlTest.java	2009-03-20 09:06:02 UTC (rev 6121)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/AddressControlTest.java	2009-03-20 09:33:55 UTC (rev 6122)
@@ -29,8 +29,6 @@
 import java.util.HashSet;
 import java.util.Set;
 
-import javax.management.MBeanServer;
-import javax.management.MBeanServerFactory;
 import javax.management.openmbean.TabularData;
 
 import org.jboss.messaging.core.client.ClientSession;
@@ -47,7 +45,6 @@
 import org.jboss.messaging.core.security.Role;
 import org.jboss.messaging.core.server.Messaging;
 import org.jboss.messaging.core.server.MessagingService;
-import org.jboss.messaging.tests.util.UnitTestCase;
 import org.jboss.messaging.utils.SimpleString;
 
 /**
@@ -56,7 +53,7 @@
  * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
  *
  */
-public class AddressControlTest extends UnitTestCase
+public class AddressControlTest extends ManagementTestBase
 {
 
    // Constants -----------------------------------------------------
@@ -65,8 +62,6 @@
 
    private MessagingService service;
 
-   protected MBeanServer mbeanServer;
-
    protected ClientSession session;
 
    // Static --------------------------------------------------------
@@ -266,8 +261,6 @@
    {
       super.setUp();
 
-      mbeanServer = MBeanServerFactory.createMBeanServer();
-
       Configuration conf = new ConfigurationImpl();
       conf.setSecurityEnabled(false);
       conf.setJMXManagementEnabled(true);

Copied: trunk/tests/src/org/jboss/messaging/tests/integration/management/AddressControlUsingCoreTest.java (from rev 6114, trunk/tests/src/org/jboss/messaging/tests/integration/management/core/CoreAddressControlTest.java)
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/AddressControlUsingCoreTest.java	                        (rev 0)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/AddressControlUsingCoreTest.java	2009-03-20 09:33:55 UTC (rev 6122)
@@ -0,0 +1,96 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.tests.integration.management;
+
+import javax.management.openmbean.TabularData;
+
+import org.jboss.messaging.core.management.AddressControlMBean;
+import org.jboss.messaging.core.management.ObjectNames;
+import org.jboss.messaging.utils.SimpleString;
+
+/**
+ * A JMXQueueControlTest
+ *
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ *
+ */
+public class AddressControlUsingCoreTest extends AddressControlTest
+{
+
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   // AddressControlTest overrides --------------------------------
+
+   @Override
+   protected AddressControlMBean createManagementControl(final SimpleString address) throws Exception
+   {
+      return new AddressControlMBean()
+      {
+         private final CoreMessagingProxy proxy = new CoreMessagingProxy(session,
+                                                                         ObjectNames.getAddressObjectName(address));
+
+         public void addRole(String name, boolean create, boolean read, boolean write) throws Exception
+         {
+            proxy.invokeOperation("addRole", name, create, read, write);
+         }
+
+         public String getAddress()
+         {
+            return (String)proxy.retrieveAttributeValue("Address");
+         }
+
+         public String[] getQueueNames() throws Exception
+         {
+            return (String[])proxy.retrieveAttributeValue("QueueNames");
+         }
+
+         public TabularData getRoles() throws Exception
+         {
+            return (TabularData)proxy.retrieveAttributeValue("Roles");
+         }
+
+         public void removeRole(String name) throws Exception
+         {
+            proxy.invokeOperation("removeRole", name);
+         }
+      };
+   }
+
+   // Public --------------------------------------------------------
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+
+}

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/management/BridgeControlTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/BridgeControlTest.java	2009-03-20 09:06:02 UTC (rev 6121)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/BridgeControlTest.java	2009-03-20 09:33:55 UTC (rev 6122)
@@ -28,9 +28,20 @@
 import static org.jboss.messaging.tests.util.RandomUtil.randomPositiveLong;
 import static org.jboss.messaging.tests.util.RandomUtil.randomString;
 
+import java.util.HashMap;
+
+import javax.management.MBeanServer;
+
+import org.jboss.messaging.core.config.Configuration;
+import org.jboss.messaging.core.config.TransportConfiguration;
 import org.jboss.messaging.core.config.cluster.BridgeConfiguration;
+import org.jboss.messaging.core.config.cluster.QueueConfiguration;
+import org.jboss.messaging.core.config.impl.ConfigurationImpl;
+import org.jboss.messaging.core.management.BridgeControlMBean;
+import org.jboss.messaging.core.management.ObjectNames;
+import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
+import org.jboss.messaging.core.server.Messaging;
 import org.jboss.messaging.core.server.MessagingService;
-import org.jboss.messaging.tests.util.UnitTestCase;
 import org.jboss.messaging.utils.Pair;
 
 /**
@@ -41,7 +52,7 @@
  * Created 11 dec. 2008 17:38:58
  *
  */
-public class BridgeControlTest extends UnitTestCase
+public class BridgeControlTest extends ManagementTestBase
 {
 
    // Constants -----------------------------------------------------
@@ -50,85 +61,35 @@
 
    private MessagingService service;
 
-   // Static --------------------------------------------------------
+   private BridgeConfiguration bridgeConfig;
 
-   public static BridgeConfiguration randomBridgeConfigurationWithDiscoveryGroup(String discoveryGroupName)
+   // Constructors --------------------------------------------------
+
+   // Public --------------------------------------------------------
+
+   public void testAttributes() throws Exception
    {
-      Pair<String, String> connectorPair = new Pair<String, String>(randomString(), randomString());
-      
-      return new BridgeConfiguration(randomString(),
-                                     randomString(),
-                                     randomString(),
-                                     null,                             
-                                     null,
-                                     randomPositiveLong(),
-                                     randomDouble(),
-                                     randomPositiveInt(),
-                                     randomPositiveInt(),
-                                     randomBoolean(),                              
-                                     connectorPair);
+      checkResource(ObjectNames.getBridgeObjectName(bridgeConfig.getName()));
+      BridgeControlMBean bridgeControl = createBridgeControl(bridgeConfig.getName(), mbeanServer);
+
+      assertEquals(bridgeConfig.getName(), bridgeControl.getName());
+      assertEquals(bridgeConfig.getDiscoveryGroupName(), bridgeControl.getDiscoveryGroupName());
+      assertTrue(bridgeControl.isStarted());
    }
 
-   // Constructors --------------------------------------------------
+   public void testStartStop() throws Exception
+   {
+      checkResource(ObjectNames.getBridgeObjectName(bridgeConfig.getName()));
+      BridgeControlMBean bridgeControl = createBridgeControl(bridgeConfig.getName(), mbeanServer);
 
-   // Public --------------------------------------------------------
+      // started by the service
+      assertTrue(bridgeControl.isStarted());
 
-//   public void testAttributes() throws Exception
-//   {
-//      DiscoveryGroupConfiguration discoveryGroupConfig = new DiscoveryGroupConfiguration(randomString(),
-//                                                                                         "231.7.7.7",
-//                                                                                         2000,
-//                                                                                         randomPositiveLong());
-//      BridgeConfiguration bridgeConfig = randomBridgeConfigurationWithDiscoveryGroup(discoveryGroupConfig.getName());
-//
-//      MBeanServer mbeanServer = MBeanServerFactory.createMBeanServer();
-//      Configuration conf = new ConfigurationImpl();
-//      conf.setSecurityEnabled(false);
-//      conf.setJMXManagementEnabled(true);
-//      conf.setClustered(true);
-//      conf.getDiscoveryGroupConfigurations().put(discoveryGroupConfig.getName(), discoveryGroupConfig);
-//      conf.getBridgeConfigurations().add(bridgeConfig);
-//      service = Messaging.newNullStorageMessagingService(conf, mbeanServer);
-//      service.start();
-//
-//      BridgeControlMBean bridgeControl = createBridgeControl(bridgeConfig.getName(), mbeanServer);
-//
-//      assertEquals(bridgeConfig.getName(), bridgeControl.getName());
-//      assertEquals(bridgeConfig.getDiscoveryGroupName(), bridgeControl.getDiscoveryGroupName());
-//   }
-//
-//   public void testStartStop() throws Exception
-//   {
-//      DiscoveryGroupConfiguration discoveryGroupConfig = new DiscoveryGroupConfiguration(randomString(),
-//                                                                                         "231.7.7.7",
-//                                                                                         2000,
-//                                                                                         randomPositiveLong());
-//      BridgeConfiguration bridgeConfig = randomBridgeConfigurationWithDiscoveryGroup(discoveryGroupConfig.getName());
-//
-//      MBeanServer mbeanServer = MBeanServerFactory.createMBeanServer();
-//      Configuration conf = new ConfigurationImpl();
-//      conf.setSecurityEnabled(false);
-//      conf.setJMXManagementEnabled(true);
-//      conf.setClustered(true);
-//      conf.getDiscoveryGroupConfigurations().put(discoveryGroupConfig.getName(), discoveryGroupConfig);
-//      conf.getBridgeConfigurations().add(bridgeConfig);
-//      service = Messaging.newNullStorageMessagingService(conf, mbeanServer);
-//      service.start();
-//
-//      BridgeControlMBean bridgeControl = createBridgeControl(bridgeConfig.getName(), mbeanServer);
-//
-//      // started by the service
-//      assertTrue(bridgeControl.isStarted());
-//
-//      bridgeControl.stop();
-//      assertFalse(bridgeControl.isStarted());
-//
-//      bridgeControl.start();
-//      assertTrue(bridgeControl.isStarted());
-//   }
-   
-   public void testFoo()
-   {      
+      bridgeControl.stop();
+      assertFalse(bridgeControl.isStarted());
+
+      bridgeControl.start();
+      assertTrue(bridgeControl.isStarted());
    }
 
    // Package protected ---------------------------------------------
@@ -136,15 +97,53 @@
    // Protected -----------------------------------------------------
 
    @Override
+   protected void setUp() throws Exception
+   {
+      super.setUp();
+
+      TransportConfiguration connectorConfig = new TransportConfiguration(InVMConnectorFactory.class.getName(),
+                                                                          new HashMap<String, Object>(),
+                                                                          randomString());
+      QueueConfiguration sourceQueueConfig = new QueueConfiguration(randomString(), randomString(), null, false);
+      QueueConfiguration targetQueueConfig = new QueueConfiguration(randomString(), randomString(), null, false);
+      Pair<String, String> connectorPair = new Pair<String, String>(connectorConfig.getName(), null);
+      bridgeConfig = new BridgeConfiguration(randomString(),
+                                             sourceQueueConfig.getName(),
+                                             targetQueueConfig.getAddress(),
+                                             null,
+                                             null,
+                                             randomPositiveLong(),
+                                             randomDouble(),
+                                             randomPositiveInt(),
+                                             randomPositiveInt(),
+                                             randomBoolean(),
+                                             connectorPair);
+
+      Configuration conf = new ConfigurationImpl();
+      conf.setSecurityEnabled(false);
+      conf.setJMXManagementEnabled(true);
+      conf.setClustered(true);
+      conf.getConnectorConfigurations().put(connectorConfig.getName(), connectorConfig);
+      conf.getQueueConfigurations().add(sourceQueueConfig);
+      conf.getQueueConfigurations().add(targetQueueConfig);
+      conf.getBridgeConfigurations().add(bridgeConfig);
+      service = Messaging.newNullStorageMessagingService(conf, mbeanServer);
+      service.start();
+   }
+
+   @Override
    protected void tearDown() throws Exception
    {
-      if (service != null)
-      {
-         service.stop();
-      }
+      service.stop();
 
       super.tearDown();
    }
+
+   protected BridgeControlMBean createBridgeControl(String name, MBeanServer mbeanServer) throws Exception
+   {
+      return ManagementControlHelper.createBridgeControl(name, mbeanServer);
+   }
+
    // Private -------------------------------------------------------
 
    // Inner classes -------------------------------------------------

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/management/BroadcastGroupControlTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/BroadcastGroupControlTest.java	2009-03-20 09:06:02 UTC (rev 6121)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/BroadcastGroupControlTest.java	2009-03-20 09:33:55 UTC (rev 6122)
@@ -25,7 +25,6 @@
 import static org.jboss.messaging.tests.integration.management.ManagementControlHelper.createBroadcastGroupControl;
 import static org.jboss.messaging.tests.util.RandomUtil.randomPort;
 import static org.jboss.messaging.tests.util.RandomUtil.randomPositiveInt;
-import static org.jboss.messaging.tests.util.RandomUtil.randomPositiveLong;
 import static org.jboss.messaging.tests.util.RandomUtil.randomString;
 
 import java.util.ArrayList;
@@ -42,7 +41,6 @@
 import org.jboss.messaging.core.server.Messaging;
 import org.jboss.messaging.core.server.MessagingService;
 import org.jboss.messaging.integration.transports.netty.NettyConnectorFactory;
-import org.jboss.messaging.tests.util.RandomUtil;
 import org.jboss.messaging.tests.util.UnitTestCase;
 import org.jboss.messaging.utils.Pair;
 
@@ -55,7 +53,7 @@
  *
  *
  */
-public class BroadcastGroupControlTest extends UnitTestCase
+public class BroadcastGroupControlTest extends ManagementTestBase
 {
 
    // Constants -----------------------------------------------------
@@ -72,7 +70,7 @@
                                              randomPort(),
                                              "231.7.7.7",
                                              randomPositiveInt(),
-                                             randomPositiveLong(),
+                                             1199,
                                              connectorInfos);
    }
 
@@ -92,7 +90,6 @@
       connectorInfos.add(new Pair<String, String>(connectorConfiguration.getName(), null));
       BroadcastGroupConfiguration broadcastGroupConfig = randomBroadcastGroupConfiguration(connectorInfos);
 
-      MBeanServer mbeanServer = MBeanServerFactory.createMBeanServer();
       Configuration conf = new ConfigurationImpl();
       conf.setSecurityEnabled(false);
       conf.setJMXManagementEnabled(true);
@@ -117,7 +114,6 @@
       connectorInfos.add(new Pair<String, String>(connectorConfiguration.getName(), null));
       BroadcastGroupConfiguration broadcastGroupConfig = randomBroadcastGroupConfiguration(connectorInfos);
 
-      MBeanServer mbeanServer = MBeanServerFactory.createMBeanServer();
       Configuration conf = new ConfigurationImpl();
       conf.setSecurityEnabled(false);
       conf.setJMXManagementEnabled(true);

Copied: trunk/tests/src/org/jboss/messaging/tests/integration/management/CoreMessagingProxy.java (from rev 6114, trunk/tests/src/org/jboss/messaging/tests/integration/management/core/CoreMessagingProxy.java)
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/CoreMessagingProxy.java	                        (rev 0)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/CoreMessagingProxy.java	2009-03-20 09:33:55 UTC (rev 6122)
@@ -0,0 +1,110 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.tests.integration.management;
+
+import static org.jboss.messaging.core.config.impl.ConfigurationImpl.DEFAULT_MANAGEMENT_ADDRESS;
+
+import javax.management.ObjectName;
+
+import org.jboss.messaging.core.client.ClientMessage;
+import org.jboss.messaging.core.client.ClientRequestor;
+import org.jboss.messaging.core.client.ClientSession;
+import org.jboss.messaging.core.client.management.impl.ManagementHelper;
+import org.jboss.messaging.utils.SimpleString;
+
+/**
+ * A MBeanUsingCoreMessage
+ *
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ *
+ */
+public class CoreMessagingProxy
+{
+
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   private final ObjectName on;
+
+   private ClientSession session;
+
+   private ClientRequestor requestor;
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public CoreMessagingProxy(ClientSession session, ObjectName objectName) throws Exception
+   {
+      this.session = session;
+
+      this.on = objectName;
+
+      this.requestor = new ClientRequestor(session, DEFAULT_MANAGEMENT_ADDRESS);
+
+   }
+
+   // Public --------------------------------------------------------
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   public Object retrieveAttributeValue(String attributeName)
+   {
+      ClientMessage m = session.createClientMessage(false);
+      ManagementHelper.putAttribute(m, on, attributeName);
+      ClientMessage reply;
+      try
+      {
+         reply = requestor.request(m);
+         return ManagementHelper.getResult(reply);
+      }
+      catch (Exception e)
+      {
+         throw new IllegalStateException(e);
+      }
+   }
+
+   public Object invokeOperation(String operationName, Object... args) throws Exception
+   {
+      ClientMessage m = session.createClientMessage(false);
+      ManagementHelper.putOperationInvocation(m, on, operationName, args);
+      ClientMessage reply = requestor.request(m);
+      if (ManagementHelper.hasOperationSucceeded(reply))
+      {
+         return ManagementHelper.getResult(reply);
+      }
+      else
+      {
+         throw new Exception(ManagementHelper.getOperationExceptionMessage(reply));
+      }
+   }
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+
+}

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/management/DiscoveryGroupControlTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/DiscoveryGroupControlTest.java	2009-03-20 09:06:02 UTC (rev 6121)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/DiscoveryGroupControlTest.java	2009-03-20 09:33:55 UTC (rev 6122)
@@ -46,7 +46,7 @@
  *
  *
  */
-public class DiscoveryGroupControlTest extends UnitTestCase
+public class DiscoveryGroupControlTest extends ManagementTestBase
 {
 
    // Constants -----------------------------------------------------
@@ -65,7 +65,6 @@
    {
       DiscoveryGroupConfiguration discoveryGroupConfig = new DiscoveryGroupConfiguration(randomString(), "231.7.7.7", 2000, randomPositiveLong());
 
-      MBeanServer mbeanServer = MBeanServerFactory.createMBeanServer();
       Configuration conf = new ConfigurationImpl();
       conf.setSecurityEnabled(false);
       conf.setJMXManagementEnabled(true);
@@ -86,7 +85,6 @@
    {
       DiscoveryGroupConfiguration discoveryGroupConfig = new DiscoveryGroupConfiguration(randomString(), "231.7.7.7", 2000, randomPositiveLong());
 
-      MBeanServer mbeanServer = MBeanServerFactory.createMBeanServer();
       Configuration conf = new ConfigurationImpl();
       conf.setSecurityEnabled(false);
       conf.setJMXManagementEnabled(true);

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/management/ManagementServiceImplTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/ManagementServiceImplTest.java	2009-03-20 09:06:02 UTC (rev 6121)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/ManagementServiceImplTest.java	2009-03-20 09:33:55 UTC (rev 6122)
@@ -34,11 +34,8 @@
 import static org.jboss.messaging.tests.util.RandomUtil.randomBoolean;
 import static org.jboss.messaging.tests.util.RandomUtil.randomString;
 
-import java.lang.management.ManagementFactory;
 import java.util.Set;
 
-import javax.management.MBeanServer;
-import javax.management.MBeanServerFactory;
 import javax.management.ObjectName;
 
 import org.jboss.messaging.core.buffers.ChannelBuffers;
@@ -53,7 +50,6 @@
 import org.jboss.messaging.core.server.ServerMessage;
 import org.jboss.messaging.core.server.impl.ServerMessageImpl;
 import org.jboss.messaging.tests.util.RandomUtil;
-import org.jboss.messaging.tests.util.UnitTestCase;
 import org.jboss.messaging.utils.SimpleString;
 
 /*
@@ -61,7 +57,7 @@
  * 
  * @version <tt>$Revision$</tt>
  */
-public class ManagementServiceImplTest extends UnitTestCase
+public class ManagementServiceImplTest extends ManagementTestBase
 {
    // Constants -----------------------------------------------------
 
@@ -77,7 +73,6 @@
 
    public void testHandleManagementMessageWithOperation() throws Exception
    {
-      MBeanServer mbeanServer = MBeanServerFactory.createMBeanServer();
       ManagementService managementService = new ManagementServiceImpl(mbeanServer, false);
       assertNotNull(managementService);
       managementService.start();
@@ -116,7 +111,6 @@
 
    public void testHandleManagementMessageWithOperationWhichFails() throws Exception
    {
-      MBeanServer mbeanServer = MBeanServerFactory.createMBeanServer();
       ManagementService managementService = new ManagementServiceImpl(mbeanServer, false);
       assertNotNull(managementService);
       managementService.start();
@@ -166,8 +160,6 @@
    {
       super.setUp();
 
-      MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();
-
       Set set = mbeanServer.queryNames(ObjectName.getInstance(ObjectNames.DOMAIN + ":*"), null);
 
       for (Object objectName : set)
@@ -179,8 +171,6 @@
    @Override
    protected void tearDown() throws Exception
    {
-      MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();
-
       Set set = mbeanServer.queryMBeans(ObjectName.getInstance(ObjectNames.DOMAIN + ":*"), null);
 
       for (Object obj : set)

Added: trunk/tests/src/org/jboss/messaging/tests/integration/management/ManagementTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/ManagementTestBase.java	                        (rev 0)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/ManagementTestBase.java	2009-03-20 09:33:55 UTC (rev 6122)
@@ -0,0 +1,130 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.tests.integration.management;
+
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+import javax.management.ObjectName;
+import javax.naming.Context;
+
+import org.jboss.messaging.core.client.ClientConsumer;
+import org.jboss.messaging.core.client.ClientMessage;
+import org.jboss.messaging.core.client.ClientSession;
+import org.jboss.messaging.tests.util.UnitTestCase;
+import org.jboss.messaging.utils.SimpleString;
+
+/**
+ * A ManagementTestBase
+ *
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ *
+ */
+public abstract class ManagementTestBase extends UnitTestCase
+{
+
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   protected MBeanServer mbeanServer;
+
+   // Static --------------------------------------------------------
+
+   protected static void consumeMessages(int expected, ClientSession session, SimpleString queue) throws Exception
+   {
+      ClientConsumer consumer = null;
+      try
+      {
+         consumer = session.createConsumer(queue);
+         ClientMessage m = null;
+         for (int i = 0; i < expected; i++)
+         {
+            m = consumer.receive(500);
+            assertNotNull("expected to received " + expected + " messages, got only " + (i + 1), m);
+            m.acknowledge();
+         }
+         session.commit();
+         m = consumer.receive(500);
+         assertNull("received one more message than expected (" + expected + ")", m);
+      }
+      finally
+      {
+         if (consumer != null)
+         {
+            consumer.close();
+         }
+      }
+   }
+
+   // Constructors --------------------------------------------------
+
+   // Public --------------------------------------------------------
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   @Override
+   protected void setUp() throws Exception
+   {
+      super.setUp();
+
+      mbeanServer = MBeanServerFactory.createMBeanServer();
+   }
+
+   protected void checkNoResource(ObjectName on)
+   {
+      assertFalse("unexpected resource for " + on, mbeanServer.isRegistered(on));
+   }
+
+   protected void checkResource(ObjectName on)
+   {
+      assertTrue("no resource for " + on, mbeanServer.isRegistered(on));
+   }
+   
+
+   protected static void checkNoBinding(Context context, String binding)
+   {
+      try
+      {
+         context.lookup(binding);
+         fail("there must be no resource to look up for " + binding);
+      }
+      catch (Exception e)
+      {
+      }
+   }
+
+   protected static  Object checkBinding(Context context, String binding) throws Exception
+   {
+      Object o = context.lookup(binding);
+      assertNotNull(o);
+      return o;
+   }
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+
+}

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/management/MessagingServerControlTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/MessagingServerControlTest.java	2009-03-20 09:06:02 UTC (rev 6121)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/MessagingServerControlTest.java	2009-03-20 09:33:55 UTC (rev 6122)
@@ -26,9 +26,6 @@
 
 import java.util.HashMap;
 
-import javax.management.MBeanServer;
-import javax.management.MBeanServerFactory;
-import javax.management.ObjectName;
 import javax.management.openmbean.TabularData;
 
 import org.jboss.messaging.core.config.Configuration;
@@ -43,7 +40,6 @@
 import org.jboss.messaging.core.server.Messaging;
 import org.jboss.messaging.core.server.MessagingService;
 import org.jboss.messaging.tests.util.RandomUtil;
-import org.jboss.messaging.tests.util.UnitTestCase;
 import org.jboss.messaging.utils.SimpleString;
 
 /**
@@ -55,7 +51,7 @@
  *
  *
  */
-public class MessagingServerControlTest extends UnitTestCase
+public class MessagingServerControlTest extends ManagementTestBase
 {
 
    // Constants -----------------------------------------------------
@@ -64,8 +60,6 @@
 
    private MessagingService service;
 
-   private MBeanServer mbeanServer;
-
    private Configuration conf;
 
    private TransportConfiguration connectorConfig;
@@ -304,8 +298,6 @@
    {
       super.setUp();
 
-      mbeanServer = MBeanServerFactory.createMBeanServer();
-
       connectorConfig = new TransportConfiguration(InVMConnectorFactory.class.getName(),
                                                                           new HashMap<String, Object>(),
                                                                           randomString());
@@ -336,16 +328,6 @@
 
    // Private -------------------------------------------------------
 
-   private void checkNoResource(ObjectName on)
-   {
-      assertFalse(mbeanServer.isRegistered(on));
-   }
-
-   private void checkResource(ObjectName on)
-   {
-      assertTrue(mbeanServer.isRegistered(on));
-   }
-
    // Inner classes -------------------------------------------------
 
 }

Copied: trunk/tests/src/org/jboss/messaging/tests/integration/management/MessagingServerControlUsingCoreTest.java (from rev 6114, trunk/tests/src/org/jboss/messaging/tests/integration/management/core/MessagingServerControlUsingCoreTest.java)
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/MessagingServerControlUsingCoreTest.java	                        (rev 0)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/MessagingServerControlUsingCoreTest.java	2009-03-20 09:33:55 UTC (rev 6122)
@@ -0,0 +1,418 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.tests.integration.management;
+
+import java.util.List;
+
+import javax.management.openmbean.TabularData;
+
+import org.jboss.messaging.core.client.ClientSession;
+import org.jboss.messaging.core.client.ClientSessionFactory;
+import org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl;
+import org.jboss.messaging.core.config.Configuration;
+import org.jboss.messaging.core.config.TransportConfiguration;
+import org.jboss.messaging.core.management.MessagingServerControlMBean;
+import org.jboss.messaging.core.management.ObjectNames;
+import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
+
+/**
+ * A MessagingServerControlUsingCoreTest
+ *
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+ */
+public class MessagingServerControlUsingCoreTest extends MessagingServerControlTest
+{
+
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   // Public --------------------------------------------------------
+
+   // MessagingServerControlTest overrides --------------------------
+
+   private ClientSession session;
+
+   @Override
+   protected void setUp() throws Exception
+   {
+      super.setUp();
+
+      ClientSessionFactory sf = new ClientSessionFactoryImpl(new TransportConfiguration(InVMConnectorFactory.class.getName()));
+      session = sf.createSession(false, true, true);
+      session.start();
+
+   }
+
+   @Override
+   protected void tearDown() throws Exception
+   {
+      session.close();
+
+      super.tearDown();
+   }
+
+   @Override
+   protected MessagingServerControlMBean createManagementControl() throws Exception
+   {
+
+      return new MessagingServerControlMBean()
+      {
+         private final CoreMessagingProxy proxy = new CoreMessagingProxy(session,
+                                                                         ObjectNames.getMessagingServerObjectName());
+
+         public boolean closeConnectionsForAddress(String ipAddress) throws Exception
+         {
+            return (Boolean)proxy.invokeOperation("closeConnectionsForAddress", ipAddress);
+         }
+
+         public boolean commitPreparedTransaction(String transactionAsBase64) throws Exception
+         {
+            return (Boolean)proxy.invokeOperation("commitPreparedTransaction", transactionAsBase64);
+         }
+
+         public void createQueue(String address, String name) throws Exception
+         {
+            proxy.invokeOperation("createQueue", address, name);
+         }
+
+         public void createQueue(String address, String name, String filter, boolean durable) throws Exception
+         {
+            proxy.invokeOperation("createQueue", address, name, filter, durable);
+         }
+
+         public void destroyQueue(String name) throws Exception
+         {
+            proxy.invokeOperation("destroyQueue", name);
+         }
+
+         public void disableMessageCounters() throws Exception
+         {
+            proxy.invokeOperation("disableMessageCounters");
+         }
+
+         public void enableMessageCounters() throws Exception
+         {
+            proxy.invokeOperation("enableMessageCounters");
+         }
+
+         public String getBackupConnectorName()
+         {
+            return (String)proxy.retrieveAttributeValue("BackupConnectorName");
+         }
+
+         public String getBindingsDirectory()
+         {
+            return (String)proxy.retrieveAttributeValue("BindingsDirectory");
+         }
+
+         public Configuration getConfiguration()
+         {
+            return (Configuration)proxy.retrieveAttributeValue("Configuration");
+         }
+
+         public int getConnectionCount()
+         {
+            return (Integer)proxy.retrieveAttributeValue("ConnectionCount");
+         }
+
+         public long getConnectionScanPeriod()
+         {
+            return (Long)proxy.retrieveAttributeValue("ConnectionScanPeriod");
+         }
+
+         public long getConnectionTTLOverride()
+         {
+            return (Long)proxy.retrieveAttributeValue("ConnectionTTLOverride");
+         }
+
+         public TabularData getConnectors() throws Exception
+         {
+            return (TabularData)proxy.retrieveAttributeValue("Connectors");
+         }
+
+         public int getIDCacheSize()
+         {
+            return (Integer)proxy.retrieveAttributeValue("IDCacheSize");
+         }
+
+         public List<String> getInterceptorClassNames()
+         {
+            return (List<String>)proxy.retrieveAttributeValue("InterceptorClassNames");
+         }
+
+         public int getJournalBufferReuseSize()
+         {
+            return (Integer)proxy.retrieveAttributeValue("JournalBufferReuseSize");
+         }
+
+         public String getJournalDirectory()
+         {
+            return (String)proxy.retrieveAttributeValue("JournalDirectory");
+         }
+
+         public int getJournalFileSize()
+         {
+            return (Integer)proxy.retrieveAttributeValue("JournalFileSize");
+         }
+
+         public int getJournalMaxAIO()
+         {
+            return (Integer)proxy.retrieveAttributeValue("JournalMaxAIO");
+         }
+
+         public int getJournalMinFiles()
+         {
+            return (Integer)proxy.retrieveAttributeValue("JournalMinFiles");
+         }
+
+         public String getJournalType()
+         {
+            return (String)proxy.retrieveAttributeValue("JournalType");
+         }
+
+         public String getLargeMessagesDirectory()
+         {
+            return (String)proxy.retrieveAttributeValue("LargeMessagesDirectory");
+         }
+
+         public String getManagementAddress()
+         {
+            return (String)proxy.retrieveAttributeValue("ManagementAddress");
+         }
+
+         public String getManagementNotificationAddress()
+         {
+            return (String)proxy.retrieveAttributeValue("ManagementNotificationAddress");
+         }
+
+         public long getManagementRequestTimeout()
+         {
+            return (Long)proxy.retrieveAttributeValue("ManagementRequestTimeout");
+         }
+
+         public int getMessageCounterMaxDayCount()
+         {
+            return (Integer)proxy.retrieveAttributeValue("MessageCounterMaxDayCount");
+         }
+
+         public long getMessageCounterSamplePeriod()
+         {
+            return (Long)proxy.retrieveAttributeValue("MessageCounterSamplePeriod");
+         }
+
+         public long getMessageExpiryScanPeriod()
+         {
+            return (Long)proxy.retrieveAttributeValue("MessageExpiryScanPeriod");
+         }
+
+         public long getMessageExpiryThreadPriority()
+         {
+            return (Long)proxy.retrieveAttributeValue("MessageExpiryThreadPriority");
+         }
+
+         public String getPagingDirectory()
+         {
+            return (String)proxy.retrieveAttributeValue("PagingDirectory");
+         }
+
+         public int getPagingGlobalWatermarkSize()
+         {
+            return (Integer)proxy.retrieveAttributeValue("PagingGlobalWatermarkSize");
+         }
+
+         public long getPagingMaxGlobalSizeBytes()
+         {
+            return (Long)proxy.retrieveAttributeValue("PagingMaxGlobalSizeBytes");
+         }
+
+         public int getPagingMaxThreads()
+         {
+            return (Integer)proxy.retrieveAttributeValue("PagingMaxThreads");
+         }
+
+         public long getQueueActivationTimeout()
+         {
+            return (Long)proxy.retrieveAttributeValue("QueueActivationTimeout");
+         }
+
+         public int getScheduledThreadPoolMaxSize()
+         {
+            return (Integer)proxy.retrieveAttributeValue("ScheduledThreadPoolMaxSize");
+         }
+
+         public long getSecurityInvalidationInterval()
+         {
+            return (Long)proxy.retrieveAttributeValue("SecurityInvalidationInterval");
+         }
+
+         public long getTransactionTimeout()
+         {
+            return (Long)proxy.retrieveAttributeValue("TransactionTimeout");
+         }
+
+         public long getTransactionTimeoutScanPeriod()
+         {
+            return (Long)proxy.retrieveAttributeValue("TransactionTimeoutScanPeriod");
+         }
+
+         public String getVersion()
+         {
+            return (String)proxy.retrieveAttributeValue("Version");
+         }
+
+         public boolean isAllowRouteWhenNoBindings()
+         {
+            return (Boolean)proxy.retrieveAttributeValue("AllowRouteWhenNoBindings");
+         }
+
+         public boolean isBackup()
+         {
+            return (Boolean)proxy.retrieveAttributeValue("Backup");
+         }
+
+         public boolean isClustered()
+         {
+            return (Boolean)proxy.retrieveAttributeValue("Clustered");
+         }
+
+         public boolean isCreateBindingsDir()
+         {
+            return (Boolean)proxy.retrieveAttributeValue("CreateBindingsDir");
+         }
+
+         public boolean isCreateJournalDir()
+         {
+            return (Boolean)proxy.retrieveAttributeValue("CreateJournalDir");
+         }
+
+         public boolean isJournalSyncNonTransactional()
+         {
+            return (Boolean)proxy.retrieveAttributeValue("JournalSyncNonTransactional");
+         }
+
+         public boolean isJournalSyncTransactional()
+         {
+            return (Boolean)proxy.retrieveAttributeValue("JournalSyncTransactional");
+         }
+
+         public boolean isMessageCounterEnabled()
+         {
+            return (Boolean)proxy.retrieveAttributeValue("MessageCounterEnabled");
+         }
+
+         public boolean isPersistDeliveryCountBeforeDelivery()
+         {
+            return (Boolean)proxy.retrieveAttributeValue("PersistDeliveryCountBeforeDelivery");
+         }
+
+         public boolean isPersistIDCache()
+         {
+            return (Boolean)proxy.retrieveAttributeValue("PersistIDCache");
+         }
+
+         public boolean isSecurityEnabled()
+         {
+            return (Boolean)proxy.retrieveAttributeValue("SecurityEnabled");
+         }
+
+         public boolean isStarted()
+         {
+            return (Boolean)proxy.retrieveAttributeValue("Started");
+         }
+
+         public boolean isWildcardRoutingEnabled()
+         {
+            return (Boolean)proxy.retrieveAttributeValue("WildcardRoutingEnabled");
+         }
+
+         public String[] listConnectionIDs() throws Exception
+         {
+            return (String[])proxy.invokeOperation("listConnectionIDs");
+         }
+
+         public String[] listPreparedTransactions() throws Exception
+         {
+            return (String[])proxy.invokeOperation("listPreparedTransactions");
+         }
+
+         public String[] listRemoteAddresses() throws Exception
+         {
+            return (String[])proxy.invokeOperation("listRemoteAddresses");
+         }
+
+         public String[] listRemoteAddresses(String ipAddress) throws Exception
+         {
+            return (String[])proxy.invokeOperation("listRemoteAddresses", ipAddress);
+         }
+
+         public String[] listSessions(String connectionID) throws Exception
+         {
+            return (String[])proxy.invokeOperation("listSessions", connectionID);
+         }
+
+         public void resetAllMessageCounterHistories() throws Exception
+         {
+            proxy.invokeOperation("resetAllMessageCounterHistories");
+         }
+
+         public void resetAllMessageCounters() throws Exception
+         {
+            proxy.invokeOperation("resetAllMessageCounters");
+         }
+
+         public boolean rollbackPreparedTransaction(String transactionAsBase64) throws Exception
+         {
+            return (Boolean)proxy.invokeOperation("rollbackPreparedTransaction", transactionAsBase64);
+         }
+
+         public void sendQueueInfoToQueue(String queueName, String address) throws Exception
+         {
+            proxy.invokeOperation("sendQueueInfoToQueue", queueName, address);
+         }
+
+         public void setMessageCounterMaxDayCount(int count) throws Exception
+         {
+            proxy.invokeOperation("setMessageCounterMaxDayCount", count);
+         }
+
+         public void setMessageCounterSamplePeriod(long newPeriod) throws Exception
+         {
+            proxy.invokeOperation("setMessageCounterSamplePeriod", newPeriod);
+         }
+
+      };
+   }
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+
+}

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/management/QueueControlTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/QueueControlTest.java	2009-03-20 09:06:02 UTC (rev 6121)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/QueueControlTest.java	2009-03-20 09:33:55 UTC (rev 6122)
@@ -30,8 +30,6 @@
 import static org.jboss.messaging.tests.util.RandomUtil.randomSimpleString;
 import static org.jboss.messaging.tests.util.RandomUtil.randomString;
 
-import javax.management.MBeanServer;
-import javax.management.MBeanServerFactory;
 import javax.management.openmbean.CompositeData;
 import javax.management.openmbean.TabularData;
 
@@ -54,7 +52,6 @@
 import org.jboss.messaging.core.server.Messaging;
 import org.jboss.messaging.core.server.MessagingService;
 import org.jboss.messaging.core.settings.impl.AddressSettings;
-import org.jboss.messaging.tests.util.UnitTestCase;
 import org.jboss.messaging.utils.SimpleString;
 
 /**
@@ -63,7 +60,7 @@
  * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
  *
  */
-public class QueueControlTest extends UnitTestCase
+public class QueueControlTest extends ManagementTestBase
 {
 
    // Constants -----------------------------------------------------
@@ -72,8 +69,6 @@
 
    protected MessagingService service;
 
-   protected MBeanServer mbeanServer;
-
    protected ClientSession session;
 
    // Static --------------------------------------------------------
@@ -1072,8 +1067,6 @@
    {
       super.setUp();
 
-      mbeanServer = MBeanServerFactory.createMBeanServer();
-
       Configuration conf = new ConfigurationImpl();
       conf.setSecurityEnabled(false);
       conf.setJMXManagementEnabled(true);
@@ -1106,32 +1099,6 @@
 
    // Private -------------------------------------------------------
 
-   private void consumeMessages(int expected, ClientSession session, SimpleString queue) throws Exception
-   {
-      ClientConsumer consumer = null;
-      try
-      {
-         consumer = session.createConsumer(queue);
-         ClientMessage m = null;
-         for (int i = 0; i < expected; i++)
-         {
-            m = consumer.receive(500);
-            assertNotNull("expected to received " + expected + " messages, got only " + (i + 1), m);
-            m.acknowledge();
-         }
-         session.commit();
-         m = consumer.receive(500);
-         assertNull("received one more message than expected (" + expected + ")", m);
-      }
-      finally
-      {
-         if (consumer != null)
-         {
-            consumer.close();
-         }
-      }
-   }
-
    // Inner classes -------------------------------------------------
 
 }

Copied: trunk/tests/src/org/jboss/messaging/tests/integration/management/QueueControlUsingCoreTest.java (from rev 6114, trunk/tests/src/org/jboss/messaging/tests/integration/management/core/CoreQueueControlTest.java)
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/QueueControlUsingCoreTest.java	                        (rev 0)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/QueueControlUsingCoreTest.java	2009-03-20 09:33:55 UTC (rev 6122)
@@ -0,0 +1,244 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.tests.integration.management;
+
+import javax.management.openmbean.CompositeData;
+import javax.management.openmbean.TabularData;
+
+import org.jboss.messaging.core.management.ObjectNames;
+import org.jboss.messaging.core.management.QueueControlMBean;
+import org.jboss.messaging.utils.SimpleString;
+
+/**
+ * A JMXQueueControlTest
+ *
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ *
+ */
+public class QueueControlUsingCoreTest extends QueueControlTest
+{
+
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   // QueueControlTestBase overrides --------------------------------
+
+   @Override
+   protected QueueControlMBean createManagementControl(final SimpleString address, final SimpleString queue) throws Exception
+   {
+
+      return new QueueControlMBean()
+      {
+
+         private final CoreMessagingProxy proxy = new CoreMessagingProxy(session,
+                                                                         ObjectNames.getQueueObjectName(address, queue));
+
+         public boolean changeMessagePriority(long messageID, int newPriority) throws Exception
+         {
+            return (Boolean)proxy.invokeOperation("changeMessagePriority", messageID, newPriority);
+         }
+
+         public int countMessages(String filter) throws Exception
+         {
+            return (Integer)proxy.invokeOperation("countMessages", filter);
+         }
+
+         public boolean expireMessage(long messageID) throws Exception
+         {
+            return (Boolean)proxy.invokeOperation("expireMessage", messageID);
+         }
+
+         public int expireMessages(String filter) throws Exception
+         {
+            return (Integer)proxy.invokeOperation("expireMessages", filter);
+         }
+
+         public String getAddress()
+         {
+            return (String)proxy.retrieveAttributeValue("Address");
+         }
+
+         public int getConsumerCount()
+         {
+            return (Integer)proxy.retrieveAttributeValue("ConsumerCount");
+         }
+
+         public String getDeadLetterAddress()
+         {
+            return (String)proxy.retrieveAttributeValue("DeadLetterAddress");
+         }
+
+         public int getDeliveringCount()
+         {
+            return (Integer)proxy.retrieveAttributeValue("DeliveringCount");
+         }
+
+         public String getExpiryAddress()
+         {
+            return (String)proxy.retrieveAttributeValue("ExpiryAddress");
+         }
+
+         public String getFilter()
+         {
+            return (String)proxy.retrieveAttributeValue("Filter");
+         }
+
+         public int getMessageCount()
+         {
+            return (Integer)proxy.retrieveAttributeValue("MessageCount");
+         }
+
+         public int getMessagesAdded()
+         {
+            return (Integer)proxy.retrieveAttributeValue("MessagesAdded");
+         }
+
+         public String getName()
+         {
+            return (String)proxy.retrieveAttributeValue("Name");
+         }
+
+         public long getPersistenceID()
+         {
+            return (Long)proxy.retrieveAttributeValue("PersistenceID");
+         }
+
+         public long getScheduledCount()
+         {
+            return (Long)proxy.retrieveAttributeValue("ScheduledCount");
+         }
+
+         public boolean isBackup()
+         {
+            return (Boolean)proxy.retrieveAttributeValue("Backup");
+         }
+
+         public boolean isDurable()
+         {
+            return (Boolean)proxy.retrieveAttributeValue("Durable");
+         }
+
+         public boolean isTemporary()
+         {
+            return (Boolean)proxy.retrieveAttributeValue("Temporary");
+         }
+
+         public TabularData listAllMessages() throws Exception
+         {
+            return (TabularData)proxy.invokeOperation("listAllMessages");
+         }
+
+         public CompositeData listMessageCounter() throws Exception
+         {
+            return (CompositeData)proxy.invokeOperation("listMessageCounter");
+         }
+
+         public String listMessageCounterAsHTML() throws Exception
+         {
+            return (String)proxy.invokeOperation("listMessageCounterAsHTML");
+         }
+
+         public TabularData listMessageCounterHistory() throws Exception
+         {
+            return (TabularData)proxy.invokeOperation("listMessageCounterHistory");
+         }
+
+         public String listMessageCounterHistoryAsHTML() throws Exception
+         {
+            return (String)proxy.invokeOperation("listMessageCounterHistoryAsHTML");
+         }
+
+         public TabularData listMessages(String filter) throws Exception
+         {
+            return (TabularData)proxy.invokeOperation("listMessages", filter);
+         }
+
+         public TabularData listScheduledMessages() throws Exception
+         {
+            return (TabularData)proxy.invokeOperation("listScheduledMessages");
+         }
+
+         public int moveAllMessages(String otherQueueName) throws Exception
+         {
+            return (Integer)proxy.invokeOperation("moveAllMessages", otherQueueName);
+         }
+
+         public int moveMatchingMessages(String filter, String otherQueueName) throws Exception
+         {
+            return (Integer)proxy.invokeOperation("moveMatchingMessages", filter, otherQueueName);
+         }
+
+         public boolean moveMessage(long messageID, String otherQueueName) throws Exception
+         {
+            return (Boolean)proxy.invokeOperation("moveMessage", messageID, otherQueueName);
+         }
+
+         public int removeAllMessages() throws Exception
+         {
+            return (Integer)proxy.invokeOperation("removeAllMessages");
+         }
+
+         public int removeMatchingMessages(String filter) throws Exception
+         {
+            return (Integer)proxy.invokeOperation("removeMatchingMessages", filter);
+         }
+
+         public boolean removeMessage(long messageID) throws Exception
+         {
+            return (Boolean)proxy.invokeOperation("removeMessage", messageID);
+         }
+
+         public boolean sendMessageToDeadLetterAddress(long messageID) throws Exception
+         {
+            return (Boolean)proxy.invokeOperation("sendMessageToDeadLetterAddress", messageID);
+         }
+
+         public void setDeadLetterAddress(String deadLetterAddress) throws Exception
+         {
+            proxy.invokeOperation("setDeadLetterAddress", deadLetterAddress);
+         }
+
+         public void setExpiryAddress(String expiryAddres) throws Exception
+         {
+            proxy.invokeOperation("setExpiryAddress", expiryAddres);
+         }
+      };
+   }
+
+   // Public --------------------------------------------------------
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+
+}




More information about the jboss-cvs-commits mailing list