[jboss-cvs] JBoss Messaging SVN: r1364 - in trunk: src/etc/server/default/deploy src/main/org/jboss/jms/client/delegate src/main/org/jboss/messaging/core/plugin/postoffice tests tests/src/org/jboss/test/messaging/tools/jmx/rmi

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Sep 26 11:40:02 EDT 2006


Author: timfox
Date: 2006-09-26 11:39:53 -0400 (Tue, 26 Sep 2006)
New Revision: 1364

Modified:
   trunk/src/etc/server/default/deploy/hsqldb-persistence-service.xml
   trunk/src/etc/server/default/deploy/mysql-persistence-service.xml
   trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java
   trunk/src/main/org/jboss/messaging/core/plugin/postoffice/DefaultPostOffice.java
   trunk/tests/build.xml
   trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/LocalTestServer.java
Log:
More tweaks - get tests running



Modified: trunk/src/etc/server/default/deploy/hsqldb-persistence-service.xml
===================================================================
--- trunk/src/etc/server/default/deploy/hsqldb-persistence-service.xml	2006-09-26 14:49:27 UTC (rev 1363)
+++ trunk/src/etc/server/default/deploy/hsqldb-persistence-service.xml	2006-09-26 15:39:53 UTC (rev 1364)
@@ -10,105 +10,46 @@
 
    <mbean code="org.jboss.messaging.core.plugin.JDBCPersistenceManagerService"
       name="jboss.messaging:service=PersistenceManager"
-      xmbean-dd="xmdesc/JDBCPersistenceManager-xmbean.xml">
-      <!-- TODO this insures the fact that dependency exists. However I need to redundantly specifiy
-           the DataSource JNDI name in order to actually get a reference to it. Fix this.
-      -->
+      xmbean-dd="xmdesc/JDBCPersistenceManager-xmbean.xml">      
       <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
       <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
       <attribute name="DataSource">java:/DefaultDS</attribute>
       <attribute name="CreateTablesOnStartup">true</attribute>
-      <attribute name="UsingBatchUpdates">true</attribute>
+      <attribute name="UsingBatchUpdates">true</attribute>            
+      <attribute name="MaxParams">500</attribute>
    </mbean>
-
+       
+   <!-- Note that Hypersonic CANNOT be used for clustered post offices -->    
+       
    <mbean code="org.jboss.messaging.core.plugin.DefaultPostOfficeService"
       name="jboss.messaging:service=QueuePostOffice"
-      xmbean-dd="xmdesc/SimplePostOffice-xmbean.xml"> 
+      xmbean-dd="xmdesc/DefaultPostOffice-xmbean.xml"> 
       <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends> 
       <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
       <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
       <attribute name="PostOfficeName">Queue</attribute>
       <attribute name="DataSource">java:/DefaultDS</attribute>
-      <attribute name="CreateTablesOnStartup">true</attribute>
+      <attribute name="CreateTablesOnStartup">true</attribute>     
    </mbean>
    
    <mbean code="org.jboss.messaging.core.plugin.DefaultPostOfficeService"
       name="jboss.messaging:service=TopicPostOffice"
-      xmbean-dd="xmdesc/SimplePostOffice-xmbean.xml"> 
+      xmbean-dd="xmdesc/DefaultPostOffice-xmbean.xml"> 
       <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
       <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
       <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
       <attribute name="PostOfficeName">Topic</attribute>
       <attribute name="DataSource">java:/DefaultDS</attribute>
-      <attribute name="CreateTablesOnStartup">true</attribute>
+      <attribute name="CreateTablesOnStartup">true</attribute>           
    </mbean> 
    
