[hornetq-commits] JBoss hornetq SVN: r8980 - in trunk: tests/src/org/hornetq/tests/integration/jms/server/management and 1 other directory.

do-not-reply at jboss.org do-not-reply at jboss.org
Sat Mar 27 08:41:58 EDT 2010


Author: ataylor
Date: 2010-03-27 08:41:58 -0400 (Sat, 27 Mar 2010)
New Revision: 8980

Modified:
   trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
   trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlTest.java
   trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlUsingJMSTest.java
Log:
tests with fixes

Modified: trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java	2010-03-27 10:52:12 UTC (rev 8979)
+++ trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java	2010-03-27 12:41:58 UTC (rev 8980)
@@ -33,6 +33,7 @@
 import org.hornetq.core.deployers.impl.FileDeploymentManager;
 import org.hornetq.core.deployers.impl.XmlDeployer;
 import org.hornetq.core.logging.Logger;
+import org.hornetq.core.persistence.impl.journal.JournalStorageManager;
 import org.hornetq.core.postoffice.Binding;
 import org.hornetq.core.postoffice.BindingType;
 import org.hornetq.core.security.Role;
@@ -62,10 +63,10 @@
 /**
  * A Deployer used to create and add to JNDI queues, topics and connection
  * factories. Typically this would only be used in an app server env.
- * 
+ * <p/>
  * JMS Connection Factories & Destinations can be configured either
  * using configuration files or using a JMSConfiguration object.
- * 
+ * <p/>
  * If configuration files are used, JMS resources are redeployed if the
  * files content is changed.
  * If a JMSConfiguration object is used, the JMS resources can not be
@@ -123,7 +124,7 @@
    public JMSServerManagerImpl(final HornetQServer server) throws Exception
    {
       this.server = server;
-
+      
       configFileName = null;
    }
 
@@ -143,6 +144,15 @@
       config = configuration;
    }
 
+   public JMSServerManagerImpl(HornetQServer server, String configFilename, JMSStorageManager storageManager)
+   {
+      this.server = server;
+
+      configFileName = null;
+
+      storage = storageManager;
+   }
+
    // ActivateCallback implementation -------------------------------------
 
    public synchronized void activated()
@@ -166,7 +176,7 @@
 
                if (configFileName != null)
                {
-                  jmsDeployer.setConfigFileNames(new String[] { configFileName });
+                  jmsDeployer.setConfigFileNames(new String[]{configFileName});
                }
 
                jmsDeployer.start();
@@ -300,14 +310,14 @@
       return server.getVersion().getFullVersion();
    }
 
-   public synchronized boolean createQueue(final String queueName, final String selectorString, final boolean durable, final String ... jndi) throws Exception
+   public synchronized boolean createQueue(final String queueName, final String selectorString, final boolean durable, final String... jndi) throws Exception
    {
       checkInitialised();
 
       boolean added = internalCreateQueue(queueName, selectorString, durable);
 
       storage.storeDestination(new PersistedDestination(PersistedType.Queue, queueName, selectorString, durable));
-      
+
       for (String jndiItem : jndi)
       {
          addQueueToJndi(queueName, jndiItem);
@@ -316,14 +326,14 @@
       return added;
    }
 
-   public synchronized boolean createTopic(final String topicName, final String ... jndi) throws Exception
+   public synchronized boolean createTopic(final String topicName, final String... jndi) throws Exception
    {
       checkInitialised();
 
       boolean added = internalCreateTopic(topicName);
 
       storage.storeDestination(new PersistedDestination(PersistedType.Topic, topicName));
-      
+
       for (String jndiItem : jndi)
       {
          addTopicToJndi(topicName, jndiItem);
@@ -335,7 +345,7 @@
    public boolean addTopicToJndi(final String topicName, final String jndiBinding) throws Exception
    {
       checkInitialised();
-      
+
       HornetQDestination destination = topics.get(topicName);
       if (destination == null)
       {
@@ -354,28 +364,27 @@
       }
       return added;
    }
-   
+
    public List<String> getJNDIOnQueue(String queue)
    {
       return getJNDIList(queueJNDI, queue);
    }
-   
+
    public List<String> getJNDIOnTopic(String topic)
    {
       return getJNDIList(topicJNDI, topic);
    }
-   
+
    public List<String> getJNDIOnConnectionFactory(String factoryName)
    {
       return getJNDIList(connectionFactoryJNDI, factoryName);
    }
 
 
-
    public boolean addQueueToJndi(final String queueName, final String jndiBinding) throws Exception
    {
       checkInitialised();
-      
+
       HornetQDestination destination = queues.get(queueName);
       if (destination == null)
       {
@@ -399,7 +408,7 @@
       checkInitialised();
 
       HornetQConnectionFactory factory = connectionFactories.get(name);
-      if(factory == null)
+      if (factory == null)
       {
          throw new IllegalArgumentException("Factory does not exist");
       }
@@ -415,62 +424,67 @@
    /* (non-Javadoc)
     * @see org.hornetq.jms.server.JMSServerManager#removeQueueFromJNDI(java.lang.String, java.lang.String)
     */
+
    public boolean removeQueueFromJNDI(String name, String jndi) throws Exception
    {
       checkInitialised();
-      
+
       removeFromJNDI(queueJNDI, name, jndi);
-      
+
       storage.deleteJNDI(PersistedType.Queue, name, jndi);
-      
+
       return true;
    }
 
    /* (non-Javadoc)
     * @see org.hornetq.jms.server.JMSServerManager#removeQueueFromJNDI(java.lang.String, java.lang.String)
     */
+
    public boolean removeQueueFromJNDI(String name) throws Exception
    {
       checkInitialised();
-      
+
       removeFromJNDI(queueJNDI, name);
-      
+
       storage.deleteJNDI(PersistedType.Queue, name);
-      
+
       return true;
    }
 
    /* (non-Javadoc)
     * @see org.hornetq.jms.server.JMSServerManager#removeTopicFromJNDI(java.lang.String, java.lang.String)
     */
+
    public boolean removeTopicFromJNDI(String name, String jndi) throws Exception
    {
       checkInitialised();
-      
+
       removeFromJNDI(topicJNDI, name, jndi);
-      
+
       storage.deleteJNDI(PersistedType.Topic, name, jndi);
-      
+
       return true;
    }
-   
+
    /* (non-Javadoc)
-    * @see org.hornetq.jms.server.JMSServerManager#removeTopicFromJNDI(java.lang.String, java.lang.String)
-    */
+   * @see org.hornetq.jms.server.JMSServerManager#removeTopicFromJNDI(java.lang.String, java.lang.String)
+   */
+
    public boolean removeTopicFromJNDI(String name) throws Exception
    {
       checkInitialised();
-      
+
       removeFromJNDI(topicJNDI, name);
-      
+
       storage.deleteJNDI(PersistedType.Topic, name);
-      
+
       return true;
    }
 
    /* (non-Javadoc)
     * @see org.hornetq.jms.server.JMSServerManager#removeConnectionFactoryFromJNDI(java.lang.String, java.lang.String)
     */
