[jboss-cvs] JBoss Messaging SVN: r6096 - in trunk: src/main/org/jboss/messaging/core/management and 6 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Mar 16 13:00:21 EDT 2009


Author: jmesnil
Date: 2009-03-16 13:00:21 -0400 (Mon, 16 Mar 2009)
New Revision: 6096

Added:
   trunk/tests/src/org/jboss/messaging/tests/integration/management/AddressControlTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/management/core/CoreAddressControlTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/management/core/CoreMessagingProxy.java
Removed:
   trunk/tests/src/org/jboss/messaging/tests/unit/core/management/impl/AddressControlTest.java
   trunk/tests/src/org/jboss/messaging/tests/unit/core/management/impl/QueueControlTest.java
Modified:
   trunk/src/main/org/jboss/messaging/core/client/management/impl/ManagementHelper.java
   trunk/src/main/org/jboss/messaging/core/management/AddressControlMBean.java
   trunk/src/main/org/jboss/messaging/core/management/impl/AddressControl.java
   trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareAddressControlWrapper.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/management/ReplicationAwareAddressControlWrapperTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/management/QueueControlTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/management/core/CoreQueueControlTest.java
Log:
management integration tests

* added AddressControlTest integration tests
* refactored CoreXXXControlTest to use CoreMessagingProxy to interact with the Management API using core messaging
* removed redundant unit tests

Modified: trunk/src/main/org/jboss/messaging/core/client/management/impl/ManagementHelper.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/management/impl/ManagementHelper.java	2009-03-16 16:36:23 UTC (rev 6095)
+++ trunk/src/main/org/jboss/messaging/core/client/management/impl/ManagementHelper.java	2009-03-16 17:00:21 UTC (rev 6096)
@@ -171,6 +171,16 @@
       throw new IllegalArgumentException(key + " property is not a valid TabularData");
    }
    
+   public static Object[] getArrayProperty(final Message message, final String key)
+   {
+      Object object = message.getProperty(new SimpleString(key));
+      if (object instanceof byte[])
+      {
+         return (Object[])from((byte[])object);
+      }
+      throw new IllegalArgumentException(key + " property is not a valid array");
+   }
+   
    public static CompositeData getCompositeDataProperty(final Message message, final String key)
    {
       Object object = message.getProperty(new SimpleString(key));
@@ -245,6 +255,10 @@
       {
          storePropertyAsBytes(message, key, typedProperty);
       }
+      else if (typedProperty != null && typedProperty.getClass().isArray())
+      {
+         storePropertyAsBytes(message, key, typedProperty);         
+      }
       // serialize as a SimpleString
       else
       {

Modified: trunk/src/main/org/jboss/messaging/core/management/AddressControlMBean.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/AddressControlMBean.java	2009-03-16 16:36:23 UTC (rev 6095)
+++ trunk/src/main/org/jboss/messaging/core/management/AddressControlMBean.java	2009-03-16 17:00:21 UTC (rev 6096)
@@ -38,8 +38,6 @@
 
    TabularData getRoles() throws Exception;
    
-   RoleInfo[] getRoleInfos() throws Exception;
-
    String[] getQueueNames() throws Exception;
 
    // Operations ----------------------------------------------------

Modified: trunk/src/main/org/jboss/messaging/core/management/impl/AddressControl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/impl/AddressControl.java	2009-03-16 16:36:23 UTC (rev 6095)
+++ trunk/src/main/org/jboss/messaging/core/management/impl/AddressControl.java	2009-03-16 17:00:21 UTC (rev 6096)
@@ -99,11 +99,6 @@
 
    public TabularData getRoles() throws Exception
    {
-      return RoleInfo.toTabularData(getRoleInfos());
-   }
-
-   public RoleInfo[] getRoleInfos() throws Exception
-   {
       Set<Role> roles = securityRepository.getMatch(address.toString());
       RoleInfo[] roleInfos = new RoleInfo[roles.size()];
       int i = 0;
@@ -114,7 +109,7 @@
                                        role.isCheckType(CheckType.READ),
                                        role.isCheckType(CheckType.WRITE));
       }
-      return roleInfos;
+      return RoleInfo.toTabularData(roleInfos);
    }
 
    public synchronized void addRole(final String name, final boolean create, final boolean read, final boolean write) throws Exception

Modified: trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareAddressControlWrapper.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareAddressControlWrapper.java	2009-03-16 16:36:23 UTC (rev 6095)
+++ trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareAddressControlWrapper.java	2009-03-16 17:00:21 UTC (rev 6096)
@@ -72,11 +72,6 @@
       return localAddressControl.getQueueNames();
    }
 
-   public RoleInfo[] getRoleInfos() throws Exception
-   {
-      return localAddressControl.getRoleInfos();
-   }
-
    public TabularData getRoles() throws Exception
    {
       return localAddressControl.getRoles();

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/management/ReplicationAwareAddressControlWrapperTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/management/ReplicationAwareAddressControlWrapperTest.java	2009-03-16 16:36:23 UTC (rev 6095)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/management/ReplicationAwareAddressControlWrapperTest.java	2009-03-16 17:00:21 UTC (rev 6096)
@@ -27,12 +27,13 @@
 import static org.jboss.messaging.tests.util.RandomUtil.randomSimpleString;
 import static org.jboss.messaging.tests.util.RandomUtil.randomString;
 
+import javax.management.openmbean.TabularData;
+
 import org.jboss.messaging.core.client.ClientSession;
 import org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl;
 import org.jboss.messaging.core.client.impl.ClientSessionFactoryInternal;
 import org.jboss.messaging.core.config.TransportConfiguration;
 import org.jboss.messaging.core.management.AddressControlMBean;
-import org.jboss.messaging.core.management.RoleInfo;
 import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
 import org.jboss.messaging.utils.SimpleString;
 
@@ -62,14 +63,13 @@
       AddressControlMBean liveAddressControl = createAddressControl(address, liveMBeanServer);
       AddressControlMBean backupAddressControl = createAddressControl(address, backupMBeanServer);
 
-      RoleInfo[] roles = liveAddressControl.getRoleInfos();
-      assertEquals(roles.length, backupAddressControl.getRoleInfos().length);
+      TabularData roles = liveAddressControl.getRoles();
+      assertEquals(roles.size(), backupAddressControl.getRoles().size());
 
       // add a role
       liveAddressControl.addRole(randomString(), randomBoolean(), randomBoolean(), randomBoolean());
 
-      assertEquals(roles.length + 1, liveAddressControl.getRoleInfos().length);
-      assertEquals(roles.length + 1, backupAddressControl.getRoleInfos().length);
+      assertEquals(roles.size() + 1, liveAddressControl.getRoles().size());
    }
 
    public void testRemoveRole() throws Exception
@@ -79,20 +79,20 @@
       AddressControlMBean liveAddressControl = createAddressControl(address, liveMBeanServer);
       AddressControlMBean backupAddressControl = createAddressControl(address, backupMBeanServer);
 
-      RoleInfo[] roles = liveAddressControl.getRoleInfos();
-      assertEquals(roles.length, backupAddressControl.getRoleInfos().length);
+      TabularData roles = liveAddressControl.getRoles();
+      assertEquals(roles.size(), backupAddressControl.getRoles().size());
 
       // add a role
       liveAddressControl.addRole(roleName, randomBoolean(), randomBoolean(), randomBoolean());
 
-      assertEquals(roles.length + 1, liveAddressControl.getRoleInfos().length);
-      assertEquals(roles.length + 1, backupAddressControl.getRoleInfos().length);
+      assertEquals(roles.size() + 1, liveAddressControl.getRoles().size());
+      assertEquals(roles.size() + 1, backupAddressControl.getRoles().size());
 
       // and remove it
       liveAddressControl.removeRole(roleName);
 
-      assertEquals(roles.length, liveAddressControl.getRoleInfos().length);
-      assertEquals(roles.length, backupAddressControl.getRoleInfos().length);
+      assertEquals(roles.size(), liveAddressControl.getRoles().size());
+      assertEquals(roles.size(), backupAddressControl.getRoles().size());
    }
 
    // Package protected ---------------------------------------------