-   <!--
-   
-   Uncomment this to enable clustered destinations
-   
-   <mbean code="org.jboss.messaging.core.plugin.ClusteredTopicPostOfficeService"
-      name="jboss.messaging:service=TopicPostOffice"
-      xmbean-dd="xmdesc/ClusteredTopicPostOffice-xmbean.xml"> 
-      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
-      <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
-      <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
-      <attribute name="PostOfficeName">Clustered Topic</attribute>
-      <attribute name="DataSource">java:/DefaultDS</attribute>
-      <attribute name="CreateTablesOnStartup">true</attribute>            
-      <attribute name="SqlProperties"><![CDATA[
-      <attribute name="GroupName">cluster1</attribute>
-      <attribute name="StateTimeout">5000</attribute>
-      <attribute name="CastTimeout">5000</attribute>
-      <attribute name="PullSize">1</attribute>
-      <attribute name="StatsSendPeriod">1000</attribute>
-      <attribute name="SyncChannelConfig">
-         <UDP mcast_recv_buf_size="500000" down_thread="false" ip_mcast="true" mcast_send_buf_size="32000"
-        mcast_port="45566" ucast_recv_buf_size="500000" use_incoming_packet_handler="false"
-        mcast_addr="228.8.8.8" use_outgoing_packet_handler="true" loopback="false" ucast_send_buf_size="32000" ip_ttl="32"/>
-         <AUTOCONF down_thread="false" up_thread="false"/>
-	      <PING timeout="2000" down_thread="false" num_initial_members="3" up_thread="false"/>
-	      <MERGE2 max_interval="10000" down_thread="false" min_interval="5000" up_thread="false"/>
-	      <FD timeout="2000" max_tries="3" down_thread="false" up_thread="false" shun="true"/>
-	      <VERIFY_SUSPECT timeout="1500" down_thread="false" up_thread="false"/>
-	      <pbcast.NAKACK max_xmit_size="8192" down_thread="false" use_mcast_xmit="true" gc_lag="50" up_thread="false"
-	                   retransmit_timeout="100,200,600,1200,2400,4800"/>
-	      <UNICAST timeout="1200,2400,3600" down_thread="false" up_thread="false"/>
-	      <pbcast.STABLE stability_delay="1000" desired_avg_gossip="20000" down_thread="false" max_bytes="0" up_thread="false"/>
-	      <FRAG frag_size="8192" down_thread="false" up_thread="false"/>
-	      <VIEW_SYNC avg_send_interval="60000" down_thread="false" up_thread="false" />
-	      <pbcast.GMS print_local_addr="true" join_timeout="3000" down_thread="false" join_retry_timeout="2000" up_thread="false" shun="true"/>
-      </attribute>      
-      
-      <attribute name="AsyncChannelConfig">
-         <UDP mcast_recv_buf_size="500000" down_thread="false" ip_mcast="true" mcast_send_buf_size="32000"
-        mcast_port="45568" ucast_recv_buf_size="500000" use_incoming_packet_handler="false"
-        mcast_addr="228.8.8.8" use_outgoing_packet_handler="true" loopback="false" ucast_send_buf_size="32000" ip_ttl="32"/>
-	      <AUTOCONF down_thread="false" up_thread="false"/>
-	      <PING timeout="2000" down_thread="false" num_initial_members="3" up_thread="false"/>
-	      <MERGE2 max_interval="10000" down_thread="false" min_interval="5000" up_thread="false"/>
-	      <FD timeout="2000" max_tries="3" down_thread="false" up_thread="false" shun="true"/>
-	      <VERIFY_SUSPECT timeout="1500" down_thread="false" up_thread="false"/>
-	      <pbcast.NAKACK max_xmit_size="8192" down_thread="false" use_mcast_xmit="true" gc_lag="50" up_thread="false"
-	                   retransmit_timeout="100,200,600,1200,2400,4800"/>
-	      <UNICAST timeout="1200,2400,3600" down_thread="false" up_thread="false"/>
-	      <pbcast.STABLE stability_delay="1000" desired_avg_gossip="20000" down_thread="false" max_bytes="0" up_thread="false"/>
-	      <FRAG frag_size="8192" down_thread="false" up_thread="false"/>
-	      <VIEW_SYNC avg_send_interval="60000" down_thread="false" up_thread="false" />
-	      <pbcast.GMS print_local_addr="true" join_timeout="3000" down_thread="false" join_retry_timeout="2000" up_thread="false" shun="true"/>
-	      <pbcast.STATE_TRANSFER down_thread="false" up_thread="false"/>
-      </attribute>      
-   </mbean>
-   
-   -->
-   
    <mbean code="org.jboss.jms.server.plugin.JDBCJMSUserManagerService"
       name="jboss.messaging:service=JMSUserManager"
       xmbean-dd="xmdesc/JMSUserManager-xmbean.xml">
       <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
       <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
       <attribute name="DataSource">java:/DefaultDS</attribute>
-      <attribute name="CreateTablesOnStartup">true</attribute>
+      <attribute name="CreateTablesOnStartup">true</attribute>            
    </mbean>    
    
 	<mbean code="org.jboss.messaging.core.plugin.JDBCShutdownLoggerService"
@@ -117,7 +58,7 @@
       <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
       <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
       <attribute name="DataSource">java:/DefaultDS</attribute>
-      <attribute name="CreateTablesOnStartup">true</attribute>
-   </mbean>              
+      <attribute name="CreateTablesOnStartup">true</attribute>      
+   </mbean>  
    
 </server>
\ No newline at end of file

Modified: trunk/src/etc/server/default/deploy/mysql-persistence-service.xml
===================================================================
--- trunk/src/etc/server/default/deploy/mysql-persistence-service.xml	2006-09-26 14:49:27 UTC (rev 1363)
+++ trunk/src/etc/server/default/deploy/mysql-persistence-service.xml	2006-09-26 15:39:53 UTC (rev 1364)
@@ -59,7 +59,7 @@
       
    <mbean code="org.jboss.messaging.core.plugin.DefaultPostOfficeService"
       name="jboss.messaging:service=QueuePostOffice"
-      xmbean-dd="xmdesc/SimplePostOffice-xmbean.xml"> 
+      xmbean-dd="xmdesc/DefaultPostOffice-xmbean.xml"> 
       <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends> 
       <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
       <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
@@ -76,7 +76,7 @@
    
    <mbean code="org.jboss.messaging.core.plugin.DefaultPostOfficeService"
       name="jboss.messaging:service=TopicPostOffice"
-      xmbean-dd="xmdesc/SimplePostOffice-xmbean.xml"> 
+      xmbean-dd="xmdesc/DefaultPostOffice-xmbean.xml"> 
       <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
       <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
       <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>

Modified: trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java	2006-09-26 14:49:27 UTC (rev 1363)
+++ trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java	2006-09-26 15:39:53 UTC (rev 1364)
@@ -178,8 +178,6 @@
 
          configuration.put(Client.ENABLE_LEASE, String.valueOf(false));
          
-         log.info("*********** SERVERLOCATOR URI:" + serverLocatorURI);
-
          client = new Client(new InvokerLocator(serverLocatorURI), configuration);     
          
          client.setSubsystem(ServerPeer.REMOTING_JMS_SUBSYSTEM);

Modified: trunk/src/main/org/jboss/messaging/core/plugin/postoffice/DefaultPostOffice.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/plugin/postoffice/DefaultPostOffice.java	2006-09-26 14:49:27 UTC (rev 1363)
+++ trunk/src/main/org/jboss/messaging/core/plugin/postoffice/DefaultPostOffice.java	2006-09-26 15:39:53 UTC (rev 1364)
@@ -128,9 +128,12 @@
    
    public void start() throws Exception
    {
+      log.info(this + " starting");
       super.start();
       
       loadBindings();
+      
+      log.info(this + " started");
    }
    
    public void stop() throws Exception

Modified: trunk/tests/build.xml
===================================================================
--- trunk/tests/build.xml	2006-09-26 14:49:27 UTC (rev 1363)
+++ trunk/tests/build.xml	2006-09-26 15:39:53 UTC (rev 1364)
@@ -338,7 +338,7 @@
                     haltonerror="${junit.batchtest.haltonerror}">
             <formatter type="plain" usefile="${junit.formatter.usefile}"/>
             <fileset dir="${build.tests.classes}">
-               <include name="**/messaging/core/**/*Test.class"/>
+               <!-- <include name="**/messaging/core/**/*Test.class"/> -->
                <include name="**/messaging/jms/**/*Test.class"/>
                <exclude name="**/jms/stress/**"/>
                <exclude name="**/jms/crash/*Test.class"/>

Modified: trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/LocalTestServer.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/LocalTestServer.java	2006-09-26 14:49:27 UTC (rev 1363)
+++ trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/LocalTestServer.java	2006-09-26 15:39:53 UTC (rev 1364)
@@ -216,141 +216,195 @@
                                String defaultQueueJNDIContext,
                                String defaultTopicJNDIContext) throws Exception
    {
-      log.debug("creating ServerPeer instance");
-
-      // we are using the "default" service deployment descriptors available in
-      // src/etc/server/default/deploy. This will allow to test the default parameters we ship.
-
-      String mainConfigFile = "server/default/deploy/messaging-service.xml";
-      URL mainConfigFileURL = getClass().getClassLoader().getResource(mainConfigFile);
-      if (mainConfigFileURL == null)
+      try
       {
-         throw new Exception("Cannot find " + mainConfigFile + " in the classpath");
+         log.debug("creating ServerPeer instance");
+   
+         // we are using the "default" service deployment descriptors available in
+         // src/etc/server/default/deploy. This will allow to test the default parameters we ship.
+   
+         String mainConfigFile = "server/default/deploy/messaging-service.xml";
+         URL mainConfigFileURL = getClass().getClassLoader().getResource(mainConfigFile);
+         if (mainConfigFileURL == null)
+         {
+            throw new Exception("Cannot find " + mainConfigFile + " in the classpath");
+         }
+   
+         String databaseType = sc.getDatabaseType();
+         String persistenceConfigFile =
+            "server/default/deploy/" + databaseType + "-persistence-service.xml";
+         URL persistenceConfigFileURL = getClass().getClassLoader().getResource(persistenceConfigFile);
+         if (persistenceConfigFileURL == null)
+         {
+            throw new Exception("Cannot find " + persistenceConfigFile + " in the classpath");
+         }
+   
+         String connFactoryConfigFile = "server/default/deploy/connection-factories-service.xml";
+         URL connFactoryConfigFileURL = getClass().getClassLoader().getResource(connFactoryConfigFile);
+         if (connFactoryConfigFileURL == null)
+         {
+            throw new Exception("Cannot find " + connFactoryConfigFile + " in the classpath");
+         }
+   
+         ServiceDeploymentDescriptor mdd = new ServiceDeploymentDescriptor(mainConfigFileURL);
+         ServiceDeploymentDescriptor pdd = new ServiceDeploymentDescriptor(persistenceConfigFileURL);
+         ServiceDeploymentDescriptor cfdd = new ServiceDeploymentDescriptor(connFactoryConfigFileURL);
+   
+         MBeanConfigurationElement persistenceManagerConfig =
+            (MBeanConfigurationElement)pdd.query("service", "PersistenceManager").iterator().next();
+         persistenceManagerObjectName = sc.registerAndConfigureService(persistenceManagerConfig);
+         sc.invoke(persistenceManagerObjectName, "create", new Object[0], new String[0]);
+         sc.invoke(persistenceManagerObjectName, "start", new Object[0], new String[0]);    
+              
+         MBeanConfigurationElement jmsUserManagerConfig =
+            (MBeanConfigurationElement)pdd.query("service", "JMSUserManager").iterator().next();
+         jmsUserManagerObjectName = sc.registerAndConfigureService(jmsUserManagerConfig);
+         sc.invoke(jmsUserManagerObjectName, "create", new Object[0], new String[0]);
+         sc.invoke(jmsUserManagerObjectName, "start", new Object[0], new String[0]);  
+         
+         MBeanConfigurationElement shutdownLoggerConfig =
+            (MBeanConfigurationElement)pdd.query("service", "ShutdownLogger").iterator().next();
+         shutdownLoggerObjectName = sc.registerAndConfigureService(shutdownLoggerConfig);
+         sc.invoke(shutdownLoggerObjectName, "create", new Object[0], new String[0]);
+         sc.invoke(shutdownLoggerObjectName, "start", new Object[0], new String[0]); 
+   
+         // register server peer as a service, dependencies are injected automatically
+         MBeanConfigurationElement serverPeerConfig =
+            (MBeanConfigurationElement)mdd.query("service", "ServerPeer").iterator().next();
+   
+         // overwrite the file configuration, if needed
+         if (serverPeerID != null)
+         {
+            serverPeerConfig.setConstructorArgumentValue(0, 0, serverPeerID);
+         }
+         if (defaultQueueJNDIContext != null)
+         {
+            serverPeerConfig.setConstructorArgumentValue(0, 1, defaultQueueJNDIContext);
+         }
+         if (defaultTopicJNDIContext != null)
+         {
+            serverPeerConfig.setConstructorArgumentValue(0, 2, defaultTopicJNDIContext);
+         }
+   
+         serverPeerObjectName = sc.registerAndConfigureService(serverPeerConfig);
+   
+         // overwrite the config file security domain
+         sc.setAttribute(serverPeerObjectName, "SecurityDomain",
+                         MockJBossSecurityManager.TEST_SECURITY_DOMAIN);
+   
+         log.debug("starting JMS server");
+   
+         sc.invoke(serverPeerObjectName, "create", new Object[0], new String[0]);
+         sc.invoke(serverPeerObjectName, "start", new Object[0], new String[0]);
+         
+         log.info("deploying post offices");
+         
+         MBeanConfigurationElement queuePostOfficeConfig =
+            (MBeanConfigurationElement)pdd.query("service", "QueuePostOffice").iterator().next();
+         queuePostOfficeObjectName = sc.registerAndConfigureService(queuePostOfficeConfig);
+         sc.invoke(queuePostOfficeObjectName, "create", new Object[0], new String[0]);
+         sc.invoke(queuePostOfficeObjectName, "start", new Object[0], new String[0]);
+         
+         MBeanConfigurationElement topicPostOfficeConfig =
+            (MBeanConfigurationElement)pdd.query("service", "TopicPostOffice").iterator().next();
+         topicPostOfficeObjectName = sc.registerAndConfigureService(topicPostOfficeConfig);
+         sc.invoke(topicPostOfficeObjectName, "create", new Object[0], new String[0]);
+         sc.invoke(topicPostOfficeObjectName, "start", new Object[0], new String[0]);
+         
+         log.info("Deployed postoffices");
+    
+         log.debug("deploying connection factories");
+   
+         List connFactoryElements = cfdd.query("service", "ConnectionFactory");
+         connFactoryObjectNames.clear();
+         for(Iterator i = connFactoryElements.iterator(); i.hasNext(); )
+         {
+            MBeanConfigurationElement connFactoryElement = (MBeanConfigurationElement)i.next();
+            ObjectName on = sc.registerAndConfigureService(connFactoryElement);
+            // dependencies have been automatically injected already
+            sc.invoke(on, "create", new Object[0], new String[0]);
+            sc.invoke(on, "start", new Object[0], new String[0]);
+            connFactoryObjectNames.add(on);
+         }
+   
+         // bind the default JMS provider
+         sc.bindDefaultJMSProvider();
+         // bind the JCA ConnectionFactory
+         sc.bindJCAJMSConnectionFactory();
       }
-
-      String databaseType = sc.getDatabaseType();
-      String persistenceConfigFile =
-         "server/default/deploy/" + databaseType + "-persistence-service.xml";
-      URL persistenceConfigFileURL = getClass().getClassLoader().getResource(persistenceConfigFile);
-      if (persistenceConfigFileURL == null)
+      catch (Exception e)
       {
-         throw new Exception("Cannot find " + persistenceConfigFile + " in the classpath");
+         log.error("Failed to start server peer", e);
+         throw e;
       }
-
-      String connFactoryConfigFile = "server/default/deploy/connection-factories-service.xml";
-      URL connFactoryConfigFileURL = getClass().getClassLoader().getResource(connFactoryConfigFile);
-      if (connFactoryConfigFileURL == null)
-      {
-         throw new Exception("Cannot find " + connFactoryConfigFile + " in the classpath");
-      }
-
-      ServiceDeploymentDescriptor mdd = new ServiceDeploymentDescriptor(mainConfigFileURL);
-      ServiceDeploymentDescriptor pdd = new ServiceDeploymentDescriptor(persistenceConfigFileURL);
-      ServiceDeploymentDescriptor cfdd = new ServiceDeploymentDescriptor(connFactoryConfigFileURL);
-
-      MBeanConfigurationElement persistenceManagerConfig =
-         (MBeanConfigurationElement)pdd.query("service", "PersistenceManager").iterator().next();
-      persistenceManagerObjectName = sc.registerAndConfigureService(persistenceManagerConfig);
-      sc.invoke(persistenceManagerObjectName, "create", new Object[0], new String[0]);
-      sc.invoke(persistenceManagerObjectName, "start", new Object[0], new String[0]);    
-           
-      MBeanConfigurationElement jmsUserManagerConfig =
-         (MBeanConfigurationElement)pdd.query("service", "JMSUserManager").iterator().next();
-      jmsUserManagerObjectName = sc.registerAndConfigureService(jmsUserManagerConfig);
-      sc.invoke(jmsUserManagerObjectName, "create", new Object[0], new String[0]);
-      sc.invoke(jmsUserManagerObjectName, "start", new Object[0], new String[0]);  
-      
-      MBeanConfigurationElement shutdownLoggerConfig =
-         (MBeanConfigurationElement)pdd.query("service", "ShutdownLogger").iterator().next();
-      shutdownLoggerObjectName = sc.registerAndConfigureService(shutdownLoggerConfig);
-      sc.invoke(shutdownLoggerObjectName, "create", new Object[0], new String[0]);
-      sc.invoke(shutdownLoggerObjectName, "start", new Object[0], new String[0]); 
-
-      // register server peer as a service, dependencies are injected automatically
-      MBeanConfigurationElement serverPeerConfig =
-         (MBeanConfigurationElement)mdd.query("service", "ServerPeer").iterator().next();
-
-      // overwrite the file configuration, if needed
-      if (serverPeerID != null)
-      {
-         serverPeerConfig.setConstructorArgumentValue(0, 0, serverPeerID);
-      }
-      if (defaultQueueJNDIContext != null)
-      {
-         serverPeerConfig.setConstructorArgumentValue(0, 1, defaultQueueJNDIContext);
-      }
-      if (defaultTopicJNDIContext != null)
-      {
-         serverPeerConfig.setConstructorArgumentValue(0, 2, defaultTopicJNDIContext);
-      }
-
-      serverPeerObjectName = sc.registerAndConfigureService(serverPeerConfig);
-
-      // overwrite the config file security domain
-      sc.setAttribute(serverPeerObjectName, "SecurityDomain",
-                      MockJBossSecurityManager.TEST_SECURITY_DOMAIN);
-
-      log.debug("starting JMS server");
-
-      sc.invoke(serverPeerObjectName, "create", new Object[0], new String[0]);
-      sc.invoke(serverPeerObjectName, "start", new Object[0], new String[0]);
-      
-      MBeanConfigurationElement queuePostOfficeConfig =
-         (MBeanConfigurationElement)pdd.query("service", "QueuePostOffice").iterator().next();
-      queuePostOfficeObjectName = sc.registerAndConfigureService(queuePostOfficeConfig);
-      sc.invoke(queuePostOfficeObjectName, "create", new Object[0], new String[0]);
-      sc.invoke(queuePostOfficeObjectName, "start", new Object[0], new String[0]);
-      
-      MBeanConfigurationElement topicPostOfficeConfig =
-         (MBeanConfigurationElement)pdd.query("service", "TopicPostOffice").iterator().next();
-      topicPostOfficeObjectName = sc.registerAndConfigureService(topicPostOfficeConfig);
-      sc.invoke(topicPostOfficeObjectName, "create", new Object[0], new String[0]);
-      sc.invoke(topicPostOfficeObjectName, "start", new Object[0], new String[0]);
- 
-      log.debug("deploying connection factories");
-
-      List connFactoryElements = cfdd.query("service", "ConnectionFactory");
-      connFactoryObjectNames.clear();
-      for(Iterator i = connFactoryElements.iterator(); i.hasNext(); )
-      {
-         MBeanConfigurationElement connFactoryElement = (MBeanConfigurationElement)i.next();
-         ObjectName on = sc.registerAndConfigureService(connFactoryElement);
-         // dependencies have been automatically injected already
-         sc.invoke(on, "create", new Object[0], new String[0]);
-         sc.invoke(on, "start", new Object[0], new String[0]);
-         connFactoryObjectNames.add(on);
-      }
-
-      // bind the default JMS provider
-      sc.bindDefaultJMSProvider();
-      // bind the JCA ConnectionFactory
-      sc.bindJCAJMSConnectionFactory();
    }
 
    public void stopServerPeer() throws Exception
    {
-      // if we don't find a ServerPeer instance registered under the serverPeerObjectName
-      // ObjectName, we assume that the server was already stopped and we silently exit
-      if (sc.query(serverPeerObjectName).isEmpty())
+      try
       {
-         log.warn("ServerPeer already stopped");
-         return;
-      }
-
-      // unbind the JCA ConnectionFactory; nothing happens if no connection factory is bound
-      sc.unbindJCAJMSConnectionFactory();
-      sc.unbindDefaultJMSProvider();
-
-      log.debug("stopping connection factories");
-
-      for(Iterator i = connFactoryObjectNames.iterator(); i.hasNext(); )
-      {
+         // if we don't find a ServerPeer instance registered under the serverPeerObjectName
+         // ObjectName, we assume that the server was already stopped and we silently exit
+         if (sc.query(serverPeerObjectName).isEmpty())
+         {
+            log.warn("ServerPeer already stopped");
+            return;
+         }
+   
+         // unbind the JCA ConnectionFactory; nothing happens if no connection factory is bound
+         sc.unbindJCAJMSConnectionFactory();
+         sc.unbindDefaultJMSProvider();
+   
+         log.debug("stopping connection factories");
+   
+         for(Iterator i = connFactoryObjectNames.iterator(); i.hasNext(); )
+         {
+            try
+            {
+               ObjectName on = (ObjectName)i.next();
+               sc.invoke(on, "stop", new Object[0], new String[0]);
+               sc.invoke(on, "destroy", new Object[0], new String[0]);
+               sc.unregisterService(on);
+            }
+            catch (Exception ignore)
+            {
+               //If the serverpeer failed when starting up previously, then only some of the
+               //services may be started. The ones that didn't start will fail when attempting to shut
+               //them down.
+               //Hence we must catch and ignore or we won't shut everything down
+            }
+         }
+         connFactoryObjectNames.clear();
+   
+         log.debug("stopping all destinations");
+   
+         Set destinations = (Set)sc.getAttribute(serverPeerObjectName, "Destinations");
+   
+         for(Iterator i = destinations.iterator(); i.hasNext(); )
+         {
+            String name;
+            boolean isQueue = true;
+            Destination d = (Destination)i.next();
+            if (d instanceof Queue)
+            {
+               name = ((Queue)d).getQueueName();
+            }
+            else
+            {
+               isQueue = false;
+               name = ((Topic)d).getTopicName();
+            }
+   
+            undeployDestination(isQueue, name);
+         }
+   
+         log.debug("stopping JMS server");
+   
          try
          {
-            ObjectName on = (ObjectName)i.next();
-            sc.invoke(on, "stop", new Object[0], new String[0]);
-            sc.invoke(on, "destroy", new Object[0], new String[0]);
-            sc.unregisterService(on);
+            sc.invoke(serverPeerObjectName, "stop", new Object[0], new String[0]);
+            sc.invoke(serverPeerObjectName, "destroy", new Object[0], new String[0]);
+            sc.unregisterService(serverPeerObjectName);
          }
          catch (Exception ignore)
          {
@@ -359,121 +413,86 @@
             //them down.
             //Hence we must catch and ignore or we won't shut everything down
          }
-      }
-      connFactoryObjectNames.clear();
-
-      log.debug("stopping all destinations");
-
-      Set destinations = (Set)sc.getAttribute(serverPeerObjectName, "Destinations");
-
-      for(Iterator i = destinations.iterator(); i.hasNext(); )
-      {
-         String name;
-         boolean isQueue = true;
-         Destination d = (Destination)i.next();
-         if (d instanceof Queue)
+   
+         
+   
+         log.debug("stopping ServerPeer's plug-in dependencies");
+         
+         try
          {
-            name = ((Queue)d).getQueueName();
+            sc.invoke(shutdownLoggerObjectName, "stop", new Object[0], new String[0]);
+            sc.invoke(shutdownLoggerObjectName, "destroy", new Object[0], new String[0]);
+            sc.unregisterService(shutdownLoggerObjectName);
          }
-         else
+         catch (Exception ignore)
          {
-            isQueue = false;
-            name = ((Topic)d).getTopicName();
+            //If the serverpeer failed when starting up previously, then only some of the
+            //services may be started. The ones that didn't start will fail when attempting to shut
+            //them down.
+            //Hence we must catch and ignore or we won't shut everything down
          }
-
-         undeployDestination(isQueue, name);
+         
+         try
+         {
+            sc.invoke(jmsUserManagerObjectName, "stop", new Object[0], new String[0]);
+            sc.invoke(jmsUserManagerObjectName, "destroy", new Object[0], new String[0]);
+            sc.unregisterService(jmsUserManagerObjectName);
+         }
+         catch (Exception ignore)
+         {
+            //If the serverpeer failed when starting up previously, then only some of the
+            //services may be started. The ones that didn't start will fail when attempting to shut
+            //them down.
+            //Hence we must catch and ignore or we won't shut everything down
+         }
+   
+         try
+         {
+            sc.invoke(queuePostOfficeObjectName, "stop", new Object[0], new String[0]);
+            sc.invoke(queuePostOfficeObjectName, "destroy", new Object[0], new String[0]);
+            sc.unregisterService(queuePostOfficeObjectName);
+         }
+         catch (Exception ignore)
+         {
+            //If the serverpeer failed when starting up previously, then only some of the
+            //services may be started. The ones that didn't start will fail when attempting to shut
+            //them down.
+            //Hence we must catch and ignore or we won't shut everything down
+         }
+         
+         try
+         {
+            sc.invoke(topicPostOfficeObjectName, "stop", new Object[0], new String[0]);
+            sc.invoke(topicPostOfficeObjectName, "destroy", new Object[0], new String[0]);
+            sc.unregisterService(topicPostOfficeObjectName);
+         }
+         catch (Exception ignore)
+         {
+            //If the serverpeer failed when starting up previously, then only some of the
+            //services may be started. The ones that didn't start will fail when attempting to shut
+            //them down.
+            //Hence we must catch and ignore or we won't shut everything down
+         }
+   
+         try
+         {
+            sc.invoke(persistenceManagerObjectName, "stop", new Object[0], new String[0]);
+            sc.invoke(persistenceManagerObjectName, "destroy", new Object[0], new String[0]);
+            sc.unregisterService(persistenceManagerObjectName);
+         }
+         catch (Exception ignore)
+         {
+            //If the serverpeer failed when starting up previously, then only some of the
+            //services may be started. The ones that didn't start will fail when attempting to shut
+            //them down.
+            //Hence we must catch and ignore or we won't shut everything down
+         }
       }
-
-      log.debug("stopping JMS server");
-
-      try
+      catch (Exception e)
       {
-         sc.invoke(serverPeerObjectName, "stop", new Object[0], new String[0]);
-         sc.invoke(serverPeerObjectName, "destroy", new Object[0], new String[0]);
-         sc.unregisterService(serverPeerObjectName);
+         log.error("Failed to stop server peer", e);
+         throw e;
       }
-      catch (Exception ignore)
-      {
-         //If the serverpeer failed when starting up previously, then only some of the
-         //services may be started. The ones that didn't start will fail when attempting to shut
-         //them down.
-         //Hence we must catch and ignore or we won't shut everything down
-      }
-
-      
-
-      log.debug("stopping ServerPeer's plug-in dependencies");
-      
-      try
-      {
-         sc.invoke(shutdownLoggerObjectName, "stop", new Object[0], new String[0]);
-         sc.invoke(shutdownLoggerObjectName, "destroy", new Object[0], new String[0]);
-         sc.unregisterService(shutdownLoggerObjectName);
-      }
-      catch (Exception ignore)
-      {
-         //If the serverpeer failed when starting up previously, then only some of the
-         //services may be started. The ones that didn't start will fail when attempting to shut
-         //them down.
-         //Hence we must catch and ignore or we won't shut everything down
-      }
-      
-      try
-      {
-         sc.invoke(jmsUserManagerObjectName, "stop", new Object[0], new String[0]);
-         sc.invoke(jmsUserManagerObjectName, "destroy", new Object[0], new String[0]);
-         sc.unregisterService(jmsUserManagerObjectName);
-      }
-      catch (Exception ignore)
-      {
-         //If the serverpeer failed when starting up previously, then only some of the
-         //services may be started. The ones that didn't start will fail when attempting to shut
-         //them down.
-         //Hence we must catch and ignore or we won't shut everything down
-      }
-
-      try
-      {
-         sc.invoke(queuePostOfficeObjectName, "stop", new Object[0], new String[0]);
-         sc.invoke(queuePostOfficeObjectName, "destroy", new Object[0], new String[0]);
-         sc.unregisterService(queuePostOfficeObjectName);
-      }
-      catch (Exception ignore)
-      {
-         //If the serverpeer failed when starting up previously, then only some of the
-         //services may be started. The ones that didn't start will fail when attempting to shut
-         //them down.
-         //Hence we must catch and ignore or we won't shut everything down
-      }
-      
-      try
-      {
-         sc.invoke(topicPostOfficeObjectName, "stop", new Object[0], new String[0]);
-         sc.invoke(topicPostOfficeObjectName, "destroy", new Object[0], new String[0]);
-         sc.unregisterService(topicPostOfficeObjectName);
-      }
-      catch (Exception ignore)
-      {
-         //If the serverpeer failed when starting up previously, then only some of the
-         //services may be started. The ones that didn't start will fail when attempting to shut
-         //them down.
-         //Hence we must catch and ignore or we won't shut everything down
-      }
-
-      try
-      {
-         sc.invoke(persistenceManagerObjectName, "stop", new Object[0], new String[0]);
-         sc.invoke(persistenceManagerObjectName, "destroy", new Object[0], new String[0]);
-         sc.unregisterService(persistenceManagerObjectName);
-      }
-      catch (Exception ignore)
-      {
-         //If the serverpeer failed when starting up previously, then only some of the
-         //services may be started. The ones that didn't start will fail when attempting to shut
-         //them down.
-         //Hence we must catch and ignore or we won't shut everything down
-      }
-
    }
 
    public boolean isServerPeerStarted() throws Exception




More information about the jboss-cvs-commits mailing list