+
    public boolean removeConnectionFactoryFromJNDI(String name, String jndi) throws Exception
    {
       checkInitialised();
@@ -485,6 +499,7 @@
    /* (non-Javadoc)
     * @see org.hornetq.jms.server.JMSServerManager#removeConnectionFactoryFromJNDI(java.lang.String, java.lang.String)
     */
+
    public boolean removeConnectionFactoryFromJNDI(String name) throws Exception
    {
       checkInitialised();
@@ -495,22 +510,22 @@
 
       return true;
    }
-   
 
+
    public synchronized boolean destroyQueue(final String name) throws Exception
    {
       checkInitialised();
-      
+
       removeFromJNDI(queueJNDI, name);
-      
 
+
       queues.remove(name);
       queueJNDI.remove(name);
-      
+
       jmsManagementService.unregisterQueue(name);
-      
+
       server.getHornetQServerControl().destroyQueue(HornetQDestination.createQueueAddressFromName(name).toString());
-      
+
       storage.deleteDestination(PersistedType.Queue, name);
 
       return true;
@@ -519,16 +534,16 @@
    public synchronized boolean destroyTopic(final String name) throws Exception
    {
       checkInitialised();
-      
+
       removeFromJNDI(topicJNDI, name);
 
       topics.remove(name);
       topicJNDI.remove(name);
 
       jmsManagementService.unregisterTopic(name);
-      
-      AddressControl addressControl = (AddressControl)server.getManagementService()
-                                                            .getResource(ResourceNames.CORE_ADDRESS + HornetQDestination.createTopicAddressFromName(name));
+
+      AddressControl addressControl = (AddressControl) server.getManagementService()
+            .getResource(ResourceNames.CORE_ADDRESS + HornetQDestination.createTopicAddressFromName(name));
       if (addressControl != null)
       {
          for (String queueName : addressControl.getQueueNames())
@@ -537,9 +552,9 @@
             if (binding == null)
             {
                log.warn("Queue " + queueName +
-                        " doesn't exist on the topic " +
-                        name +
-                        ". It was deleted manually probably.");
+                     " doesn't exist on the topic " +
+                     name +
+                     ". It was deleted manually probably.");
                continue;
             }
 
@@ -556,7 +571,7 @@
 
    public synchronized void createConnectionFactory(final String name,
                                                     final List<Pair<TransportConfiguration, TransportConfiguration>> connectorConfigs,
-                                                    String ... jndiBindings) throws Exception
+                                                    String... jndiBindings) throws Exception
    {
       checkInitialised();
       HornetQConnectionFactory cf = connectionFactories.get(name);
@@ -570,7 +585,7 @@
    public synchronized void createConnectionFactory(final String name,
                                                     final List<Pair<TransportConfiguration, TransportConfiguration>> connectorConfigs,
                                                     final String clientID,
-                                                    String ... jndiBindings) throws Exception
+                                                    String... jndiBindings) throws Exception
    {
       checkInitialised();
       HornetQConnectionFactory cf = connectionFactories.get(name);
@@ -612,7 +627,7 @@
                                                     final int reconnectAttempts,
                                                     final boolean failoverOnServerShutdown,
                                                     final String groupId,
-                                                    String ... jndiBindings) throws Exception
+                                                    String... jndiBindings) throws Exception
    {
       checkInitialised();
       HornetQConnectionFactory cf = connectionFactories.get(name);
@@ -684,7 +699,7 @@
                                                     final int reconnectAttempts,
                                                     final boolean failoverOnServerShutdown,
                                                     final String groupId,
-                                                    final String ... jndiBindings) throws Exception
+                                                    final String... jndiBindings) throws Exception
    {
       checkInitialised();
       HornetQConnectionFactory cf = connectionFactories.get(name);
@@ -727,7 +742,7 @@
    public synchronized void createConnectionFactory(final String name,
                                                     final String discoveryAddress,
                                                     final int discoveryPort,
-                                                    final String ... jndiBindings) throws Exception
+                                                    final String... jndiBindings) throws Exception
    {
       checkInitialised();
       HornetQConnectionFactory cf = connectionFactories.get(name);
@@ -743,7 +758,7 @@
                                                     final String discoveryAddress,
                                                     final int discoveryPort,
                                                     final String clientID,
-                                                    final String ... jndiBindings) throws Exception
+                                                    final String... jndiBindings) throws Exception
    {
       checkInitialised();
 
@@ -768,44 +783,44 @@
    }
 
    private HornetQConnectionFactory internalCreateConnectionFactory(final String name,
-                                                    final String discoveryAddress,
-                                                    final int discoveryPort,
-                                                    final String clientID,
-                                                    final long discoveryRefreshTimeout,
-                                                    final long clientFailureCheckPeriod,
-                                                    final long connectionTTL,
-                                                    final long callTimeout,
-                                                    final boolean cacheLargeMessagesClient,
-                                                    final int minLargeMessageSize,
-                                                    final int consumerWindowSize,
-                                                    final int consumerMaxRate,
-                                                    final int confirmationWindowSize,
-                                                    final int producerWindowSize,
-                                                    final int producerMaxRate,
-                                                    final boolean blockOnAcknowledge,
-                                                    final boolean blockOnDurableSend,
-                                                    final boolean blockOnNonDurableSend,
-                                                    final boolean autoGroup,
-                                                    final boolean preAcknowledge,
-                                                    final String loadBalancingPolicyClassName,
-                                                    final int transactionBatchSize,
-                                                    final int dupsOKBatchSize,
-                                                    final long initialWaitTimeout,
-                                                    final boolean useGlobalPools,
-                                                    final int scheduledThreadPoolMaxSize,
-                                                    final int threadPoolMaxSize,
-                                                    final long retryInterval,
-                                                    final double retryIntervalMultiplier,
-                                                    final long maxRetryInterval,
-                                                    final int reconnectAttempts,
-                                                    final boolean failoverOnServerShutdown,
-                                                    final String groupId) throws Exception
+                                                                    final String discoveryAddress,
+                                                                    final int discoveryPort,
+                                                                    final String clientID,
+                                                                    final long discoveryRefreshTimeout,
+                                                                    final long clientFailureCheckPeriod,
+                                                                    final long connectionTTL,
+                                                                    final long callTimeout,
+                                                                    final boolean cacheLargeMessagesClient,
+                                                                    final int minLargeMessageSize,
+                                                                    final int consumerWindowSize,
+                                                                    final int consumerMaxRate,
+                                                                    final int confirmationWindowSize,
+                                                                    final int producerWindowSize,
+                                                                    final int producerMaxRate,
+                                                                    final boolean blockOnAcknowledge,
+                                                                    final boolean blockOnDurableSend,
+                                                                    final boolean blockOnNonDurableSend,
+                                                                    final boolean autoGroup,
+                                                                    final boolean preAcknowledge,
+                                                                    final String loadBalancingPolicyClassName,
+                                                                    final int transactionBatchSize,
+                                                                    final int dupsOKBatchSize,
+                                                                    final long initialWaitTimeout,
+                                                                    final boolean useGlobalPools,
+                                                                    final int scheduledThreadPoolMaxSize,
+                                                                    final int threadPoolMaxSize,
+                                                                    final long retryInterval,
+                                                                    final double retryIntervalMultiplier,
+                                                                    final long maxRetryInterval,
+                                                                    final int reconnectAttempts,
+                                                                    final boolean failoverOnServerShutdown,
+                                                                    final String groupId) throws Exception
    {
       checkInitialised();
       HornetQConnectionFactory cf = connectionFactories.get(name);
       if (cf == null)
       {
-         cf = (HornetQConnectionFactory)HornetQJMSClient.createConnectionFactory(discoveryAddress, discoveryPort);
+         cf = (HornetQConnectionFactory) HornetQJMSClient.createConnectionFactory(discoveryAddress, discoveryPort);
          cf.setClientID(clientID);
          cf.setDiscoveryRefreshTimeout(discoveryRefreshTimeout);
          cf.setClientFailureCheckPeriod(clientFailureCheckPeriod);
@@ -841,75 +856,74 @@
    }
 
    private HornetQConnectionFactory internalCreateConnectionFactory(final String name,
-                                                      final List<Pair<TransportConfiguration, TransportConfiguration>> connectorConfigs,
-                                                      final String clientID,
-                                                      final long clientFailureCheckPeriod,
-                                                      final long connectionTTL,
-                                                      final long callTimeout,
-                                                      final boolean cacheLargeMessagesClient,
-                                                      final int minLargeMessageSize,
-                                                      final int consumerWindowSize,
-                                                      final int consumerMaxRate,
-                                                      final int confirmationWindowSize,
-                                                      final int producerWindowSize,
-                                                      final int producerMaxRate,
-                                                      final boolean blockOnAcknowledge,
-                                                      final boolean blockOnDurableSend,
-                                                      final boolean blockOnNonDurableSend,
-                                                      final boolean autoGroup,
-                                                      final boolean preAcknowledge,
-                                                      final String loadBalancingPolicyClassName,
-                                                      final int transactionBatchSize,
-                                                      final int dupsOKBatchSize,
-                                                      final boolean useGlobalPools,
-                                                      final int scheduledThreadPoolMaxSize,
-                                                      final int threadPoolMaxSize,
-                                                      final long retryInterval,
-                                                      final double retryIntervalMultiplier,
-                                                      final long maxRetryInterval,
-                                                      final int reconnectAttempts,
-                                                      final boolean failoverOnServerShutdown,
-                                                      final String groupId) throws Exception
-     {
-        checkInitialised();
-        HornetQConnectionFactory cf = connectionFactories.get(name);
-        if (cf == null)
-        {
-           cf = (HornetQConnectionFactory)HornetQJMSClient.createConnectionFactory(connectorConfigs);
-           cf.setClientID(clientID);
-           cf.setClientFailureCheckPeriod(clientFailureCheckPeriod);
-           cf.setConnectionTTL(connectionTTL);
-           cf.setCallTimeout(callTimeout);
-           cf.setCacheLargeMessagesClient(cacheLargeMessagesClient);
-           cf.setMinLargeMessageSize(minLargeMessageSize);
-           cf.setConsumerWindowSize(consumerWindowSize);
-           cf.setConsumerMaxRate(consumerMaxRate);
-           cf.setConfirmationWindowSize(confirmationWindowSize);
-           cf.setProducerWindowSize(producerWindowSize);
-           cf.setProducerMaxRate(producerMaxRate);
-           cf.setBlockOnAcknowledge(blockOnAcknowledge);
-           cf.setBlockOnDurableSend(blockOnDurableSend);
-           cf.setBlockOnNonDurableSend(blockOnNonDurableSend);
-           cf.setAutoGroup(autoGroup);
-           cf.setPreAcknowledge(preAcknowledge);
-           cf.setConnectionLoadBalancingPolicyClassName(loadBalancingPolicyClassName);
-           cf.setTransactionBatchSize(transactionBatchSize);
-           cf.setDupsOKBatchSize(dupsOKBatchSize);
-           cf.setUseGlobalPools(useGlobalPools);
-           cf.setScheduledThreadPoolMaxSize(scheduledThreadPoolMaxSize);
-           cf.setThreadPoolMaxSize(threadPoolMaxSize);
-           cf.setRetryInterval(retryInterval);
-           cf.setRetryIntervalMultiplier(retryIntervalMultiplier);
-           cf.setMaxRetryInterval(maxRetryInterval);
-           cf.setReconnectAttempts(reconnectAttempts);
-           cf.setFailoverOnServerShutdown(failoverOnServerShutdown);
-           cf.setGroupID(groupId);
-        }
-        return cf;
-     }
+                                                                    final List<Pair<TransportConfiguration, TransportConfiguration>> connectorConfigs,
+                                                                    final String clientID,
+                                                                    final long clientFailureCheckPeriod,
+                                                                    final long connectionTTL,
+                                                                    final long callTimeout,
+                                                                    final boolean cacheLargeMessagesClient,
+                                                                    final int minLargeMessageSize,
+                                                                    final int consumerWindowSize,
+                                                                    final int consumerMaxRate,
+                                                                    final int confirmationWindowSize,
+                                                                    final int producerWindowSize,
+                                                                    final int producerMaxRate,
+                                                                    final boolean blockOnAcknowledge,
+                                                                    final boolean blockOnDurableSend,
+                                                                    final boolean blockOnNonDurableSend,
+                                                                    final boolean autoGroup,
+                                                                    final boolean preAcknowledge,
+                                                                    final String loadBalancingPolicyClassName,
+                                                                    final int transactionBatchSize,
+                                                                    final int dupsOKBatchSize,
+                                                                    final boolean useGlobalPools,
+                                                                    final int scheduledThreadPoolMaxSize,
+                                                                    final int threadPoolMaxSize,
+                                                                    final long retryInterval,
+                                                                    final double retryIntervalMultiplier,
+                                                                    final long maxRetryInterval,
+                                                                    final int reconnectAttempts,
+                                                                    final boolean failoverOnServerShutdown,
+                                                                    final String groupId) throws Exception
+   {
+      checkInitialised();
+      HornetQConnectionFactory cf = connectionFactories.get(name);
+      if (cf == null)
+      {
+         cf = (HornetQConnectionFactory) HornetQJMSClient.createConnectionFactory(connectorConfigs);
+         cf.setClientID(clientID);
+         cf.setClientFailureCheckPeriod(clientFailureCheckPeriod);
+         cf.setConnectionTTL(connectionTTL);
+         cf.setCallTimeout(callTimeout);
+         cf.setCacheLargeMessagesClient(cacheLargeMessagesClient);
+         cf.setMinLargeMessageSize(minLargeMessageSize);
+         cf.setConsumerWindowSize(consumerWindowSize);
+         cf.setConsumerMaxRate(consumerMaxRate);
+         cf.setConfirmationWindowSize(confirmationWindowSize);
+         cf.setProducerWindowSize(producerWindowSize);
+         cf.setProducerMaxRate(producerMaxRate);
+         cf.setBlockOnAcknowledge(blockOnAcknowledge);
+         cf.setBlockOnDurableSend(blockOnDurableSend);
+         cf.setBlockOnNonDurableSend(blockOnNonDurableSend);
+         cf.setAutoGroup(autoGroup);
+         cf.setPreAcknowledge(preAcknowledge);
+         cf.setConnectionLoadBalancingPolicyClassName(loadBalancingPolicyClassName);
+         cf.setTransactionBatchSize(transactionBatchSize);
+         cf.setDupsOKBatchSize(dupsOKBatchSize);
+         cf.setUseGlobalPools(useGlobalPools);
+         cf.setScheduledThreadPoolMaxSize(scheduledThreadPoolMaxSize);
+         cf.setThreadPoolMaxSize(threadPoolMaxSize);
+         cf.setRetryInterval(retryInterval);
+         cf.setRetryIntervalMultiplier(retryIntervalMultiplier);
+         cf.setMaxRetryInterval(maxRetryInterval);
+         cf.setReconnectAttempts(reconnectAttempts);
+         cf.setFailoverOnServerShutdown(failoverOnServerShutdown);
+         cf.setGroupID(groupId);
+      }
+      return cf;
+   }
 
 
-
    private List<String> getJNDIList(final Map<String, List<String>> map, final String name)
    {
       List<String> result = map.get(name);
@@ -936,10 +950,10 @@
       }
 
       server.getHornetQServerControl().deployQueue(hqQueue.getAddress(),
-                                                   hqQueue.getAddress(),
-                                                   coreFilterString,
-                                                   durable);
-      
+            hqQueue.getAddress(),
+            coreFilterString,
+            durable);
+
       queues.put(queueName, hqQueue);
 
       jmsManagementService.registerQueue(hqQueue);