Added: trunk/tests/src/org/jboss/messaging/tests/integration/management/AddressControlTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/AddressControlTest.java	                        (rev 0)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/AddressControlTest.java	2009-03-16 17:00:21 UTC (rev 6096)
@@ -0,0 +1,304 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, 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.tests.util.RandomUtil.randomBoolean;
+import static org.jboss.messaging.tests.util.RandomUtil.randomSimpleString;
+import static org.jboss.messaging.tests.util.RandomUtil.randomString;
+
+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;
+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.config.impl.ConfigurationImpl;
+import org.jboss.messaging.core.management.AddressControlMBean;
+import org.jboss.messaging.core.management.RoleInfo;
+import org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory;
+import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
+import org.jboss.messaging.core.security.CheckType;
+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;
+
+/**
+ * A QueueControlTest
+ *
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ */
+public class AddressControlTest extends UnitTestCase
+{
+
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   private MessagingService service;
+
+   protected MBeanServer mbeanServer;
+
+   protected ClientSession session;
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   // Public --------------------------------------------------------
+
+   public void testGetAddress() throws Exception
+   {
+      SimpleString address = randomSimpleString();
+      SimpleString queue = randomSimpleString();
+
+      session.createQueue(address, queue, false);
+
+      AddressControlMBean addressControl = createManagementControl(address);
+
+      assertEquals(address.toString(), addressControl.getAddress());
+
+      session.deleteQueue(queue);
+   }
+
+   public void testGetQueueNames() throws Exception
+   {
+      SimpleString address = randomSimpleString();
+      SimpleString queue = randomSimpleString();
+      SimpleString anotherQueue = randomSimpleString();
+
+      session.createQueue(address, queue, true);
+
+      AddressControlMBean addressControl = createManagementControl(address);
+      String[] queueNames = addressControl.getQueueNames();
+      assertEquals(1, queueNames.length);
+      assertEquals(queue.toString(), queueNames[0]);
+
+      session.createQueue(address, anotherQueue, false);
+      queueNames = addressControl.getQueueNames();
+      assertEquals(2, queueNames.length);
+
+      session.deleteQueue(queue);
+
+      queueNames = addressControl.getQueueNames();
+      assertEquals(1, queueNames.length);
+      assertEquals(anotherQueue.toString(), queueNames[0]);
+
+      session.deleteQueue(anotherQueue);
+   }
+
+   public void testGetRoles() throws Exception
+   {
+      SimpleString address = randomSimpleString();
+      SimpleString queue = randomSimpleString();
+      Role role = new Role(randomString(), randomBoolean(), randomBoolean(), randomBoolean());
+
+      session.createQueue(address, queue, true);
+
+      AddressControlMBean addressControl = createManagementControl(address);
+      TabularData tabularData = addressControl.getRoles();
+      assertEquals(0, tabularData.size());
+
+      Set<Role> newRoles = new HashSet<Role>();
+      newRoles.add(role);
+      service.getServer().getSecurityRepository().addMatch(address.toString(), newRoles);
+
+      tabularData = addressControl.getRoles();
+      assertEquals(1, tabularData.size());
+      RoleInfo[] roleInfos = RoleInfo.from(tabularData);
+      assertEquals(role.getName(), roleInfos[0].getName());
+      assertEquals(role.isCheckType(CheckType.READ), roleInfos[0].isRead());
+      assertEquals(role.isCheckType(CheckType.WRITE), roleInfos[0].isWrite());
+      assertEquals(role.isCheckType(CheckType.CREATE), roleInfos[0].isCreate());
+
+      session.deleteQueue(queue);
+   }
+
+   public void testAddRole() throws Exception
+   {
+      SimpleString address = randomSimpleString();
+      SimpleString queue = randomSimpleString();
+      Role role = new Role(randomString(), randomBoolean(), randomBoolean(), randomBoolean());
+
+      session.createQueue(address, queue, true);
+
+      AddressControlMBean addressControl = createManagementControl(address);
+      TabularData tabularData = addressControl.getRoles();
+      assertEquals(0, tabularData.size());
+
+      addressControl.addRole(role.getName(),
+                             role.isCheckType(CheckType.CREATE),
+                             role.isCheckType(CheckType.READ),
+                             role.isCheckType(CheckType.WRITE));
+
+      tabularData = addressControl.getRoles();
+      assertEquals(1, tabularData.size());
+      RoleInfo[] roleInfos = RoleInfo.from(tabularData);
+      assertEquals(role.getName(), roleInfos[0].getName());
+      assertEquals(role.isCheckType(CheckType.CREATE), roleInfos[0].isCreate());
+      assertEquals(role.isCheckType(CheckType.READ), roleInfos[0].isRead());
+      assertEquals(role.isCheckType(CheckType.WRITE), roleInfos[0].isWrite());
+
+      session.deleteQueue(queue);
+   }
+
+   public void testAddRoleWhichAlreadyExists() throws Exception
+   {
+      SimpleString address = randomSimpleString();
+      SimpleString queue = randomSimpleString();
+      Role role = new Role(randomString(), randomBoolean(), randomBoolean(), randomBoolean());
+
+      session.createQueue(address, queue, true);
+
+      AddressControlMBean addressControl = createManagementControl(address);
+      TabularData tabularData = addressControl.getRoles();
+      assertEquals(0, tabularData.size());
+
+      addressControl.addRole(role.getName(),
+                             role.isCheckType(CheckType.CREATE),
+                             role.isCheckType(CheckType.READ),
+                             role.isCheckType(CheckType.WRITE));
+
+      tabularData = addressControl.getRoles();
+      assertEquals(1, tabularData.size());
+
+      try
+      {
+         addressControl.addRole(role.getName(),
+                                role.isCheckType(CheckType.CREATE),
+                                role.isCheckType(CheckType.READ),
+                                role.isCheckType(CheckType.WRITE));
+         fail("can not add a role which already exists");
+      }
+      catch (Exception e)
+      {
+      }
+
+      tabularData = addressControl.getRoles();
+      assertEquals(1, tabularData.size());
+
+      session.deleteQueue(queue);
+   }
+
+   public void testRemoveRole() throws Exception
+   {
+      SimpleString address = randomSimpleString();
+      SimpleString queue = randomSimpleString();
+      String roleName = randomString();
+
+      session.createQueue(address, queue, true);
+
+      AddressControlMBean addressControl = createManagementControl(address);
+      TabularData tabularData = addressControl.getRoles();
+      assertEquals(0, tabularData.size());
+
+      addressControl.addRole(roleName, randomBoolean(), randomBoolean(), randomBoolean());
+
+      tabularData = addressControl.getRoles();
+      assertEquals(1, tabularData.size());
+
+      addressControl.removeRole(roleName);
+
+      tabularData = addressControl.getRoles();
+      assertEquals(0, tabularData.size());
+
+      session.deleteQueue(queue);
+   }
+
+   public void testRemoveRoleWhichDoesNotExist() throws Exception
+   {
+      SimpleString address = randomSimpleString();
+      SimpleString queue = randomSimpleString();
+      String roleName = randomString();
+
+      session.createQueue(address, queue, true);
+
+      AddressControlMBean addressControl = createManagementControl(address);
+      TabularData tabularData = addressControl.getRoles();
+      assertEquals(0, tabularData.size());
+
+      try
+      {
+         addressControl.removeRole(roleName);
+         fail("can not remove a role which does not exist");
+      }
+      catch (Exception e)
+      {
+      }
+
+      session.deleteQueue(queue);
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   @Override
+   protected void setUp() throws Exception
+   {
+      super.setUp();
+
+      mbeanServer = MBeanServerFactory.createMBeanServer();
+
+      Configuration conf = new ConfigurationImpl();
+      conf.setSecurityEnabled(false);
+      conf.setJMXManagementEnabled(true);
+      conf.getAcceptorConfigurations().add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
+      service = Messaging.newNullStorageMessagingService(conf, mbeanServer);
+      service.start();
+
+      ClientSessionFactory sf = new ClientSessionFactoryImpl(new TransportConfiguration(InVMConnectorFactory.class.getName()));
+      sf.setBlockOnNonPersistentSend(true);
+      sf.setBlockOnNonPersistentSend(true);
+      session = sf.createSession(false, true, false);
+      session.start();
+   }
+
+   @Override
+   protected void tearDown() throws Exception
+   {
+      session.close();
+
+      service.stop();
+
+      super.tearDown();
+   }
+
+   protected AddressControlMBean createManagementControl(SimpleString address) throws Exception
+   {
+      return ManagementControlHelper.createAddressControl(address, mbeanServer);
+   }
+
+   // 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-16 16:36:23 UTC (rev 6095)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/QueueControlTest.java	2009-03-16 17:00:21 UTC (rev 6096)
@@ -349,7 +349,7 @@
       session.deleteQueue(queue);
    }
 
-   public void testListMessages() throws Exception
+   public void testListAllMessages() throws Exception
    {
       SimpleString address = randomSimpleString();
       SimpleString queue = randomSimpleString();

Added: trunk/tests/src/org/jboss/messaging/tests/integration/management/core/CoreAddressControlTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/core/CoreAddressControlTest.java	                        (rev 0)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/core/CoreAddressControlTest.java	2009-03-16 17:00:21 UTC (rev 6096)
@@ -0,0 +1,99 @@
+/*
+ * 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.core;
+
+import static org.jboss.messaging.tests.integration.management.core.CoreMessagingProxy.fromNullableSimpleString;
+
+import javax.management.openmbean.TabularData;
+
+import org.jboss.messaging.core.management.AddressControlMBean;
+import org.jboss.messaging.core.management.ObjectNames;
+import org.jboss.messaging.tests.integration.management.AddressControlTest;
+import org.jboss.messaging.utils.SimpleString;
+
+/**
+ * A JMXQueueControlTest
+ *
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ *
+ */
+public class CoreAddressControlTest 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.invokOperation("addRole", name, create, read, write);
+         }
+
+         public String getAddress()
+         {
+            return fromNullableSimpleString((SimpleString)proxy.retriveAttributeValue("Address"));
+         }
+
+         public String[] getQueueNames() throws Exception
+         {
+            return (String[])proxy.retrieveArrayAttribute("QueueNames");
+         }
+
+         public TabularData getRoles() throws Exception
+         {
+            return proxy.retrieveTabularAttribute("Roles");
+         }
+
+         public void removeRole(String name) throws Exception
+         {
+            proxy.invokOperation("removeRole", name);
+         }
+      };
+   }
+
+   // Public --------------------------------------------------------
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+
+}

Added: trunk/tests/src/org/jboss/messaging/tests/integration/management/core/CoreMessagingProxy.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/core/CoreMessagingProxy.java	                        (rev 0)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/core/CoreMessagingProxy.java	2009-03-16 17:00:21 UTC (rev 6096)
@@ -0,0 +1,189 @@
+/*
+ * 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.core;
+
+import static org.jboss.messaging.core.config.impl.ConfigurationImpl.DEFAULT_MANAGEMENT_ADDRESS;
+
+import javax.management.ObjectName;
+import javax.management.openmbean.CompositeData;
+import javax.management.openmbean.TabularData;
+
+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 --------------------------------------------------------
+
+   protected static String fromNullableSimpleString(SimpleString sstring)
+   {
+      if (sstring == null)
+      {
+         return null;
+      }
+      else
+      {
+         return sstring.toString();
+      }
+   }
+
+   // 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 -----------------------------------------------------
+
+   protected Object retriveAttributeValue(String attributeName)
+   {
+      ClientMessage m = session.createClientMessage(false);
+      ManagementHelper.putAttributes(m, on, attributeName);
+      ClientMessage reply;
+      try
+      {
+         reply = requestor.request(m);
+         Object attributeValue = reply.getProperty(new SimpleString(attributeName));
+         if (attributeValue.equals(new SimpleString("null")))
+         {
+            return null;
+         }
+         return attributeValue;
+      }
+      catch (Exception e)
+      {
+         throw new IllegalStateException(e);
+      }
+   }
+
+   public Object[] retrieveArrayAttribute(String attributeName)
+   {
+      ClientMessage m = session.createClientMessage(false);
+      ManagementHelper.putAttributes(m, on, attributeName);
+      try
+      {
+         ClientMessage reply = requestor.request(m);
+         return (Object[])ManagementHelper.getArrayProperty(reply, attributeName);
+      }
+      catch (Exception e)
+      {
+         throw new IllegalStateException(e);
+      }
+   }
+   
+   public TabularData retrieveTabularAttribute(String attributeName)
+   {
+      ClientMessage m = session.createClientMessage(false);
+      ManagementHelper.putAttributes(m, on, attributeName);
+      try
+      {
+         ClientMessage reply = requestor.request(m);
+         return (TabularData)ManagementHelper.getTabularDataProperty(reply, attributeName);
+      }
+      catch (Exception e)
+      {
+         throw new IllegalStateException(e);
+      }
+   }
+
+   protected Object invokOperation(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 reply.getProperty(new SimpleString(operationName));
+      }
+      else
+      {
+         throw new Exception(ManagementHelper.getOperationExceptionMessage(reply));
+      }
+   }
+
+   protected TabularData invokeTabularOperation(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.getTabularDataProperty(reply, operationName);
+      }
+      else
+      {
+         throw new Exception(ManagementHelper.getOperationExceptionMessage(reply));
+      }
+   }
+
+   protected CompositeData invokeCompositeOperation(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.getCompositeDataProperty(reply, operationName);
+      }
+      else
+      {
+         throw new Exception(ManagementHelper.getOperationExceptionMessage(reply));
+      }
+   }
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+
+}

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/management/core/CoreQueueControlTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/core/CoreQueueControlTest.java	2009-03-16 16:36:23 UTC (rev 6095)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/core/CoreQueueControlTest.java	2009-03-16 17:00:21 UTC (rev 6096)
@@ -22,15 +22,11 @@
 
 package org.jboss.messaging.tests.integration.management.core;
 
-import static org.jboss.messaging.core.config.impl.ConfigurationImpl.DEFAULT_MANAGEMENT_ADDRESS;
+import static org.jboss.messaging.tests.integration.management.core.CoreMessagingProxy.fromNullableSimpleString;
 
-import javax.management.ObjectName;
 import javax.management.openmbean.CompositeData;
 import javax.management.openmbean.TabularData;
 
-import org.jboss.messaging.core.client.ClientMessage;
-import org.jboss.messaging.core.client.ClientRequestor;
-import org.jboss.messaging.core.client.management.impl.ManagementHelper;
 import org.jboss.messaging.core.management.ObjectNames;
 import org.jboss.messaging.core.management.QueueControlMBean;
 import org.jboss.messaging.tests.integration.management.QueueControlTest;
@@ -52,18 +48,6 @@
 
    // Static --------------------------------------------------------
 
-   private static String fromNullableSimpleString(SimpleString sstring)
-   {
-      if (sstring == null)
-      {
-         return null;
-      }
-      else
-      {
-         return sstring.toString();
-      }
-   }
-
    // Constructors --------------------------------------------------
 
    // QueueControlTestBase overrides --------------------------------
@@ -72,233 +56,181 @@
    protected QueueControlMBean createManagementControl(final SimpleString address, final SimpleString queue) throws Exception
    {
 
-      final ClientRequestor requestor = new ClientRequestor(session, DEFAULT_MANAGEMENT_ADDRESS);
-
       return new QueueControlMBean()
       {
 
-         private ObjectName queueON = ObjectNames.getQueueObjectName(address, queue);
+         private final CoreMessagingProxy proxy = new CoreMessagingProxy(session,
+                                                                         ObjectNames.getQueueObjectName(address, queue));
 
          public boolean changeMessagePriority(long messageID, int newPriority) throws Exception
          {
-            ClientMessage m = session.createClientMessage(false);
-            ManagementHelper.putOperationInvocation(m, queueON, "changeMessagePriority", messageID, newPriority);
-            ClientMessage reply = requestor.request(m);
-            return (Boolean)reply.getProperty(new SimpleString("changeMessagePriority"));
+            return (Boolean)proxy.invokOperation("changeMessagePriority", messageID, newPriority);
          }
 
          public int countMessages(String filter) throws Exception
          {
-            return (Integer)invokOperation("countMessages", filter);
+            return (Integer)proxy.invokOperation("countMessages", filter);
          }
 
          public boolean expireMessage(long messageID) throws Exception
          {
-            return (Boolean)invokOperation("expireMessage", messageID);
+            return (Boolean)proxy.invokOperation("expireMessage", messageID);
          }
 
          public int expireMessages(String filter) throws Exception
          {
-            return (Integer)invokOperation("expireMessages", filter);
+            return (Integer)proxy.invokOperation("expireMessages", filter);
          }
 
          public String getAddress()
          {
-            return fromNullableSimpleString((SimpleString)retriveAttributeValue("Address"));
+            return fromNullableSimpleString((SimpleString)proxy.retriveAttributeValue("Address"));
          }
 
          public int getConsumerCount()
          {
-            return (Integer)retriveAttributeValue("ConsumerCount");
+            return (Integer)proxy.retriveAttributeValue("ConsumerCount");
          }
 
          public String getDeadLetterAddress()
          {
-            return fromNullableSimpleString((SimpleString)retriveAttributeValue("DeadLetterAddress"));
+            return fromNullableSimpleString((SimpleString)proxy.retriveAttributeValue("DeadLetterAddress"));
          }
 
          public int getDeliveringCount()
          {
-            return (Integer)retriveAttributeValue("DeliveringCount");
+            return (Integer)proxy.retriveAttributeValue("DeliveringCount");
          }
 
          public String getExpiryAddress()
          {
-            return fromNullableSimpleString((SimpleString)retriveAttributeValue("ExpiryAddress"));
+            return fromNullableSimpleString((SimpleString)proxy.retriveAttributeValue("ExpiryAddress"));
          }
 
          public String getFilter()
          {
-            return fromNullableSimpleString((SimpleString)retriveAttributeValue("Filter"));
+            return fromNullableSimpleString((SimpleString)proxy.retriveAttributeValue("Filter"));
          }
 
          public int getMessageCount()
          {
-            return (Integer)retriveAttributeValue("MessageCount");
+            return (Integer)proxy.retriveAttributeValue("MessageCount");
          }
 
          public int getMessagesAdded()
          {
-            return (Integer)retriveAttributeValue("MessagesAdded");
+            return (Integer)proxy.retriveAttributeValue("MessagesAdded");
          }
 
          public String getName()
          {
-            return fromNullableSimpleString((SimpleString)retriveAttributeValue("Name"));
+            return fromNullableSimpleString((SimpleString)proxy.retriveAttributeValue("Name"));
          }
 
          public long getPersistenceID()
          {
-            return (Long)retriveAttributeValue("PersistenceID");
+            return (Long)proxy.retriveAttributeValue("PersistenceID");
          }
 
          public long getScheduledCount()
          {
-            return (Long)retriveAttributeValue("ScheduledCount");
+            return (Long)proxy.retriveAttributeValue("ScheduledCount");
          }
 
          public boolean isBackup()
          {
-            return (Boolean)retriveAttributeValue("Backup");
+            return (Boolean)proxy.retriveAttributeValue("Backup");
          }
 
          public boolean isDurable()
          {
-            return (Boolean)retriveAttributeValue("Durable");
+            return (Boolean)proxy.retriveAttributeValue("Durable");
          }
 
          public boolean isTemporary()
          {
-            return (Boolean)retriveAttributeValue("Temporary");
+            return (Boolean)proxy.retriveAttributeValue("Temporary");
          }
 
          public TabularData listAllMessages() throws Exception
          {
-            ClientMessage m = session.createClientMessage(false);
-            ManagementHelper.putOperationInvocation(m, queueON, "listAllMessages");
-            ClientMessage reply = requestor.request(m);
-            return (TabularData)ManagementHelper.getTabularDataProperty(reply, "listAllMessages");
+            return proxy.invokeTabularOperation("listAllMessages");
          }
 
          public CompositeData listMessageCounter() throws Exception
          {
-            ClientMessage m = session.createClientMessage(false);
-            ManagementHelper.putOperationInvocation(m, queueON, "listMessageCounter");
-            ClientMessage reply = requestor.request(m);
-            return (CompositeData)ManagementHelper.getCompositeDataProperty(reply, "listMessageCounter");
+            return proxy.invokeCompositeOperation("listMessageCounter");
          }
 
          public String listMessageCounterAsHTML() throws Exception
          {
-            return fromNullableSimpleString((SimpleString)invokOperation("listMessageCounterAsHTML"));
+            return fromNullableSimpleString((SimpleString)proxy.invokOperation("listMessageCounterAsHTML"));
          }
 
          public TabularData listMessageCounterHistory() throws Exception
          {
-            ClientMessage m = session.createClientMessage(false);
-            ManagementHelper.putOperationInvocation(m, queueON, "listMessageCounterHistory");
-            ClientMessage reply = requestor.request(m);
-            return (TabularData)ManagementHelper.getTabularDataProperty(reply, "listMessageCounterHistory");
+            return proxy.invokeTabularOperation("listMessageCounterHistory");
          }
 
          public String listMessageCounterHistoryAsHTML() throws Exception
          {
-            return fromNullableSimpleString((SimpleString)invokOperation("listMessageCounterHistoryAsHTML"));
+            return fromNullableSimpleString((SimpleString)proxy.invokOperation("listMessageCounterHistoryAsHTML"));
          }
 
          public TabularData listMessages(String filter) throws Exception
          {
-            ClientMessage m = session.createClientMessage(false);
-            ManagementHelper.putOperationInvocation(m, queueON, "listMessages", filter);
-            ClientMessage reply = requestor.request(m);
-            return (TabularData)ManagementHelper.getTabularDataProperty(reply, "listMessages");
+            return proxy.invokeTabularOperation("listMessages", filter);
          }
 
          public TabularData listScheduledMessages() throws Exception
          {
-            ClientMessage m = session.createClientMessage(false);
-            ManagementHelper.putOperationInvocation(m, queueON, "listScheduledMessages");
-            ClientMessage reply = requestor.request(m);
-            return (TabularData)ManagementHelper.getTabularDataProperty(reply, "listScheduledMessages");
+            return proxy.invokeTabularOperation("listScheduledMessages");
          }
 
          public int moveAllMessages(String otherQueueName) throws Exception
          {
-            return (Integer)invokOperation("moveAllMessages", otherQueueName);
+            return (Integer)proxy.invokOperation("moveAllMessages", otherQueueName);
          }
 
          public int moveMatchingMessages(String filter, String otherQueueName) throws Exception
          {
-            return (Integer)invokOperation("moveMatchingMessages", filter, otherQueueName);
+            return (Integer)proxy.invokOperation("moveMatchingMessages", filter, otherQueueName);
          }
 
          public boolean moveMessage(long messageID, String otherQueueName) throws Exception
          {
-            return (Boolean)invokOperation("moveMessage", messageID, otherQueueName);
+            return (Boolean)proxy.invokOperation("moveMessage", messageID, otherQueueName);
          }
 
          public int removeAllMessages() throws Exception
          {
-            return (Integer)invokOperation("removeAllMessages");
+            return (Integer)proxy.invokOperation("removeAllMessages");
          }
 
          public int removeMatchingMessages(String filter) throws Exception
          {
-            return (Integer)invokOperation("removeMatchingMessages", filter);
+            return (Integer)proxy.invokOperation("removeMatchingMessages", filter);
          }
 
          public boolean removeMessage(long messageID) throws Exception
          {
-            return (Boolean)invokOperation("removeMessage", messageID);
+            return (Boolean)proxy.invokOperation("removeMessage", messageID);
          }
 
          public boolean sendMessageToDeadLetterAddress(long messageID) throws Exception
          {
-            return (Boolean)invokOperation("sendMessageToDeadLetterAddress", messageID);
+            return (Boolean)proxy.invokOperation("sendMessageToDeadLetterAddress", messageID);
          }
 
          public void setDeadLetterAddress(String deadLetterAddress) throws Exception
          {
-            ClientMessage m = session.createClientMessage(false);
-            ManagementHelper.putOperationInvocation(m, queueON, "setDeadLetterAddress", deadLetterAddress);
-            requestor.request(m);
+            proxy.invokOperation("setDeadLetterAddress", deadLetterAddress);
          }
 
          public void setExpiryAddress(String expiryAddres) throws Exception
          {
-            ClientMessage m = session.createClientMessage(false);
-            ManagementHelper.putOperationInvocation(m, queueON, "setExpiryAddress", expiryAddres);
-            requestor.request(m);
+            proxy.invokOperation("setExpiryAddress", expiryAddres);
          }
-
-         private Object retriveAttributeValue(String attributeName)
-         {
-            ClientMessage m = session.createClientMessage(false);
-            ManagementHelper.putAttributes(m, queueON, attributeName);
-            ClientMessage reply;
-            try
-            {
-               reply = requestor.request(m);
-               Object attributeValue = reply.getProperty(new SimpleString(attributeName));
-               if (attributeValue.equals(new SimpleString("null")))
-               {
-                  return null;
-               }
-               return attributeValue;
-            }
-            catch (Exception e)
-            {
-               throw new IllegalStateException(e);
-            }
-         }
-
-         public Object invokOperation(String operationName, Object... args) throws Exception
-         {
-            ClientMessage m = session.createClientMessage(false);
-            ManagementHelper.putOperationInvocation(m, queueON, operationName, args);
-            ClientMessage reply = requestor.request(m);
-            return reply.getProperty(new SimpleString(operationName));
-         }
       };
    }
 

Deleted: trunk/tests/src/org/jboss/messaging/tests/unit/core/management/impl/AddressControlTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/management/impl/AddressControlTest.java	2009-03-16 16:36:23 UTC (rev 6095)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/management/impl/AddressControlTest.java	2009-03-16 17:00:21 UTC (rev 6096)
@@ -1,298 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, 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.unit.core.management.impl;
-
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.eq;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.isA;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-import static org.jboss.messaging.tests.util.RandomUtil.randomBoolean;
-import static org.jboss.messaging.tests.util.RandomUtil.randomSimpleString;
-import static org.jboss.messaging.tests.util.RandomUtil.randomString;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.management.openmbean.CompositeData;
-import javax.management.openmbean.TabularData;
-
-import org.jboss.messaging.core.management.RoleInfo;
-import org.jboss.messaging.core.management.impl.AddressControl;
-import org.jboss.messaging.core.postoffice.PostOffice;
-import org.jboss.messaging.core.security.CheckType;
-import org.jboss.messaging.core.security.Role;
-import org.jboss.messaging.core.settings.HierarchicalRepository;
-import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.utils.SimpleString;
-
-/**
- * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
- * 
- * @version <tt>$Revision$</tt>
- * 
- */
-public class AddressControlTest extends UnitTestCase
-{
-   // Constants -----------------------------------------------------
-
-   // Attributes ----------------------------------------------------
-
-   // Static --------------------------------------------------------
-
-   private static void assertRoleEquals(Role expected, RoleInfo actual)
-   {
-      assertEquals(expected.getName(), actual.getName());
-      assertEquals(expected.isCheckType(CheckType.CREATE), actual.isCreate());
-      assertEquals(expected.isCheckType(CheckType.READ), actual.isRead());
-      assertEquals(expected.isCheckType(CheckType.WRITE), actual.isWrite());
-   }
-
-   private static void assertRoleEquals(Role expected, CompositeData actual)
-   {
-      assertTrue(actual.getCompositeType().equals(RoleInfo.TYPE));
-
-      assertEquals(expected.getName(), actual.get("name"));
-      assertEquals(expected.isCheckType(CheckType.CREATE), actual.get("create"));
-      assertEquals(expected.isCheckType(CheckType.READ), actual.get("read"));
-      assertEquals(expected.isCheckType(CheckType.WRITE), actual.get("write"));
-   }
-
-   // Constructors --------------------------------------------------
-
-   // Public --------------------------------------------------------
-
-   public void testGetAddress() throws Exception
-   {
-      SimpleString address = randomSimpleString();
-      PostOffice postOffice = createMock(PostOffice.class);
-      HierarchicalRepository<Set<Role>> securityRepository = createMock(HierarchicalRepository.class);
-      replay(postOffice, securityRepository);
-
-      AddressControl control = new AddressControl(address, postOffice,
-            securityRepository);
-      assertEquals(address.toString(), control.getAddress());
-
-      verify(postOffice, securityRepository);
-   }
-
-//   public void testGetQueueNames() throws Exception
-//   {
-//      SimpleString address = randomSimpleString();
-//      PostOffice postOffice = createMock(PostOffice.class);
-//      HierarchicalRepository<Set<Role>> securityRepository = createMock(HierarchicalRepository.class);
-//      Bindings bindings = new BindingsImpl();
-//      Queue queue_1 = createMock(Queue.class);
-//      expect(queue_1.getName()).andStubReturn(randomSimpleString());
-//      Binding binding_1 = createMock(Binding.class);
-//      
-//      expect(binding_1.getQueue()).andReturn(queue_1);      
-//      Queue queue_2 = createMock(Queue.class);
-//      expect(queue_2.getName()).andStubReturn(randomSimpleString());
-//      expect(binding_1.isExclusive()).andStubReturn(false);
-//      Binding binding_2 = createMock(Binding.class);
-//      
-//      expect(binding_2.getQueue()).andReturn(queue_2);      
-//      bindings.addBinding(binding_1);
-//      bindings.addBinding(binding_2);
-//      expect(postOffice.getBindingsForAddress(address)).andReturn(bindings);
-//      expect(binding_2.isExclusive()).andStubReturn(false);
-//
-//      replay(binding_1, queue_1, binding_2, queue_2);
-//      replay(postOffice, securityRepository);
-//
-//      AddressControl control = new AddressControl(address, postOffice,
-//            securityRepository);
-//      String[] queueNames = control.getQueueNames();
-//      assertEquals(2, queueNames.length);
-//      assertEquals(queue_1.getName().toString(), queueNames[0]);
-//      assertEquals(queue_2.getName().toString(), queueNames[1]);
-//
-//      verify(binding_1, queue_1, binding_2, queue_2);
-//      verify(postOffice, securityRepository);
-//   }
-
-   public void testGetRoleInfos() throws Exception
-   {
-      SimpleString address = randomSimpleString();
-      PostOffice postOffice = createMock(PostOffice.class);
-      HierarchicalRepository<Set<Role>> securityRepository = createMock(HierarchicalRepository.class);
-
-      Set<Role> roles = new HashSet<Role>();
-      Role role_1 = new Role(randomString(), randomBoolean(), randomBoolean(),
-            randomBoolean());
-      Role role_2 = new Role(randomString(), randomBoolean(), randomBoolean(),
-            randomBoolean());
-      roles.add(role_1);
-      roles.add(role_2);
-      expect(securityRepository.getMatch(address.toString())).andReturn(roles);
-
-      replay(postOffice, securityRepository);
-
-      AddressControl control = new AddressControl(address, postOffice,
-            securityRepository);
-      RoleInfo[] infos = control.getRoleInfos();
-      assertEquals(2, infos.length);
-      if (infos[0].getName().equals(role_1.getName()))
-      {
-         assertRoleEquals(role_1, infos[0]);
-         assertRoleEquals(role_2, infos[1]);
-      } else
-      {
-         assertRoleEquals(role_2, infos[0]);
-         assertRoleEquals(role_1, infos[1]);
-      }
-
-      verify(postOffice, securityRepository);
-   }
-
-   public void testGetRoles() throws Exception
-   {
-      SimpleString address = randomSimpleString();
-      PostOffice postOffice = createMock(PostOffice.class);
-      HierarchicalRepository<Set<Role>> securityRepository = createMock(HierarchicalRepository.class);
-
-      Set<Role> roles = new HashSet<Role>();
-      Role role_1 = new Role(randomString(), randomBoolean(), randomBoolean(),
-            randomBoolean());
-      Role role_2 = new Role(randomString(), randomBoolean(), randomBoolean(),
-            randomBoolean());
-      roles.add(role_1);
-      roles.add(role_2);
-      expect(securityRepository.getMatch(address.toString())).andReturn(roles);
-
-      replay(postOffice, securityRepository);
-
-      AddressControl control = new AddressControl(address, postOffice,
-            securityRepository);
-      TabularData data = control.getRoles();
-      assertEquals(2, data.size());
-      CompositeData roleData_1 = data.get(new Object[] { role_1.getName() });
-      CompositeData roleData_2 = data.get(new Object[] { role_2.getName() });
-      assertRoleEquals(role_1, roleData_1);
-      assertRoleEquals(role_2, roleData_2);
-
-      verify(postOffice, securityRepository);
-   }
-
-   public void testAddRole() throws Exception
-   {
-      SimpleString address = randomSimpleString();
-      PostOffice postOffice = createMock(PostOffice.class);
-      HierarchicalRepository<Set<Role>> securityRepository = createMock(HierarchicalRepository.class);
-
-      expect(securityRepository.getMatch(address.toString())).andReturn(
-            new HashSet<Role>());
-      securityRepository.addMatch(eq(address.toString()), isA(Set.class));
-      replay(postOffice, securityRepository);
-
-      AddressControl control = new AddressControl(address, postOffice,
-            securityRepository);
-      control.addRole(randomString(), randomBoolean(), randomBoolean(),
-            randomBoolean());
-
-      verify(postOffice, securityRepository);
-   }
-
-   public void testAddRoleWhichAlreadExists() throws Exception
-   {
-      SimpleString address = randomSimpleString();
-      PostOffice postOffice = createMock(PostOffice.class);
-      HierarchicalRepository<Set<Role>> securityRepository = createMock(HierarchicalRepository.class);
-
-      Set<Role> roles = new HashSet<Role>();
-      Role role = new Role(randomString(), randomBoolean(), randomBoolean(),
-            randomBoolean());
-      roles.add(role);
-      expect(securityRepository.getMatch(address.toString())).andReturn(roles);
-
-      replay(postOffice, securityRepository);
-
-      AddressControl control = new AddressControl(address, postOffice,
-            securityRepository);
-      try
-      {
-         control.addRole(role.getName(), role.isCheckType(CheckType.CREATE),
-               role.isCheckType(CheckType.READ), role
-                     .isCheckType(CheckType.WRITE));
-         fail("role already exists");
-      } catch (IllegalArgumentException e)
-      {
-      }
-
-      verify(postOffice, securityRepository);
-   }
-
-   public void testRemoveRole() throws Exception
-   {
-      SimpleString address = randomSimpleString();
-      PostOffice postOffice = createMock(PostOffice.class);
-      HierarchicalRepository<Set<Role>> securityRepository = createMock(HierarchicalRepository.class);
-
-      Set<Role> roles = new HashSet<Role>();
-      Role role = new Role(randomString(), randomBoolean(), randomBoolean(),
-            randomBoolean());
-      roles.add(role);
-      expect(securityRepository.getMatch(address.toString())).andReturn(roles);
-      securityRepository.addMatch(eq(address.toString()), isA(Set.class));
-      replay(postOffice, securityRepository);
-
-      AddressControl control = new AddressControl(address, postOffice,
-            securityRepository);
-      control.removeRole(role.getName());
-
-      verify(postOffice, securityRepository);
-   }
-
-   public void testRemoveRoleFromEmptySet() throws Exception
-   {
-      SimpleString address = randomSimpleString();
-      PostOffice postOffice = createMock(PostOffice.class);
-      HierarchicalRepository<Set<Role>> securityRepository = createMock(HierarchicalRepository.class);
-
-      expect(securityRepository.getMatch(address.toString())).andReturn(
-            new HashSet<Role>());
-      replay(postOffice, securityRepository);
-
-      AddressControl control = new AddressControl(address, postOffice,
-            securityRepository);
-      try
-      {
-         control.removeRole(randomString());
-         fail("role does not exisits");
-      } catch (IllegalArgumentException e)
-      {
-      }
-
-      verify(postOffice, securityRepository);
-   }
-
-   // Package protected ---------------------------------------------
-
-   // Protected -----------------------------------------------------
-
-   // Private -------------------------------------------------------
-
-   // Inner classes -------------------------------------------------
-}