@@ -948,8 +962,9 @@
    }
 
    /**
-    * Performs the internal creation without activating any storage. 
+    * Performs the internal creation without activating any storage.
     * The storage load will call this method
+    *
     * @param topicName
     * @return
     * @throws Exception
@@ -962,9 +977,9 @@
       // does not exist - otherwise we would not be able to distinguish from a non existent topic and one with no
       // subscriptions - core has no notion of a topic
       server.getHornetQServerControl().deployQueue(hqTopic.getAddress(),
-                                                   hqTopic.getAddress(),
-                                                   JMSServerManagerImpl.REJECT_FILTER,
-                                                   true);
+            hqTopic.getAddress(),
+            JMSServerManagerImpl.REJECT_FILTER,
+            true);
 
       topics.put(topicName, hqTopic);
 
@@ -984,81 +999,86 @@
       List<Pair<TransportConfiguration, TransportConfiguration>> connectorConfigs = lookupConnectors(cfConfig);
 
       lookupDiscovery(cfConfig);
-
+      HornetQConnectionFactory cf;
       if (cfConfig.getDiscoveryAddress() != null)
       {
-         return internalCreateConnectionFactory(cfConfig.getName(),
-                                 cfConfig.getDiscoveryAddress(),
-                                 cfConfig.getDiscoveryPort(),
-                                 cfConfig.getClientID(),
-                                 cfConfig.getDiscoveryRefreshTimeout(),
-                                 cfConfig.getClientFailureCheckPeriod(),
-                                 cfConfig.getConnectionTTL(),
-                                 cfConfig.getCallTimeout(),
-                                 cfConfig.isCacheLargeMessagesClient(),
-                                 cfConfig.getMinLargeMessageSize(),
-                                 cfConfig.getConsumerWindowSize(),
-                                 cfConfig.getConsumerMaxRate(),
-                                 cfConfig.getConfirmationWindowSize(),
-                                 cfConfig.getProducerWindowSize(),
-                                 cfConfig.getProducerMaxRate(),
-                                 cfConfig.isBlockOnAcknowledge(),
-                                 cfConfig.isBlockOnDurableSend(),
-                                 cfConfig.isBlockOnNonDurableSend(),
-                                 cfConfig.isAutoGroup(),
-                                 cfConfig.isPreAcknowledge(),
-                                 cfConfig.getLoadBalancingPolicyClassName(),
-                                 cfConfig.getTransactionBatchSize(),
-                                 cfConfig.getDupsOKBatchSize(),
-                                 cfConfig.getInitialWaitTimeout(),
-                                 cfConfig.isUseGlobalPools(),
-                                 cfConfig.getScheduledThreadPoolMaxSize(),
-                                 cfConfig.getThreadPoolMaxSize(),
-                                 cfConfig.getRetryInterval(),
-                                 cfConfig.getRetryIntervalMultiplier(),
-                                 cfConfig.getMaxRetryInterval(),
-                                 cfConfig.getReconnectAttempts(),
-                                 cfConfig.isFailoverOnServerShutdown(),
-                                 cfConfig.getGroupID());
+         cf = internalCreateConnectionFactory(cfConfig.getName(),
+               cfConfig.getDiscoveryAddress(),
+               cfConfig.getDiscoveryPort(),
+               cfConfig.getClientID(),
+               cfConfig.getDiscoveryRefreshTimeout(),
+               cfConfig.getClientFailureCheckPeriod(),
+               cfConfig.getConnectionTTL(),
+               cfConfig.getCallTimeout(),
+               cfConfig.isCacheLargeMessagesClient(),
+               cfConfig.getMinLargeMessageSize(),
+               cfConfig.getConsumerWindowSize(),
+               cfConfig.getConsumerMaxRate(),
+               cfConfig.getConfirmationWindowSize(),
+               cfConfig.getProducerWindowSize(),
+               cfConfig.getProducerMaxRate(),
+               cfConfig.isBlockOnAcknowledge(),
+               cfConfig.isBlockOnDurableSend(),
+               cfConfig.isBlockOnNonDurableSend(),
+               cfConfig.isAutoGroup(),
+               cfConfig.isPreAcknowledge(),
+               cfConfig.getLoadBalancingPolicyClassName(),
+               cfConfig.getTransactionBatchSize(),
+               cfConfig.getDupsOKBatchSize(),
+               cfConfig.getInitialWaitTimeout(),
+               cfConfig.isUseGlobalPools(),
+               cfConfig.getScheduledThreadPoolMaxSize(),
+               cfConfig.getThreadPoolMaxSize(),
+               cfConfig.getRetryInterval(),
+               cfConfig.getRetryIntervalMultiplier(),
+               cfConfig.getMaxRetryInterval(),
+               cfConfig.getReconnectAttempts(),
+               cfConfig.isFailoverOnServerShutdown(),
+               cfConfig.getGroupID());
       }
       else
       {
-         return internalCreateConnectionFactory(cfConfig.getName(),
-                                 connectorConfigs,
-                                 cfConfig.getClientID(),
-                                 cfConfig.getClientFailureCheckPeriod(),
-                                 cfConfig.getConnectionTTL(),
-                                 cfConfig.getCallTimeout(),
-                                 cfConfig.isCacheLargeMessagesClient(),
-                                 cfConfig.getMinLargeMessageSize(),
-                                 cfConfig.getConsumerWindowSize(),
-                                 cfConfig.getConsumerMaxRate(),
-                                 cfConfig.getConfirmationWindowSize(),
-                                 cfConfig.getProducerWindowSize(),
-                                 cfConfig.getProducerMaxRate(),
-                                 cfConfig.isBlockOnAcknowledge(),
-                                 cfConfig.isBlockOnDurableSend(),
-                                 cfConfig.isBlockOnNonDurableSend(),
-                                 cfConfig.isAutoGroup(),
-                                 cfConfig.isPreAcknowledge(),
-                                 cfConfig.getLoadBalancingPolicyClassName(),
-                                 cfConfig.getTransactionBatchSize(),
-                                 cfConfig.getDupsOKBatchSize(),
-                                 cfConfig.isUseGlobalPools(),
-                                 cfConfig.getScheduledThreadPoolMaxSize(),
-                                 cfConfig.getThreadPoolMaxSize(),
-                                 cfConfig.getRetryInterval(),
-                                 cfConfig.getRetryIntervalMultiplier(),
-                                 cfConfig.getMaxRetryInterval(),
-                                 cfConfig.getReconnectAttempts(),
-                                 cfConfig.isFailoverOnServerShutdown(),
-                                 cfConfig.getGroupID());
+         cf = internalCreateConnectionFactory(cfConfig.getName(),
+               connectorConfigs,
+               cfConfig.getClientID(),
+               cfConfig.getClientFailureCheckPeriod(),
+               cfConfig.getConnectionTTL(),
+               cfConfig.getCallTimeout(),
+               cfConfig.isCacheLargeMessagesClient(),
+               cfConfig.getMinLargeMessageSize(),
+               cfConfig.getConsumerWindowSize(),
+               cfConfig.getConsumerMaxRate(),
+               cfConfig.getConfirmationWindowSize(),
+               cfConfig.getProducerWindowSize(),
+               cfConfig.getProducerMaxRate(),
+               cfConfig.isBlockOnAcknowledge(),
+               cfConfig.isBlockOnDurableSend(),
+               cfConfig.isBlockOnNonDurableSend(),
+               cfConfig.isAutoGroup(),
+               cfConfig.isPreAcknowledge(),
+               cfConfig.getLoadBalancingPolicyClassName(),
+               cfConfig.getTransactionBatchSize(),
+               cfConfig.getDupsOKBatchSize(),
+               cfConfig.isUseGlobalPools(),
+               cfConfig.getScheduledThreadPoolMaxSize(),
+               cfConfig.getThreadPoolMaxSize(),
+               cfConfig.getRetryInterval(),
+               cfConfig.getRetryIntervalMultiplier(),
+               cfConfig.getMaxRetryInterval(),
+               cfConfig.getReconnectAttempts(),
+               cfConfig.isFailoverOnServerShutdown(),
+               cfConfig.getGroupID());
       }
+      connectionFactories.put(cfConfig.getName(), cf);
+
+      jmsManagementService.registerConnectionFactory(cfConfig.getName(), cf);
+
+      return cf;
    }
 
    public synchronized void createConnectionFactory(final String name,
                                                     final TransportConfiguration liveTC,
-                                                    final String ... jndiBindings) throws Exception
+                                                    final String... jndiBindings) throws Exception
    {
       checkInitialised();
       HornetQConnectionFactory cf = connectionFactories.get(name);
@@ -1072,7 +1092,7 @@
    public synchronized void createConnectionFactory(final String name,
                                                     final TransportConfiguration liveTC,
                                                     final String clientID,
-                                                    final String ... jndiBindings) throws Exception
+                                                    final String... jndiBindings) throws Exception
    {
       checkInitialised();
       HornetQConnectionFactory cf = connectionFactories.get(name);
@@ -1087,7 +1107,7 @@
    public synchronized void createConnectionFactory(final String name,
                                                     final TransportConfiguration liveTC,
                                                     final TransportConfiguration backupTC,
-                                                    final String ... jndiBindings) throws Exception
+                                                    final String... jndiBindings) throws Exception
    {
       checkInitialised();
       HornetQConnectionFactory cf = connectionFactories.get(name);
@@ -1102,7 +1122,7 @@
                                                     final TransportConfiguration liveTC,
                                                     final TransportConfiguration backupTC,
                                                     final String clientID,
-                                                    final String ... jndiBindings) throws Exception
+                                                    final String... jndiBindings) throws Exception
    {
       checkInitialised();
       HornetQConnectionFactory cf = connectionFactories.get(name);
@@ -1198,7 +1218,7 @@
 
       jmsManagementService.registerConnectionFactory(name, cf);
    }
-   
+
    private void addToBindings(Map<String, List<String>> map, String name, String jndi)
    {
       List<String> list = map.get(name);
@@ -1257,16 +1277,16 @@
 
          DiscoveryGroupConfiguration discoveryGroupConfiguration = null;
          discoveryGroupConfiguration = configuration.getDiscoveryGroupConfigurations()
-                                                    .get(cfConfig.getDiscoveryGroupName());
+               .get(cfConfig.getDiscoveryGroupName());
 
          if (discoveryGroupConfiguration == null)
          {
             JMSServerManagerImpl.log.warn("There is no discovery group with name '" + cfConfig.getDiscoveryGroupName() +
-                                          "' deployed.");
+                  "' deployed.");
 
             throw new HornetQException(HornetQException.ILLEGAL_STATE,
-                                       "There is no discovery group with name '" + cfConfig.getDiscoveryGroupName() +
-                                                "' deployed.");
+                  "There is no discovery group with name '" + cfConfig.getDiscoveryGroupName() +
+                        "' deployed.");
          }
 
          cfConfig.setDiscoveryAddress(discoveryGroupConfiguration.getGroupAddress());
@@ -1309,7 +1329,7 @@
       {
          String[] bindings = config.getBindings();
          createTopic(config.getName());
-         
+
          for (String binding : bindings)
          {
             addTopicToJndi(config.getName(), binding);
@@ -1324,15 +1344,18 @@
    {
       this.coreConfig = server.getConfiguration();
 
-      if (coreConfig.isPersistenceEnabled())
+      if (storage == null)
       {
-         // TODO: replication
-         storage = new JournalJMSStorageManagerImpl(new TimeAndCounterIDGenerator(), coreConfig, null);
+         if (coreConfig.isPersistenceEnabled())
+         {
+            // TODO: replication
+            storage = new JournalJMSStorageManagerImpl(new TimeAndCounterIDGenerator(), coreConfig, null);
+         }
+         else
+         {
+            storage = new NullJMSStorageManagerImpl();
+         }
       }
-      else
-      {
-         storage = new NullJMSStorageManagerImpl();
-      }
 
       storage.start();
 
@@ -1350,21 +1373,21 @@
          if (destination.getType() == PersistedType.Queue)
          {
             internalCreateQueue(destination.getName(),
-                                destination.getSelector(),
-                                destination.isDurable());
+                  destination.getSelector(),
+                  destination.isDurable());
          }
          else if (destination.getType() == PersistedType.Topic)
          {
             internalCreateTopic(destination.getName());
          }
       }
-      
+
       List<PersistedJNDI> jndiSpace = storage.recoverPersistedJNDI();
       for (PersistedJNDI record : jndiSpace)
       {
          Map<String, List<String>> mapJNDI;
          Map<String, ?> objects;
-         
+
          switch (record.getType())
          {
             case Queue:
@@ -1381,22 +1404,22 @@
                objects = connectionFactories;
                break;
          }
-         
+
          Object objectToBind = objects.get(record.getName());
-         
+
          if (objectToBind == null)
          {
             continue;
          }
-         
+
          List<String> jndiList = mapJNDI.get(record.getName());
          if (jndiList == null)
          {
             jndiList = new ArrayList<String>();
             mapJNDI.put(record.getName(), jndiList);
          }
-         
-         
+
+
          for (String jndi : record.getJndi())
          {
             jndiList.add(jndi);
@@ -1404,7 +1427,7 @@
          }
       }
    }
-   
+
    private synchronized boolean removeFromJNDI(final Map<String, List<String>> jndiMap, final String name) throws Exception
    {
       checkInitialised();
@@ -1425,8 +1448,8 @@
       }
       return true;
    }
-   
-   
+
+
    private synchronized boolean removeFromJNDI(final Map<String, List<String>> jndiMap, final String name, final String jndi) throws Exception
    {
       checkInitialised();
@@ -1444,7 +1467,7 @@
       }
       return true;
    }
-   
+
    /**
     * @param cfConfig
     * @return
@@ -1472,7 +1495,7 @@
             {
                JMSServerManagerImpl.log.warn("There is no connector with name '" + connectorName + "' deployed.");
                throw new HornetQException(HornetQException.ILLEGAL_STATE,
-                                          "There is no connector with name '" + connectorName + "' deployed.");
+                     "There is no connector with name '" + connectorName + "' deployed.");
             }
 
             TransportConfiguration backupConnector = null;
@@ -1484,10 +1507,10 @@
                if (backupConnector == null)
                {
                   JMSServerManagerImpl.log.warn("There is no backup connector with name '" + backupConnectorName +
-                                                "' deployed.");
+                        "' deployed.");
                   throw new HornetQException(HornetQException.ILLEGAL_STATE,
-                                             "There is no backup connector with name '" + backupConnectorName +
-                                                      "' deployed.");
+                        "There is no backup connector with name '" + backupConnectorName +
+                              "' deployed.");
                }
             }
 
@@ -1501,5 +1524,4 @@
          return null;
       }
    }
-
 }

Modified: trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlTest.java	2010-03-27 10:52:12 UTC (rev 8979)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlTest.java	2010-03-27 12:41:58 UTC (rev 8980)
@@ -22,6 +22,7 @@
 
 import junit.framework.Assert;
 
+import org.hornetq.api.core.SimpleString;
 import org.hornetq.api.core.TransportConfiguration;
 import org.hornetq.api.core.management.AddressControl;
 import org.hornetq.api.core.management.ObjectNameBuilder;
@@ -38,6 +39,11 @@
 import org.hornetq.core.server.HornetQServers;
 import org.hornetq.jms.client.HornetQConnectionFactory;
 import org.hornetq.jms.client.HornetQDestination;
+import org.hornetq.jms.persistence.JMSStorageManager;
+import org.hornetq.jms.persistence.config.PersistedConnectionFactory;
+import org.hornetq.jms.persistence.config.PersistedDestination;
+import org.hornetq.jms.persistence.config.PersistedJNDI;
+import org.hornetq.jms.persistence.config.PersistedType;
 import org.hornetq.jms.server.JMSServerManager;
 import org.hornetq.jms.server.impl.JMSServerManagerImpl;
 import org.hornetq.tests.integration.management.ManagementControlHelper;
@@ -46,6 +52,9 @@
 import org.hornetq.tests.util.RandomUtil;
 import org.hornetq.tests.util.UnitTestCase;
 
+import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
+
 /**
  * A JMSServerControlTest
  *
@@ -69,6 +78,8 @@
 
    private JMSServerManagerImpl serverManager;
 
+   private FakeJMSStorageManager fakeJMSStorageManager;
+
    // Static --------------------------------------------------------
 
    private static String toCSV(final Object[] objects)
@@ -96,25 +107,122 @@
       Assert.assertEquals(serverManager.getVersion(), version);
    }
 
-   public void testCreateQueue() throws Exception
+   public void testCreateQueueWithBindings() throws Exception
    {
-      String queueJNDIBinding = RandomUtil.randomString();
+      String[] bindings = new String[3];
+      bindings[0] = RandomUtil.randomString();
+      bindings[1] = RandomUtil.randomString();
+      bindings[2] = RandomUtil.randomString();
       String queueName = RandomUtil.randomString();
 
-      UnitTestCase.checkNoBinding(context, queueJNDIBinding);
+      String bindingsCSV = JMSServerControlTest.toCSV(bindings);
+      UnitTestCase.checkNoBinding(context, bindingsCSV);
+
       checkNoResource(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName));
 
       JMSServerControl control = createManagementControl();
-      control.createQueue(queueName, queueJNDIBinding);
+      control.createQueue(queueName, bindingsCSV);
 
-      Object o = UnitTestCase.checkBinding(context, queueJNDIBinding);
+      Object o = UnitTestCase.checkBinding(context, bindings[0]);
       Assert.assertTrue(o instanceof Queue);
       Queue queue = (Queue)o;
       Assert.assertEquals(queueName, queue.getQueueName());
+      o = UnitTestCase.checkBinding(context, bindings[1]);
+      Assert.assertTrue(o instanceof Queue);
+      queue = (Queue)o;
+      Assert.assertEquals(queueName, queue.getQueueName());
+      o = UnitTestCase.checkBinding(context, bindings[2]);
+      Assert.assertTrue(o instanceof Queue);
+      queue = (Queue)o;
+      Assert.assertEquals(queueName, queue.getQueueName());
       checkResource(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName));
 
+      Assert.assertNotNull(fakeJMSStorageManager.destinationMap.get(queueName));
+      Assert.assertNotNull(fakeJMSStorageManager.persistedJNDIMap.get(queueName));
+      Assert.assertTrue(fakeJMSStorageManager.persistedJNDIMap.get(queueName).contains(bindings[0]));
+      Assert.assertTrue(fakeJMSStorageManager.persistedJNDIMap.get(queueName).contains(bindings[1]));
+      Assert.assertTrue(fakeJMSStorageManager.persistedJNDIMap.get(queueName).contains(bindings[2]));
    }
 
+   public void testCreateQueueWithCommaBindings() throws Exception
+   {
+      String[] bindings = new String[3];
+      bindings[0] = "first&comma;first";
+      bindings[1] = "second&comma;second";
+      bindings[2] = "third&comma;third";
+      String queueName = RandomUtil.randomString();
+
+      String bindingsCSV = JMSServerControlTest.toCSV(bindings);
+      UnitTestCase.checkNoBinding(context, bindingsCSV);
+
+      checkNoResource(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName));
+
+      JMSServerControl control = createManagementControl();
+      control.createQueue(queueName, bindingsCSV);
+
+      Object o = UnitTestCase.checkBinding(context, "first,first");
+      Assert.assertTrue(o instanceof Queue);
+      Queue queue = (Queue)o;
+      Assert.assertEquals(queueName, queue.getQueueName());
+      o = UnitTestCase.checkBinding(context, "second,second");
+      Assert.assertTrue(o instanceof Queue);
+      queue = (Queue)o;
+      Assert.assertEquals(queueName, queue.getQueueName());
+      o = UnitTestCase.checkBinding(context, "third,third");
+      Assert.assertTrue(o instanceof Queue);
+      queue = (Queue)o;
+      Assert.assertEquals(queueName, queue.getQueueName());
+      checkResource(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName));
+
+      Assert.assertNotNull(fakeJMSStorageManager.destinationMap.get(queueName));
+      Assert.assertNotNull(fakeJMSStorageManager.persistedJNDIMap.get(queueName));
+      Assert.assertTrue(fakeJMSStorageManager.persistedJNDIMap.get(queueName).contains("first,first"));
+      Assert.assertTrue(fakeJMSStorageManager.persistedJNDIMap.get(queueName).contains("second,second"));
+      Assert.assertTrue(fakeJMSStorageManager.persistedJNDIMap.get(queueName).contains("third,third"));
+   }
+
+   public void testCreateQueueWithSelector() throws Exception
+   {
+      String[] bindings = new String[3];
+      bindings[0] = RandomUtil.randomString();
+      bindings[1] = RandomUtil.randomString();
+      bindings[2] = RandomUtil.randomString();
+      String queueName = RandomUtil.randomString();
+
+      String bindingsCSV = JMSServerControlTest.toCSV(bindings);
+      UnitTestCase.checkNoBinding(context, bindingsCSV);
+
+      checkNoResource(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName));
+
+      JMSServerControl control = createManagementControl();
+      String selector = "foo='bar'";
+      control.createQueue(queueName, bindingsCSV, selector);
+
+      Object o = UnitTestCase.checkBinding(context, bindings[0]);
+      Assert.assertTrue(o instanceof Queue);
+      Queue queue = (Queue)o;
+      //assertEquals(((HornetQDestination)queue).get);
+      Assert.assertEquals(queueName, queue.getQueueName());
+      Assert.assertEquals(selector,server.getPostOffice().getBinding(new SimpleString("jms.queue." + queueName)).getFilter().getFilterString().toString());
+      o = UnitTestCase.checkBinding(context, bindings[1]);
+      Assert.assertTrue(o instanceof Queue);
+      queue = (Queue)o;
+      Assert.assertEquals(queueName, queue.getQueueName());
+      Assert.assertEquals(selector,server.getPostOffice().getBinding(new SimpleString("jms.queue." + queueName)).getFilter().getFilterString().toString());
+      o = UnitTestCase.checkBinding(context, bindings[2]);
+      Assert.assertTrue(o instanceof Queue);
+      queue = (Queue)o;
+      Assert.assertEquals(queueName, queue.getQueueName());
+      Assert.assertEquals(selector,server.getPostOffice().getBinding(new SimpleString("jms.queue." + queueName)).getFilter().getFilterString().toString());
+      checkResource(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName));
+
+      Assert.assertNotNull(fakeJMSStorageManager.destinationMap.get(queueName));
+      Assert.assertNotNull(fakeJMSStorageManager.persistedJNDIMap.get(queueName));
+      Assert.assertTrue(fakeJMSStorageManager.persistedJNDIMap.get(queueName).contains(bindings[0]));
+      Assert.assertTrue(fakeJMSStorageManager.persistedJNDIMap.get(queueName).contains(bindings[1]));
+      Assert.assertTrue(fakeJMSStorageManager.persistedJNDIMap.get(queueName).contains(bindings[2]));
+   }
+
    public void testDestroyQueue() throws Exception
    {
       String queueJNDIBinding = RandomUtil.randomString();
@@ -133,6 +241,8 @@
 
       UnitTestCase.checkNoBinding(context, queueJNDIBinding);
       checkNoResource(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName));
+
+      Assert.assertNull(fakeJMSStorageManager.destinationMap.get(queueName));
    }
 
    public void testGetQueueNames() throws Exception
@@ -156,7 +266,12 @@
 
    public void testCreateTopic() throws Exception
    {
-      String topicJNDIBinding = RandomUtil.randomString();
+      String[] bindings = new String[3];
+      bindings[0] = RandomUtil.randomString();
+      bindings[1] = RandomUtil.randomString();
+      bindings[2] = RandomUtil.randomString();
+      String topicJNDIBinding = JMSServerControlTest.toCSV(bindings);
+      UnitTestCase.checkNoBinding(context, topicJNDIBinding);
       String topicName = RandomUtil.randomString();
 
       UnitTestCase.checkNoBinding(context, topicJNDIBinding);
@@ -165,11 +280,25 @@
       JMSServerControl control = createManagementControl();
       control.createTopic(topicName, topicJNDIBinding);
 
-      Object o = UnitTestCase.checkBinding(context, topicJNDIBinding);
+      Object o = UnitTestCase.checkBinding(context, bindings[0]);
       Assert.assertTrue(o instanceof Topic);
       Topic topic = (Topic)o;
       Assert.assertEquals(topicName, topic.getTopicName());
+      o = UnitTestCase.checkBinding(context, bindings[1]);
+      Assert.assertTrue(o instanceof Topic);
+      topic = (Topic)o;
+      Assert.assertEquals(topicName, topic.getTopicName());
+      o = UnitTestCase.checkBinding(context, bindings[2]);
+      Assert.assertTrue(o instanceof Topic);
+      topic = (Topic)o;
+      Assert.assertEquals(topicName, topic.getTopicName());
       checkResource(ObjectNameBuilder.DEFAULT.getJMSTopicObjectName(topicName));
+
+      Assert.assertNotNull(fakeJMSStorageManager.destinationMap.get(topicName));
+      Assert.assertNotNull(fakeJMSStorageManager.persistedJNDIMap.get(topicName));
+      Assert.assertTrue(fakeJMSStorageManager.persistedJNDIMap.get(topicName).contains(bindings[0]));
+      Assert.assertTrue(fakeJMSStorageManager.persistedJNDIMap.get(topicName).contains(bindings[1]));
+      Assert.assertTrue(fakeJMSStorageManager.persistedJNDIMap.get(topicName).contains(bindings[2]));
    }
 
    public void testDestroyTopic() throws Exception
@@ -204,6 +333,8 @@
       assertNull(server.getManagementService().getResource(ResourceNames.CORE_ADDRESS + topicAddress));
       UnitTestCase.checkNoBinding(context, topicJNDIBinding);
       checkNoResource(ObjectNameBuilder.DEFAULT.getJMSTopicObjectName(topicName));
+
+      Assert.assertNull(fakeJMSStorageManager.destinationMap.get(topicName));
    }
 
    public void testGetTopicNames() throws Exception
@@ -306,7 +437,8 @@
       server = HornetQServers.newHornetQServer(conf, mbeanServer, false);
 
       context = new InVMContext();
-      serverManager = new JMSServerManagerImpl(server);
+      fakeJMSStorageManager = new FakeJMSStorageManager();
+      serverManager = new JMSServerManagerImpl(server, null, fakeJMSStorageManager);
       serverManager.setContext(context);
       serverManager.start();
       serverManager.activated();
@@ -333,7 +465,9 @@
 
    // Private -------------------------------------------------------
 
-   private void doCreateConnectionFactory(final ConnectionFactoryCreator creator) throws Exception
+   private void
+
+   doCreateConnectionFactory(final ConnectionFactoryCreator creator) throws Exception
    {
       Object[] cfJNDIBindings = new Object[] { RandomUtil.randomString(),
                                               RandomUtil.randomString(),
@@ -359,6 +493,11 @@
          connection.close();
       }
       checkResource(ObjectNameBuilder.DEFAULT.getConnectionFactoryObjectName(cfName));
+
+      Assert.assertNotNull(fakeJMSStorageManager.connectionFactoryMap.get(cfName));
+      Assert.assertTrue(fakeJMSStorageManager.persistedJNDIMap.get(cfName).contains(cfJNDIBindings[0]));
+      Assert.assertTrue(fakeJMSStorageManager.persistedJNDIMap.get(cfName).contains(cfJNDIBindings[1]));
+      Assert.assertTrue(fakeJMSStorageManager.persistedJNDIMap.get(cfName).contains(cfJNDIBindings[2]));
    }
 
    private JMSServerManager startHornetQServer(final int discoveryPort) throws Exception
@@ -390,4 +529,76 @@
       void createConnectionFactory(JMSServerControl control, String cfName, Object[] bindings) throws Exception;
    }
 
+   class FakeJMSStorageManager implements JMSStorageManager
+   {
+      Map<String, PersistedDestination> destinationMap = new HashMap<String, PersistedDestination>();
+      Map<String, PersistedConnectionFactory> connectionFactoryMap = new HashMap<String, PersistedConnectionFactory>();
+      ConcurrentHashMap<String, List<String>> persistedJNDIMap = new ConcurrentHashMap<String, List<String>>();
+      public void storeDestination(PersistedDestination destination) throws Exception
+      {
+         destinationMap.put(destination.getName(), destination);
+      }
+
+      public void deleteDestination(PersistedType type, String name) throws Exception
+      {
+         destinationMap.remove(name);
+      }
+
+      public List<PersistedDestination> recoverDestinations()
+      {
+         return Collections.EMPTY_LIST;
+      }
+
+      public void deleteConnectionFactory(String connectionFactory) throws Exception
+      {
+         connectionFactoryMap.remove(connectionFactory);
+      }
+
+      public void storeConnectionFactory(PersistedConnectionFactory connectionFactory) throws Exception
+      {
+         connectionFactoryMap.put(connectionFactory.getName(), connectionFactory);
+      }
+
+      public List<PersistedConnectionFactory> recoverConnectionFactories()
+      {
+         return Collections.EMPTY_LIST;
+      }
+
+      public void addJNDI(PersistedType type, String name, String address) throws Exception
+      {
+         persistedJNDIMap.putIfAbsent(name, new ArrayList<String>());
+         persistedJNDIMap.get(name).add(address);
+      }
+
+      public List<PersistedJNDI> recoverPersistedJNDI() throws Exception
+      {
+         return Collections.EMPTY_LIST;
+      }
+
+      public void deleteJNDI(PersistedType type, String name, String address) throws Exception
+      {
+         persistedJNDIMap.get(name).remove(address);
+      }
+
+      public void deleteJNDI(PersistedType type, String name) throws Exception
+      {
+         persistedJNDIMap.get(name).clear();
+      }
+
+      public void start() throws Exception
+      {
+         //To change body of implemented methods use File | Settings | File Templates.
+      }
+
+      public void stop() throws Exception
+      {
+         //To change body of implemented methods use File | Settings | File Templates.
+      }
+
+      public boolean isStarted()
+      {
+         return false;  //To change body of implemented methods use File | Settings | File Templates.
+      }
+   }
+
 }
\ No newline at end of file

Modified: trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlUsingJMSTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlUsingJMSTest.java	2010-03-27 10:52:12 UTC (rev 8979)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlUsingJMSTest.java	2010-03-27 12:41:58 UTC (rev 8980)
@@ -261,14 +261,12 @@
 
          public boolean createQueue(String name, String jndiBinding) throws Exception
          {
-            // TODO add a test for this
-            return false;
+            return (Boolean)proxy.invokeOperation("createQueue", name, jndiBinding);
          }
 
          public boolean createTopic(String name, String jndiBinding) throws Exception
          {
-            // TODO add a test for this
-            return false;
+            return (Boolean)proxy.invokeOperation("createTopic", name, jndiBinding);
          }
 
       };



More information about the hornetq-commits mailing list