Deleted: trunk/tests/src/org/jboss/messaging/tests/unit/core/management/impl/QueueControlTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/management/impl/QueueControlTest.java	2009-03-16 16:36:23 UTC (rev 6095)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/management/impl/QueueControlTest.java	2009-03-16 17:00:21 UTC (rev 6096)
@@ -1,643 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, 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.unit.core.management.impl;
-
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.expectLastCall;
-import static org.easymock.EasyMock.isA;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-import static org.jboss.messaging.tests.util.RandomUtil.randomBoolean;
-import static org.jboss.messaging.tests.util.RandomUtil.randomByte;
-import static org.jboss.messaging.tests.util.RandomUtil.randomInt;
-import static org.jboss.messaging.tests.util.RandomUtil.randomLong;
-import static org.jboss.messaging.tests.util.RandomUtil.randomPositiveInt;
-import static org.jboss.messaging.tests.util.RandomUtil.randomSimpleString;
-import static org.jboss.messaging.tests.util.RandomUtil.randomString;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-
-import javax.management.openmbean.CompositeData;
-import javax.management.openmbean.TabularData;
-
-import org.jboss.messaging.core.exception.MessagingException;
-import org.jboss.messaging.core.filter.Filter;
-import org.jboss.messaging.core.management.QueueControlMBean;
-import org.jboss.messaging.core.management.impl.QueueControl;
-import org.jboss.messaging.core.messagecounter.MessageCounter;
-import org.jboss.messaging.core.persistence.StorageManager;
-import org.jboss.messaging.core.postoffice.Binding;
-import org.jboss.messaging.core.postoffice.PostOffice;
-import org.jboss.messaging.core.server.MessageReference;
-import org.jboss.messaging.core.server.Queue;
-import org.jboss.messaging.core.server.ServerMessage;
-import org.jboss.messaging.core.settings.HierarchicalRepository;
-import org.jboss.messaging.core.settings.impl.AddressSettings;
-import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.utils.SimpleString;
-
-/**
- * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
- * 
- * @version <tt>$Revision$</tt>
- * 
- */
-public class QueueControlTest extends UnitTestCase
-{
-   // Constants -----------------------------------------------------
-
-   // Attributes ----------------------------------------------------
-
-   private Queue queue;
-
-   private String address;
-   
-   private StorageManager storageManager;
-
-   private PostOffice postOffice;
-
-   private HierarchicalRepository<AddressSettings> repository;
-
-   private MessageCounter messageCounter;
-
-   private SimpleString queueName;
-
-   // Static --------------------------------------------------------
-
-   // Constructors --------------------------------------------------
-
-   // Public --------------------------------------------------------
-
-   public void testGetName() throws Exception
-   {
-      expect(queue.getName()).andReturn(queueName);
-
-      replayMockedAttributes();
-
-      QueueControlMBean control = createControl();
-      assertEquals(queueName.toString(), control.getName());
-
-      verifyMockedAttributes();
-   }
-
-   public void testGetFilter() throws Exception
-   {
-      String filterStr = "color = 'green'";
-      Filter filter = createMock(Filter.class);
-      expect(filter.getFilterString()).andReturn(new SimpleString(filterStr));
-      expect(queue.getFilter()).andReturn(filter);
-
-      replayMockedAttributes();
-      replay(filter);
-
-      QueueControlMBean control = createControl();
-      assertEquals(filterStr, control.getFilter());
-
-      verifyMockedAttributes();
-      verify(filter);
-   }
-
-   public void testGetFilterWithNull() throws Exception
-   {
-      expect(queue.getFilter()).andReturn(null);
-
-      replayMockedAttributes();
-
-      QueueControlMBean control = createControl();
-      assertNull(control.getFilter());
-
-      verifyMockedAttributes();
-   }
-
-   public void testIsDurable() throws Exception
-   {
-      boolean durable = randomBoolean();
-      expect(queue.isDurable()).andReturn(durable);
-
-      replayMockedAttributes();
-
-      QueueControlMBean control = createControl();
-      assertEquals(durable, control.isDurable());
-
-      verifyMockedAttributes();
-   }
-
-   public void testIsTemporary() throws Exception
-   {
-      boolean temp = randomBoolean();
-      expect(queue.isTemporary()).andReturn(temp);
-
-      replayMockedAttributes();
-
-      QueueControlMBean control = createControl();
-      assertEquals(temp, control.isTemporary());
-
-      verify(queue, storageManager, postOffice, repository);
-   }
-
-   public void testIsBackup() throws Exception
-   {
-      boolean backup = randomBoolean();
-      expect(queue.isBackup()).andReturn(backup);
-
-      replayMockedAttributes();
-
-      QueueControlMBean control = createControl();
-      assertEquals(backup, control.isBackup());
-
-      verifyMockedAttributes();
-   }
-
-   public void testGetMessageCount() throws Exception
-   {
-      int count = randomInt();
-      expect(queue.getMessageCount()).andReturn(count);
-
-      replayMockedAttributes();
-
-      QueueControlMBean control = createControl();
-      assertEquals(count, control.getMessageCount());
-
-      verifyMockedAttributes();
-   }
-
-   public void testGetMessagesAdded() throws Exception
-   {
-      int count = randomInt();
-      expect(queue.getMessagesAdded()).andReturn(count);
-
-      replayMockedAttributes();
-
-      QueueControlMBean control = createControl();
-      assertEquals(count, control.getMessagesAdded());
-
-      verifyMockedAttributes();
-   }
-
-   public void testGetScheduledCount() throws Exception
-   {
-      int count = randomInt();
-      expect(queue.getScheduledCount()).andReturn(count);
-
-      replayMockedAttributes();
-
-      QueueControlMBean control = createControl();
-      assertEquals(count, control.getScheduledCount());
-
-      verifyMockedAttributes();
-   }
-
-   public void testGetConsumerCount() throws Exception
-   {
-      int count = randomInt();
-      expect(queue.getConsumerCount()).andReturn(count);
-
-      replayMockedAttributes();
-
-      QueueControlMBean control = createControl();
-      assertEquals(count, control.getConsumerCount());
-
-      verifyMockedAttributes();
-   }
-
-   public void testGetDeliveringCount() throws Exception
-   {
-      int count = randomInt();
-      expect(queue.getDeliveringCount()).andReturn(count);
-
-      replayMockedAttributes();
-
-      QueueControlMBean control = createControl();
-      assertEquals(count, control.getDeliveringCount());
-
-      verifyMockedAttributes();
-   }
-
-   public void testGetPersistenceID() throws Exception
-   {
-      long id = randomLong();
-      expect(queue.getPersistenceID()).andReturn(id);
-
-      replayMockedAttributes();
-
-      QueueControlMBean control = createControl();
-      assertEquals(id, control.getPersistenceID());
-
-      verifyMockedAttributes();
-   }
-
-   public void testGetDeadLetterAddress() throws Exception
-   {
-      final String dlqName = randomString();
-
-      AddressSettings addressSettings = new AddressSettings()
-      {
-         @Override
-         public SimpleString getDeadLetterAddress()
-         {
-            return new SimpleString(dlqName);
-         }
-      };
-      expect(repository.getMatch(address)).andReturn(addressSettings);
-
-      replayMockedAttributes();
-
-      QueueControlMBean control = createControl();
-      assertEquals(dlqName, control.getDeadLetterAddress());
-
-      verifyMockedAttributes();
-   }
-
-   public void testGetExpiryAddress() throws Exception
-   {
-      final String expiryQueueName = randomString();
-
-      AddressSettings addressSettings = new AddressSettings()
-      {
-         @Override
-         public SimpleString getExpiryAddress()
-         {
-            return new SimpleString(expiryQueueName);
-         }
-      };
-      expect(repository.getMatch(address)).andReturn(addressSettings);
-
-      replayMockedAttributes();
-
-      QueueControlMBean control = createControl();
-      assertEquals(expiryQueueName, control.getExpiryAddress());
-
-      verifyMockedAttributes();
-   }
-
-   public void testRemoveAllMessages() throws Exception
-   {
-      int messageRemoved = randomPositiveInt();
-      expect(queue.deleteAllReferences()).andReturn(messageRemoved);
-
-      replayMockedAttributes();
-
-      QueueControlMBean control = createControl();
-      assertEquals(messageRemoved, control.removeAllMessages());
-
-      verifyMockedAttributes();
-   }
-
-   public void testRemoveAllMessagesThrowsException() throws Exception
-   {
-      queue.deleteAllReferences();
-      expectLastCall().andThrow(new MessagingException());
-
-      replayMockedAttributes();
-
-      QueueControlMBean control = createControl();
-      try
-      {
-         control.removeAllMessages();
-         fail("IllegalStateException");
-      }
-      catch (IllegalStateException e)
-      {
-
-      }
-
-      verifyMockedAttributes();
-   }
-
-   public void testRemoveMessage() throws Exception
-   {
-      long messageID = randomLong();
-      boolean deleted = randomBoolean();
-      expect(queue.deleteReference(messageID)).andReturn(deleted);
-
-      replayMockedAttributes();
-
-      QueueControlMBean control = createControl();
-      assertEquals(deleted, control.removeMessage(messageID));
-
-      verifyMockedAttributes();
-   }
-
-   public void testRemoveMessageThrowsException() throws Exception
-   {
-      long messageID = randomLong();
-      expect(queue.deleteReference(messageID)).andThrow(new MessagingException());
-
-      replayMockedAttributes();
-
-      QueueControlMBean control = createControl();
-      try
-      {
-         control.removeMessage(messageID);
-         fail("IllegalStateException");
-      }
-      catch (IllegalStateException e)
-      {
-
-      }
-
-      verifyMockedAttributes();
-   }
-
-   public void testListMessages() throws Exception
-   {
-      String filterStr = "color = 'green'";
-      List<MessageReference> refs = new ArrayList<MessageReference>();
-
-      MessageReference ref = createMock(MessageReference.class);
-      ServerMessage message = createMock(ServerMessage.class);
-      expect(message.getMessageID()).andStubReturn(randomLong());
-      expect(message.getDestination()).andStubReturn(randomSimpleString());
-      expect(message.isDurable()).andStubReturn(randomBoolean());
-      expect(message.getTimestamp()).andStubReturn(randomLong());
-      expect(message.getType()).andStubReturn(randomByte());
-      expect(message.getEncodeSize()).andStubReturn(randomInt());
-      expect(message.getPriority()).andStubReturn(randomByte());
-      expect(message.isExpired()).andStubReturn(randomBoolean());
-      expect(message.getExpiration()).andStubReturn(randomLong());
-      expect(message.getPropertyNames()).andReturn(new HashSet<SimpleString>());
-      expect(ref.getMessage()).andReturn(message);
-      refs.add(ref);
-      expect(queue.list(isA(Filter.class))).andReturn(refs);
-
-      replayMockedAttributes();
-      replay(ref, message);
-
-      QueueControlMBean control = createControl();
-      TabularData data = control.listMessages(filterStr);
-      assertEquals(1, data.size());
-      CompositeData info = data.get(new Object[] { message.getMessageID() });
-      assertNotNull(info);
-      assertEquals(message.getMessageID(), info.get("id"));
-      assertEquals(message.getDestination().toString(), info.get("destination"));
-      assertEquals(message.isDurable(), info.get("durable"));
-      assertEquals(message.getTimestamp(), info.get("timestamp"));
-      assertEquals(message.getType(), info.get("type"));
-      assertEquals(message.getEncodeSize(), info.get("size"));
-      assertEquals(message.getPriority(), info.get("priority"));
-      assertEquals(message.isExpired(), info.get("expired"));
-      assertEquals(message.getExpiration(), info.get("expiration"));
-
-      verifyMockedAttributes();
-      verify(ref, message);
-   }
-
-   public void testExpireMessageWithMessageID() throws Exception
-   {
-      long messageID = randomLong();
-      expect(queue.expireMessage(messageID)).andReturn(true);
-
-      replayMockedAttributes();
-
-      QueueControlMBean control = createControl();
-      assertTrue(control.expireMessage(messageID));
-
-      verifyMockedAttributes();
-   }
-
-   public void testExpireMessageWithNoMatch() throws Exception
-   {
-      long messageID = randomLong();
-      expect(queue.expireMessage(messageID)).andReturn(false);
-      replayMockedAttributes();
-
-      QueueControlMBean control = createControl();
-      assertFalse(control.expireMessage(messageID));
-
-      verifyMockedAttributes();
-   }
-
-   public void testExpireMessagesWithFilter() throws Exception
-   {
-      int expiredMessagesCount = randomPositiveInt();
-
-      expect(queue.expireMessages(isA(Filter.class))).andReturn(expiredMessagesCount);
-      replayMockedAttributes();
-
-      QueueControlMBean control = createControl();
-      assertEquals(expiredMessagesCount, control.expireMessages("foo = true"));
-
-      verifyMockedAttributes();
-   }
-
-   public void testMoveMessage() throws Exception
-   {
-      long messageID = randomLong();
-      SimpleString otherQueueName = randomSimpleString();
-      SimpleString otherAddress = randomSimpleString();
-      Binding otherBinding = createMock(Binding.class);
-      expect(otherBinding.getAddress()).andReturn(otherAddress);
-      expect(postOffice.getBinding(otherQueueName)).andReturn(otherBinding);
-      expect(queue.moveMessage(messageID, otherAddress)).andReturn(true);
-
-      replayMockedAttributes();
-      replay(otherBinding);
-
-      QueueControlMBean control = createControl();
-      assertTrue(control.moveMessage(messageID, otherQueueName.toString()));
-
-      verifyMockedAttributes();
-      verify(otherBinding);
-   }
-
-   public void testMoveMessageWithNoQueue() throws Exception
-   {
-      long messageID = randomLong();
-      SimpleString otherQueueName = randomSimpleString();
-      expect(postOffice.getBinding(otherQueueName)).andReturn(null);
-
-      replayMockedAttributes();
-
-      QueueControl control = createControl();
-      try
-      {
-         control.moveMessage(messageID, otherQueueName.toString());
-         fail("IllegalArgumentException");
-      }
-      catch (IllegalArgumentException e)
-      {
-
-      }
-      verifyMockedAttributes();
-   }
-
-   public void testMoveMessageWithNoMessageID() throws Exception
-   {
-      long messageID = randomLong();
-      SimpleString otherQueueName = randomSimpleString();
-      SimpleString otherAddress = randomSimpleString();
-      Binding otherBinding = createMock(Binding.class);
-      expect(otherBinding.getAddress()).andReturn(otherAddress);
-      expect(postOffice.getBinding(otherQueueName)).andReturn(otherBinding);
-      expect(queue.moveMessage(messageID, otherAddress)).andReturn(false);
-
-      replayMockedAttributes();
-      replay(otherBinding);
-
-      QueueControl control = createControl();
-      assertFalse(control.moveMessage(messageID, otherQueueName.toString()));
-
-      verifyMockedAttributes();
-      verify(otherBinding);
-   }
-
-   public void testChangeMessagePriority() throws Exception
-   {
-      long messageID = randomLong();
-      byte newPriority = 5;
-      List<MessageReference> refs = new ArrayList<MessageReference>();
-      MessageReference ref = createMock(MessageReference.class);
-      refs.add(ref);
-      expect(queue.changeMessagePriority(messageID, newPriority)).andReturn(true);
-
-      replayMockedAttributes();
-      replay(ref);
-
-      QueueControl control = createControl();
-      assertTrue(control.changeMessagePriority(messageID, newPriority));
-
-      verifyMockedAttributes();
-      verify(ref);
-   }
-
-   public void testChangeMessagePriorityWithInvalidPriorityValues() throws Exception
-   {
-      long messageID = randomLong();
-
-      replayMockedAttributes();
-
-      QueueControl control = createControl();
-
-      try
-      {
-         control.changeMessagePriority(messageID, -1);
-         fail("IllegalArgumentException");
-      }
-      catch (IllegalArgumentException e)
-      {
-      }
-
-      try
-      {
-         control.changeMessagePriority(messageID, 10);
-         fail("IllegalArgumentException");
-      }
-      catch (IllegalArgumentException e)
-      {
-      }
-
-      verifyMockedAttributes();
-   }
-
-   public void testChangeMessagePriorityWithNoMessageID() throws Exception
-   {
-      long messageID = randomLong();
-      byte newPriority = 5;
-      expect(queue.changeMessagePriority(messageID, newPriority)).andReturn(false);
-
-      replayMockedAttributes();
-
-      QueueControl control = createControl();
-      assertFalse(control.changeMessagePriority(messageID, newPriority));
-
-      verifyMockedAttributes();
-   }
-
-   public void testSendMessageToDeadLetterAddress() throws Exception
-   {
-      long messageID = randomLong();
-      expect(queue.sendMessageToDeadLetterAddress(messageID)).andReturn(true);
-
-      replayMockedAttributes();
-
-      QueueControlMBean control = createControl();
-      assertTrue(control.sendMessageToDeadLetterAddress(messageID));
-
-      verifyMockedAttributes();
-   }
-
-   public void testSendMessageToDeadLetterAddressWithNoMessageID() throws Exception
-   {
-      long messageID = randomLong();
-      expect(queue.sendMessageToDeadLetterAddress(messageID)).andReturn(false);
-
-      replayMockedAttributes();
-
-      QueueControlMBean control = createControl();
-      assertFalse(control.sendMessageToDeadLetterAddress(messageID));
-
-      verifyMockedAttributes();
-   }
-
-   // Package protected ---------------------------------------------
-
-   // Protected -----------------------------------------------------
-
-   @Override
-   protected void setUp() throws Exception
-   {
-      super.setUp();
-
-      queueName = randomSimpleString();
-      address = randomString();
-      queue = createMock(Queue.class);      
-      storageManager = createMock(StorageManager.class);
-      postOffice = createMock(PostOffice.class);
-      repository = createMock(HierarchicalRepository.class);
-      messageCounter = new MessageCounter(queueName.toString(), null, queue, false, false, 10);
-   }
-
-   @Override
-   protected void tearDown() throws Exception
-   {
-      queue = null;
-      storageManager = null;
-      postOffice = null;
-      repository = null;
-      messageCounter = null;
-
-      super.tearDown();
-   }
-
-   // Private -------------------------------------------------------
-
-   private void replayMockedAttributes()
-   {
-      replay(queue, storageManager, postOffice, repository);
-   }
-
-   private void verifyMockedAttributes()
-   {
-      verify(queue, storageManager, postOffice, repository);
-   }
-
-   private QueueControl createControl() throws Exception
-   {
-      return new QueueControl(queue, address, postOffice, repository, messageCounter);
-   }
-
-   // Inner classes -------------------------------------------------
-}




More information about the jboss-cvs-commits mailing list