[jboss-cvs] JBoss Messaging SVN: r1613 - in branches/Branch_Client_Failover_Experiment: . docs docs/clustering/en/modules docs/examples/ejb3mdb docs/examples/ejb3mdb/src/org/jboss/example/jms/ejb3mdb docs/examples/http docs/examples/mdb docs/examples/queue docs/examples/secure-socket docs/examples/stateless/src/org/jboss/example/jms/stateless/bean docs/examples/stateless/src/org/jboss/example/jms/stateless/client docs/examples/topic docs/gettingstarted/en/modules src/etc/server/default/deploy src/main/org/jboss/jms/server tests tests/etc tests/etc/stress tests/lib tests/smoke tests/src/org/jboss/test/messaging/jms tests/src/org/jboss/test/messaging/jms/crash tests/src/org/jboss/test/messaging/jms/manual tests/src/org/jboss/test/messaging/jms/server tests/src/org/jboss/test/messaging/jms/server/destination tests/src/org/jboss/test/messaging/tools tests/src/org/jboss/test/messaging/tools/jmx tests/src/org/jboss/test/messaging/tools/jmx/rmi tests/src/org/jboss/test/messaging/tool! s/jndi

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Nov 21 16:24:00 EST 2006


Author: clebert.suconic at jboss.com
Date: 2006-11-21 16:23:34 -0500 (Tue, 21 Nov 2006)
New Revision: 1613

Added:
   branches/Branch_Client_Failover_Experiment/tests/lib/jdbc-drivers/
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/clustering/
Removed:
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/manual/ManualClusteringTest.java
Modified:
   branches/Branch_Client_Failover_Experiment/build-messaging.xml
   branches/Branch_Client_Failover_Experiment/build-thirdparty.xml
   branches/Branch_Client_Failover_Experiment/docs/README.html
   branches/Branch_Client_Failover_Experiment/docs/clustering/en/modules/configuration.xml
   branches/Branch_Client_Failover_Experiment/docs/examples/ejb3mdb/README.html
   branches/Branch_Client_Failover_Experiment/docs/examples/ejb3mdb/build.xml
   branches/Branch_Client_Failover_Experiment/docs/examples/ejb3mdb/do-not-distribute.properties
   branches/Branch_Client_Failover_Experiment/docs/examples/ejb3mdb/src/org/jboss/example/jms/ejb3mdb/EJB3MDBExample.java
   branches/Branch_Client_Failover_Experiment/docs/examples/http/README.html
   branches/Branch_Client_Failover_Experiment/docs/examples/mdb/README.html
   branches/Branch_Client_Failover_Experiment/docs/examples/queue/README.html
   branches/Branch_Client_Failover_Experiment/docs/examples/secure-socket/README.html
   branches/Branch_Client_Failover_Experiment/docs/examples/stateless/src/org/jboss/example/jms/stateless/bean/StatelessSessionExample.java
   branches/Branch_Client_Failover_Experiment/docs/examples/stateless/src/org/jboss/example/jms/stateless/bean/StatelessSessionExampleBean.java
   branches/Branch_Client_Failover_Experiment/docs/examples/stateless/src/org/jboss/example/jms/stateless/client/Client.java
   branches/Branch_Client_Failover_Experiment/docs/examples/topic/README.html
   branches/Branch_Client_Failover_Experiment/docs/gettingstarted/en/modules/installation.xml
   branches/Branch_Client_Failover_Experiment/messaging.iml
   branches/Branch_Client_Failover_Experiment/messaging.ipr
   branches/Branch_Client_Failover_Experiment/readme-ha-experiment.txt
   branches/Branch_Client_Failover_Experiment/src/etc/server/default/deploy/mssql-persistence-service.xml
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/DestinationJNDIMapper.java
   branches/Branch_Client_Failover_Experiment/tests/build.xml
   branches/Branch_Client_Failover_Experiment/tests/etc/container.xml
   branches/Branch_Client_Failover_Experiment/tests/etc/stress/log4j.xml
   branches/Branch_Client_Failover_Experiment/tests/smoke/build.xml
   branches/Branch_Client_Failover_Experiment/tests/smoke/smoke.properties.example
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/MessageConsumerTest.java
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/CallbackFailureTest.java
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashLargeLeaseTest.java
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashNegativeLeaseTest.java
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashTest.java
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashTwoConnectionsTest.java
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashZeroLeaseTest.java
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/server/DestinationManagerTest.java
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/server/ServerPeerTest.java
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/server/destination/QueueManagementTest.java
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/ServerManagement.java
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainerConfiguration.java
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/rmi/LocalTestServer.java
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RMITestServer.java
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RemoteTestServer.java
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/rmi/Server.java
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/rmi/StopRMIServer.java
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jndi/RemoteContext.java
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jndi/RemoteInitialContextFactory.java
Log:
svn merge -r 1517:HEAD https://svn.jboss.org/repos/messaging/trunk 
  (Head was on 1540)

Modified: branches/Branch_Client_Failover_Experiment/build-messaging.xml
===================================================================
--- branches/Branch_Client_Failover_Experiment/build-messaging.xml	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/build-messaging.xml	2006-11-21 21:23:34 UTC (rev 1613)
@@ -48,17 +48,17 @@
    <property name="messaging.version.major" value="1"/>
    <property name="messaging.version.minor" value="2"/>
    <property name="messaging.version.revision" value="0"/>
-   <property name="messaging.version.incrementing" value="7"/>
-   <property name="messaging.version.tag" value="Alpha2"/>
+   <property name="messaging.version.incrementing" value="8"/>
+   <property name="messaging.version.tag" value="Beta1"/>
    <property name="messaging.version.name" value=""/>
-   <property name="messaging.version.cvstag" value="JBossMessaging_1_2_0_Alpha2"/>
+   <property name="messaging.version.cvstag" value="JBossMessaging_1_2_0_Beta1"/>
    <property name="module.name" value="messaging"/>
    <property name="module.Name" value="JBoss Messaging"/>
    <property name="module.version" value="${messaging.version.major}.${messaging.version.minor}.${messaging.version.revision}.${messaging.version.tag}"/>
 
    <property name="jms.version.major" value="1"/>
-   <property name="jms.version.minor" value="2"/>
-   <property name="jms.version" value="1.2"/>
+   <property name="jms.version.minor" value="1"/>
+   <property name="jms.version" value="1.1"/>
 
    <!--
         Jar manifest version information.

Modified: branches/Branch_Client_Failover_Experiment/build-thirdparty.xml
===================================================================
--- branches/Branch_Client_Failover_Experiment/build-thirdparty.xml	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/build-thirdparty.xml	2006-11-21 21:23:34 UTC (rev 1613)
@@ -85,7 +85,7 @@
       <componentref name="oswego-concurrent" version="1.3.4"/>
       <componentref name="apache-log4j" version="1.2.8"/>
       <componentref name="javassist" version="3.2.0.GA"/>
-      <componentref name="jgroups" version="2.3"/>
+      <componentref name="jgroups" version="2.4"/>
       <componentref name="trove" version="1.0.2"/>
       <componentref name="jboss/common" version="snapshot"/>
       <componentref name="jboss/aop" version="1.5.0.GA"/>

Modified: branches/Branch_Client_Failover_Experiment/docs/README.html
===================================================================
--- branches/Branch_Client_Failover_Experiment/docs/README.html	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/docs/README.html	2006-11-21 21:23:34 UTC (rev 1613)
@@ -7,9 +7,9 @@
 </head>
 <body>
 <h1><br>
-JBoss Messaging 1.2.0.Alpha1 Release Notes</h1>
+JBoss Messaging 1.2.0.Alpha2 Release Notes</h1>
 <br>
-September 29, 2006<br>
+1st November 2006<br>
 <br>
 <br>
 JBoss
@@ -34,113 +34,48 @@
 </div>
 <h2>Release Notes<br>
 </h2>
-<h2 style="margin-left: 40px;">Bug</h2>
-<ul style="margin-left: 40px;">
-  <li>[<a href="http://jira.jboss.com/jira/browse/JBMESSAGING-171">JBMESSAGING-171</a>]
-- Remoting timeouts</li>
-  <li>[<a href="http://jira.jboss.com/jira/browse/JBMESSAGING-247">JBMESSAGING-247</a>]
-- Race condition - out of order delivery</li>
-  <li>[<a href="http://jira.jboss.com/jira/browse/JBMESSAGING-302">JBMESSAGING-302</a>]
-- Invoking Topic management interface's listMessagesDurableSub()/
-listMessagesNonDurableSub() with empty params throws exception</li>
-  <li>[<a href="http://jira.jboss.com/jira/browse/JBMESSAGING-331">JBMESSAGING-331</a>]
-- Message id generator and resource manager Memory leak</li>
-  <li>[<a href="http://jira.jboss.com/jira/browse/JBMESSAGING-424">JBMESSAGING-424</a>]
-- Cannot access the first message when starting the JMS subscriber</li>
-  <li>[<a href="http://jira.jboss.com/jira/browse/JBMESSAGING-435">JBMESSAGING-435</a>]
-- PointToPoint delivery with multiple consumers and selectors is broken</li>
-  <li>[<a href="http://jira.jboss.com/jira/browse/JBMESSAGING-499">JBMESSAGING-499</a>]
-- get-test-execution-classpath assumes windows</li>
-  <li>[<a href="http://jira.jboss.com/jira/browse/JBMESSAGING-525">JBMESSAGING-525</a>]
-- postgresql-persistence-service.xml contains invalid SQL syntax</li>
-  <li>[<a href="http://jira.jboss.com/jira/browse/JBMESSAGING-526">JBMESSAGING-526</a>]
-- JMSRedelivered flag not correctly set on true in certain redelivery
-scenarios</li>
-  <li>[<a href="http://jira.jboss.com/jira/browse/JBMESSAGING-536">JBMESSAGING-536</a>]
-- The CallbackServer cannot be contacted for some particular network
-interface configurations</li>
-  <li>[<a href="http://jira.jboss.com/jira/browse/JBMESSAGING-564">JBMESSAGING-564</a>]
-- Session.unsubscribe() leaves an active associated consumer (durable
-subscriber) in an undefined state</li>
-  <li>[<a href="http://jira.jboss.com/jira/browse/JBMESSAGING-565">JBMESSAGING-565</a>]
-- Race Condition between Topic/Queue.getMessageCount and Deliver Thread</li>
+
+<h2>Bug</h2>
+<ul>
+<li>[<a href='http://jira.jboss.com/jira/browse/JBMESSAGING-552'>JBMESSAGING-552</a>] - MessageConsumerTest.testRedeliveryToCompetingConsumerOnSubscription() fails on race condition</li>
+<li>[<a href='http://jira.jboss.com/jira/browse/JBMESSAGING-587'>JBMESSAGING-587</a>] - Fix perf/build.xml</li>
+<li>[<a href='http://jira.jboss.com/jira/browse/JBMESSAGING-589'>JBMESSAGING-589</a>] - DefaultClusteredPostOfficeTest::testClusteredNameUniqueness is failing</li>
+<li>[<a href='http://jira.jboss.com/jira/browse/JBMESSAGING-595'>JBMESSAGING-595</a>] - Rebind of clustered durable subscription fails</li>
+<li>[<a href='http://jira.jboss.com/jira/browse/JBMESSAGING-596'>JBMESSAGING-596</a>] - BrowserTest should close its Connection in tearDown()</li>
+<li>[<a href='http://jira.jboss.com/jira/browse/JBMESSAGING-606'>JBMESSAGING-606</a>] - Issue with cancel when paging</li>
+<li>[<a href='http://jira.jboss.com/jira/browse/JBMESSAGING-617'>JBMESSAGING-617</a>] - Stress tests do not run</li>
+<li>[<a href='http://jira.jboss.com/jira/browse/JBMESSAGING-618'>JBMESSAGING-618</a>] - Failure in stress tests</li>
 </ul>
-<h2 style="margin-left: 40px;">Feature Request</h2>
-<ul style="margin-left: 40px;">
-  <li>[<a href="http://jira.jboss.com/jira/browse/JBMESSAGING-4">JBMESSAGING-4</a>]
-- Load balancing</li>
-  <li>[<a href="http://jira.jboss.com/jira/browse/JBMESSAGING-193">JBMESSAGING-193</a>]
-- Enable configurable timeout on all calls of
-RpcServerCall.remoteInvoke(...)</li>
-  <li>[<a href="http://jira.jboss.com/jira/browse/JBMESSAGING-561">JBMESSAGING-561</a>]
-- Write a simple example (distributed topic) and include it in the set
-shipped with the release</li>
+
+<h2>Feature Request</h2>
+<ul>
+<li>[<a href='http://jira.jboss.com/jira/browse/JBMESSAGING-583'>JBMESSAGING-583</a>] - Add an integer check for release-admin.xml's -Did=...</li>
 </ul>
-<h2 style="margin-left: 40px;">Task</h2>
-<ul style="margin-left: 40px;">
-  <li>[<a href="http://jira.jboss.com/jira/browse/JBMESSAGING-43">JBMESSAGING-43</a>]
-- Change the module name to "messaging"</li>
-  <li>[<a href="http://jira.jboss.com/jira/browse/JBMESSAGING-89">JBMESSAGING-89</a>]
-- Repository reorganization</li>
-  <li>[<a href="http://jira.jboss.com/jira/browse/JBMESSAGING-139">JBMESSAGING-139</a>]
-- Consider whether core can be refactored to remove concept of delivery</li>
-  <li>[<a href="http://jira.jboss.com/jira/browse/JBMESSAGING-175">JBMESSAGING-175</a>]
-- Unnecessary junit.timeout2 used by tests/build.xml</li>
-  <li>[<a href="http://jira.jboss.com/jira/browse/JBMESSAGING-192">JBMESSAGING-192</a>]
-- Refactor Replicator so it won't be forced to provide noop
-implementation for Distributor's methods.</li>
-  <li>[<a href="http://jira.jboss.com/jira/browse/JBMESSAGING-197">JBMESSAGING-197</a>]
-- Refactor Channel, Distributor etc so there is only one receiver per
-channel</li>
-  <li>[<a href="http://jira.jboss.com/jira/browse/JBMESSAGING-199">JBMESSAGING-199</a>]
-- Fix or mothball remotetopic so it does not require multiple
-deliveries per message reference</li>
-  <li>[<a href="http://jira.jboss.com/jira/browse/JBMESSAGING-200">JBMESSAGING-200</a>]
-- Complete XA transaction recovery</li>
-  <li>[<a href="http://jira.jboss.com/jira/browse/JBMESSAGING-227">JBMESSAGING-227</a>]
-- Complete extension of smoke test to deploy/test non-scoped Messaging
-with JBoss 5.0</li>
-  <li>[<a href="http://jira.jboss.com/jira/browse/JBMESSAGING-228">JBMESSAGING-228</a>]
-- Re-enable DistributedTopicTest testDistributedTopic_2() and
-testDistributedTopic_4()</li>
-  <li>[<a href="http://jira.jboss.com/jira/browse/JBMESSAGING-229">JBMESSAGING-229</a>]
-- Peristence Optimizations</li>
-  <li>[<a href="http://jira.jboss.com/jira/browse/JBMESSAGING-255">JBMESSAGING-255</a>]
-- Change signature of core interfaces to deal with MessageReferences
-only</li>
-  <li>[<a href="http://jira.jboss.com/jira/browse/JBMESSAGING-267">JBMESSAGING-267</a>]
-- Re-enable distributed tests</li>
-  <li>[<a href="http://jira.jboss.com/jira/browse/JBMESSAGING-269">JBMESSAGING-269</a>]
-- Review ChannelMapper interface for possible functionality separation</li>
-  <li>[<a href="http://jira.jboss.com/jira/browse/JBMESSAGING-310">JBMESSAGING-310</a>]
-- Investigate whether rw lock on ServerConnectionEndpoint is necessary</li>
-  <li>[<a href="http://jira.jboss.com/jira/browse/JBMESSAGING-319">JBMESSAGING-319</a>]
-- Enable the Messaging build to use component-info.xml and versioned
-dependencies</li>
-  <li>[<a href="http://jira.jboss.com/jira/browse/JBMESSAGING-332">JBMESSAGING-332</a>]
-- Consider how best to factor paging logic out of channel state</li>
-  <li>[<a href="http://jira.jboss.com/jira/browse/JBMESSAGING-398">JBMESSAGING-398</a>]
-- Summarize clustering design discussions and forum threads in a
-Clustering Design document</li>
-  <li>[<a href="http://jira.jboss.com/jira/browse/JBMESSAGING-404">JBMESSAGING-404</a>]
-- Remove Channel::deliver(Receiver r) method</li>
-  <li>[<a href="http://jira.jboss.com/jira/browse/JBMESSAGING-414">JBMESSAGING-414</a>]
-- Simplify delivery hierarchy</li>
-  <li>[<a href="http://jira.jboss.com/jira/browse/JBMESSAGING-422">JBMESSAGING-422</a>]
-- Move channel mapper logic into Queue, Topic, Subscription classes</li>
-  <li>[<a href="http://jira.jboss.com/jira/browse/JBMESSAGING-425">JBMESSAGING-425</a>]
-- Naming of Pipe and Distributed Pipe</li>
-  <li>[<a href="http://jira.jboss.com/jira/browse/JBMESSAGING-444">JBMESSAGING-444</a>]
-- Release 1.2.0.Alpha1</li>
-  <li>[<a href="http://jira.jboss.com/jira/browse/JBMESSAGING-550">JBMESSAGING-550</a>]
-- Add JBoss 4.0.5.CR1 (expanded and installer-generated) to the smoke
-test suite</li>
-  <li>[<a href="http://jira.jboss.com/jira/browse/JBMESSAGING-562">JBMESSAGING-562</a>]
-- Adjust the installation script to support a clustered installation</li>
-  <li>[<a href="http://jira.jboss.com/jira/browse/JBMESSAGING-563">JBMESSAGING-563</a>]
-- Update the documentation with a Clustering Intro</li>
+
+<h2>Patch</h2>
+<ul>
+<li>[<a href='http://jira.jboss.com/jira/browse/JBMESSAGING-625'>JBMESSAGING-625</a>] - ClassCastException String to ManagedDestination</li>
 </ul>
-<br>
-<hr style="width: 100%; height: 2px;">
+
+<h2>Task</h2>
+<ul>
+<li>[<a href='http://jira.jboss.com/jira/browse/JBMESSAGING-289'>JBMESSAGING-289</a>] - Make service container configurable wrt datasource and persistence manager config</li>
+<li>[<a href='http://jira.jboss.com/jira/browse/JBMESSAGING-568'>JBMESSAGING-568</a>] - Complete the configuration section in the Alpha clustering guide</li>
+<li>[<a href='http://jira.jboss.com/jira/browse/JBMESSAGING-571'>JBMESSAGING-571</a>] - Get unicast to work with clustering</li>
+<li>[<a href='http://jira.jboss.com/jira/browse/JBMESSAGING-573'>JBMESSAGING-573</a>] - Add clustering crash and recovery tests to suite</li>
+<li>[<a href='http://jira.jboss.com/jira/browse/JBMESSAGING-575'>JBMESSAGING-575</a>] - Stabilise the default message pull policy</li>
+<li>[<a href='http://jira.jboss.com/jira/browse/JBMESSAGING-577'>JBMESSAGING-577</a>] - Handle sequence numbers properly for state transfer...</li>
+<li>[<a href='http://jira.jboss.com/jira/browse/JBMESSAGING-579'>JBMESSAGING-579</a>] - Improve shared durable subscription tests</li>
+<li>[<a href='http://jira.jboss.com/jira/browse/JBMESSAGING-581'>JBMESSAGING-581</a>] - ServerManagement needs to be extended to start cluster node instances</li>
+<li>[<a href='http://jira.jboss.com/jira/browse/JBMESSAGING-591'>JBMESSAGING-591</a>] - MessageConsumerTest::testTimeoutReceiveOnClose can randomly fail</li>
+<li>[<a href='http://jira.jboss.com/jira/browse/JBMESSAGING-597'>JBMESSAGING-597</a>] - Tracker task for JBSHOTOKU-101 (blogs dont show up in our Labs project blog area)</li>
+<li>[<a href='http://jira.jboss.com/jira/browse/JBMESSAGING-601'>JBMESSAGING-601</a>] - Place Messaging artifacts in the repository</li>
+<li>[<a href='http://jira.jboss.com/jira/browse/JBMESSAGING-610'>JBMESSAGING-610</a>] - Merge 1.0.1.GA changes (Branch_1_0) into the trunk</li>
+<li>[<a href='http://jira.jboss.com/jira/browse/JBMESSAGING-614'>JBMESSAGING-614</a>] - Remove shutdown logger</li>
+<li>[<a href='http://jira.jboss.com/jira/browse/JBMESSAGING-621'>JBMESSAGING-621</a>] - Modify the smoke test suite to run tests in top of JBoss 4.0.5.GA instead of 4.0.5.CR1</li>
+</ul>
+
+
+
 </body>
 </html>

Modified: branches/Branch_Client_Failover_Experiment/docs/clustering/en/modules/configuration.xml
===================================================================
--- branches/Branch_Client_Failover_Experiment/docs/clustering/en/modules/configuration.xml	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/docs/clustering/en/modules/configuration.xml	2006-11-21 21:23:34 UTC (rev 1613)
@@ -61,12 +61,12 @@
 
    <programlisting>
    &lt;mbean code="org.jboss.messaging.core.plugin.ClusteredPostOfficeService"
-         name="jboss.messaging:service=TopicPostOffice"
+         name="jboss.messaging:service=QueuePostOffice"
          xmbean-dd="xmdesc/ClusteredPostOffice-xmbean.xml"&gt;
          &lt;depends optional-attribute-name="ServerPeer"&gt;jboss.messaging:service=ServerPeer&lt;/depends&gt;
          &lt;depends&gt;jboss.jca:service=DataSourceBinding,name=DefaultDS&lt;/depends&gt;
          &lt;depends optional-attribute-name="TransactionManager"&gt;jboss:service=TransactionManager&lt;/depends&gt;
-         &lt;attribute name="PostOfficeName"&gt;Clustered Topic&lt;/attribute&gt;
+         &lt;attribute name="PostOfficeName"&gt;Clustered Queue&lt;/attribute&gt;
          &lt;attribute name="DataSource"&gt;java:/DefaultDS&lt;/attribute&gt;
          &lt;attribute name="CreateTablesOnStartup"&gt;true&lt;/attribute&gt;
          &lt;attribute name="SqlProperties"&gt;&lt;![CDATA[
@@ -75,7 +75,7 @@
    DELETE_BINDING=DELETE FROM JMS_POSTOFFICE WHERE POSTOFFICE_NAME=? AND NODE_ID=? AND QUEUE_NAME=?
    LOAD_BINDINGS=SELECT NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID FROM JMS_POSTOFFICE WHERE POSTOFFICE_NAME  = ?
          ]]&gt;&lt;/attribute&gt;
-         &lt;attribute name="GroupName"&gt;Topic&lt;/attribute&gt;
+         &lt;attribute name="GroupName"&gt;Queue&lt;/attribute&gt;
          &lt;attribute name="StateTimeout"&gt;5000&lt;/attribute&gt;
          &lt;attribute name="CastTimeout"&gt;5000&lt;/attribute&gt;
          &lt;attribute name="StatsSendPeriod"&gt;10000&lt;/attribute&gt;
@@ -85,7 +85,7 @@
          &lt;attribute name="AsyncChannelConfig"&gt;
             &lt;config&gt;
                &lt;UDP mcast_recv_buf_size="500000" down_thread="false" ip_mcast="true" mcast_send_buf_size="32000"
-              mcast_port="45569" ucast_recv_buf_size="500000" use_incoming_packet_handler="false"
+              mcast_port="45567" ucast_recv_buf_size="500000" use_incoming_packet_handler="false"
               mcast_addr="228.8.8.8" use_outgoing_packet_handler="true" loopback="true" ucast_send_buf_size="32000" ip_ttl="32" bind_addr="127.0.0.1"/&gt;
                &lt;AUTOCONF down_thread="false" up_thread="false"/&gt;
                &lt;PING timeout="2000" down_thread="false" num_initial_members="3" up_thread="false"/&gt;
@@ -105,7 +105,7 @@
          &lt;attribute name="SyncChannelConfig"&gt;
             &lt;config&gt;
                &lt;UDP mcast_recv_buf_size="500000" down_thread="false" ip_mcast="true" mcast_send_buf_size="32000"
-              mcast_port="45570" ucast_recv_buf_size="500000" use_incoming_packet_handler="false"
+              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="true" ucast_send_buf_size="32000" ip_ttl="32" bind_addr="127.0.0.1"/&gt;
                &lt;AUTOCONF down_thread="false" up_thread="false"/&gt;
                &lt;PING timeout="2000" down_thread="false" num_initial_members="3" up_thread="false"/&gt;
@@ -161,7 +161,8 @@
      <para>
         The fully qualified class name of the class that implements the MessagePullPolicy.
         To specify different message pull policies this can be changed.
-        In the Alpha1 release only the NullMessagePullPolicy is stable.
+        To disable message redistribution specify org.jboss.messaging.core.plugin.postoffice.cluster.NullMessagePullPolicy.
+        To enable default message redistribution specify org.jboss.messaging.core.plugin.postoffice.cluster.DefaultMessagePullPolicy.
      </para>
    </section>
 

Modified: branches/Branch_Client_Failover_Experiment/docs/examples/ejb3mdb/README.html
===================================================================
--- branches/Branch_Client_Failover_Experiment/docs/examples/ejb3mdb/README.html	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/docs/examples/ejb3mdb/README.html	2006-11-21 21:23:34 UTC (rev 1613)
@@ -87,8 +87,9 @@
 use the JBoss Installer.<br>
 <br>
 <span style="font-weight: bold;">Note</span>: The current example was
-tested with <span class="tdwn">JBoss EJB 3.0 RC5 - PFD</span> but more
-recent EJB3 versions are liable to introduce API changes that may break
+tested with <span class="tdwn">the EJB3 release bundled with JBoss
+4.0.5. Earlier </span>EJB3 versions may use slightly different APIs
+that may break
 the example. If this is the case, please modify the example
 accordingly. Most likely, you will only need to modify the import fully
 qualified class names.<br>
@@ -176,7 +177,7 @@
 sent to the testQueue queue<br>
 &nbsp;&nbsp;&nbsp;&nbsp; [java] Received message: !olleH<br>
 &nbsp;&nbsp;&nbsp;&nbsp; [java] The example connected to JBoss
-Messaging version 1.0.1.CR3 (1.0)<br>
+Messaging version 1.0.1.GA (1.0)<br>
       <br>
 &nbsp;&nbsp;&nbsp;&nbsp; [java] #####################<br>
 &nbsp;&nbsp;&nbsp;&nbsp; [java] ###&nbsp;&nbsp;&nbsp;

Modified: branches/Branch_Client_Failover_Experiment/docs/examples/ejb3mdb/build.xml
===================================================================
--- branches/Branch_Client_Failover_Experiment/docs/examples/ejb3mdb/build.xml	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/docs/examples/ejb3mdb/build.xml	2006-11-21 21:23:34 UTC (rev 1613)
@@ -79,15 +79,12 @@
    </target>
 
    <target name="jar" depends="compile">
-      <!-- TODO: uncomment this when http://jira.jboss.org/jira/browse/JBMESSAGING-351 is done -->
-      <!--
       <copy todir="./output/classes/META-INF" filtering="true">
          <fileset dir="./etc/META-INF" includes="*"/>
          <filterset>
             <filter token="QUEUE_NAME" value="${example.queue.name}"/>
          </filterset>
       </copy>
-      -->
       <jar destfile="./output/lib/mdb-example.ejb3"
            basedir="./output/classes"
            includes="META-INF/**,org/jboss/example/**/EJB3MDBExample.class"/>

Modified: branches/Branch_Client_Failover_Experiment/docs/examples/ejb3mdb/do-not-distribute.properties
===================================================================
--- branches/Branch_Client_Failover_Experiment/docs/examples/ejb3mdb/do-not-distribute.properties	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/docs/examples/ejb3mdb/do-not-distribute.properties	2006-11-21 21:23:34 UTC (rev 1613)
@@ -4,4 +4,5 @@
 #
 messaging.client.jar.path=../../../output/lib
 messaging.client.jar.name=jboss-messaging-client.jar
-jboss.configuration=messaging
+jboss.configuration=messaging-smoke-test
+jboss.home=C:\\work\\src\\jboss-4.0.5.CR1-src\\build\\output\\jboss-4.0.5.CR1-ejb3

Modified: branches/Branch_Client_Failover_Experiment/docs/examples/ejb3mdb/src/org/jboss/example/jms/ejb3mdb/EJB3MDBExample.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/docs/examples/ejb3mdb/src/org/jboss/example/jms/ejb3mdb/EJB3MDBExample.java	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/docs/examples/ejb3mdb/src/org/jboss/example/jms/ejb3mdb/EJB3MDBExample.java	2006-11-21 21:23:34 UTC (rev 1613)
@@ -8,7 +8,6 @@
 
 import javax.ejb.ActivationConfigProperty;
 import javax.ejb.MessageDriven;
-import javax.ejb.MessageDrivenContext;
 
 import javax.naming.InitialContext;
 import javax.jms.TextMessage;

Modified: branches/Branch_Client_Failover_Experiment/docs/examples/http/README.html
===================================================================
--- branches/Branch_Client_Failover_Experiment/docs/examples/http/README.html	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/docs/examples/http/README.html	2006-11-21 21:23:34 UTC (rev 1613)
@@ -142,7 +142,7 @@
 the testQueue queue<br>
 &nbsp;&nbsp;&nbsp;&nbsp; [java] Received message: Hello!<br>
 &nbsp;&nbsp;&nbsp;&nbsp; [java] The example connected to JBoss
-Messaging version 1.0.1.CR3 (1.0)<br>
+Messaging version 1.0.1.GA (1.0)<br>
       <br>
 &nbsp;&nbsp;&nbsp;&nbsp; [java] #####################<br>
 &nbsp;&nbsp;&nbsp;&nbsp; [java] ###&nbsp;&nbsp;&nbsp;

Modified: branches/Branch_Client_Failover_Experiment/docs/examples/mdb/README.html
===================================================================
--- branches/Branch_Client_Failover_Experiment/docs/examples/mdb/README.html	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/docs/examples/mdb/README.html	2006-11-21 21:23:34 UTC (rev 1613)
@@ -132,7 +132,7 @@
 sent to the testQueue queue<br>
 &nbsp;&nbsp;&nbsp;&nbsp; [java] Received message: !olleH<br>
 &nbsp;&nbsp;&nbsp;&nbsp; [java] The example connected to JBoss
-Messaging version 1.0.1.CR3 (1.0)<br>
+Messaging version 1.0.1.GA (1.0)<br>
       <br>
 &nbsp;&nbsp;&nbsp;&nbsp; [java] #####################<br>
 &nbsp;&nbsp;&nbsp;&nbsp; [java] ###&nbsp;&nbsp;&nbsp;

Modified: branches/Branch_Client_Failover_Experiment/docs/examples/queue/README.html
===================================================================
--- branches/Branch_Client_Failover_Experiment/docs/examples/queue/README.html	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/docs/examples/queue/README.html	2006-11-21 21:23:34 UTC (rev 1613)
@@ -104,7 +104,7 @@
 the testQueue queue<br>
 &nbsp;&nbsp;&nbsp;&nbsp; [java] Received message: Hello!<br>
 &nbsp;&nbsp;&nbsp;&nbsp; [java] The example connected to JBoss
-Messaging version 1.0.1.CR3 (1.0)<br>
+Messaging version 1.0.1.GA (1.0)<br>
       <br>
 &nbsp;&nbsp;&nbsp;&nbsp; [java] #####################<br>
 &nbsp;&nbsp;&nbsp;&nbsp; [java] ###&nbsp;&nbsp;&nbsp;

Modified: branches/Branch_Client_Failover_Experiment/docs/examples/secure-socket/README.html
===================================================================
--- branches/Branch_Client_Failover_Experiment/docs/examples/secure-socket/README.html	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/docs/examples/secure-socket/README.html	2006-11-21 21:23:34 UTC (rev 1613)
@@ -142,7 +142,7 @@
 the testQueue queue<br>
 &nbsp;&nbsp;&nbsp;&nbsp; [java] Received message: Hello!<br>
 &nbsp;&nbsp;&nbsp;&nbsp; [java] The example connected to JBoss
-Messaging version 1.0.1.CR3 (1.0)<br>
+Messaging version 1.0.1.GA (1.0)<br>
       <br>
 &nbsp;&nbsp;&nbsp;&nbsp; [java] #####################<br>
 &nbsp;&nbsp;&nbsp;&nbsp; [java] ###&nbsp;&nbsp;&nbsp;

Modified: branches/Branch_Client_Failover_Experiment/docs/examples/stateless/src/org/jboss/example/jms/stateless/bean/StatelessSessionExample.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/docs/examples/stateless/src/org/jboss/example/jms/stateless/bean/StatelessSessionExample.java	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/docs/examples/stateless/src/org/jboss/example/jms/stateless/bean/StatelessSessionExample.java	2006-11-21 21:23:34 UTC (rev 1613)
@@ -6,9 +6,8 @@
  */
 package org.jboss.example.jms.stateless.bean;
 
-import javax.ejb.EJBObject;
-import java.util.List;
 import java.rmi.RemoteException;
+import javax.ejb.EJBObject;
 
 /**
  * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
@@ -21,6 +20,6 @@
 {
    public void drain(String queueName) throws RemoteException, Exception;
    public void send(String txt, String queueName) throws RemoteException, Exception;
-   public List browse(String queueName) throws RemoteException, Exception;
+   public int browse(String queueName) throws RemoteException, Exception;
    public String receive(String queueName) throws RemoteException, Exception;
 }

Modified: branches/Branch_Client_Failover_Experiment/docs/examples/stateless/src/org/jboss/example/jms/stateless/bean/StatelessSessionExampleBean.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/docs/examples/stateless/src/org/jboss/example/jms/stateless/bean/StatelessSessionExampleBean.java	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/docs/examples/stateless/src/org/jboss/example/jms/stateless/bean/StatelessSessionExampleBean.java	2006-11-21 21:23:34 UTC (rev 1613)
@@ -6,15 +6,14 @@
  */
 package org.jboss.example.jms.stateless.bean;
 
-import javax.jms.*;
+import java.rmi.RemoteException;
+import java.util.ArrayList;
+import java.util.Enumeration;
 import javax.ejb.EJBException;
 import javax.ejb.SessionBean;
 import javax.ejb.SessionContext;
+import javax.jms.*;
 import javax.naming.InitialContext;
-import java.rmi.RemoteException;
-import java.util.List;
-import java.util.Enumeration;
-import java.util.ArrayList;
 
 /**
  * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
@@ -90,7 +89,7 @@
       }
    }
 
-   public List browse(String queueName) throws Exception
+   public int browse(String queueName) throws Exception
    {
       InitialContext ic = new InitialContext();
       Queue queue = (Queue)ic.lookup(queueName);
@@ -111,7 +110,7 @@
             list.add(e.nextElement());
          }
 
-         return list;
+         return list.size();
       }
       finally
       {

Modified: branches/Branch_Client_Failover_Experiment/docs/examples/stateless/src/org/jboss/example/jms/stateless/client/Client.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/docs/examples/stateless/src/org/jboss/example/jms/stateless/client/Client.java	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/docs/examples/stateless/src/org/jboss/example/jms/stateless/client/Client.java	2006-11-21 21:23:34 UTC (rev 1613)
@@ -21,14 +21,11 @@
 */
 package org.jboss.example.jms.stateless.client;
 
+import javax.naming.InitialContext;
 import org.jboss.example.jms.common.ExampleSupport;
-import org.jboss.example.jms.stateless.bean.StatelessSessionExampleHome;
 import org.jboss.example.jms.stateless.bean.StatelessSessionExample;
+import org.jboss.example.jms.stateless.bean.StatelessSessionExampleHome;
 
-import javax.naming.InitialContext;
-import javax.jms.TextMessage;
-import java.util.List;
-
 /**
  * This example deploys a simple Stateless Session Bean that is used as a proxy to send and receive
  * JMS messages in a managed environment.
@@ -67,28 +64,25 @@
 
 
       bean.drain(queueName);
-            
 
 
 
+
       bean.send("Hello!", queueName);
       log("The " + text + " message was successfully sent to the " + queueName + " queue");
 
 
-      List list = bean.browse(queueName);
+      int num = bean.browse(queueName);
 
 
 
-      assertEquals(1, list.size());
-      assertEquals("Hello!", ((TextMessage)list.get(0)).getText());
+      assertEquals(1, num);
 
 
+      log("Queue browse result: " + num);
 
-      log("Queue browse result: " + ((TextMessage)list.get(0)).getText());
 
 
-
-
       String result = bean.receive(queueName);
       log("Received " + result);
 

Modified: branches/Branch_Client_Failover_Experiment/docs/examples/topic/README.html
===================================================================
--- branches/Branch_Client_Failover_Experiment/docs/examples/topic/README.html	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/docs/examples/topic/README.html	2006-11-21 21:23:34 UTC (rev 1613)
@@ -100,7 +100,7 @@
 on the topic<br>
 &nbsp;&nbsp;&nbsp;&nbsp; [java] Received message: Hello!<br>
 &nbsp;&nbsp;&nbsp;&nbsp; [java] The example connected to JBoss
-Messaging version 1.0.1.CR3 (1.0)<br>
+Messaging version 1.0.1.GA (1.0)<br>
       <br>
 &nbsp;&nbsp;&nbsp;&nbsp; [java] #####################<br>
 &nbsp;&nbsp;&nbsp;&nbsp; [java] ###&nbsp;&nbsp;&nbsp;

Modified: branches/Branch_Client_Failover_Experiment/docs/gettingstarted/en/modules/installation.xml
===================================================================
--- branches/Branch_Client_Failover_Experiment/docs/gettingstarted/en/modules/installation.xml	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/docs/gettingstarted/en/modules/installation.xml	2006-11-21 21:23:34 UTC (rev 1613)
@@ -82,7 +82,7 @@
                          Using an isolation level less strict than READ_COMMITTED may lead to data consistency problems.
                          Using an isolation level more strict than READ_COMMITTED may lead to deadlock.
 
-14:23:57,276 INFO  [ServerPeer] JBoss Messaging 1.0.1.CR3 server [server.0] started
+14:23:57,276 INFO  [ServerPeer] JBoss Messaging 1.0.1.GA server [server.0] started
 14:23:57,937 INFO  [ConnectionFactory] Connector has leasing enabled, lease period 20000 milliseconds
 14:23:57,937 INFO  [ConnectionFactory] [/ConnectionFactory, /XAConnectionFactory, java:/ConnectionFactory, java:/XAConnectionFactory] deployed
 14:23:57,987 INFO  [Queue] Queue[/queue/DLQ] started, fullSize=75000, pageSize=2000, downCacheSize=2000

Modified: branches/Branch_Client_Failover_Experiment/messaging.iml
===================================================================
--- branches/Branch_Client_Failover_Experiment/messaging.iml	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/messaging.iml	2006-11-21 21:23:34 UTC (rev 1613)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <module version="4" relativePaths="true" type="JAVA_MODULE">
   <component name="ModuleRootManager" />
-  <component name="NewModuleRootManager">
+  <component name="NewModuleRootManager" inherit-compiler-output="false">
     <output url="file://$MODULE_DIR$/classes" />
     <exclude-output />
     <content url="file://$MODULE_DIR$">

Modified: branches/Branch_Client_Failover_Experiment/messaging.ipr
===================================================================
--- branches/Branch_Client_Failover_Experiment/messaging.ipr	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/messaging.ipr	2006-11-21 21:23:34 UTC (rev 1613)
@@ -12,13 +12,19 @@
       <properties />
     </buildFile>
   </component>
+  <component name="BuildJarProjectSettings">
+    <option name="BUILD_JARS_ON_MAKE" value="false" />
+  </component>
+  <component name="CodeStyleProjectProfileManger">
+    <option name="PROJECT_PROFILE" />
+    <option name="USE_PROJECT_LEVEL_SETTINGS" value="false" />
+  </component>
   <component name="CodeStyleSettingsManager">
     <option name="PER_PROJECT_SETTINGS" />
     <option name="USE_PER_PROJECT_SETTINGS" value="false" />
   </component>
   <component name="CompilerConfiguration">
     <option name="DEFAULT_COMPILER" value="Javac" />
-    <option name="CLEAR_OUTPUT_DIRECTORY" value="false" />
     <option name="DEPLOY_AFTER_MAKE" value="0" />
     <resourceExtensions>
       <entry name=".+\.(properties|xml|html|dtd|tld)" />
@@ -41,6 +47,20 @@
     <option name="myForwardDirection" value="false" />
   </component>
   <component name="DependencyValidationManager" />
+  <component name="EclipseCompilerSettings">
+    <option name="DEBUGGING_INFO" value="true" />
+    <option name="GENERATE_NO_WARNINGS" value="true" />
+    <option name="DEPRECATION" value="false" />
+    <option name="ADDITIONAL_OPTIONS_STRING" value="" />
+    <option name="MAXIMUM_HEAP_SIZE" value="128" />
+  </component>
+  <component name="EclipseEmbeddedCompilerSettings">
+    <option name="DEBUGGING_INFO" value="true" />
+    <option name="GENERATE_NO_WARNINGS" value="true" />
+    <option name="DEPRECATION" value="false" />
+    <option name="ADDITIONAL_OPTIONS_STRING" value="" />
+    <option name="MAXIMUM_HEAP_SIZE" value="128" />
+  </component>
   <component name="EntryPointsManager">
     <entry_points />
   </component>
@@ -50,6 +70,36 @@
     <option name="OUTPUT_DIRECTORY" />
   </component>
   <component name="GUI Designer component loader factory" />
+  <component name="IdProvider" IDEtalkID="598BFEB0C246A693943DB46D674F660C" />
+  <component name="InspectionProjectProfileManager">
+    <option name="PROJECT_PROFILE" value="Project Default" />
+    <option name="USE_PROJECT_LEVEL_SETTINGS" value="false" />
+    <scopes />
+    <profiles>
+      <profile version="1.0" is_locked="false">
+        <option name="myName" value="Project Default" />
+        <option name="myLocal" value="false" />
+        <used_levels>
+          <error>
+            <option name="myName" value="ERROR" />
+            <option name="myVal" value="400" />
+          </error>
+          <warning>
+            <option name="myName" value="WARNING" />
+            <option name="myVal" value="300" />
+          </warning>
+          <information>
+            <option name="myName" value="INFO" />
+            <option name="myVal" value="200" />
+          </information>
+          <server>
+            <option name="myName" value="SERVER PROBLEM" />
+            <option name="myVal" value="100" />
+          </server>
+        </used_levels>
+      </profile>
+    </profiles>
+  </component>
   <component name="JavacSettings">
     <option name="DEBUGGING_INFO" value="true" />
     <option name="GENERATE_NO_WARNINGS" value="false" />
@@ -71,6 +121,7 @@
     <option name="OPTION_DEPRECATED_LIST" value="true" />
     <option name="OTHER_OPTIONS" value="" />
     <option name="HEAP_SIZE" />
+    <option name="LOCALE" />
     <option name="OPEN_IN_BROWSER" value="true" />
   </component>
   <component name="JikesSettings">
@@ -81,108 +132,131 @@
     <option name="IS_EMACS_ERRORS_MODE" value="true" />
     <option name="ADDITIONAL_OPTIONS_STRING" value="" />
   </component>
+  <component name="LogConsolePreferences">
+    <option name="FILTER_ERRORS" value="false" />
+    <option name="FILTER_WARNINGS" value="false" />
+    <option name="FILTER_INFO" value="true" />
+    <option name="CUSTOM_FILTER" />
+  </component>
   <component name="Palette2">
     <group name="Swing">
-      <item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false">
+      <item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
         <default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
       </item>
-      <item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false">
+      <item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
         <default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
       </item>
-      <item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false">
+      <item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
         <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
       </item>
-      <item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false">
+      <item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
         <default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
       </item>
-      <item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false">
+      <item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
         <default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
         <initial-values>
           <property name="text" value="Button" />
         </initial-values>
       </item>
-      <item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false">
+      <item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
         <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
         <initial-values>
           <property name="text" value="RadioButton" />
         </initial-values>
       </item>
-      <item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false">
+      <item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
         <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
         <initial-values>
           <property name="text" value="CheckBox" />
         </initial-values>
       </item>
-      <item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false">
+      <item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
         <default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
         <initial-values>
           <property name="text" value="Label" />
         </initial-values>
       </item>
-      <item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false">
+      <item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
         <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
           <preferred-size width="150" height="-1" />
         </default-constraints>
       </item>
-      <item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false">
+      <item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
         <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
           <preferred-size width="150" height="-1" />
         </default-constraints>
       </item>
-      <item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false">
+      <item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
         <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
           <preferred-size width="150" height="-1" />
         </default-constraints>
       </item>
-      <item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false">
+      <item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
         <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
           <preferred-size width="150" height="50" />
         </default-constraints>
       </item>
-      <item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false">
+      <item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
         <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
           <preferred-size width="150" height="50" />
         </default-constraints>
       </item>
-      <item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false">
+      <item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
         <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
           <preferred-size width="150" height="50" />
         </default-constraints>
       </item>
-      <item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false">
+      <item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
         <default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
       </item>
-      <item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false">
+      <item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
         <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
           <preferred-size width="150" height="50" />
         </default-constraints>
       </item>
-      <item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false">
+      <item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
         <default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
           <preferred-size width="150" height="50" />
         </default-constraints>
       </item>
-      <item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false">
+      <item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
         <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
           <preferred-size width="150" height="50" />
         </default-constraints>
       </item>
-      <item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false">
+      <item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
         <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
           <preferred-size width="200" height="200" />
         </default-constraints>
       </item>
-      <item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false">
+      <item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
         <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
           <preferred-size width="200" height="200" />
         </default-constraints>
       </item>
-      <item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false">
+      <item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
         <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
       </item>
-      <item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false">
+      <item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
         <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
       </item>
+      <item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
+      </item>
+      <item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
+      </item>
+      <item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
+          <preferred-size width="-1" height="20" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
+      </item>
+      <item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
+      </item>
     </group>
   </component>
   <component name="ProjectModuleManager">
@@ -191,6 +265,7 @@
     </modules>
   </component>
   <component name="ProjectRootManager" version="2" assert-keyword="true" jdk-15="true" project-jdk-name="1.5" />
+  <component name="ProjectRunConfigurationManager" />
   <component name="RmicSettings">
     <option name="IS_EANABLED" value="false" />
     <option name="DEBUGGING_INFO" value="true" />
@@ -198,10 +273,20 @@
     <option name="GENERATE_IIOP_STUBS" value="false" />
     <option name="ADDITIONAL_OPTIONS_STRING" value="" />
   </component>
+  <component name="StarteamVcsAdapter" />
+  <component name="VssVcs" />
+  <component name="com.intellij.jsf.UserDefinedFacesConfigs">
+    <option name="USER_DEFINED_CONFIGS">
+      <value>
+        <list size="0" />
+      </value>
+    </option>
+  </component>
   <component name="libraryTable" />
   <component name="uidesigner-configuration">
     <option name="INSTRUMENT_CLASSES" value="true" />
     <option name="COPY_FORMS_RUNTIME_TO_OUTPUT" value="true" />
+    <option name="DEFAULT_LAYOUT_MANAGER" value="GridLayoutManager" />
   </component>
   <UsedPathMacros />
 </project>

Modified: branches/Branch_Client_Failover_Experiment/readme-ha-experiment.txt
===================================================================
--- branches/Branch_Client_Failover_Experiment/readme-ha-experiment.txt	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/readme-ha-experiment.txt	2006-11-21 21:23:34 UTC (rev 1613)
@@ -6,3 +6,7 @@
 svn merge  https://svn.jboss.org/repos/messaging/trunk@1451 https://svn.jboss.org/repos/messaging/trunk
 
 (when trunk was at 1517)
+
+
+svn merge -r 1517:HEAD https://svn.jboss.org/repos/messaging/trunk
+(Head was on 1540)

Modified: branches/Branch_Client_Failover_Experiment/src/etc/server/default/deploy/mssql-persistence-service.xml
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/etc/server/default/deploy/mssql-persistence-service.xml	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/src/etc/server/default/deploy/mssql-persistence-service.xml	2006-11-21 21:23:34 UTC (rev 1613)
@@ -1,84 +1,84 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-     Microsoft SQL Server persistence deployment descriptor.
-
-     $Id: postgresql-persistence-service.xml 1222 2006-08-10 18:51:44Z ovidiu.feodorov at jboss.com $
- -->
-
-<server>
-
-   <mbean code="org.jboss.messaging.core.plugin.JDBCPersistenceManager"
-          name="jboss.messaging:service=PersistenceManager"
-          xmbean-dd="xmdesc/JDBCPersistenceManager-xmbean.xml">
-      <depends>jboss.jca:service=DataSourceBinding,name=MSSQLDS</depends>
-      <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
-      <depends optional-attribute-name="ChannelMapper">jboss.messaging:service=ChannelMapper</depends>
-      <attribute name="DataSource">java:/MSSQLDS</attribute>
-      <attribute name="CreateTablesOnStartup">true</attribute>
-      <attribute name="UsingBatchUpdates">true</attribute>
-      <attribute name="SqlProperties"><![CDATA[
-CREATE_MESSAGE_REF=CREATE TABLE JMS_MESSAGE_REFERENCE (CHANNELID BIGINT, MESSAGEID BIGINT, TRANSACTIONID BIGINT, STATE CHAR(1), ORD BIGINT, DELIVERYCOUNT INTEGER, RELIABLE CHAR(1), LOADED CHAR(1), PRIMARY KEY(CHANNELID, MESSAGEID))
-CREATE_IDX_MESSAGE_REF_TX=CREATE INDEX JMS_MESSAGE_REF_TX ON JMS_MESSAGE_REFERENCE (TRANSACTIONID)
-CREATE_IDX_MESSAGE_REF_ORD=CREATE INDEX JMS_MESSAGE_REF_ORD ON JMS_MESSAGE_REFERENCE (ORD)
-CREATE_IDX_MESSAGE_REF_MESSAGEID=CREATE INDEX JMS_MESSAGE_REF_MESSAGEID ON JMS_MESSAGE_REFERENCE (MESSAGEID)
-CREATE_IDX_MESSAGE_REF_LOADED=CREATE INDEX JMS_MESSAGE_REF_LOADED ON JMS_MESSAGE_REFERENCE (LOADED)
-CREATE_IDX_MESSAGE_REF_RELIABLE=CREATE INDEX JMS_MESSAGE_REF_RELIABLE ON JMS_MESSAGE_REFERENCE (RELIABLE)
-INSERT_MESSAGE_REF=INSERT INTO JMS_MESSAGE_REFERENCE (CHANNELID, MESSAGEID, TRANSACTIONID, STATE, ORD, DELIVERYCOUNT, RELIABLE, LOADED) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
-DELETE_MESSAGE_REF=DELETE FROM JMS_MESSAGE_REFERENCE WHERE MESSAGEID=? AND CHANNELID=? AND STATE='C'
-UPDATE_MESSAGE_REF=UPDATE JMS_MESSAGE_REFERENCE SET TRANSACTIONID=?, STATE='-' WHERE MESSAGEID=? AND CHANNELID=? AND STATE='C'
-UPDATE_MESSAGE_REF_NOT_LOADED=UPDATE JMS_MESSAGE_REFERENCE SET LOADED='N' WHERE MESSAGEID=? AND CHANNELID=?
-COMMIT_MESSAGE_REF1=UPDATE JMS_MESSAGE_REFERENCE SET STATE='C', TRANSACTIONID = NULL WHERE TRANSACTIONID=? AND STATE='+'
-COMMIT_MESSAGE_REF2=DELETE FROM JMS_MESSAGE_REFERENCE WHERE TRANSACTIONID=? AND STATE='-'
-ROLLBACK_MESSAGE_REF1=DELETE FROM JMS_MESSAGE_REFERENCE WHERE TRANSACTIONID=? AND STATE='+'
-ROLLBACK_MESSAGE_REF2=UPDATE JMS_MESSAGE_REFERENCE SET STATE='C', TRANSACTIONID = NULL WHERE TRANSACTIONID=? AND STATE='-'
-LOAD_REF_INFO=SELECT MESSAGEID, ORD, DELIVERYCOUNT, RELIABLE FROM JMS_MESSAGE_REFERENCE WHERE CHANNELID=? AND STATE <> '+' AND LOADED = 'N' AND ORD BETWEEN ? AND ? ORDER BY ORD
-SELECT_COUNT_REFS=SELECT COUNT(MESSAGEID) FROM JMS_MESSAGE_REFERENCE WHERE CHANNELID=? AND STATE <> '+' AND LOADED='N'
-UPDATE_RELIABLE_REFS=UPDATE JMS_MESSAGE_REFERENCE SET LOADED='Y' WHERE ORD BETWEEN ? AND ? AND CHANNELID=? AND RELIABLE='Y' AND STATE <> '+'
-UPDATE_RELIABLE_REFS_NOT_LOADED=UPDATE JMS_MESSAGE_REFERENCE SET LOADED='N' WHERE CHANNELID=?
-SELECT_MIN_ORDERING=SELECT MIN(ORD) FROM JMS_MESSAGE_REFERENCE WHERE CHANNELID=? AND STATE <> '+' AND LOADED = 'N'
-DELETE_UNRELIABLE_REFS=DELETE FROM JMS_MESSAGE_REFERENCE WHERE RELIABLE = 'N'
-CREATE_MESSAGE=CREATE TABLE JMS_MESSAGE (MESSAGEID BIGINT, RELIABLE CHAR(1), EXPIRATION BIGINT, TIMESTAMP BIGINT, PRIORITY TINYINT, COREHEADERS IMAGE, PAYLOAD IMAGE, CHANNELCOUNT INTEGER, TYPE TINYINT, JMSTYPE VARCHAR(255), CORRELATIONID VARCHAR(255), CORRELATIONID_BYTES IMAGE, DESTINATION_ID BIGINT, REPLYTO_ID BIGINT, JMSPROPERTIES IMAGE, PRIMARY KEY (MESSAGEID))
-LOAD_MESSAGES=SELECT MESSAGEID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, COREHEADERS, PAYLOAD, CHANNELCOUNT, TYPE, JMSTYPE, CORRELATIONID, CORRELATIONID_BYTES, DESTINATION_ID, REPLYTO_ID, JMSPROPERTIES FROM JMS_MESSAGE
-INSERT_MESSAGE=INSERT INTO JMS_MESSAGE (MESSAGEID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, COREHEADERS, PAYLOAD, CHANNELCOUNT, TYPE, JMSTYPE, CORRELATIONID, CORRELATIONID_BYTES, DESTINATION_ID, REPLYTO_ID, JMSPROPERTIES) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
-UPDATE_MESSAGE_CHANNELCOUNT=UPDATE JMS_MESSAGE SET CHANNELCOUNT=? WHERE MESSAGEID=?
-DELETE_MESSAGE=DELETE FROM JMS_MESSAGE WHERE MESSAGEID=?
-MESSAGEID_COLUMN=MESSAGEID
-UPDATE_UNRELIABLE_CHANNELCOUNT=UPDATE JMS_MESSAGE M SET M.CHANNELCOUNT = M.CHANNELCOUNT - 1 WHERE M.MESSAGEID IN (SELECT MR.MESSAGEID FROM JMS_MESSAGE_REFERENCE MR WHERE MR.RELIABLE = 'N' AND MR.CHANNELID = ?)
-DELETE_UNREFFED_MESSAGES=DELETE FROM JMS_MESSAGE WHERE CHANNELCOUNT = 0
-CREATE_TRANSACTION=CREATE TABLE JMS_TRANSACTION (TRANSACTIONID BIGINT, BRANCH_QUAL IMAGE, FORMAT_ID INTEGER, GLOBAL_TXID IMAGE, PRIMARY KEY (TRANSACTIONID))
-INSERT_TRANSACTION=INSERT INTO JMS_TRANSACTION (TRANSACTIONID, BRANCH_QUAL, FORMAT_ID, GLOBAL_TXID) VALUES(?, ?, ?, ?)
-DELETE_TRANSACTION=DELETE FROM JMS_TRANSACTION WHERE TRANSACTIONID = ?
-SELECT_PREPARED_TRANSACTIONS=SELECT TRANSACTIONID, BRANCH_QUAL, FORMAT_ID, GLOBAL_TXID FROM JMS_TRANSACTION
-DELETE_ALL_TRANSACTIONS=DELETE FROM JMS_TRANSACTION
-CREATE_COUNTER=CREATE TABLE JMS_COUNTER (NAME VARCHAR(255), NEXT_ID BIGINT, PRIMARY KEY(NAME))
-UPDATE_COUNTER=UPDATE JMS_COUNTER SET NEXT_ID = ? WHERE NAME=?
-SELECT_COUNTER=SELECT NEXT_ID FROM JMS_COUNTER WHERE NAME=?
-INSERT_COUNTER=INSERT INTO JMS_COUNTER (NAME, NEXT_ID) VALUES (?, ?)
-DELETE_ALL_COUNTERS=DELETE FROM JMS_COUNTER
-SELECT_ALL_CHANNELS=SELECT DISTINCT(CHANNELID) FROM JMS_MESSAGE_REFERENCE
-           ]]></attribute>
-      <attribute name="MaxParams">500</attribute>
-   </mbean>
-
-   <mbean code="org.jboss.jms.server.plugin.JDBCChannelMapper"
-          name="jboss.messaging:service=ChannelMapper"
-          xmbean-dd="xmdesc/JDBCChannelMapper-xmbean.xml">
-      <depends>jboss.jca:service=DataSourceBinding,name=MSSQLDS</depends>
-      <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
-      <attribute name="DataSource">java:/MSSQLDS</attribute>
-      <attribute name="CreateTablesOnStartup">true</attribute>
-      <attribute name="SqlProperties"><![CDATA[
-CREATE_USER_TABLE=CREATE TABLE JMS_USER (USERID VARCHAR(32) NOT NULL, PASSWD VARCHAR(32) NOT NULL, CLIENTID VARCHAR(128), PRIMARY KEY(USERID))
-CREATE_ROLE_TABLE=CREATE TABLE JMS_ROLE (ROLEID VARCHAR(32) NOT NULL, USERID VARCHAR(32) NOT NULL, PRIMARY KEY(USERID, ROLEID))
-SELECT_PRECONF_CLIENTID=SELECT CLIENTID FROM JMS_USER WHERE USERID=?
-CREATE_MAPPING_TABLE=CREATE TABLE JMS_CHANNEL_MAPPING (ID BIGINT, TYPE CHAR(1), JMS_DEST_NAME VARCHAR(1024), JMS_SUB_NAME VARCHAR(1024), CLIENT_ID VARCHAR(128), SELECTOR VARCHAR(1024), NO_LOCAL CHAR(1), PRIMARY KEY(ID))
-INSERT_MAPPING=INSERT INTO JMS_CHANNEL_MAPPING (ID, TYPE, JMS_DEST_NAME, JMS_SUB_NAME, CLIENT_ID, SELECTOR, NO_LOCAL) VALUES (?, ?, ?, ?, ?, ?, ?)
-DELETE_MAPPING=DELETE FROM JMS_CHANNEL_MAPPING WHERE ID = ?
-SELECT_ID_FOR_DESTINATION=SELECT ID FROM JMS_CHANNEL_MAPPING WHERE TYPE=? AND JMS_DEST_NAME=?
-SELECT_DURABLE_SUB=SELECT JMS_DEST_NAME, ID, SELECTOR, NO_LOCAL FROM JMS_CHANNEL_MAPPING WHERE CLIENT_ID=? AND JMS_SUB_NAME=?
-SELECT_SUBSCRIPTIONS_FOR_TOPIC=SELECT ID, CLIENT_ID, JMS_SUB_NAME, SELECTOR, NO_LOCAL FROM JMS_CHANNEL_MAPPING WHERE TYPE='D' AND JMS_DEST_NAME=?
-           ]]></attribute>
-   </mbean>
-
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+     Microsoft SQL Server persistence deployment descriptor.
+
+     $Id: postgresql-persistence-service.xml 1222 2006-08-10 18:51:44Z ovidiu.feodorov at jboss.com $
+ -->
+
+<server>
+
+   <mbean code="org.jboss.messaging.core.plugin.JDBCPersistenceManager"
+          name="jboss.messaging:service=PersistenceManager"
+          xmbean-dd="xmdesc/JDBCPersistenceManager-xmbean.xml">
+      <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
+      <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
+      <depends optional-attribute-name="ChannelMapper">jboss.messaging:service=ChannelMapper</depends>
+      <attribute name="DataSource">java:/DefaultDS</attribute>
+      <attribute name="CreateTablesOnStartup">true</attribute>
+      <attribute name="UsingBatchUpdates">true</attribute>
+      <attribute name="SqlProperties"><![CDATA[
+CREATE_MESSAGE_REF=CREATE TABLE JMS_MESSAGE_REFERENCE (CHANNELID BIGINT, MESSAGEID BIGINT, TRANSACTIONID BIGINT, STATE CHAR(1), ORD BIGINT, DELIVERYCOUNT INTEGER, RELIABLE CHAR(1), LOADED CHAR(1), PRIMARY KEY(CHANNELID, MESSAGEID))
+CREATE_IDX_MESSAGE_REF_TX=CREATE INDEX JMS_MESSAGE_REF_TX ON JMS_MESSAGE_REFERENCE (TRANSACTIONID)
+CREATE_IDX_MESSAGE_REF_ORD=CREATE INDEX JMS_MESSAGE_REF_ORD ON JMS_MESSAGE_REFERENCE (ORD)
+CREATE_IDX_MESSAGE_REF_MESSAGEID=CREATE INDEX JMS_MESSAGE_REF_MESSAGEID ON JMS_MESSAGE_REFERENCE (MESSAGEID)
+CREATE_IDX_MESSAGE_REF_LOADED=CREATE INDEX JMS_MESSAGE_REF_LOADED ON JMS_MESSAGE_REFERENCE (LOADED)
+CREATE_IDX_MESSAGE_REF_RELIABLE=CREATE INDEX JMS_MESSAGE_REF_RELIABLE ON JMS_MESSAGE_REFERENCE (RELIABLE)
+INSERT_MESSAGE_REF=INSERT INTO JMS_MESSAGE_REFERENCE (CHANNELID, MESSAGEID, TRANSACTIONID, STATE, ORD, DELIVERYCOUNT, RELIABLE, LOADED) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
+DELETE_MESSAGE_REF=DELETE FROM JMS_MESSAGE_REFERENCE WHERE MESSAGEID=? AND CHANNELID=? AND STATE='C'
+UPDATE_MESSAGE_REF=UPDATE JMS_MESSAGE_REFERENCE SET TRANSACTIONID=?, STATE='-' WHERE MESSAGEID=? AND CHANNELID=? AND STATE='C'
+UPDATE_MESSAGE_REF_NOT_LOADED=UPDATE JMS_MESSAGE_REFERENCE SET LOADED='N' WHERE MESSAGEID=? AND CHANNELID=?
+COMMIT_MESSAGE_REF1=UPDATE JMS_MESSAGE_REFERENCE SET STATE='C', TRANSACTIONID = NULL WHERE TRANSACTIONID=? AND STATE='+'
+COMMIT_MESSAGE_REF2=DELETE FROM JMS_MESSAGE_REFERENCE WHERE TRANSACTIONID=? AND STATE='-'
+ROLLBACK_MESSAGE_REF1=DELETE FROM JMS_MESSAGE_REFERENCE WHERE TRANSACTIONID=? AND STATE='+'
+ROLLBACK_MESSAGE_REF2=UPDATE JMS_MESSAGE_REFERENCE SET STATE='C', TRANSACTIONID = NULL WHERE TRANSACTIONID=? AND STATE='-'
+LOAD_REF_INFO=SELECT MESSAGEID, ORD, DELIVERYCOUNT, RELIABLE FROM JMS_MESSAGE_REFERENCE WHERE CHANNELID=? AND STATE <> '+' AND LOADED = 'N' AND ORD BETWEEN ? AND ? ORDER BY ORD
+SELECT_COUNT_REFS=SELECT COUNT(MESSAGEID) FROM JMS_MESSAGE_REFERENCE WHERE CHANNELID=? AND STATE <> '+' AND LOADED='N'
+UPDATE_RELIABLE_REFS=UPDATE JMS_MESSAGE_REFERENCE SET LOADED='Y' WHERE ORD BETWEEN ? AND ? AND CHANNELID=? AND RELIABLE='Y' AND STATE <> '+'
+UPDATE_RELIABLE_REFS_NOT_LOADED=UPDATE JMS_MESSAGE_REFERENCE SET LOADED='N' WHERE CHANNELID=?
+SELECT_MIN_ORDERING=SELECT MIN(ORD) FROM JMS_MESSAGE_REFERENCE WHERE CHANNELID=? AND STATE <> '+' AND LOADED = 'N'
+DELETE_UNRELIABLE_REFS=DELETE FROM JMS_MESSAGE_REFERENCE WHERE RELIABLE = 'N'
+CREATE_MESSAGE=CREATE TABLE JMS_MESSAGE (MESSAGEID BIGINT, RELIABLE CHAR(1), EXPIRATION BIGINT, TIMESTAMP BIGINT, PRIORITY TINYINT, COREHEADERS IMAGE, PAYLOAD IMAGE, CHANNELCOUNT INTEGER, TYPE TINYINT, JMSTYPE VARCHAR(255), CORRELATIONID VARCHAR(255), CORRELATIONID_BYTES IMAGE, DESTINATION_ID BIGINT, REPLYTO_ID BIGINT, JMSPROPERTIES IMAGE, PRIMARY KEY (MESSAGEID))
+LOAD_MESSAGES=SELECT MESSAGEID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, COREHEADERS, PAYLOAD, CHANNELCOUNT, TYPE, JMSTYPE, CORRELATIONID, CORRELATIONID_BYTES, DESTINATION_ID, REPLYTO_ID, JMSPROPERTIES FROM JMS_MESSAGE
+INSERT_MESSAGE=INSERT INTO JMS_MESSAGE (MESSAGEID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, COREHEADERS, PAYLOAD, CHANNELCOUNT, TYPE, JMSTYPE, CORRELATIONID, CORRELATIONID_BYTES, DESTINATION_ID, REPLYTO_ID, JMSPROPERTIES) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
+UPDATE_MESSAGE_CHANNELCOUNT=UPDATE JMS_MESSAGE SET CHANNELCOUNT=? WHERE MESSAGEID=?
+DELETE_MESSAGE=DELETE FROM JMS_MESSAGE WHERE MESSAGEID=?
+MESSAGEID_COLUMN=MESSAGEID
+UPDATE_UNRELIABLE_CHANNELCOUNT=UPDATE JMS_MESSAGE SET CHANNELCOUNT = CHANNELCOUNT - 1 WHERE MESSAGEID IN (SELECT MR.MESSAGEID FROM JMS_MESSAGE_REFERENCE MR WHERE MR.RELIABLE = 'N' AND MR.CHANNELID = ?)
+DELETE_UNREFFED_MESSAGES=DELETE FROM JMS_MESSAGE WHERE CHANNELCOUNT = 0
+CREATE_TRANSACTION=CREATE TABLE JMS_TRANSACTION (TRANSACTIONID BIGINT, BRANCH_QUAL IMAGE, FORMAT_ID INTEGER, GLOBAL_TXID IMAGE, PRIMARY KEY (TRANSACTIONID))
+INSERT_TRANSACTION=INSERT INTO JMS_TRANSACTION (TRANSACTIONID, BRANCH_QUAL, FORMAT_ID, GLOBAL_TXID) VALUES(?, ?, ?, ?)
+DELETE_TRANSACTION=DELETE FROM JMS_TRANSACTION WHERE TRANSACTIONID = ?
+SELECT_PREPARED_TRANSACTIONS=SELECT TRANSACTIONID, BRANCH_QUAL, FORMAT_ID, GLOBAL_TXID FROM JMS_TRANSACTION
+DELETE_ALL_TRANSACTIONS=DELETE FROM JMS_TRANSACTION
+CREATE_COUNTER=CREATE TABLE JMS_COUNTER (NAME VARCHAR(255), NEXT_ID BIGINT, PRIMARY KEY(NAME))
+UPDATE_COUNTER=UPDATE JMS_COUNTER SET NEXT_ID = ? WHERE NAME=?
+SELECT_COUNTER=SELECT NEXT_ID FROM JMS_COUNTER WHERE NAME=?
+INSERT_COUNTER=INSERT INTO JMS_COUNTER (NAME, NEXT_ID) VALUES (?, ?)
+DELETE_ALL_COUNTERS=DELETE FROM JMS_COUNTER
+SELECT_ALL_CHANNELS=SELECT DISTINCT(CHANNELID) FROM JMS_MESSAGE_REFERENCE
+           ]]></attribute>
+      <attribute name="MaxParams">500</attribute>
+   </mbean>
+
+   <mbean code="org.jboss.jms.server.plugin.JDBCChannelMapper"
+          name="jboss.messaging:service=ChannelMapper"
+          xmbean-dd="xmdesc/JDBCChannelMapper-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="SqlProperties"><![CDATA[
+CREATE_USER_TABLE=CREATE TABLE JMS_USER (USERID VARCHAR(32) NOT NULL, PASSWD VARCHAR(32) NOT NULL, CLIENTID VARCHAR(128), PRIMARY KEY(USERID))
+CREATE_ROLE_TABLE=CREATE TABLE JMS_ROLE (ROLEID VARCHAR(32) NOT NULL, USERID VARCHAR(32) NOT NULL, PRIMARY KEY(USERID, ROLEID))
+SELECT_PRECONF_CLIENTID=SELECT CLIENTID FROM JMS_USER WHERE USERID=?
+CREATE_MAPPING_TABLE=CREATE TABLE JMS_CHANNEL_MAPPING (ID BIGINT, TYPE CHAR(1), JMS_DEST_NAME VARCHAR(1024), JMS_SUB_NAME VARCHAR(1024), CLIENT_ID VARCHAR(128), SELECTOR VARCHAR(1024), NO_LOCAL CHAR(1), PRIMARY KEY(ID))
+INSERT_MAPPING=INSERT INTO JMS_CHANNEL_MAPPING (ID, TYPE, JMS_DEST_NAME, JMS_SUB_NAME, CLIENT_ID, SELECTOR, NO_LOCAL) VALUES (?, ?, ?, ?, ?, ?, ?)
+DELETE_MAPPING=DELETE FROM JMS_CHANNEL_MAPPING WHERE ID = ?
+SELECT_ID_FOR_DESTINATION=SELECT ID FROM JMS_CHANNEL_MAPPING WHERE TYPE=? AND JMS_DEST_NAME=?
+SELECT_DURABLE_SUB=SELECT JMS_DEST_NAME, ID, SELECTOR, NO_LOCAL FROM JMS_CHANNEL_MAPPING WHERE CLIENT_ID=? AND JMS_SUB_NAME=?
+SELECT_SUBSCRIPTIONS_FOR_TOPIC=SELECT ID, CLIENT_ID, JMS_SUB_NAME, SELECTOR, NO_LOCAL FROM JMS_CHANNEL_MAPPING WHERE TYPE='D' AND JMS_DEST_NAME=?
+           ]]></attribute>
+   </mbean>
+
 </server>
\ No newline at end of file

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/DestinationJNDIMapper.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/DestinationJNDIMapper.java	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/DestinationJNDIMapper.java	2006-11-21 21:23:34 UTC (rev 1613)
@@ -21,22 +21,12 @@
   */
 package org.jboss.jms.server;
 
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
+import java.util.*;
 import javax.jms.InvalidDestinationException;
 import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NameNotFoundException;
-
-import org.jboss.jms.destination.JBossDestination;
-import org.jboss.jms.destination.JBossQueue;
-import org.jboss.jms.destination.JBossTemporaryQueue;
-import org.jboss.jms.destination.JBossTemporaryTopic;
-import org.jboss.jms.destination.JBossTopic;
+import org.jboss.jms.destination.*;
 import org.jboss.jms.server.destination.ManagedDestination;
 import org.jboss.jms.util.JNDIUtil;
 import org.jboss.jms.util.MessagingJMSException;
@@ -260,9 +250,9 @@
 
    public void stop() throws Exception
    {
-      Set queues = new HashSet(queueMap.keySet());
+      Set queues = new HashSet(queueMap.values());
       
-      Set topics = new HashSet(topicMap.keySet());
+      Set topics = new HashSet(topicMap.values());
       
       // remove all destinations from JNDI
       for(Iterator i = queues.iterator(); i.hasNext(); )

Modified: branches/Branch_Client_Failover_Experiment/tests/build.xml
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/build.xml	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/tests/build.xml	2006-11-21 21:23:34 UTC (rev 1613)
@@ -67,6 +67,9 @@
    <property name="stress.tests.database" value="mysql"/>
    <property name="stress.tests.serialization" value="jms"/>
 
+   <!-- Clustering tests -->
+   <property name="clustering.tests.database" value="mysql"/>
+
    <!--
         Project paths.
    -->
@@ -133,7 +136,11 @@
    <!--
        JDBC Drivers.
    -->
+   <path id="any.jdbc.driver.classpath">
+          <fileset dir="${tests.root}/lib/jdbc-drivers" includes="*.jar"/>
+   </path>
 
+
    <path id="mysql.jdbc.driver.classpath">
       <pathelement path="${tests.root}/lib/mysql-connector-java-3.1.13-bin.jar"/>
    </path>
@@ -154,6 +161,7 @@
       <path refid="compilation.classpath"/>
       <path location="../output/lib/jboss-messaging.jar"/>
       <path refid="junit.junit.classpath"/>
+      <path refid="any.jdbc.driver.classpath"/>
       <path refid="hsqldb.hsqldb.classpath"/>
       <path refid="jboss.server.classpath"/> <!-- for org.jboss.jms.jndi.JNDIProviderAdapter -->
       <path refid="jboss.jca.classpath"/>  <!-- for org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory, etc -->
@@ -269,6 +277,23 @@
       </java>
    </target>
 
+   <target name="start-rmi-server-clustering" depends="init"
+           description="Starts the RMI server used by clustering tests">
+
+      <java classname="org.jboss.test.messaging.tools.jmx.rmi.RMITestServer" fork="true" spawn="true">
+         <sysproperty key="test.registry.index" value="${test.registry.index}"/>
+         <sysproperty key="module.output" value="${tests.output}"/>
+         <sysproperty key="remote.test.suffix" value="-remote"/>
+         <sysproperty key="test.bind.address" value="${test.bind.address}"/>
+         <sysproperty key="test.database" value="${clustering.tests.database}"/>
+         <sysproperty key="test.serialization" value="${functional.tests.serialization}"/>
+         <!--
+         <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=rmiserver"/>
+         -->
+         <classpath refid="test.execution.classpath"/>
+      </java>
+   </target>
+
    <target name="start-rmi-server-stress" depends="init"
            description="Starts the RMI server used by remote stress tests">
 
@@ -290,6 +315,14 @@
             classpathref="test.execution.classpath"/>
    </target>
 
+   <target name="stop-rmi-server-clustering" depends="init"
+           description="Stops the RMI server used by clustering tests">
+      <java classname="org.jboss.test.messaging.tools.jmx.rmi.StopRMIServer"
+            classpathref="test.execution.classpath">
+         <sysproperty key="test.registry.index" value="${test.registry.index}"/>
+      </java>
+   </target>
+
    <!-- ======================================================================================== -->
    <!-- Test Execution Tasks                                                                     -->
    <!-- ======================================================================================== -->
@@ -344,6 +377,7 @@
                <exclude name="**/jms/crash/*Test.class"/>
                <exclude name="**/jms/MemLeakTest.class"/>
                <exclude name="**/jms/manual/**/*Test.class"/>
+               <exclude name="**/jms/clustering/*Test.class"/>
             </fileset>
          </batchtest>
       </junit>
@@ -416,11 +450,11 @@
                     haltonerror="${junit.batchtest.haltonerror}">
             <formatter type="plain" usefile="${junit.formatter.usefile}"/>
             <fileset dir="${build.tests.classes}">
-               <!-- <include name="org/jboss/test/messaging/jms/JMSTest.class"/> -->
                <include name="**/messaging/jms/ReferenceableTest.class"/>
                <exclude name="**/jms/stress/**"/>
                <exclude name="**/jms/crash/*Test.class"/>
                <exclude name="**/jms/MemLeakTest.class"/>
+               <exclude name="**/jms/clustering/*Test.class"/>
             </fileset>
          </batchtest>
       </junit>
@@ -456,8 +490,7 @@
                     haltonerror="${junit.batchtest.haltonerror}">
             <formatter type="plain" usefile="${junit.formatter.usefile}"/>
             <fileset dir="${build.tests.classes}">
-               <!-- <include name="**/jms/stress/**/*Test.class"/> -->
-               <include name="**/jms/stress/StressTest.class"/>
+               <include name="**/jms/stress/*Test.class"/>
             </fileset>
          </batchtest>
       </junit>
@@ -518,20 +551,18 @@
                     haltonerror="${junit.batchtest.haltonerror}">
             <formatter type="plain" usefile="${junit.formatter.usefile}"/>
             <fileset dir="${build.tests.classes}">
-               <!--
-               <include name="org/jboss/test/messaging/jms/JMSTest.class"/>
-               -->
-               <include name="org/jboss/test/messaging/jms/**/*Test.class"/>
-               <exclude name="org/jboss/test/messaging/jms/stress/**"/>
-               <exclude name="org/jboss/test/messaging/jms/server/**"/>
-               <exclude name="org/jboss/test/messaging/jms/persistence/**"/>
-               <exclude name="org/jboss/test/messaging/jms/ReferencingTest.class"/>
-               <exclude name="org/jboss/test/messaging/jms/PersistenceTest.class"/>
-               <exclude name="org/jboss/test/messaging/jms/crash/*Test.class"/>
-               <exclude name="org/jboss/test/messaging/jms/MemLeakTest.class"/>
-               <exclude name="org/jboss/test/messaging/jms/ManifestTest.class"/>
-               <exclude name="org/jboss/test/messaging/jms/JCAWrapperTest.class"/>
+               <include name="**/jms/**/*Test.class"/>
+               <exclude name="**/jms/stress/**"/>
+               <exclude name="**/jms/server/**"/>
+               <exclude name="**/jms/persistence/**"/>
+               <exclude name="**/jms/ReferencingTest.class"/>
+               <exclude name="**/jms/PersistenceTest.class"/>
+               <exclude name="**/jms/crash/*Test.class"/>
+               <exclude name="**/jms/MemLeakTest.class"/>
+               <exclude name="**/jms/ManifestTest.class"/>
+               <exclude name="**/jms/JCAWrapperTest.class"/>
                <exclude name="**/jms/manual/**/*Test.class"/>
+               <exclude name="**/jms/clustering/*Test.class"/>
             </fileset>
          </batchtest>
       </junit>
@@ -587,7 +618,7 @@
                     haltonerror="${junit.batchtest.haltonerror}">
             <formatter type="plain" usefile="${junit.formatter.usefile}"/>
             <fileset dir="${build.tests.classes}">
-               <include name="org/jboss/test/messaging/jms/stress/**/*Test.class"/>
+               <include name="**/jms/stress/**/*Test.class"/>
             </fileset>
          </batchtest>
       </junit>
@@ -596,6 +627,100 @@
 
    </target>
 
+   <target name="clustering-tests" depends="tests-jar, prepare-testdirs, clear-test-logs"
+           description="Runs the clustering tests">
+
+      <!-- Stop the rmi servers in case a previous run aborted -->
+
+      <antcall target="stop-rmi-server-clustering">
+         <param name="test.registry.index" value="0"/>
+      </antcall>
+      <antcall target="stop-rmi-server-clustering">
+         <param name="test.registry.index" value="1"/>
+      </antcall>
+      <antcall target="stop-rmi-server-clustering">
+         <param name="test.registry.index" value="2"/>
+      </antcall>
+
+      <!-- Start 3 rmi servers -->
+
+      <antcall target="start-rmi-server-clustering">
+         <param name="test.registry.index" value="0"/>
+      </antcall>
+      <antcall target="start-rmi-server-clustering">
+         <param name="test.registry.index" value="1"/>
+      </antcall>
+      <antcall target="start-rmi-server-clustering">
+         <param name="test.registry.index" value="2"/>
+      </antcall>
+
+      <mkdir dir="${build.tests.reports}"/>
+
+      <echo message=""/>
+      <echo message="Running clustering tests, fork=${junit.fork}, junit.batchtest.fork=${junit.batchtest.fork}"/>
+      <echo message=""/>
+
+      <junit printsummary="${junit.printsummary}"
+             fork="${junit.fork}"
+             includeantruntime="yes"
+             haltonerror="${junit.haltonerror}"
+             haltonfailure="${junit.haltonfailure}"
+             showoutput="${junit.showoutput}"
+             timeout="${junit.timeout}">
+
+         <sysproperty key="remote" value="true"/>
+         <sysproperty key="module.output" value="${tests.output}"/>
+         <sysproperty key="test.bind.address" value="${test.bind.address}"/>
+         <sysproperty key="test.database" value="${clustering.tests.database}"/>
+         <sysproperty key="test.serialization" value="${functional.tests.serialization}"/>
+         <jvmarg value="-Xmx512M"/>
+         <!--
+         <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=antjunit"/>
+         -->
+         <classpath>
+            <path refid="test.execution.classpath"/>
+
+            <!-- Add this when http://jira.jboss.org/jira/browse/JBAS-2554 is done -->
+            <!--
+            <path refid="jboss.test.classpath"/>
+            -->
+         </classpath>
+
+         <!-- Use this when http://jira.jboss.org/jira/browse/JBAS-2554 is done -->
+         <!--
+         <sysproperty key="jboss-junit-configuration" value="Remote"/>
+         <formatter classname="org.jboss.ant.taskdefs.XMLJUnitMultipleResultFormatter"
+            usefile="${junit.formatter.usefile}" extension="-Remote.xml"/>
+         -->
+
+         <sysproperty key="messaging-test-configuration" value="Clustering"/>
+         <formatter classname="org.jboss.test.messaging.tools.ant.XMLJUnitMultipleResultFormatter"
+                    usefile="${junit.formatter.usefile}" extension="-Clustering.xml"/>
+
+         <batchtest fork="${junit.batchtest.fork}"
+                    todir="${junit.batchtest.todir}"
+                    haltonfailure="${junit.batchtest.haltonfailure}"
+                    haltonerror="${junit.batchtest.haltonerror}">
+            <formatter type="plain" usefile="${junit.formatter.usefile}"/>
+            <fileset dir="${build.tests.classes}">
+               <include name="**/jms/clustering/*Test.class"/>
+            </fileset>
+         </batchtest>
+      </junit>
+
+      <antcall target="stop-rmi-server-clustering">
+         <param name="test.registry.index" value="0"/>
+      </antcall>
+      <antcall target="stop-rmi-server-clustering">
+         <param name="test.registry.index" value="1"/>
+      </antcall>
+      <antcall target="stop-rmi-server-clustering">
+         <param name="test.registry.index" value="2"/>
+      </antcall>
+
+   </target>
+
+
    <target name="crash-tests" depends="tests-jar, prepare-testdirs, clear-test-logs"
       description="Runs crash tests">
 
@@ -719,6 +844,7 @@
                <include name="**/messaging/jms/**/*Test.class"/>
                <exclude name="**/jms/stress/**"/>
                <exclude name="org/jboss/test/messaging/jms/ManifestTest.class"/>
+               <exclude name="**/jms/clustering/*Test.class"/>
             </fileset>
          </batchtest>
       </junit>

Modified: branches/Branch_Client_Failover_Experiment/tests/etc/container.xml
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/etc/container.xml	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/tests/etc/container.xml	2006-11-21 21:23:34 UTC (rev 1613)
@@ -48,6 +48,15 @@
          <password>jboss</password>
       </database-configuration>
 
+      <database-configuration name="mssql">
+          <url>jdbc:jtds:sqlserver://localhost:1433/messaging</url>
+          <driver>net.sourceforge.jtds.jdbc.Driver</driver>
+          <isolation>TRANSACTION_READ_COMMITTED</isolation>
+          <username>messaging</username>
+          <password>messaging</password>
+      </database-configuration>
+
+
    </database-configurations>
 
    <!--

Modified: branches/Branch_Client_Failover_Experiment/tests/etc/stress/log4j.xml
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/etc/stress/log4j.xml	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/tests/etc/stress/log4j.xml	2006-11-21 21:23:34 UTC (rev 1613)
@@ -30,7 +30,7 @@
    <appender name="FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">
       <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
 
-      <param name="File" value="${module.output}/logs/messaging-tests${remote.test.suffix}.stress.trace.log"/>
+      <param name="File" value="${module.output}/logs/messaging-tests${remote.test.suffix}.stress.log"/>
 
       <!-- since majority of the tests are ran in fork mode by ant, the log file is overwritten
            for each test. We need to append if we want to preserve a full testsuite run log.

Copied: branches/Branch_Client_Failover_Experiment/tests/lib/jdbc-drivers (from rev 1612, trunk/tests/lib/jdbc-drivers)

Modified: branches/Branch_Client_Failover_Experiment/tests/smoke/build.xml
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/smoke/build.xml	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/tests/smoke/build.xml	2006-11-21 21:23:34 UTC (rev 1613)
@@ -18,6 +18,9 @@
    <property name="messaging.client.jar.path" value="${basedir}/../../output/lib"/>
    <property name="smoke.test.type" value="installation"/>
 
+   <property name="password" value="admin"/>
+   <property name="user" value="admin"/>
+
    <!--
         By default, each test (installation or compatiblity) runs all examples. If you want to
         prevent a specific example from running during a test, set run.<examplename>.example=false
@@ -61,7 +64,7 @@
 
       <antcall target="old-server-compatibility-tests">
          <param name="smoke.test.type" value="client.compatibility"/>
-      </antcall>                                           
+      </antcall>
       <antcall target="old-client-compatibility-tests">
          <param name="smoke.test.type" value="server.compatibility"/>
       </antcall>
@@ -73,8 +76,12 @@
 
       <!-- 4.0.0, 4.0.1 NOT SUPPORTED -->
 
-                                                                                                <!--
 
+      <!-- Note on installer versions.
+      When installing versions to test via the JBoss installer, make sure call by value is *not*
+      selected in the installation process. The reason for testing installer versions is to test
+      the arrangement where JBoss is configured for all pass by reference -->
+
       <antcall target="installation-test">
          <param name="jboss.home" value="${jboss401sp1.home}"/>
          <param name="run.secure-socket.example" value="false"/>
@@ -86,16 +93,6 @@
       </antcall>
 
       <antcall target="installation-test">
-         <param name="jboss.home" value="${jboss403.home}"/>
-         <param name="run.secure-socket.example" value="false"/>
-      </antcall>
-
-      <antcall target="installation-test">
-         <param name="jboss.home" value="${jboss403-installer.home}"/>
-         <param name="run.secure-socket.example" value="false"/>
-      </antcall>
-
-      <antcall target="installation-test">
          <param name="jboss.home" value="${jboss403SP1.home}"/>
          <param name="run.secure-socket.example" value="false"/>
       </antcall>
@@ -113,7 +110,6 @@
          <param name="run.secure-socket.example" value="false"/>
       </antcall>
 
-                                                                                                 -->
       <antcall target="installation-test">
          <param name="jboss.home" value="${jboss404GA.home}"/>
       </antcall>
@@ -129,20 +125,28 @@
          <param name="run.stateless.example" value="false"/>
          <param name="run.secure-socket.example" value="false"/>
       </antcall>
-                                                                                                <!--
+
       <antcall target="installation-test">
-         <param name="jboss.home" value="${jboss405CR1.home}"/>
+         <param name="jboss.home" value="${jboss405GA.home}"/>
       </antcall>
 
       <antcall target="installation-test">
-         <param name="jboss.home" value="${jboss405CR1.home}"/>
+         <param name="jboss.home" value="${jboss405GA-installer.home}"/>
+      </antcall>
+
+      <antcall target="installation-test">
+         <param name="jboss.home" value="${jboss405GA.home}"/>
          <param name="release.admin.target" value="standalone"/>
          <param name="run.mdb.example" value="false"/>
          <param name="run.stateless.example" value="false"/>
          <param name="run.secure-socket.example" value="false"/>
       </antcall>
 
-                                                                                                 -->
+      <antcall target="installation-test">
+         <param name="jboss.home" value="${jboss405GAejb3.home}"/>
+         <param name="no.java4" value="true"/>
+         <param name="run.ejb3mdb.example" value="true"/>
+      </antcall>
 
       <!--
          Stateless Session Bean installation test will fail on this because the client talks to
@@ -253,16 +257,16 @@
 
       <antcall target="start"/>
       <antcall target="record-running-jboss-instance"/>
-      <antcall target="sleep"><param name="sleep.interval" value="35"/></antcall>
+      <antcall target="sleep"><param name="sleep.interval" value="45"/></antcall>
 
       <antcall target="ping-jms-server"/>
 
       <antcall target="deploy-scoped-queue"/>
-      <antcall target="sleep"><param name="sleep.interval" value="5"/></antcall>
+      <antcall target="sleep"><param name="sleep.interval" value="8"/></antcall>
       <antcall target="ping-queue"/>
 
       <antcall target="deploy-scoped-topic"/>
-      <antcall target="sleep"><param name="sleep.interval" value="5"/></antcall>
+      <antcall target="sleep"><param name="sleep.interval" value="8"/></antcall>
       <antcall target="ping-topic">
          <param name="example.topic.name" value="SmokeTestTopic"/>
       </antcall>
@@ -341,7 +345,7 @@
          <param name="jboss.configuration" value="${jboss.configuration}-node0"/>
       </antcall>
 
-      <antcall target="sleep"><param name="sleep.interval" value="5"/></antcall>
+      <antcall target="sleep"><param name="sleep.interval" value="8"/></antcall>
 
       <antcall target="ping-topic">
          <param name="example.topic.name" value="DistributedSmokeTestTopic"/>
@@ -369,7 +373,7 @@
          <param name="jboss.configuration" value="${jboss.configuration}-node1"/>
       </antcall>
 
-      <antcall target="sleep"><param name="sleep.interval" value="5"/></antcall>
+      <antcall target="sleep"><param name="sleep.interval" value="8"/></antcall>
 
       <antcall target="ping-topic">
          <param name="example.topic.name" value="DistributedSmokeTestTopic"/>
@@ -476,7 +480,7 @@
    <!--      Internal Targets                                                    -->
    <!-- ======================================================================== -->
 
-   <target name="installation-test" depends="check-jboss-availability">
+   <target name="installation-test" depends="check-java-version, check-jboss-availability" unless="skip.current.java">
 
       <echo message="Testing installation on ${jboss.home}"/>
       <!--
@@ -494,6 +498,21 @@
                                                                                                  -->
    </target>
 
+   <target name="check-java-version">
+      <condition property="skip.current.java" value="true">
+         <or>
+            <and>
+               <istrue value="${no.java4}"/>
+               <equals arg1="1.4" arg2="${ant.java.version}"/>
+            </and>
+            <and>
+               <istrue value="${no.java5}"/>
+               <equals arg1="1.5" arg2="${ant.java.version}"/>
+            </and>
+         </or>
+      </condition>
+   </target>
+
    <target name="old-server-compatibility-test" depends="check-jboss-availability">
 
       <echo message="Checking current client's compatibility with a ${jboss.messaging.version} server"/>
@@ -681,7 +700,9 @@
 
       <ant dir="../.." antfile="build.xml" target="clean" inheritAll="false"/>
       <ant dir="../.." antfile="build.xml" target="artifacts" inheritAll="false"/>
-      <!-- I need this because the smoke test itself uses org.jboss.test.messaging.tools classes -->
+      <!--
+           I need this because the smoke test itself uses org.jboss.test.messaging.tools classes.
+      -->
       <ant dir="../../tests" antfile="build.xml" target="compile" inheritAll="false"/>
 
    </target>
@@ -714,6 +735,19 @@
 
    </target>
 
+
+   <target name="twiddle">
+
+      <java classname="org.jboss.console.twiddle.Twiddle" fork="yes" failonerror="yes"
+            dir="${jboss.home}/bin">
+         <arg line="-help"/>
+         <classpath>
+            <path refid="twiddle.classpath"/>
+         </classpath>
+      </java>
+
+   </target>
+
    <target name="ping-jms-server">
 
       <java classname="org.jboss.console.twiddle.Twiddle" fork="yes" failonerror="yes"
@@ -808,6 +842,8 @@
          <jvmarg value="-Xmx128m"/>
          <arg line="-s jnp://localhost:${jnpPort} -S"/>
          <!-- <arg value="-S"/> -->
+         <arg value="--user=${user}"/>
+         <arg value="--password=${password}"/>
          <classpath>
             <pathelement location="${jboss.home}/bin/shutdown.jar"/>
             <pathelement location="${jboss.home}/client/jbossall-client.jar"/>

Modified: branches/Branch_Client_Failover_Experiment/tests/smoke/smoke.properties.example
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/smoke/smoke.properties.example	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/tests/smoke/smoke.properties.example	2006-11-21 21:23:34 UTC (rev 1613)
@@ -4,17 +4,16 @@
 
 #JBoss AS 4.0.0 and 4.0.1 are not supported
 
-jboss401sp1.home=C:\\work\\src\\jboss-4.0.1sp1-src\\build\\output\\jboss-4.0.1sp1
-jboss402.home=C:\\work\\src\\jboss-4.0.2-src\\build\\output\\jboss-4.0.2
-jboss403.home=C:\\work\\src\\jboss-4.0.3-src\\build\\output\\jboss-4.0.3
-jboss403-installer.home=C:\\work\\jnlp\\jboss-4.0.3
-jboss403SP1.home=C:\\work\\src\\jboss-4.0.3SP1-src\\build\\output\\jboss-4.0.3SP1
-jboss403SP1-installer.home=C:\\work\\jnlp\\jboss-4.0.3SP1
-jboss404GA.home=C:\\work\\src\\jboss-4.0.4.GA-src\\build\\output\\jboss-4.0.4.GA
-jboss404GA-installer.home=C:\\work\\jnlp\\jboss-4.0.4.GA
+jboss401sp1.home=C:\\dev\jboss-4.0.1sp1-src\\build\\output\\jboss-4.0.1sp1
+jboss402.home=C:\\dev\\jboss-4.0.2-src\\build\\output\\jboss-4.0.2
+jboss403SP1.home=C:\\dev\\jboss-4.0.3SP1-src\\build\\output\\jboss-4.0.3SP1
+jboss403SP1-installer.home=C:\\dev\\jboss-4.0.3SP1-installer
+jboss404GA.home=C:\\dev\\jboss-4.0.4.GA-src\\build\\output\\jboss-4.0.4.GA
+jboss404GA-installer.home=C:\\dev\\jboss-4.0.4.GA0-installer
+jboss405GA.home=C:\\dev\\jboss-4.0.5.GA-src\\build\\output\\jboss-4.0.5.GA
+jboss405GA-installer.home=C:\\dev\\jboss-4.0.5.GA-installer
+jboss405GAejb3.home=C:\\dev\\jboss-4.0.5.GA-installer-ejb3
 
-jboss500Alpha.home=C:\\work\\src\\cvs\\jboss-head\\build\\output\\jboss-5.0.0.Alpha
-
 #
 # Compatibility test configuration
 #

Modified: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/MessageConsumerTest.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/MessageConsumerTest.java	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/MessageConsumerTest.java	2006-11-21 21:23:34 UTC (rev 1613)
@@ -21,38 +21,17 @@
   */
 package org.jboss.test.messaging.jms;
 
+import EDU.oswego.cs.dl.util.concurrent.Latch;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
-
-import javax.jms.BytesMessage;
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.DeliveryMode;
-import javax.jms.InvalidDestinationException;
-import javax.jms.JMSException;
-import javax.jms.MapMessage;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageListener;
-import javax.jms.MessageProducer;
-import javax.jms.ObjectMessage;
-import javax.jms.Queue;
-import javax.jms.QueueReceiver;
-import javax.jms.Session;
-import javax.jms.StreamMessage;
-import javax.jms.TextMessage;
-import javax.jms.Topic;
-import javax.jms.TopicSubscriber;
+import javax.jms.*;
 import javax.naming.InitialContext;
-
 import org.jboss.jms.destination.JBossTopic;
 import org.jboss.test.messaging.MessagingTestCase;
 import org.jboss.test.messaging.tools.ServerManagement;
 
-import EDU.oswego.cs.dl.util.concurrent.Latch;
-
 /**
  * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
@@ -66,7 +45,7 @@
    // Constants -----------------------------------------------------
 
    // Static --------------------------------------------------------
-   
+
    // Attributes ----------------------------------------------------
 
    protected Connection producerConnection, consumerConnection;
@@ -94,11 +73,11 @@
       super.setUp();
 
       ServerManagement.start("all");
-                  
+
       ServerManagement.undeployTopic("Topic");
       ServerManagement.undeployQueue("Queue");
       ServerManagement.undeployQueue("Queue2");
-      
+
       ServerManagement.deployTopic("Topic");
       ServerManagement.deployQueue("Queue");
       ServerManagement.deployQueue("Queue2");
@@ -122,7 +101,7 @@
       queueProducer = producerSession.createProducer(queue);
       queueProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
       queueConsumer = consumerSession.createConsumer(queue);
-      
+
       this.drainDestination(cf, queue);
       this.drainDestination(cf, queue2);
 
@@ -142,48 +121,48 @@
       ServerManagement.undeployTopic("Topic");
       ServerManagement.undeployQueue("Queue");
       ServerManagement.undeployQueue("Queue2");
-      
+
       super.tearDown();
    }
-   
+
    public void testRelayMessage() throws Exception
    {
       Connection conn = cf.createConnection();
-      
+
       conn.start();
-      
+
       final Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-      
+
       MessageConsumer cons = sess.createConsumer(queue);
-      
+
       final Object lock = new Object();
-      
+
       final int numMessages = 100;
-      
-      
+
+
       class MyListener implements MessageListener
       {
          boolean failed;
-         
+
          int count;
-         
+
          public void onMessage(Message m)
          {
             try
             {
                MessageProducer prod = sess.createProducer(queue2);
-            
+
                prod.send(m);
-               
+
                count++;
-               
+
                if (count == numMessages)
                {
                   synchronized (lock)
                   {
                      lock.notify();
                   }
-                  
+
                }
             }
             catch (JMSException e)
@@ -192,29 +171,29 @@
             }
          }
       }
-      
+
       MyListener listener = new MyListener();
-         
+
       cons.setMessageListener(listener);
-      
+
       MessageProducer prod = sess.createProducer(queue);
-      
+
       for (int i = 0; i < numMessages; i++)
       {
          prod.send(sess.createMessage());
       }
-      
+
       synchronized (lock)
       {
-         lock.wait();         
+         lock.wait();
       }
-      
+
       conn.close();
-     
+
       assertFalse(listener.failed);
    }
-   
-   
+
+
    /*
     * If there are two competing consumers on a queue/subscription then if one closes
     * and has unacknowledged deliveries these should be cancelled but also
@@ -229,105 +208,105 @@
    public void testRedeliveryToCompetingConsumerOnQueue() throws Exception
    {
       Connection conn = cf.createConnection();
-      
+
       Session sessSend = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-      
+
       MessageProducer prod = sessSend.createProducer(queue);
-      
+
       conn.start();
-      
+
       Session sessConsume1 = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
-      
+
       MessageConsumer cons1 = sessConsume1.createConsumer(queue);
-      
+
       TextMessage tm = sessSend.createTextMessage();
-      
+
       tm.setText("Your mum");
-      
+
       prod.send(tm);
-      
+
       TextMessage tm2 = (TextMessage)cons1.receive();
-      
+
       assertNotNull(tm2);
-      
+
       assertEquals("Your mum", tm2.getText());
-      
+
       // Don't ack
-      
+
       // Create another consumer
-      
+
       Session sessConsume2 = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
-      
+
       MessageConsumer cons2 = sessConsume2.createConsumer(queue);
-      
+
       // this should cancel message and cause delivery to other consumer
-      
+
       sessConsume1.close();
-      
+
       TextMessage tm3 = (TextMessage)cons2.receive(1000);
-      
+
       assertNotNull(tm3);
-      
+
       assertEquals("Your mum", tm3.getText());
-      
+
       tm3.acknowledge();
-      
+
       conn.close();
-      
-      
+
+
    }
-  
-   
+
+
    public void testRedeliveryToCompetingConsumerOnSubscription() throws Exception
    {
       Connection conn = cf.createConnection();
-      
+
       conn.setClientID("wibble");
-      
+
       Session sessSend = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-      
+
       MessageProducer prod = sessSend.createProducer(topic);
-      
+
       conn.start();
-      
+
       Session sessConsume1 = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
-      
+
       MessageConsumer cons1 = sessConsume1.createDurableSubscriber(topic, "sub1");
-      
+
       TextMessage tm = sessSend.createTextMessage();
-      
+
       tm.setText("Your mum");
-      
+
       prod.send(tm);
-      
+
       TextMessage tm2 = (TextMessage)cons1.receive();
-      
+
       assertNotNull(tm2);
-      
+
       assertEquals("Your mum", tm2.getText());
-      
+
       //Don't ack
-      
+
       //Create another consumer
-                 
+
       Session sessConsume2 = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
-       
+
       MessageConsumer cons2 = sessConsume2.createDurableSubscriber(topic, "sub1");
-          
+
       //this should cancel message and cause delivery to other consumer
-      
+
       sessConsume1.close();
-               
+
       TextMessage tm3 = (TextMessage)cons2.receive(1000);
-      
+
       assertNotNull(tm3);
-      
+
       assertEquals("Your mum", tm3.getText());
-      
-      tm3.acknowledge();            
-      
+
+      tm3.acknowledge();
+
       conn.close();
-      
+
    }
 
    /**
@@ -388,14 +367,14 @@
 
       // start consumer connection after the message is submitted
       consumerConnection.start();
-      
+
       //NOTE! There semantics of receiveNoWait do not guarantee the message is available
       //immediately after the message is sent
       //It will be available some indeterminate time later.
       //This is fine and as per spec.
       //To implement receiveNoWait otherwise would be very costly
       //Also other messaging systems e.g. Sun implement it this way
-      
+
       Thread.sleep(500);
 
       TextMessage m = (TextMessage)queueConsumer.receiveNoWait();
@@ -455,9 +434,9 @@
    // closed consumer tests
    //
 
-   //This test is not valid - 
+   //This test is not valid -
    //The message will not be in the new consumer it will be in the original consumer
-   
+
 //   public void testClose1() throws Exception
 //   {
 //      // there is a consumer already open by setup
@@ -895,13 +874,13 @@
           assertEquals("hello1", rm1.getText());
 
           cons1.close();
-          
+
           //rollback should cause redelivery of messages
 
           //in this case redelivery occurs to a different receiver
 
           sess.rollback();
-  
+
           MessageConsumer cons2 = sess.createConsumer(queue);
 
           TextMessage rm2 = (TextMessage)cons2.receive(1500);
@@ -1010,12 +989,12 @@
           assertEquals("hello1", rm1.getText());
 
           cons1.close();
-         
+
           log.debug("sess.recover()");
 
           //redeliver
           sess.recover();
-          
+
           MessageConsumer cons2 = sess.createConsumer(queue);
 
           log.debug("receiving ...");
@@ -1067,26 +1046,26 @@
           prod.send(sess.createTextMessage("1"));
           prod.send(sess.createTextMessage("2"));
           prod.send(sess.createTextMessage("3"));
-          
+
           MessageConsumer cons1 = sess.createConsumer(queue);
 
           Message r1 = cons1.receive();
-          
+
           log.trace("Got first message");
-          
+
           cons1.close();
-          
+
           log.trace("Closed consumer");
-          
+
           MessageConsumer cons2 = sess.createConsumer(queue);
-          
+
           log.trace("Wairting for second message");
           Message r2 = cons2.receive();
-                  
+
           log.trace("got second message");
-          
+
           Message r3 = cons2.receive();
-          
+
           r1.acknowledge();
           r2.acknowledge();
           r3.acknowledge();
@@ -1152,8 +1131,8 @@
     * Test server-side consumer delegate activation (on receive())
     */
 // This test is not valid since the message will be in the first consumer, not c2
-   
-   
+
+
 //   public void testReceive1() throws Exception
 //   {
 //      Connection conn = null;
@@ -1193,9 +1172,9 @@
    /**
     * Test server-side consumer delegate activation (on receive())
     */
-   
+
    //This test is not valid since the message will be in the first consumer, not c2
-   
+
 //   public void testReceive2() throws Exception
 //   {
 //      Connection conn = null;
@@ -1321,9 +1300,9 @@
    /**
     * TODO Get rid of this (http://jira.jboss.org/jira/browse/JBMESSAGING-92)
     */
-   
+
    //This test is no longer valid since we only use one listener per connection now
-   
+
 //   public void testRemotingInternals() throws Exception
 //   {
 //      if (ServerManagement.isRemote())
@@ -1767,114 +1746,112 @@
       latch.acquire();
    }
 
-
     /** to be used by testTimeoutReceiveOnClose */
-    private class ThreadCloser extends Thread
-    {
+	   private class ThreadCloser extends Thread
+	   {
 
-        Object waitMonitor;
-        long timeToSleep;
+	       Object waitMonitor;
+	       long timeToSleep;
 
-        public ThreadCloser( Object waitMonitor, long timeToSleep)
-        {
-            this.waitMonitor=waitMonitor;
-            this.timeToSleep=timeToSleep;
-        }
+	       public ThreadCloser( Object waitMonitor, long timeToSleep)
+	       {
+	           this.waitMonitor=waitMonitor;
+	           this.timeToSleep=timeToSleep;
+	       }
 
 
-        public void run()
-        {
-            try
-            {
-                log.trace("(ThreadCloser)Waiting on monitor to close thread");
-                synchronized (waitMonitor)
-                {
-                    waitMonitor.wait();
-                }
-                log.trace("(ThreadCloser)Notification received");
-                Thread.sleep(timeToSleep);
-                topicConsumer.close();
+	       public void run()
+	       {
+	           try
+	           {
+	               log.info("(ThreadCloser)Waiting on monitor to close thread");
+	               synchronized (waitMonitor)
+	               {
+	                   waitMonitor.wait();
+	               }
+	               log.info("(ThreadCloser)Notification received");
+	               Thread.sleep(timeToSleep);
+	               topicConsumer.close();
 
-            }
-            catch (Exception e)
-            {
-                log.error(e);
-                e.printStackTrace();
-            }
-        }
-    }
+	           }
+	           catch (Exception e)
+	           {
+	               log.error(e);
+	               e.printStackTrace();
+	           }
+	       }
+	   }
 
-    /** to be used by testTimeoutReceiveOnClose */
-    private class ThreadReceiver extends Thread
-    {
+	   /** to be used by testTimeoutReceiveOnClose */
+	   private class ThreadReceiver extends Thread
+	   {
 
-        long timeToWait;
-        Object waitMonitor;
-        long t1;
-        long t2;
-        Object receivedObject;
+	       long timeToWait;
+	       Object waitMonitor;
+	       long t1;
+	       long t2;
+	       Object receivedObject;
 
-        public ThreadReceiver(Object waitMonitor, long timeToWait)
-        {
-            this.waitMonitor=waitMonitor;
-            this.timeToWait=timeToWait;
-        }
+	       public ThreadReceiver(Object waitMonitor, long timeToWait)
+	       {
+	           this.waitMonitor=waitMonitor;
+	           this.timeToWait=timeToWait;
+	       }
 
-        public void run()
-        {
-            try
-            {
-                log.trace("(ThreadReceiver)Waiting on monitor to close thread");
-                synchronized(waitMonitor)
-                {
-                    waitMonitor.wait();
-                }
-                log.trace("(ThreadReceiver)Notification received");
-                t1=System.currentTimeMillis();
-                receivedObject=topicConsumer.receive(timeToWait);
-                t2=System.currentTimeMillis();
+	       public void run()
+	       {
+	           try
+	           {
+	               log.info("(ThreadReceiver)Waiting on monitor to close thread");
+	               synchronized(waitMonitor)
+	               {
+	                   waitMonitor.wait();
+	               }
+	               log.info("(ThreadReceiver)Notification received");
+	               t1=System.currentTimeMillis();
+	               receivedObject=topicConsumer.receive(timeToWait);
+	               t2=System.currentTimeMillis();
 
-            }
-            catch (Exception e)
-            {
-                log.error(e);
-                e.printStackTrace();
-            }
-        }
-    }
+	           }
+	           catch (Exception e)
+	           {
+	               log.error(e);
+	               e.printStackTrace();
+	           }
+	       }
+	   }
 
-   public void testTimeoutReceiveOnClose() throws Exception
-   {
-      System.gc();       /// If A GC need to be execute, it' s better to be executed now
-      Thread.sleep(1000);
-      if (log.isTraceEnabled()) log.trace("testTimeoutReceiveOnClose");
+	  public void testTimeoutReceiveOnClose() throws Exception
+	  {
+	     System.gc();       /// If A GC need to be executed, it' s better to be executed now
+	     Thread.sleep(1000);
+	     if (log.isTraceEnabled()) log.trace("testTimeoutReceiveOnClose");
 
-      Object monitor = new Object();
-      ThreadCloser closer = null;
-      ThreadReceiver receiver = new ThreadReceiver(monitor,2000);
+	     Object monitor = new Object();
+	     ThreadCloser closer = null;
+	     ThreadReceiver receiver = new ThreadReceiver(monitor,2000);
 
-      closer = new ThreadCloser(monitor,1000);
-      receiver= new ThreadReceiver(monitor,2000);
-      closer.start();
-      receiver.start();
-      Thread.sleep(2000);
-      synchronized (monitor)
-      {
-         monitor.notifyAll();
-      }
-      closer.join();
-      receiver.join();
+	     closer = new ThreadCloser(monitor,1000);
+	     receiver= new ThreadReceiver(monitor,2000);
+	     closer.start();
+	     receiver.start();
+	     Thread.sleep(2000);
+	     synchronized (monitor)
+	     {
+	        monitor.notifyAll();
+	     }
+	     closer.join();
+	     receiver.join();
 
 
-      assertNull(receiver.receivedObject);
+	     assertNull(receiver.receivedObject);
 
-      log.trace("Elapsed time was " + (receiver.t2-receiver.t1));
+	     log.info("Elapsed time was " + (receiver.t2-receiver.t1));
 
-      // We need to make sure the
-      assertTrue("Receive was supposed to receive a notification before 2 seconds",receiver.t2-receiver.t1<=1500);
-   }
+	     // We need to make sure the
+	     assertTrue("Receive was supposed to receive a notification before 2 seconds",receiver.t2-receiver.t1<=1500);
+	  }
 
-
    //
    // MessageListener tests
    //
@@ -2107,7 +2084,7 @@
    //
    // NoLocal
    //
-   
+
    public void testNoLocal() throws Exception
    {
       if (log.isTraceEnabled()) log.trace("testNoLocal");
@@ -2232,17 +2209,17 @@
          Session sess1 = conn1.createSession(false, Session.CLIENT_ACKNOWLEDGE);
          Session sess2 = conn1.createSession(false, Session.CLIENT_ACKNOWLEDGE);
 
-         
+
          log.trace("careting consumer1");
          MessageConsumer cons1 = sess1.createConsumer(topic);
-         
+
          log.trace("creating consumer2");
          MessageConsumer cons2 = sess2.createConsumer(topic);
-         
+
          log.trace("starting connection");
-         
+
          conn1.start();
-         
+
          log.trace("started connection");
 
          Session sess3 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE);
@@ -2494,7 +2471,7 @@
          }
 
          assertEquals(NUM_MESSAGES, count);
-         
+
          durable.close();
 
          sess1.unsubscribe("mySubscription");
@@ -2692,7 +2669,7 @@
          }
 
          log.debug("unsubscribing mySubscription");
-         
+
          durable.close();
          sess5.unsubscribe("mySubscription");
          log.debug("unsubscribing done");
@@ -2707,7 +2684,7 @@
 
          TextMessage tm3 = (TextMessage)durable.receive(1000);
          assertNull(tm3);
-         
+
          durable.close();
       }
       finally
@@ -2733,7 +2710,7 @@
             conn5.close();
          }
          if (sess6 != null)
-         {            
+         {
             sess6.unsubscribe("mySubscription");
          }
          if (conn6 != null)
@@ -2820,7 +2797,7 @@
          log.trace("Received " + count  + " messages");
 
          assertEquals(NUM_MESSAGES - NUM_TO_RECEIVE, count);
-         
+
          durable2.close();
 
          sess2.unsubscribe("mySubscription");
@@ -2909,7 +2886,7 @@
          }
 
          assertEquals(0, count);
-         
+
          durable2.close();
 
          sess2.unsubscribe("mySubscription");
@@ -3005,7 +2982,7 @@
    {
       producerSession.close();
       consumerSession.close();
-            
+
       Session sessProducer = producerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
       MessageProducer prod = sessProducer.createProducer(queue);
       TextMessage tm = sessProducer.createTextMessage("testRedeliveredDifferentSessions");
@@ -3238,7 +3215,7 @@
 
    }
 
-   
+
    // Package protected ---------------------------------------------
 
    // Protected -----------------------------------------------------
@@ -3250,31 +3227,31 @@
    private class ExceptionRedelMessageListenerImpl implements MessageListener
    {
       private Latch latch = new Latch();
-      
+
       private int count;
-      
+
       private Session sess;
-      
+
       private boolean failed;
-      
+
       public void waitForMessages() throws InterruptedException
       {
          latch.acquire();
          //Thread.sleep(2000); //enough time for postdeliver to be called
       }
-       
+
       public ExceptionRedelMessageListenerImpl(Session sess)
       {
          this.sess = sess;
       }
-      
+
       public void onMessage(Message m)
       {
          TextMessage tm = (TextMessage)m;
          count++;
-         
+
          log.trace("Got message:" + count);
-                  
+
          try
          {
             log.trace("message:" + tm.getText());
@@ -3340,7 +3317,7 @@
                   latch.release();
                }
             }
-            
+
             else if (count == 4)
             {
                if (sess.getAcknowledgeMode() == Session.AUTO_ACKNOWLEDGE || sess.getAcknowledgeMode() == Session.DUPS_OK_ACKNOWLEDGE)
@@ -3362,25 +3339,25 @@
             }
          }
          catch (JMSException e)
-         {           
+         {
             failed = true;
             latch.release();
          }
       }
    }
-   
+
    private class RedelMessageListenerImpl implements MessageListener
    {
       private Session sess;
-      
+
       private int count;
-      
+
       private boolean failed;
-      
+
       private Latch latch = new Latch();
-      
+
       private boolean transacted;
-      
+
       public RedelMessageListenerImpl(boolean transacted)
       {
          this.transacted = transacted;
@@ -3392,15 +3369,15 @@
          latch.acquire();
          //Thread.sleep(2000); //enough time for postdeliver to be called
       }
-      
+
       public void onMessage(Message m)
       {
          try
          {
             TextMessage tm = (TextMessage)m;
-            
+
             log.trace("Got message:" + tm.getText() + " count is " + count);
-            
+
             if (count == 0)
             {
                if (!("a".equals(tm.getText())))
@@ -3421,7 +3398,7 @@
                   log.trace("recover() called");
                }
             }
-            
+
             if (count == 1)
             {
                if (!("a".equals(tm.getText())))
@@ -3443,7 +3420,7 @@
                   log.trace("Should be b but was " + tm.getText());
                   failed = true;
                   latch.release();
-               }               
+               }
             }
             if (count == 3)
             {
@@ -3452,7 +3429,7 @@
                   log.trace("Should be c but was " + tm.getText());
                   failed = true;
                   latch.release();
-               }               
+               }
                if (transacted)
                {
                   sess.commit();
@@ -3474,7 +3451,7 @@
          }
       }
    }
-   
+
    private class MessageListenerImpl implements MessageListener
    {
       private List messages = Collections.synchronizedList(new ArrayList());

Copied: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/clustering (from rev 1612, trunk/tests/src/org/jboss/test/messaging/jms/clustering)

Modified: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/CallbackFailureTest.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/CallbackFailureTest.java	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/CallbackFailureTest.java	2006-11-21 21:23:34 UTC (rev 1613)
@@ -21,14 +21,9 @@
   */
 package org.jboss.test.messaging.jms.crash;
 
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
+import javax.jms.*;
 import javax.management.ObjectName;
 import javax.naming.InitialContext;
-
 import org.jboss.jms.server.ConnectionManager;
 import org.jboss.logging.Logger;
 import org.jboss.test.messaging.MessagingTestCase;
@@ -78,9 +73,9 @@
       localServer = new LocalTestServer();
       
       //Start all the services locally
-      localServer.start("all");
+      localServer.start("all", false);
             
-      localServer.deployQueue("Queue", null);
+      localServer.deployQueue("Queue", null, false);
            
       //Connect to the remote server, but don't start a servicecontainer on it
       //We are only using the remote server to open a client connection to the local server
@@ -121,7 +116,7 @@
       
       String remotingSessionId = (String)remoteServer.executeCommand(command);
       
-      remoteServer.exit();
+      remoteServer.destroy();
         
       //we have removed the exception listener so the server side resouces shouldn't be cleared up
       

Modified: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashLargeLeaseTest.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashLargeLeaseTest.java	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashLargeLeaseTest.java	2006-11-21 21:23:34 UTC (rev 1613)
@@ -24,7 +24,6 @@
 import javax.jms.ConnectionFactory;
 import javax.jms.Queue;
 import javax.naming.InitialContext;
-
 import org.jboss.jms.server.ConnectionManager;
 import org.jboss.logging.Logger;
 import org.jboss.test.messaging.MessagingTestCase;
@@ -74,11 +73,11 @@
       localServer = new LocalTestServer();
       
       // Start all the services locally
-      localServer.start("all");
+      localServer.start("all", false);
 
       localServer.setAttribute(ServiceContainer.REMOTING_OBJECT_NAME, "LeasePeriod", "30000");
        
-      localServer.deployQueue("Queue", null);
+      localServer.deployQueue("Queue", null, false);
           
       // Connect to the remote server, but don't start a servicecontainer on it. We are only using
       // the remote server to open a client connection to the local server.
@@ -116,7 +115,7 @@
       
       // Now we should have a client connection from the remote server to the local server
       
-      remoteServer.exit();
+      remoteServer.destroy();
       log.trace("killed remote server");
         
       // Wait for connection resources to be cleared up

Modified: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashNegativeLeaseTest.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashNegativeLeaseTest.java	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashNegativeLeaseTest.java	2006-11-21 21:23:34 UTC (rev 1613)
@@ -24,7 +24,6 @@
 import javax.jms.ConnectionFactory;
 import javax.jms.Queue;
 import javax.naming.InitialContext;
-
 import org.jboss.jms.server.ConnectionManager;
 import org.jboss.logging.Logger;
 import org.jboss.test.messaging.MessagingTestCase;
@@ -74,14 +73,13 @@
       localServer = new LocalTestServer();
       
       // Start all the services locally
-      localServer.start("all");
+      localServer.start("all", false);
 
-
       //Set lease period to -1 --> this should disable leasing so the state won't be cleared up
       
       localServer.setAttribute(ServiceContainer.REMOTING_OBJECT_NAME, "LeasePeriod", "-1");
        
-      localServer.deployQueue("Queue", null);
+      localServer.deployQueue("Queue", null, false);
           
       // Connect to the remote server, but don't start a servicecontainer on it. We are only using
       // the remote server to open a client connection to the local server.
@@ -119,7 +117,7 @@
       
       // Now we should have a client connection from the remote server to the local server
       
-      remoteServer.exit();
+      remoteServer.destroy();
       log.trace("killed remote server");
         
       // Wait for connection resources to be cleared up

Modified: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashTest.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashTest.java	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashTest.java	2006-11-21 21:23:34 UTC (rev 1613)
@@ -24,7 +24,6 @@
 import javax.jms.ConnectionFactory;
 import javax.jms.Queue;
 import javax.naming.InitialContext;
-
 import org.jboss.jms.server.ConnectionManager;
 import org.jboss.logging.Logger;
 import org.jboss.test.messaging.MessagingTestCase;
@@ -74,16 +73,15 @@
       localServer = new LocalTestServer();
       
       // Start all the services locally
-      localServer.start("all");
+      localServer.start("all", false);
 
-
       // This crash test is relying on a precise value of LeaseInterval, so we don't rely on
       // the default, whatever that is ...
 
       localServer.setAttribute(ServiceContainer.REMOTING_OBJECT_NAME, "LeasePeriod", "3000");
        
-      localServer.deployQueue("Queue", null);
-      localServer.deployTopic("Topic", null);
+      localServer.deployQueue("Queue", null, false);
+      localServer.deployTopic("Topic", null, false);
           
       // Connect to the remote server, but don't start a servicecontainer on it. We are only using
       // the remote server to open a client connection to the local server.
@@ -121,7 +119,7 @@
       
       // Now we should have a client connection from the remote server to the local server
       
-      remoteServer.exit();
+      remoteServer.destroy();
       log.trace("killed remote server");
         
       // Wait for connection resources to be cleared up

Modified: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashTwoConnectionsTest.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashTwoConnectionsTest.java	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashTwoConnectionsTest.java	2006-11-21 21:23:34 UTC (rev 1613)
@@ -24,7 +24,6 @@
 import javax.jms.ConnectionFactory;
 import javax.jms.Topic;
 import javax.naming.InitialContext;
-
 import org.jboss.jms.server.ConnectionManager;
 import org.jboss.jms.server.connectionmanager.SimpleConnectionManager;
 import org.jboss.logging.Logger;
@@ -76,16 +75,15 @@
       localServer = new LocalTestServer();
       
       // Start all the services locally
-      localServer.start("all");
+      localServer.start("all", false);
 
-
       // This crash test is relying on a precise value of LeaseInterval, so we don't rely on
       // the default, whatever that is ...
 
       localServer.setAttribute(ServiceContainer.REMOTING_OBJECT_NAME, "LeasePeriod", "3000");
        
-      localServer.deployQueue("Queue", null);
-      localServer.deployTopic("Topic", null);
+      localServer.deployQueue("Queue", null, false);
+      localServer.deployTopic("Topic", null, false);
           
       // Connect to the remote server, but don't start a servicecontainer on it. We are only using
       // the remote server to open a client connection to the local server.
@@ -123,7 +121,7 @@
       log.info("we have = " + ((SimpleConnectionManager)cm).getClients().size() + " clients registered on SimpleconnectionManager");
       
       // Now we should have a client connection from the remote server to the local server
-      remoteServer.exit();
+      remoteServer.destroy();
       log.info("killed remote server");
         
       // Wait for connection resources to be cleared up

Modified: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashZeroLeaseTest.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashZeroLeaseTest.java	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashZeroLeaseTest.java	2006-11-21 21:23:34 UTC (rev 1613)
@@ -24,7 +24,6 @@
 import javax.jms.ConnectionFactory;
 import javax.jms.Queue;
 import javax.naming.InitialContext;
-
 import org.jboss.jms.server.ConnectionManager;
 import org.jboss.logging.Logger;
 import org.jboss.test.messaging.MessagingTestCase;
@@ -74,14 +73,13 @@
       localServer = new LocalTestServer();
       
       // Start all the services locally
-      localServer.start("all");
+      localServer.start("all", false);
 
-
       //Set lease period to 0 --> this should disable leasing so the state won't be cleared up
       
       localServer.setAttribute(ServiceContainer.REMOTING_OBJECT_NAME, "LeasePeriod", "0");
        
-      localServer.deployQueue("Queue", null);
+      localServer.deployQueue("Queue", null, false);
           
       // Connect to the remote server, but don't start a servicecontainer on it. We are only using
       // the remote server to open a client connection to the local server.
@@ -119,7 +117,7 @@
       
       // Now we should have a client connection from the remote server to the local server
       
-      remoteServer.exit();
+      remoteServer.destroy();
       log.trace("killed remote server");
         
       // Wait for connection resources to be cleared up

Deleted: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/manual/ManualClusteringTest.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/manual/ManualClusteringTest.java	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/manual/ManualClusteringTest.java	2006-11-21 21:23:34 UTC (rev 1613)
@@ -1,1297 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.messaging.jms.manual;
-
-import java.util.Properties;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.DeliveryMode;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageListener;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.jms.Topic;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-
-import org.jboss.test.messaging.MessagingTestCase;
-
-/**
- * 
- * A ManualClusteringTest
- * 
- * Nodes must be started up in order node1, node2, node3
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- * @version <tt>$Revision: 1.1 $</tt>
- *
- * $Id$
- *
- */
-public class ManualClusteringTest extends MessagingTestCase
-{
-   protected Context ic1;
-   
-   protected Context ic2;
-   
-   protected Context ic3;
-   
-   protected Queue queue1;
-   
-   protected Topic topic1;
-   
-   protected Queue queue2;
-   
-   protected Topic topic2;
-   
-   protected Queue queue3;
-   
-   protected Topic topic3;
-   
-   protected ConnectionFactory cf1;
-   
-   protected ConnectionFactory cf2;
-   
-   protected ConnectionFactory cf3;
-     
-   public ManualClusteringTest(String name)
-   {
-      super(name);
-   }
-
-   protected void setUp() throws Exception
-   {
-      super.setUp();
-      
-      Properties props1 = new Properties();
-      
-      props1.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
-      props1.put(Context.PROVIDER_URL, "jnp://localhost:1199");
-      props1.put(Context.URL_PKG_PREFIXES, "org.jnp.interfaces");
-      
-      ic1 = new InitialContext(props1);
-      
-      Properties props2 = new Properties();
-      
-      props2.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
-      props2.put(Context.PROVIDER_URL, "jnp://localhost:1299");
-      props2.put(Context.URL_PKG_PREFIXES, "org.jnp.interfaces");
-      
-      ic2 = new InitialContext(props2);
-      
-      Properties props3 = new Properties();
-      
-      props3.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
-      props3.put(Context.PROVIDER_URL, "jnp://localhost:1399");
-      props3.put(Context.URL_PKG_PREFIXES, "org.jnp.interfaces");
-      
-      ic3 = new InitialContext(props3);
-      
-      queue1 = (Queue)ic1.lookup("queue/testDistributedQueue");
-      
-      queue2 = (Queue)ic2.lookup("queue/testDistributedQueue");
-      
-      queue3 = (Queue)ic3.lookup("queue/testDistributedQueue");
-            
-      topic1 = (Topic)ic1.lookup("topic/testDistributedTopic");
-      
-      topic2 = (Topic)ic2.lookup("topic/testDistributedTopic");
-      
-      topic3 = (Topic)ic3.lookup("topic/testDistributedTopic");
-      
-      cf1 = (ConnectionFactory)ic1.lookup("/ConnectionFactory");
-      
-      cf2 = (ConnectionFactory)ic2.lookup("/ConnectionFactory");
-      
-      cf3 = (ConnectionFactory)ic3.lookup("/ConnectionFactory");
-      
-      drainStuff();
-   }
-
-   protected void tearDown() throws Exception
-   {
-      super.tearDown();
-      
-      ic1.close();
-      
-      ic2.close();
-   }
-   
-   protected void drainStuff() throws Exception
-   {
-      Connection conn1 = null;
-      
-      Connection conn2 = null;
-      
-      Connection conn3 = null;
-            
-      try
-      {
-         conn1 = cf1.createConnection();
-         
-         conn2 = cf2.createConnection();
-         
-         conn3 = cf3.createConnection();
-           
-         Session sess1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         
-         Session sess2 = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         
-         Session sess3 = conn3.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         
-         MessageConsumer cons1 = sess1.createConsumer(queue1);
-         
-         MessageConsumer cons2 = sess2.createConsumer(queue2);
-         
-         MessageConsumer cons3 = sess3.createConsumer(queue2);
-         
-         conn1.start();
-         
-         conn2.start();
-         
-         conn3.start();
-         
-         Message msg = null;
-         
-         do
-         {
-            msg = cons1.receive(1000);
-         }
-         while (msg != null);
-         
-         do
-         {
-            msg = cons2.receive(1000);
-         }
-         while (msg != null);
-         
-         do
-         {
-            msg = cons3.receive(1000);
-         }
-         while (msg != null);
-      }
-      finally
-      {      
-         if (conn1 != null) conn1.close();
-         
-         if (conn2 != null) conn2.close();
-         
-         if (conn3 != null) conn3.close();
-      }
-   }
-   
-   public void testClusteredQueueLocalConsumerNonPersistent() throws Exception
-   {
-      clusteredQueueLocalConsumer(false);
-   }
-   
-   public void testClusteredQueueLocalConsumerPersistent() throws Exception
-   {
-      clusteredQueueLocalConsumer(true);
-   }
-   
-   public void testClusteredQueueNoLocalConsumerNonPersistent() throws Exception
-   {
-      clusteredQueueNoLocalConsumer(false);
-   }
-   
-   public void testClusteredQueueNoLocalConsumerPersistent() throws Exception
-   {
-      clusteredQueueNoLocalConsumer(true);
-   }
-   
-   
-   public void testClusteredTopicNonDurableNonPersistent() throws Exception
-   {
-      clusteredTopicNonDurable(false);
-   }
-   
-   public void testClusteredTopicNonDurablePersistent() throws Exception
-   {
-      clusteredTopicNonDurable(true);
-   }
-   
-   
-   public void testClusteredTopicNonDurableWithSelectorsNonPersistent() throws Exception
-   {
-      clusteredTopicNonDurableWithSelectors(false);
-   }
-   
-   public void testClusteredTopicNonDurableWithSelectorsPersistent() throws Exception
-   {
-      clusteredTopicNonDurableWithSelectors(true);
-   }
-   
-   public void testClusteredTopicDurableNonPersistent() throws Exception
-   {
-      clusteredTopicDurable(false);
-   }
-   
-   public void testClusteredTopicDurablePersistent() throws Exception
-   {
-      clusteredTopicDurable(true);
-   }
-   
-   public void testClusteredTopicSharedDurableLocalConsumerNonPersistent() throws Exception
-   {
-      clusteredTopicSharedDurableLocalConsumer(false);
-   }
-   
-   public void testClusteredTopicSharedDurableLocalConsumerPersistent() throws Exception
-   {
-      clusteredTopicSharedDurableLocalConsumer(true);
-   }
-   
-   public void testClusteredTopicSharedDurableNoLocalConsumerNonPersistent() throws Exception
-   {
-      clusteredTopicSharedDurableNoLocalConsumer(false);
-   }
-   
-   public void testClusteredTopicSharedDurableNoLocalConsumerPersistent() throws Exception
-   {
-      clusteredTopicSharedDurableNoLocalConsumer(true);
-   }
-   
-   public void testClusteredTopicSharedDurableNoLocalSubNonPersistent() throws Exception
-   {
-      clusteredTopicSharedDurableNoLocalSub(false);
-   }
-   
-   public void testClusteredTopicSharedDurableNoLocalSubPersistent() throws Exception
-   {
-      clusteredTopicSharedDurableNoLocalSub(true);
-   }
-   
-   
-   
-   
-   /*
-    * Create a consumer on each queue on each node.
-    * Send messages in turn from all nodes.
-    * Ensure that the local consumer gets the message
-    */
-   protected void clusteredQueueLocalConsumer(boolean persistent) throws Exception
-   {
-      Connection conn1 = null;
-      
-      Connection conn2 = null;
-      
-      Connection conn3 = null;
-      try
-      {
-         conn1 = cf1.createConnection();
-         
-         conn2 = cf2.createConnection();
-         
-         conn3 = cf3.createConnection();
-           
-         Session sess1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         
-         Session sess2 = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         
-         Session sess3 = conn3.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         
-         MessageConsumer cons1 = sess1.createConsumer(queue1);
-         
-         MessageConsumer cons2 = sess2.createConsumer(queue2);
-         
-         MessageConsumer cons3 = sess3.createConsumer(queue3);
-         
-         conn1.start();
-         
-         conn2.start();
-         
-         conn3.start();
-         
-         //Send at node1
-         
-         MessageProducer prod1 = sess1.createProducer(queue1);
-         
-         prod1.setDeliveryMode(persistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT);
-         
-         final int NUM_MESSAGES = 100;
-         
-         for (int i = 0; i < NUM_MESSAGES; i++)
-         {
-            TextMessage tm = sess1.createTextMessage("message" + i);
-            
-            prod1.send(tm);
-         }
-         
-         for (int i = 0; i < NUM_MESSAGES; i++)
-         {
-            TextMessage tm = (TextMessage)cons1.receive(1000);
-            
-            assertNotNull(tm);
-            
-            assertEquals("message" + i, tm.getText());
-         }
-         
-         Message m = cons2.receive(2000);
-         
-         assertNull(m);
-         
-         m = cons3.receive(2000);
-         
-         assertNull(m);
-         
-         // Send at node2
-         
-         MessageProducer prod2 = sess2.createProducer(queue2);
-         
-         prod2.setDeliveryMode(persistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT);
-         
-         for (int i = 0; i < NUM_MESSAGES; i++)
-         {
-            TextMessage tm = sess2.createTextMessage("message" + i);
-            
-            prod2.send(tm);
-         }
-         
-         for (int i = 0; i < NUM_MESSAGES; i++)
-         {
-            TextMessage tm = (TextMessage)cons2.receive(1000);
-            
-            assertNotNull(tm);
-            
-            assertEquals("message" + i, tm.getText());
-         }
-         
-         m = cons1.receive(2000);
-         
-         assertNull(m);
-         
-         m = cons3.receive(2000);
-         
-         assertNull(m);
-         
-         // Send at node3
-         
-         MessageProducer prod3 = sess3.createProducer(queue3);
-         
-         prod3.setDeliveryMode(persistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT);
-         
-         for (int i = 0; i < NUM_MESSAGES; i++)
-         {
-            TextMessage tm = sess3.createTextMessage("message" + i);
-            
-            prod3.send(tm);
-         }
-            
-         for (int i = 0; i < NUM_MESSAGES; i++)
-         {
-            TextMessage tm = (TextMessage)cons3.receive(1000);
-            
-            assertNotNull(tm);
-            
-            assertEquals("message" + i, tm.getText());
-         }
-         
-         m = cons1.receive(2000);
-         
-         assertNull(m);
-         
-         m = cons2.receive(2000);
-         
-         assertNull(m);         
-      }
-      finally
-      {      
-         if (conn1 != null) conn1.close();
-         
-         if (conn2 != null) conn2.close();
-         
-         if (conn3 != null) conn3.close();
-      }
-   }
-   
-   
-   
-   
-   /*
-    * Create a consumer on two nodes out of three
-    * Send messages from the third node
-    * Ensure that the messages are received from the other two nodes in 
-    * round robin order.
-    * (Note that this test depends on us using the default router which has
-    * this round robin behaviour)
-    */
-   protected void clusteredQueueNoLocalConsumer(boolean persistent) throws Exception
-   {
-      Connection conn1 = null;
-      
-      Connection conn2 = null;
-      
-      Connection conn3 = null;
-      try
-      {
-         conn1 = cf1.createConnection();
-         
-         conn2 = cf2.createConnection();
-         
-         conn3 = cf3.createConnection();
-           
-         Session sess1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         
-         Session sess2 = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         
-         Session sess3 = conn3.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         
-         MessageConsumer cons2 = sess2.createConsumer(queue2);
-         
-         MessageConsumer cons3 = sess3.createConsumer(queue3);
-         
-         conn2.start();
-         
-         conn3.start();
-         
-         //Send at node1
-         
-         MessageProducer prod1 = sess1.createProducer(queue1);
-         
-         prod1.setDeliveryMode(persistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT);
-         
-         final int NUM_MESSAGES = 100;
-         
-         for (int i = 0; i < NUM_MESSAGES; i++)
-         {
-            TextMessage tm = sess1.createTextMessage("message" + i);
-            
-            prod1.send(tm);
-         }
-         
-         for (int i = 0; i < NUM_MESSAGES / 2; i++)
-         {
-            TextMessage tm = (TextMessage)cons2.receive(1000);
-            
-            assertNotNull(tm);
-            
-            assertEquals("message" + i * 2, tm.getText());
-         }
-         
-         for (int i = 0; i < NUM_MESSAGES / 2; i++)
-         {
-            TextMessage tm = (TextMessage)cons3.receive(1000);
-            
-            assertNotNull(tm);
-            
-            assertEquals("message" + (i * 2 + 1), tm.getText());
-         }
-      
-      }
-      finally
-      {      
-         if (conn1 != null) conn1.close();
-         
-         if (conn2 != null) conn2.close();
-         
-         if (conn3 != null) conn3.close();
-      }
-   }
-   
-   
-   
-   /*
-    * Create non durable subscriptions on all nodes of the cluster.
-    * Ensure all messages are receive as appropriate
-    */
-   public void clusteredTopicNonDurable(boolean persistent) throws Exception
-   {
-      Connection conn1 = null;
-      
-      Connection conn2 = null;
-      
-      Connection conn3 = null;
-      try
-      {
-         conn1 = cf1.createConnection();
-         
-         conn2 = cf2.createConnection();
-         
-         conn3 = cf3.createConnection();
-           
-         Session sess1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         
-         Session sess2 = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         
-         Session sess3 = conn3.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         
-         MessageConsumer cons1 = sess1.createConsumer(topic1);
-         
-         MessageConsumer cons2 = sess2.createConsumer(topic2);
-         
-         MessageConsumer cons3 = sess3.createConsumer(topic3);
-         
-         MessageConsumer cons4 = sess1.createConsumer(topic1);
-         
-         MessageConsumer cons5 = sess2.createConsumer(topic2);
-            
-         conn1.start();
-         
-         conn2.start();
-         
-         conn3.start();
-         
-         //Send at node1
-         
-         MessageProducer prod1 = sess1.createProducer(topic1);
-         
-         prod1.setDeliveryMode(persistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT);
-         
-         final int NUM_MESSAGES = 100;
-         
-         for (int i = 0; i < NUM_MESSAGES; i++)
-         {
-            TextMessage tm = sess1.createTextMessage("message" + i);
-            
-            prod1.send(tm);
-         }
-            
-         for (int i = 0; i < NUM_MESSAGES; i++)
-         {
-            TextMessage tm = (TextMessage)cons1.receive(1000);
-            
-            assertNotNull(tm);
-                        
-            assertEquals("message" + i, tm.getText());                        
-         }
-         
-         for (int i = 0; i < NUM_MESSAGES; i++)
-         {
-            TextMessage tm = (TextMessage)cons2.receive(1000);
-                      
-            assertNotNull(tm);
-            
-            assertEquals("message" + i, tm.getText());
-         }
-         
-         for (int i = 0; i < NUM_MESSAGES; i++)
-         {
-            TextMessage tm = (TextMessage)cons3.receive(1000);
-                        
-            assertNotNull(tm);
-             
-            assertEquals("message" + i, tm.getText());
-         } 
-         
-         for (int i = 0; i < NUM_MESSAGES; i++)
-         {
-            TextMessage tm = (TextMessage)cons4.receive(1000);
-                        
-            assertNotNull(tm);
-             
-            assertEquals("message" + i, tm.getText());
-         } 
-         
-         for (int i = 0; i < NUM_MESSAGES; i++)
-         {
-            TextMessage tm = (TextMessage)cons5.receive(1000);
-                        
-            assertNotNull(tm);
-             
-            assertEquals("message" + i, tm.getText());
-         } 
-      }
-      finally
-      {      
-         if (conn1 != null) conn1.close();
-         
-         if (conn2 != null) conn2.close();
-         
-         if (conn3 != null) conn3.close();
-      }
-   }
-   
-   
-   
-   
-   /*
-    * Create non durable subscriptions on all nodes of the cluster.
-    * Include some with selectors
-    * Ensure all messages are receive as appropriate
-    */
-   public void clusteredTopicNonDurableWithSelectors(boolean persistent) throws Exception
-   {
-      Connection conn1 = null;
-      
-      Connection conn2 = null;
-      
-      Connection conn3 = null;
-      try
-      {
-         conn1 = cf1.createConnection();
-         
-         conn2 = cf2.createConnection();
-         
-         conn3 = cf3.createConnection();
-                             
-         Session sess1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         
-         Session sess2 = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         
-         Session sess3 = conn3.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         
-         MessageConsumer cons1 = sess1.createConsumer(topic1);
-         
-         MessageConsumer cons2 = sess2.createConsumer(topic2);
-         
-         MessageConsumer cons3 = sess3.createConsumer(topic3);
-         
-         MessageConsumer cons4 = sess1.createConsumer(topic1, "COLOUR='red'");
-         
-         MessageConsumer cons5 = sess2.createConsumer(topic2, "COLOUR='blue'");
-            
-         conn1.start();
-         
-         conn2.start();
-         
-         conn3.start();
-         
-         //Send at node1
-         
-         MessageProducer prod1 = sess1.createProducer(topic1);
-         
-         prod1.setDeliveryMode(persistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT);
-         
-         final int NUM_MESSAGES = 100;
-         
-         for (int i = 0; i < NUM_MESSAGES; i++)
-         {
-            TextMessage tm = sess1.createTextMessage("message" + i);
-            
-            int c = i % 3;
-            if (c == 0)
-            {
-               tm.setStringProperty("COLOUR", "red");
-            }
-            else if (c == 1)
-            {
-               tm.setStringProperty("COLOUR", "blue");
-            }
-            
-            prod1.send(tm);
-         }
-            
-         for (int i = 0; i < NUM_MESSAGES; i++)
-         {
-            TextMessage tm = (TextMessage)cons1.receive(1000);
-            
-            assertNotNull(tm);
-                        
-            assertEquals("message" + i, tm.getText());                        
-         }
-         
-         for (int i = 0; i < NUM_MESSAGES; i++)
-         {
-            TextMessage tm = (TextMessage)cons2.receive(1000);
-                      
-            assertNotNull(tm);
-            
-            assertEquals("message" + i, tm.getText());
-         }
-         
-         for (int i = 0; i < NUM_MESSAGES; i++)
-         {
-            TextMessage tm = (TextMessage)cons3.receive(1000);
-                        
-            assertNotNull(tm);
-             
-            assertEquals("message" + i, tm.getText());
-         } 
-         
-         for (int i = 0; i < NUM_MESSAGES; i++)
-         {
-            int c = i % 3;
-            
-            if (c == 0)
-            {
-               TextMessage tm = (TextMessage)cons4.receive(1000);
-                           
-               assertNotNull(tm);
-                
-               assertEquals("message" + i, tm.getText());
-            }
-         } 
-         
-         for (int i = 0; i < NUM_MESSAGES; i++)
-         {
-            int c = i % 3;
-            
-            if (c == 1)
-            {
-               TextMessage tm = (TextMessage)cons5.receive(1000);
-                           
-               assertNotNull(tm);
-                
-               assertEquals("message" + i, tm.getText());
-            }
-         } 
-      }
-      finally
-      {      
-         if (conn1 != null) conn1.close();
-         
-         if (conn2 != null) conn2.close();
-         
-         if (conn3 != null) conn3.close();
-      }
-   }
-   
-   
-   
-   /*
-    * Create durable subscriptions on all nodes of the cluster.
-    * Include a couple with selectors
-    * Ensure all messages are receive as appropriate
-    * None of the durable subs are shared
-    */
-   public void clusteredTopicDurable(boolean persistent) throws Exception
-   {
-      Connection conn1 = null;
-      
-      Connection conn2 = null;
-      
-      Connection conn3 = null;
-      try
-      {
-         conn1 = cf1.createConnection();
-         
-         conn2 = cf2.createConnection();
-         
-         conn3 = cf3.createConnection();
-         
-         conn1.setClientID("wib1");
-         
-         conn2.setClientID("wib1");
-         
-         conn3.setClientID("wib1");
-           
-         Session sess1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         
-         Session sess2 = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         
-         Session sess3 = conn3.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         
-         MessageConsumer cons1 = sess1.createDurableSubscriber(topic1, "sub1");
-         
-         MessageConsumer cons2 = sess2.createDurableSubscriber(topic2, "sub2");
-         
-         MessageConsumer cons3 = sess3.createDurableSubscriber(topic3, "sub3");
-         
-         MessageConsumer cons4 = sess1.createDurableSubscriber(topic1, "sub4");
-         
-         MessageConsumer cons5 = sess2.createDurableSubscriber(topic2, "sub5");
-            
-         conn1.start();
-         
-         conn2.start();
-         
-         conn3.start();
-         
-         //Send at node1
-         
-         MessageProducer prod1 = sess1.createProducer(topic1);
-         
-         prod1.setDeliveryMode(persistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT);
-         
-         final int NUM_MESSAGES = 100;
-         
-         for (int i = 0; i < NUM_MESSAGES; i++)
-         {
-            TextMessage tm = sess1.createTextMessage("message" + i);
-            
-            prod1.send(tm);
-         }
-            
-         for (int i = 0; i < NUM_MESSAGES; i++)
-         {
-            TextMessage tm = (TextMessage)cons1.receive(1000);
-            
-            assertNotNull(tm);
-                        
-            assertEquals("message" + i, tm.getText());                        
-         }
-         
-         for (int i = 0; i < NUM_MESSAGES; i++)
-         {
-            TextMessage tm = (TextMessage)cons2.receive(1000);
-                      
-            assertNotNull(tm);
-            
-            assertEquals("message" + i, tm.getText());
-         }
-         
-         for (int i = 0; i < NUM_MESSAGES; i++)
-         {
-            TextMessage tm = (TextMessage)cons3.receive(1000);
-                        
-            assertNotNull(tm);
-             
-            assertEquals("message" + i, tm.getText());
-         } 
-         
-         for (int i = 0; i < NUM_MESSAGES; i++)
-         {
-            TextMessage tm = (TextMessage)cons4.receive(1000);
-                        
-            assertNotNull(tm);
-             
-            assertEquals("message" + i, tm.getText());
-         } 
-         
-         for (int i = 0; i < NUM_MESSAGES; i++)
-         {
-            TextMessage tm = (TextMessage)cons5.receive(1000);
-                        
-            assertNotNull(tm);
-             
-            assertEquals("message" + i, tm.getText());
-         } 
-         
-         cons1.close();
-         
-         cons2.close();
-         
-         cons3.close();
-         
-         cons4.close();
-         
-         cons5.close();
-         
-         sess1.unsubscribe("sub1");
-         
-         sess2.unsubscribe("sub2");
-         
-         sess3.unsubscribe("sub3");
-         
-         sess1.unsubscribe("sub4");
-         
-         sess2.unsubscribe("sub5");
-         
-      }
-      finally
-      {      
-         if (conn1 != null) conn1.close();
-         
-         if (conn2 != null) conn2.close();
-         
-         if (conn3 != null) conn3.close();
-      }
-   }
-   
-   
-   
-   
-   /*
-    * Create shared durable subs on multiple nodes, the local instance should always get the message
-    */
-   protected void clusteredTopicSharedDurableLocalConsumer(boolean persistent) throws Exception
-   {
-      Connection conn1 = null;
-      
-      Connection conn2 = null;
-      
-      Connection conn3 = null;
-      try
-      {
-         conn1 = cf1.createConnection();
-         
-         conn2 = cf2.createConnection();
-         
-         conn3 = cf3.createConnection();
-         
-         conn1.setClientID("wib1");
-         
-         conn2.setClientID("wib1");
-         
-         conn3.setClientID("wib1");
-           
-         Session sess1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         
-         Session sess2 = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         
-         Session sess3 = conn3.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         
-         MessageConsumer cons1 = sess1.createDurableSubscriber(topic1, "sub1");
-         
-         MessageConsumer cons2 = sess2.createDurableSubscriber(topic2, "sub1");
-         
-         MessageConsumer cons3 = sess3.createDurableSubscriber(topic3, "sub1");
-         
-         conn1.start();
-         
-         conn2.start();
-         
-         conn3.start();
-         
-         //Send at node1
-         
-         MessageProducer prod1 = sess1.createProducer(topic1);
-         
-         prod1.setDeliveryMode(persistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT);
-         
-         final int NUM_MESSAGES = 100;
-         
-         for (int i = 0; i < NUM_MESSAGES; i++)
-         {
-            TextMessage tm = sess1.createTextMessage("message" + i);
-            
-            prod1.send(tm);
-         }
-         
-         for (int i = 0; i < NUM_MESSAGES; i++)
-         {
-            TextMessage tm = (TextMessage)cons1.receive(1000);
-            
-            assertNotNull(tm);
-            
-            assertEquals("message" + i, tm.getText());
-         }
-         
-         Message m = cons2.receive(2000);
-         
-         assertNull(m);
-         
-         m = cons3.receive(2000);
-         
-         assertNull(m);
-         
-         // Send at node2
-         
-         MessageProducer prod2 = sess2.createProducer(topic2);
-         
-         prod2.setDeliveryMode(persistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT);
-         
-         for (int i = 0; i < NUM_MESSAGES; i++)
-         {
-            TextMessage tm = sess2.createTextMessage("message" + i);
-            
-            prod2.send(tm);
-         }
-         
-         for (int i = 0; i < NUM_MESSAGES; i++)
-         {
-            TextMessage tm = (TextMessage)cons2.receive(1000);
-            
-            assertNotNull(tm);
-               
-            assertEquals("message" + i, tm.getText());
-         }
-         
-         m = cons1.receive(2000);
-         
-         assertNull(m);
-         
-         m = cons3.receive(2000);
-         
-         assertNull(m);
-         
-         // Send at node3
-         
-         MessageProducer prod3 = sess3.createProducer(topic3);
-         
-         prod3.setDeliveryMode(persistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT);
-         
-         for (int i = 0; i < NUM_MESSAGES; i++)
-         {
-            TextMessage tm = sess3.createTextMessage("message" + i);
-            
-            prod3.send(tm);
-         }
-           
-         for (int i = 0; i < NUM_MESSAGES; i++)
-         {
-            TextMessage tm = (TextMessage)cons3.receive(1000);
-            
-            assertNotNull(tm);
-            
-            assertEquals("message" + i, tm.getText());
-         }
-         
-         m = cons1.receive(2000);
-         
-         assertNull(m);
-         
-         m = cons2.receive(2000);
-         
-         assertNull(m);         
-         
-         cons1.close();
-         
-         cons2.close();
-         
-         cons3.close();
-         
-         //Need to unsubscribe on any node that the durable sub was created on
-         
-         sess1.unsubscribe("sub1");
-         
-         sess2.unsubscribe("sub1");
-         
-         sess3.unsubscribe("sub1");
-      }
-      finally
-      {      
-         if (conn1 != null) conn1.close();
-         
-         if (conn2 != null) conn2.close();
-         
-         if (conn3 != null) conn3.close();
-      }
-   }
-   
-   
-   /*
-    * Create shared durable subs on multiple nodes, but without consumer on local node
-    * even thought there is durable sub
-    * should round robin
-    * note that this test assumes round robin
-    */
-   protected void clusteredTopicSharedDurableNoLocalConsumer(boolean persistent) throws Exception
-   {
-      Connection conn1 = null;
-      
-      Connection conn2 = null;
-      
-      Connection conn3 = null;
-      try
-      {
-         conn1 = cf1.createConnection();
-         
-         conn2 = cf2.createConnection();
-         
-         conn3 = cf3.createConnection();
-         
-         conn1.setClientID("wib1");
-         
-         conn2.setClientID("wib1");
-         
-         conn3.setClientID("wib1");
-           
-         Session sess1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         
-         Session sess2 = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         
-         Session sess3 = conn3.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         
-         MessageConsumer cons1 = sess1.createDurableSubscriber(topic1, "sub1");
-         
-         //Now close it on node 1
-         conn1.close();
-         
-         conn1 = cf1.createConnection();
-         
-         conn1.setClientID("wib1");         
-         
-         sess1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         
-         //This means the durable sub is inactive on node1
-         
-         MessageConsumer cons2 = sess2.createDurableSubscriber(topic2, "sub1");
-         
-         MessageConsumer cons3 = sess3.createDurableSubscriber(topic3, "sub1");
-         
-         conn2.start();
-         
-         conn3.start();
-         
-         //Send at node1
-         
-         //Should round robin between the other 2 since there is no active consumer on sub1 on node1
-         
-         MessageProducer prod1 = sess1.createProducer(topic1);
-         
-         prod1.setDeliveryMode(persistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT);
-         
-         final int NUM_MESSAGES = 100;
-         
-         for (int i = 0; i < NUM_MESSAGES; i++)
-         {
-            TextMessage tm = sess1.createTextMessage("message" + i);
-            
-            prod1.send(tm);
-         }
-         
-         for (int i = 0; i < NUM_MESSAGES / 2; i++)
-         {
-            TextMessage tm = (TextMessage)cons2.receive(1000);
-            
-            assertNotNull(tm);
-            
-            assertEquals("message" + i * 2, tm.getText());
-         }
-         
-         for (int i = 0; i < NUM_MESSAGES / 2; i++)
-         {
-            TextMessage tm = (TextMessage)cons3.receive(1000);
-            
-            assertNotNull(tm);
-            
-            assertEquals("message" + (i * 2 + 1), tm.getText());
-         }
-         
-         cons2.close();
-         
-         cons3.close();
-         
-         sess1.unsubscribe("sub1");
-         
-         sess2.unsubscribe("sub1");
-         
-         sess3.unsubscribe("sub1");
-      
-      }
-      finally
-      {      
-         if (conn1 != null) conn1.close();
-         
-         if (conn2 != null) conn2.close();
-         
-         if (conn3 != null) conn3.close();
-      }
-   }
-   
-   
-   
-   /*
-    * Create shared durable subs on multiple nodes, but without sub on local node
-    * should round robin
-    * note that this test assumes round robin
-    */
-   protected void clusteredTopicSharedDurableNoLocalSub(boolean persistent) throws Exception
-   {
-      Connection conn1 = null;
-      
-      Connection conn2 = null;
-      
-      Connection conn3 = null;
-      try
-      {
-         conn1 = cf1.createConnection();
-         
-         conn2 = cf2.createConnection();
-         
-         conn3 = cf3.createConnection();
-         
-         conn2.setClientID("wib1");
-         
-         conn3.setClientID("wib1");
-           
-         Session sess1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         
-         Session sess2 = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         
-         Session sess3 = conn3.createSession(false, Session.AUTO_ACKNOWLEDGE);
-                  
-         MessageConsumer cons2 = sess2.createDurableSubscriber(topic2, "sub1");
-         
-         MessageConsumer cons3 = sess3.createDurableSubscriber(topic3, "sub1");
-         
-         conn2.start();
-         
-         conn3.start();
-         
-         //Send at node1
-         
-         //Should round robin between the other 2 since there is no active consumer on sub1 on node1
-         
-         MessageProducer prod1 = sess1.createProducer(topic1);
-         
-         prod1.setDeliveryMode(persistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT);
-         
-         final int NUM_MESSAGES = 100;
-         
-         for (int i = 0; i < NUM_MESSAGES; i++)
-         {
-            TextMessage tm = sess1.createTextMessage("message" + i);
-            
-            prod1.send(tm);
-         }
-         
-         for (int i = 0; i < NUM_MESSAGES / 2; i++)
-         {
-            TextMessage tm = (TextMessage)cons2.receive(1000);
-            
-            assertNotNull(tm);
-            
-            assertEquals("message" + i * 2, tm.getText());
-         }
-         
-         for (int i = 0; i < NUM_MESSAGES / 2; i++)
-         {
-            TextMessage tm = (TextMessage)cons3.receive(1000);
-            
-            assertNotNull(tm);
-            
-            assertEquals("message" + (i * 2 + 1), tm.getText());
-         }
-         
-         cons2.close();
-         
-         cons3.close();
-         
-         sess2.unsubscribe("sub1");
-         
-         sess3.unsubscribe("sub1");
-      
-      }
-      finally
-      {      
-         if (conn1 != null) conn1.close();
-         
-         if (conn2 != null) conn2.close();
-         
-         if (conn3 != null) conn3.close();
-      }
-   }
-
-   class MyListener implements MessageListener
-   {
-      private int i;
-      
-      MyListener(int i)
-      {
-         this.i = i;
-      }
-
-      public void onMessage(Message m)
-      {
-         try
-         {
-            int count = m.getIntProperty("count");
-            
-            log.info("Listener " + i + " received message " + count);
-         }
-         catch (Exception e)
-         {
-            e.printStackTrace();
-         }
-      }
-      
-   }
-   
-}

Modified: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/server/DestinationManagerTest.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/server/DestinationManagerTest.java	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/server/DestinationManagerTest.java	2006-11-21 21:23:34 UTC (rev 1613)
@@ -25,7 +25,11 @@
 import javax.jms.Topic;
 import javax.naming.InitialContext;
 import javax.naming.NameNotFoundException;
-
+import org.jboss.jms.server.DestinationManager;
+import org.jboss.jms.server.ServerPeer;
+import org.jboss.jms.server.destination.ManagedDestination;
+import org.jboss.jms.server.destination.ManagedQueue;
+import org.jboss.jms.server.destination.ManagedTopic;
 import org.jboss.test.messaging.MessagingTestCase;
 import org.jboss.test.messaging.tools.ServerManagement;
 
@@ -367,6 +371,69 @@
       Topic q = (Topic)initialContext.lookup(ServerManagement.DEFAULT_TOPIC_CONTEXT + "/" + name);
       assertEquals(name, q.getTopicName());      
    }
+   
+   public void testDestinationManager() throws Exception
+   {
+      ServerPeer sp = ServerManagement.getServer().getServerPeer();
+      
+      DestinationManager dm = sp.getDestinationManager();
+      
+      dm.stop();
+      
+      dm.start();
+        
+      ManagedQueue queue1 = new ManagedQueue("queue1", 1000, 10, 10);
+      
+      ManagedTopic topic1 = new ManagedTopic("topic1", 1000, 10, 10);
+      
+      dm.registerDestination(queue1);
+      
+      dm.registerDestination(topic1);
+      
+      ManagedDestination queue2 = dm.getDestination("not exists", true);
+      
+      assertNull(queue2);
+      
+      ManagedDestination topic2 = dm.getDestination("not exists", false);
+      
+      assertNull(topic2);
+      
+      ManagedQueue queue3 = (ManagedQueue)dm.getDestination("queue1", true);
+      
+      assertTrue(queue1 == queue3);
+      
+      ManagedDestination queue4 = dm.getDestination("queue1", false);
+      
+      assertNull(queue4);
+      
+      ManagedTopic topic3 = (ManagedTopic)dm.getDestination("topic1", false);
+      
+      assertTrue(topic1 == topic3);
+      
+      ManagedDestination topic4 = dm.getDestination("topic1", true);
+      
+      assertNull(topic4);            
+            
+      dm.unregisterDestination(queue1);
+      
+      ManagedDestination queue5 = dm.getDestination("queue1", true);
+      
+      assertNull(queue5);
+      
+      dm.unregisterDestination(topic1);
+      
+      ManagedDestination topic5 = dm.getDestination("topic1", false);
+      
+      assertNull(topic5);
+      
+      dm.registerDestination(queue1);
+      
+      dm.registerDestination(topic1);
+      
+      dm.stop();
+      
+      dm.start();
+   }
 
 
 

Modified: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/server/ServerPeerTest.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/server/ServerPeerTest.java	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/server/ServerPeerTest.java	2006-11-21 21:23:34 UTC (rev 1613)
@@ -21,15 +21,14 @@
   */
 package org.jboss.test.messaging.jms.server;
 
-import javax.naming.InitialContext;
-import javax.naming.Context;
-import javax.naming.NameNotFoundException;
 import javax.jms.Queue;
 import javax.jms.Topic;
-
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NameNotFoundException;
+import org.jboss.jms.util.MessagingJMSException;
 import org.jboss.test.messaging.MessagingTestCase;
 import org.jboss.test.messaging.tools.ServerManagement;
-import org.jboss.jms.util.MessagingJMSException;
 
 /**
  * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
@@ -83,7 +82,7 @@
 
       try
       {
-         ServerManagement.startServerPeer("0", "/some-new-context", null);
+         ServerManagement.startServerPeer(0, "/some-new-context", null);
          fail("should throw exception");
       }
       catch(MessagingJMSException e)
@@ -96,7 +95,7 @@
    {
       ServerManagement.stopServerPeer();
      
-      ServerManagement.startServerPeer("0", "/here-go-queues", "/and-here-topics/etc/etc");
+      ServerManagement.startServerPeer(0, "/here-go-queues", "/and-here-topics/etc/etc");
       
       try
       {

Modified: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/server/destination/QueueManagementTest.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/server/destination/QueueManagementTest.java	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/server/destination/QueueManagementTest.java	2006-11-21 21:23:34 UTC (rev 1613)
@@ -22,18 +22,9 @@
 package org.jboss.test.messaging.jms.server.destination;
 
 import java.util.List;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.DeliveryMode;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.TextMessage;
+import javax.jms.*;
 import javax.management.ObjectName;
 import javax.naming.InitialContext;
-
 import org.jboss.test.messaging.jms.server.destination.base.DestinationManagementTestBase;
 import org.jboss.test.messaging.tools.ServerManagement;
 
@@ -53,7 +44,7 @@
    private static final String MESSAGE_TWO = "message two";
 
    // Static --------------------------------------------------------
-   
+
    // Attributes ----------------------------------------------------
 
    // Constructors --------------------------------------------------
@@ -75,16 +66,16 @@
    {
       super.tearDown();
    }
-   
+
    public void testReloadQueue() throws Exception
-   {      
+   {
       String config =
          "<mbean code=\"org.jboss.jms.server.destination.QueueService\" " +
          "       name=\"somedomain:service=Queue,name=ReloadQueue\"" +
          "       xmbean-dd=\"xmdesc/Queue-xmbean.xml\">" +
          "    <depends optional-attribute-name=\"ServerPeer\">jboss.messaging:service=ServerPeer</depends>" +
          "</mbean>";
-      
+
       ObjectName destObjectName = deploy(config);
 
       assertEquals("ReloadQueue", ServerManagement.getAttribute(destObjectName, "Name"));
@@ -92,82 +83,82 @@
       String jndiName = "/queue/ReloadQueue";
       String s = (String)ServerManagement.getAttribute(destObjectName, "JNDIName");
       assertEquals(jndiName, s);
-      
+
       //Send some messages
-      
+
       InitialContext ic = new InitialContext(ServerManagement.getJNDIEnvironment());
-      
+
       ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
-      
+
       Queue queue = (Queue)ic.lookup("/queue/ReloadQueue");
 
       Connection conn = cf.createConnection();
-      
+
       Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-      
+
       MessageProducer prod = sess.createProducer(queue);
       prod.setDeliveryMode(DeliveryMode.PERSISTENT);
-  
+
       for (int i = 0; i < 10; i++)
       {
          TextMessage tm = sess.createTextMessage();
-         
+
          tm.setText("message:" + i);
-         
+
          prod.send(tm);
       }
-      
+
       conn.close();
-      
+
       //Receive half of them
-      
+
       conn = cf.createConnection();
-      
+
       sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-      
+
       MessageConsumer cons = sess.createConsumer(queue);
-      
+
       conn.start();
-      
+
       for (int i = 0; i < 5; i++)
       {
          TextMessage tm = (TextMessage)cons.receive(1000);
-         
+
          assertNotNull(tm);
-         
+
          assertEquals("message:" + i, tm.getText());
       }
-      
+
       conn.close();
-      
+
       //Undeploy and redeploy the queue
       //The last 5 persistent messages should still be there
-      
+
       undeployDestination("ReloadQueue");
-      
+
       deploy(config);
-      
+
       queue = (Queue)ic.lookup("/queue/ReloadQueue");
-      
+
       conn = cf.createConnection();
-      
+
       sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-      
+
       cons = sess.createConsumer(queue);
-      
+
       conn.start();
-      
+
       for (int i = 5; i < 10; i++)
       {
          TextMessage tm = (TextMessage)cons.receive(1000);
-         
+
          assertNotNull(tm);
-         
+
          assertEquals("message:" + i, tm.getText());
       }
-      
-      conn.close();      
-      
+
+      conn.close();
+
       undeployDestination("ReloadQueue");
    }
 
@@ -175,43 +166,43 @@
    {
       InitialContext ic = new InitialContext(ServerManagement.getJNDIEnvironment());
       ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
-      
+
       ServerManagement.deployQueue("QueueMessageCount");
-      
+
       try
       {
          Queue queue = (Queue)ic.lookup("/queue/QueueMessageCount");
-         
+
          // Test MessageCount, should be 0 msg
-         ObjectName destObjectName = 
+         ObjectName destObjectName =
             new ObjectName("jboss.messaging.destination:service=Queue,name=QueueMessageCount");
          Integer count = (Integer)ServerManagement.getAttribute(destObjectName, "MessageCount");
          assertEquals(0, count.intValue());
-         
+
          // Send 1 message to queue
          Connection conn = cf.createConnection();
          Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
          MessageProducer prod = session.createProducer(queue);
          prod.setDeliveryMode(DeliveryMode.PERSISTENT);
-         
+
          TextMessage m = session.createTextMessage("message one");
          prod.send(m);
-         conn.close();           
-         
+         conn.close();
+
          // Test MessageCount again, should be 1 msg
          count = (Integer)ServerManagement.getAttribute(destObjectName, "MessageCount");
          assertEquals(1, count.intValue());
-         
-         
+
+
          // Consume the message
          conn = cf.createConnection();
          session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
          MessageConsumer cons = session.createConsumer(queue);
          conn.start();
-         
+
          cons.receive();
          conn.close();
-         
+
          //Need to pause for a bit since the message is not necessarily removed
          //in memory until sometime after receive has completed
          Thread.sleep(1000);
@@ -275,6 +266,7 @@
             receivedCount++;
 
             Thread.sleep(500);
+
             int mc = ((Integer)ServerManagement.
                getAttribute(destObjectName, "MessageCount")).intValue();
 
@@ -374,72 +366,72 @@
          ServerManagement.undeployQueue("QueueRemoveMessages");
       }
    }
-   
+
    public void testListMessages() throws Exception
    {
       InitialContext ic = new InitialContext(ServerManagement.getJNDIEnvironment());
       ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
-      
+
       ServerManagement.deployQueue("QueueListMessages");
-      
+
       try
       {
-         
+
          Queue queue = (Queue)ic.lookup("/queue/QueueListMessages");
-         
+
          // Test listMessages, should be 0 msg
-         ObjectName destObjectName = 
+         ObjectName destObjectName =
             new ObjectName("jboss.messaging.destination:service=Queue,name=QueueListMessages");
-         
+
          List list = (List)ServerManagement.invoke(
-               destObjectName, 
-               "listMessages", 
-               new Object[] {null}, 
+               destObjectName,
+               "listMessages",
+               new Object[] {null},
                new String[] {"java.lang.String"});
          assertNotNull(list);
          assertEquals(0, list.size());
-         
+
          // Send 1 message to queue
          Connection conn = cf.createConnection();
          Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
          MessageProducer prod = session.createProducer(queue);
          prod.setDeliveryMode(DeliveryMode.PERSISTENT);
-         
+
          TextMessage m = session.createTextMessage("message one");
          prod.send(m);
          conn.close();
-           
+
          // Test listMessages again, should be 1 msg
          list = (List)ServerManagement.invoke(
-               destObjectName, 
-               "listMessages", 
-               new Object[] {null}, 
+               destObjectName,
+               "listMessages",
+               new Object[] {null},
                new String[] {"java.lang.String"});
          assertEquals(1, list.size());
          assertTrue(list.get(0) instanceof TextMessage);
          TextMessage m1 = (TextMessage)list.get(0);
          assertEquals(m1.getText(), m.getText());
-         
+
          // Consume the message
          conn = cf.createConnection();
          session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
          MessageConsumer cons = session.createConsumer(queue);
          conn.start();
-         
+
          cons.receive();
          conn.close();
-         
+
          // Test MessageCount again, should be 0 msg
          list = (List)ServerManagement.invoke(
-               destObjectName, 
-               "listMessages", 
-               new Object[] {null}, 
+               destObjectName,
+               "listMessages",
+               new Object[] {null},
                new String[] {"java.lang.String"});
          assertEquals(0, list.size());
       }
       finally
       {
-      
+
          ServerManagement.undeployQueue("QueueListMessages");
       }
    }
@@ -471,9 +463,9 @@
 
       ServerManagement.undeployQueue("QueueListMessages");
    }
-   
+
    // Package protected ---------------------------------------------
-   
+
    // Protected -----------------------------------------------------
 
    protected boolean isQueue()

Modified: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/ServerManagement.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/ServerManagement.java	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/ServerManagement.java	2006-11-21 21:23:34 UTC (rev 1613)
@@ -21,17 +21,11 @@
 */
 package org.jboss.test.messaging.tools;
 
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.InputStreamReader;
-import java.io.PrintStream;
 import java.rmi.Naming;
 import java.util.Hashtable;
 import java.util.Set;
-
 import javax.management.ObjectName;
 import javax.transaction.UserTransaction;
-
 import org.jboss.jms.message.MessageIdGeneratorFactory;
 import org.jboss.jms.server.DestinationManager;
 import org.jboss.logging.Logger;
@@ -49,6 +43,7 @@
  * is also use to start/stop a remote server.
  *
  * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
  * @version <tt>$Revision$</tt>
  *
  * $Id$
@@ -74,9 +69,7 @@
 
    private static final int RMI_SERVER_LOOKUP_RETRIES = 10;
 
-   private static Server server;
-   private static volatile Process process;
-   private static Thread vmStarter;
+   private static Server[] servers = new Server[RMITestServer.RMI_REGISTRY_PORTS.length];
 
    public static boolean isLocal()
    {
@@ -90,25 +83,42 @@
 
    public static Server getServer()
    {
-      return server;
+      return getServer(0);
    }
-
+   
+   public static Server getServer(int i)
+   {
+      Server s = servers[i];
+      
+      if (s == null)
+      {
+         throw new IllegalStateException("Server " + i + " is not started!");
+      }
+      
+      return s;
+   }
+   
    public static synchronized void create() throws Exception
    {
-      if (server != null)
+      create(0);
+   }
+
+   public static synchronized void create(int index) throws Exception
+   {
+      if (servers[index] != null)
       {
          return;
       }
 
       if (isLocal())
       {
-         server = new LocalTestServer();
+         servers[index] = new LocalTestServer();
          return;
       }
 
-      server = acquireRemote(RMI_SERVER_LOOKUP_RETRIES);
+      servers[index] = acquireRemote(RMI_SERVER_LOOKUP_RETRIES, index);
 
-      if (server != null)
+      if (servers[index] != null)
       {
          // RMI server started
          return;
@@ -121,15 +131,20 @@
       // but when running such a test from a forking ant, ant blocks forever waiting for *this* VM
       // to exit. That's why I require the remote server to be started in advance.
 
-      throw new IllegalStateException("The RMI server doesn't seem to be started. " +
+      throw new IllegalStateException("The RMI server " + index + " doesn't seem to be started. " +
                                       "Start it and re-run the test.");
 
    }
-
+   
    public static synchronized void start(String config) throws Exception
    {
-      create();
+      start(config, 0, false);
+   }
 
+   public static synchronized void start(String config, int index, boolean clustered) throws Exception
+   {
+      create(index);
+
       if (isLocal())
       {
          log.info("IN-VM TEST");
@@ -141,106 +156,99 @@
       
       MessageIdGeneratorFactory.instance.clear();      
 
-      server.start(config);
+      //Now start the server
+      servers[index].start(config, clustered);
 
       log.debug("server started");
    }
 
    public static synchronized void stop() throws Exception
    {
-      if (server != null)
-      {
-         server.stop();
-      }
+      insureStarted();
+      
+      servers[0].stop();      
    }
 
    public static synchronized void destroy() throws Exception
    {
       stop();
 
-      server.destroy();
+      servers[0].destroy();
 
-      if (isRemote())
-      {
-         log.debug("destroying the remote server VM");
-         process.destroy();
-         log.debug("remote server VM destroyed");
-      }
-      server = null;
+      servers[0] = null;
    }
 
    public static void disconnect() throws Exception
    {
       if (isRemote())
       {
-         server = null;
-         process = null;
-         if (vmStarter != null)
-         {
-            vmStarter.interrupt();
-            vmStarter = null;
-         }
+         servers[0] = null;
       }
    }
 
    public static ObjectName deploy(String mbeanConfiguration) throws Exception
    {
       insureStarted();
-      return server.deploy(mbeanConfiguration);
+      return servers[0].deploy(mbeanConfiguration);
    }
 
    public static void undeploy(ObjectName on) throws Exception
    {
       insureStarted();
-      server.undeploy(on);
+      servers[0].undeploy(on);
    }
 
    public static Object getAttribute(ObjectName on, String attribute) throws Exception
    {
       insureStarted();
-      return server.getAttribute(on, attribute);
+      return servers[0].getAttribute(on, attribute);
    }
 
    public static void setAttribute(ObjectName on, String name, String valueAsString)
       throws Exception
    {
       insureStarted();
-      server.setAttribute(on, name, valueAsString);
+      servers[0].setAttribute(on, name, valueAsString);
    }
 
    public static Object invoke(ObjectName on, String operationName,
                                Object[] params, String[] signature) throws Exception
    {
       insureStarted();
-      return server.invoke(on, operationName, params, signature);
+      return servers[0].invoke(on, operationName, params, signature);
    }
 
    public static Set query(ObjectName pattern) throws Exception
    {
       insureStarted();
-      return server.query(pattern);
+      return servers[0].query(pattern);
    }
 
    public static UserTransaction getUserTransaction() throws Exception
    {
       insureStarted();
-      return server.getUserTransaction();
+      return servers[0].getUserTransaction();
    }
-
+   
    public static void log(int level, String text)
    {
+      log(level, text, 0);
+   }
+
+   public static void log(int level, String text, int index)
+   {
       if (isRemote())
       {
-         if (server == null)
+         if (servers[index] == null)
          {
-            log.debug("The remote server has not been created yet " +
+            log.debug("The remote server " + index + " has not been created yet " +
                       "so this log won't make it to the server!");
             return;
          }
 
          try
          {
-            server.log(level, text);
+            servers[index].log(level, text);
          }
          catch(Exception e)
          {
@@ -251,7 +259,7 @@
 
    public static void startServerPeer() throws Exception
    {
-      startServerPeer(null, null, null);
+      startServerPeer(0, null, null);
    }
 
    /**
@@ -259,30 +267,30 @@
     * @param defaultQueueJNDIContext - if null, the jboss-service.xml value will be used.
     * @param defaultTopicJNDIContext - if null, the jboss-service.xml value will be used.
     */
-   public static void startServerPeer(String serverPeerID,
+   public static void startServerPeer(int serverPeerID,
                                       String defaultQueueJNDIContext,
                                       String defaultTopicJNDIContext) throws Exception
    {
       insureStarted();
-      server.startServerPeer(serverPeerID, defaultQueueJNDIContext, defaultTopicJNDIContext);
+      servers[0].startServerPeer(serverPeerID, defaultQueueJNDIContext, defaultTopicJNDIContext, false);
    }
 
    public static void stopServerPeer() throws Exception
    {
       insureStarted();
-      server.stopServerPeer();
+      servers[0].stopServerPeer();
    }
 
    public static boolean isServerPeerStarted() throws Exception
    {
       insureStarted();
-      return server.isServerPeerStarted();
+      return servers[0].isServerPeerStarted();
    }
 
    public static ObjectName getServerPeerObjectName() throws Exception
    {
       insureStarted();
-      return server.getServerPeerObjectName();
+      return servers[0].getServerPeerObjectName();
    }
 
    /**
@@ -292,7 +300,7 @@
    public static Set getConnectorSubsystems() throws Exception
    {
       insureStarted();
-      return server.getConnectorSubsystems();
+      return servers[0].getConnectorSubsystems();
    }
 
    /**
@@ -303,7 +311,7 @@
                                                  ServerInvocationHandler handler) throws Exception
    {
       insureStarted();
-      server.addServerInvocationHandler(subsystem, handler);
+      servers[0].addServerInvocationHandler(subsystem, handler);
    }
 
    /**
@@ -314,47 +322,56 @@
       throws Exception
    {
       insureStarted();
-      server.removeServerInvocationHandler(subsystem);
+      servers[0].removeServerInvocationHandler(subsystem);
    }
 
    public static MessageStore getMessageStore() throws Exception
    {
       insureStarted();
-      return server.getMessageStore();
+      return servers[0].getMessageStore();
    }
 
    public static DestinationManager getDestinationManager()
       throws Exception
    {
       insureStarted();
-      return server.getDestinationManager();
+      return servers[0].getDestinationManager();
    }
 
    public static PersistenceManager getPersistenceManager()
       throws Exception
    {
       insureStarted();
-      return server.getPersistenceManager();
+      return servers[0].getPersistenceManager();
    }
 
    public static void configureSecurityForDestination(String destName, String config)
       throws Exception
    {
       insureStarted();
-      server.configureSecurityForDestination(destName, config);
+      servers[0].configureSecurityForDestination(destName, config);
    }
 
    public static void setDefaultSecurityConfig(String config) throws Exception
    {
       insureStarted();
-      server.setDefaultSecurityConfig(config);
+      servers[0].setDefaultSecurityConfig(config);
    }
 
    public static String getDefaultSecurityConfig() throws Exception
    {
       insureStarted();
-      return server.getDefaultSecurityConfig();
+      return servers[0].getDefaultSecurityConfig();
    }
+   
+   /**
+    * Simulates a topic deployment (copying the topic descriptor in the deploy directory).
+    */
+   public static void deployClusteredTopic(String name, int serverIndex) throws Exception
+   {
+      insureStarted(serverIndex);
+      servers[serverIndex].deployTopic(name, null, true);
+   }
 
    /**
     * Simulates a topic deployment (copying the topic descriptor in the deploy directory).
@@ -370,7 +387,7 @@
    public static void deployTopic(String name, String jndiName) throws Exception
    {
       insureStarted();
-      server.deployTopic(name, jndiName);
+      servers[0].deployTopic(name, jndiName, false);
    }
 
    /**
@@ -389,7 +406,7 @@
                                   int downCacheSize) throws Exception
    {
       insureStarted();
-      server.deployTopic(name, jndiName, fullSize, pageSize, downCacheSize);
+      servers[0].deployTopic(name, jndiName, fullSize, pageSize, downCacheSize, false);
    }
 
    /**
@@ -399,6 +416,14 @@
    {
       undeployDestination(false, name);
    }
+   
+   /**
+    * Simulates a topic un-deployment (deleting the topic descriptor from the deploy directory).
+    */
+   public static void undeployTopic(String name, int serverIndex) throws Exception
+   {
+      undeployDestination(false, name, serverIndex);
+   }
 
    /**
     * Creates a topic programatically.
@@ -406,7 +431,7 @@
    public static void createTopic(String name, String jndiName) throws Exception
    {
       insureStarted();
-      server.createTopic(name, jndiName);
+      servers[0].createTopic(name, jndiName);
    }
 
    /**
@@ -414,8 +439,17 @@
     */
    public static boolean destroyTopic(String name) throws Exception
    {
-      return server.destroyDestination(false, name);
+      return servers[0].destroyDestination(false, name);
    }
+   
+   /**
+    * Simulates a queue deployment (copying the queue descriptor in the deploy directory).
+    */
+   public static void deployClusteredQueue(String name, int serverIndex) throws Exception
+   {
+      insureStarted(serverIndex);
+      servers[serverIndex].deployQueue(name, null, true);
+   }
 
    /**
     * Simulates a queue deployment (copying the queue descriptor in the deploy directory).
@@ -431,7 +465,7 @@
    public static void deployQueue(String name, String jndiName) throws Exception
    {
       insureStarted();
-      server.deployQueue(name, jndiName);
+      servers[0].deployQueue(name, jndiName, false);
    }
 
    /**
@@ -450,7 +484,7 @@
                                   int downCacheSize) throws Exception
    {
       insureStarted();
-      server.deployQueue(name, jndiName, fullSize, pageSize, downCacheSize);
+      servers[0].deployQueue(name, jndiName, fullSize, pageSize, downCacheSize, false);
    }
 
    /**
@@ -460,6 +494,14 @@
    {
       undeployDestination(true, name);
    }
+   
+   /**
+    * Simulates a queue un-deployment (deleting the queue descriptor from the deploy directory).
+    */
+   public static void undeployQueue(String name, int serverIndex) throws Exception
+   {
+      undeployDestination(true, name, serverIndex);
+   }
 
    /**
     * Creates a queue programatically.
@@ -467,7 +509,7 @@
    public static void createQueue(String name, String jndiName) throws Exception
    {
       insureStarted();
-      server.createQueue(name, jndiName);
+      servers[0].createQueue(name, jndiName);
    }
 
    /**
@@ -475,7 +517,7 @@
     */
    public static boolean destroyQueue(String name) throws Exception
    {
-      return server.destroyDestination(true, name);
+      return servers[0].destroyDestination(true, name);
    }
 
    /**
@@ -485,8 +527,18 @@
    private static void undeployDestination(boolean isQueue, String name) throws Exception
    {
       insureStarted();
-      server.undeployDestination(isQueue, name);
+      servers[0].undeployDestination(isQueue, name);
    }
+   
+   /**
+    * Simulates a destination un-deployment (deleting the destination descriptor from the deploy
+    * directory).
+    */
+   private static void undeployDestination(boolean isQueue, String name, int serverIndex) throws Exception
+   {
+      insureStarted(serverIndex);
+      servers[serverIndex].undeployDestination(isQueue, name);
+   }
 
    public static void deployConnectionFactory(String objectName,
                                               String[] jndiBindings,
@@ -496,7 +548,7 @@
                                               int defaultTempQueueDownCacheSize)
       throws Exception
    {
-      server.deployConnectionFactory(objectName,
+      servers[0].deployConnectionFactory(objectName,
                                      jndiBindings,
                                      prefetchSize,
                                      defaultTempQueueFullSize,
@@ -509,19 +561,19 @@
                                               int prefetchSize)
       throws Exception
    {
-      server.deployConnectionFactory(objectName, jndiBindings, prefetchSize);
+      servers[0].deployConnectionFactory(objectName, jndiBindings, prefetchSize);
    }
    
    public static void deployConnectionFactory(String objectName,
                                               String[] jndiBindings)
       throws Exception
    {
-      server.deployConnectionFactory(objectName, jndiBindings);
+      servers[0].deployConnectionFactory(objectName, jndiBindings);
    }
 
    public static void undeployConnectionFactory(ObjectName objectName) throws Exception
    {
-      server.undeployConnectionFactory(objectName);
+      servers[0].undeployConnectionFactory(objectName);
    }
 
    public static Hashtable getJNDIEnvironment()
@@ -532,9 +584,14 @@
       }
       else
       {
-         return RemoteInitialContextFactory.getJNDIEnvironment();
+         return getJNDIEnvironment(0);
       }
    }
+   
+   public static Hashtable getJNDIEnvironment(int index)
+   {
+      return RemoteInitialContextFactory.getJNDIEnvironment(index);      
+   }
 
    // Attributes ----------------------------------------------------
 
@@ -550,19 +607,24 @@
 
    private static void insureStarted() throws Exception
    {
-      if (server == null)
+      insureStarted(0);
+   }
+   
+   private static void insureStarted(int index) throws Exception
+   {
+      if (servers[index] == null)
       {
-         throw new Exception("The server has not been created!");
+         throw new Exception("The server " + index + " has not been created!");
       }
-      if (!server.isStarted())
+      if (!servers[index].isStarted())
       {
-         throw new Exception("The server has not been started!");
+         throw new Exception("The server " + index + " has not been started!");
       }
    }
 
-   private static Server acquireRemote(int initialRetries)
+   private static Server acquireRemote(int initialRetries, int index)
    {
-      String name = "//localhost:" + RMITestServer.RMI_REGISTRY_PORT + "/" + RMITestServer.RMI_SERVER_NAME;
+      String name = "//localhost:" + RMITestServer.RMI_REGISTRY_PORTS[index] + "/" + RMITestServer.RMI_SERVER_NAME;
       Server s = null;
       int retries = initialRetries;
       while(s == null && retries > 0)
@@ -598,138 +660,138 @@
 
    // Inner classes -------------------------------------------------
 
-   static class VMStarter implements Runnable
-   {
-      public void run()
-      {
-         // start a remote java process that runs a TestServer
-
-         String userDir = System.getProperty("user.dir");
-         String javaClassPath = System.getProperty("java.class.path");
-         String fileSeparator = System.getProperty("file.separator");
-         String javaHome = System.getProperty("java.home");
-         String moduleOutput = System.getProperty("module.output");
-
-         String osName = System.getProperty("os.name").toLowerCase();
-         boolean isWindows = osName.indexOf("windows") != -1;
-
-         String javaExecutable =
-            javaHome + fileSeparator + "bin" + fileSeparator + "java" + (isWindows ? ".exe" : "");
-
-         String[] cmdarray = new String[]
-         {
-            javaExecutable,
-            "-cp",
-            javaClassPath,
-            "-Dmodule.output=" + moduleOutput,
-            "-Dremote.test.suffix=-remote",
-            "org.jboss.test.messaging.tools.jmx.rmi.TestServer",
-         };
-
-         String[] environment;
-         if (isWindows)
-         {
-            environment = new String[]
-            {
-               "SYSTEMROOT=C:\\WINDOWS" // TODO get this from environment, as it may be diffrent on different machines
-            };
-         }
-         else
-         {
-            environment = new String[0];
-         }
-
-         Runtime runtime = Runtime.getRuntime();
-
-         try
-         {
-            log.debug("creating external process");
-
-            Thread stdoutLogger = new Thread(new RemoteProcessLogger(RemoteProcessLogger.STDOUT),
-                                             "Remote VM STDOUT Logging Thread");
-            Thread stderrLogger = new Thread(new RemoteProcessLogger(RemoteProcessLogger.STDERR),
-                                             "Remote VM STDERR Logging Thread");
-
-            stdoutLogger.setDaemon(true);
-            stdoutLogger.setDaemon(true);
-            stdoutLogger.start();
-            stderrLogger.start();
-
-            process = runtime.exec(cmdarray, environment, new File(userDir));
-         }
-         catch(Exception e)
-         {
-            log.error("Error spawning remote server", e);
-         }
-      }
-   }
-
-   /**
-    * This logger is used to get and display the output generated at stdout or stderr by the
-    * RMI server VM.
-    */
-   static class RemoteProcessLogger implements Runnable
-   {
-      public static final int STDOUT = 0;
-      public static final int STDERR = 1;
-
-      private int type;
-      private BufferedReader br;
-      private PrintStream out;
-
-      public RemoteProcessLogger(int type)
-      {
-         this.type = type;
-
-         if (type == STDOUT)
-         {
-            out = System.out;
-         }
-         else if (type == STDERR)
-         {
-            out = System.err;
-         }
-         else
-         {
-            throw new IllegalArgumentException("Unknown type " + type);
-         }
-      }
-
-      public void run()
-      {
-         while(process == null)
-         {
-            try
-            {
-               Thread.sleep(50);
-            }
-            catch(InterruptedException e)
-            {
-               // OK
-            }
-         }
-
-         if (type == STDOUT)
-         {
-            br = new BufferedReader(new InputStreamReader(process.getInputStream()));
-         }
-         else if (type == STDERR)
-         {
-            br = new BufferedReader(new InputStreamReader(process.getErrorStream()));
-         }
-
-         String line;
-         try
-         {
-            while((line = br.readLine()) != null)
-            {
-               out.println(line);
-            }
-         }
-         catch(Exception e)
-         {
-            log.error("failed to read from process " + process, e);
-         }
-      }
-   }
+//   static class VMStarter implements Runnable
+//   {
+//      public void run()
+//      {
+//         // start a remote java process that runs a TestServer
+//
+//         String userDir = System.getProperty("user.dir");
+//         String javaClassPath = System.getProperty("java.class.path");
+//         String fileSeparator = System.getProperty("file.separator");
+//         String javaHome = System.getProperty("java.home");
+//         String moduleOutput = System.getProperty("module.output");
+//
+//         String osName = System.getProperty("os.name").toLowerCase();
+//         boolean isWindows = osName.indexOf("windows") != -1;
+//
+//         String javaExecutable =
+//            javaHome + fileSeparator + "bin" + fileSeparator + "java" + (isWindows ? ".exe" : "");
+//
+//         String[] cmdarray = new String[]
+//         {
+//            javaExecutable,
+//            "-cp",
+//            javaClassPath,
+//            "-Dmodule.output=" + moduleOutput,
+//            "-Dremote.test.suffix=-remote",
+//            "org.jboss.test.messaging.tools.jmx.rmi.TestServer",
+//         };
+//
+//         String[] environment;
+//         if (isWindows)
+//         {
+//            environment = new String[]
+//            {
+//               "SYSTEMROOT=C:\\WINDOWS" // TODO get this from environment, as it may be diffrent on different machines
+//            };
+//         }
+//         else
+//         {
+//            environment = new String[0];
+//         }
+//
+//         Runtime runtime = Runtime.getRuntime();
+//
+//         try
+//         {
+//            log.debug("creating external process");
+//
+//            Thread stdoutLogger = new Thread(new RemoteProcessLogger(RemoteProcessLogger.STDOUT),
+//                                             "Remote VM STDOUT Logging Thread");
+//            Thread stderrLogger = new Thread(new RemoteProcessLogger(RemoteProcessLogger.STDERR),
+//                                             "Remote VM STDERR Logging Thread");
+//
+//            stdoutLogger.setDaemon(true);
+//            stdoutLogger.setDaemon(true);
+//            stdoutLogger.start();
+//            stderrLogger.start();
+//
+//            process = runtime.exec(cmdarray, environment, new File(userDir));
+//         }
+//         catch(Exception e)
+//         {
+//            log.error("Error spawning remote server", e);
+//         }
+//      }
+//   }
+//
+//   /**
+//    * This logger is used to get and display the output generated at stdout or stderr by the
+//    * RMI server VM.
+//    */
+//   static class RemoteProcessLogger implements Runnable
+//   {
+//      public static final int STDOUT = 0;
+//      public static final int STDERR = 1;
+//
+//      private int type;
+//      private BufferedReader br;
+//      private PrintStream out;
+//
+//      public RemoteProcessLogger(int type)
+//      {
+//         this.type = type;
+//
+//         if (type == STDOUT)
+//         {
+//            out = System.out;
+//         }
+//         else if (type == STDERR)
+//         {
+//            out = System.err;
+//         }
+//         else
+//         {
+//            throw new IllegalArgumentException("Unknown type " + type);
+//         }
+//      }
+//
+//      public void run()
+//      {
+//         while(process == null)
+//         {
+//            try
+//            {
+//               Thread.sleep(50);
+//            }
+//            catch(InterruptedException e)
+//            {
+//               // OK
+//            }
+//         }
+//
+//         if (type == STDOUT)
+//         {
+//            br = new BufferedReader(new InputStreamReader(process.getInputStream()));
+//         }
+//         else if (type == STDERR)
+//         {
+//            br = new BufferedReader(new InputStreamReader(process.getErrorStream()));
+//         }
+//
+//         String line;
+//         try
+//         {
+//            while((line = br.readLine()) != null)
+//            {
+//               out.println(line);
+//            }
+//         }
+//         catch(Exception e)
+//         {
+//            log.error("failed to read from process " + process, e);
+//         }
+//      }
+//   }
 }

Modified: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java	2006-11-21 21:23:34 UTC (rev 1613)
@@ -22,30 +22,12 @@
 package org.jboss.test.messaging.tools.jmx;
 
 
-import java.net.URL;
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.Statement;
-import java.sql.PreparedStatement;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
-import java.util.StringTokenizer;
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;
-
-import javax.management.Attribute;
-import javax.management.MBeanAttributeInfo;
-import javax.management.MBeanException;
-import javax.management.MBeanInfo;
-import javax.management.MBeanServer;
-import javax.management.MBeanServerFactory;
-import javax.management.ObjectName;
+import java.net.URL;
+import java.sql.*;
+import java.util.*;
+import javax.management.*;
 import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NameNotFoundException;
@@ -53,23 +35,21 @@
 import javax.sql.DataSource;
 import javax.transaction.TransactionManager;
 import javax.transaction.UserTransaction;
-
 import org.hsqldb.Server;
 import org.hsqldb.persist.HsqlProperties;
 import org.jboss.jms.jndi.JNDIProviderAdapter;
+import org.jboss.jms.server.ServerPeer;
+import org.jboss.jms.server.remoting.JMSServerInvocationHandler;
 import org.jboss.jms.util.JNDIUtil;
 import org.jboss.jms.util.XMLUtil;
-import org.jboss.jms.server.remoting.JMSServerInvocationHandler;
-import org.jboss.jms.server.ServerPeer;
 import org.jboss.logging.Logger;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.ServerInvocationHandler;
+import org.jboss.remoting.serialization.SerializationStreamFactory;
 import org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory;
 import org.jboss.resource.adapter.jdbc.remote.WrapperDataSourceService;
 import org.jboss.resource.adapter.jms.JmsManagedConnectionFactory;
-import org.jboss.resource.connectionmanager.CachedConnectionManager;
-import org.jboss.resource.connectionmanager.CachedConnectionManagerMBean;
-import org.jboss.resource.connectionmanager.ConnectionFactoryBindingService;
-import org.jboss.resource.connectionmanager.JBossManagedConnectionPool;
-import org.jboss.resource.connectionmanager.TxConnectionManager;
+import org.jboss.resource.connectionmanager.*;
 import org.jboss.system.Registry;
 import org.jboss.system.ServiceController;
 import org.jboss.system.ServiceCreator;
@@ -81,9 +61,6 @@
 import org.jboss.tm.TransactionManagerLocator;
 import org.jboss.tm.TransactionManagerService;
 import org.jboss.tm.usertx.client.ServerVMClientUserTransaction;
-import org.jboss.remoting.InvokerLocator;
-import org.jboss.remoting.ServerInvocationHandler;
-import org.jboss.remoting.serialization.SerializationStreamFactory;
 
 
 /**
@@ -188,6 +165,10 @@
 
    private List toUnbindAtExit;
    private String ipAddressOrHostName;
+   
+   //There may be many service containers on the same machine, so we need to distinguish them
+   //so we don't start up multiple servers with services running on the same port
+   private int serverIndex;
 
    // Static --------------------------------------------------------
 
@@ -247,10 +228,15 @@
 
    // Constructors --------------------------------------------------
 
-   public ServiceContainer(String sevicesToStart) throws Exception
+   public ServiceContainer(String servicesToStart) throws Exception
    {
-      this(sevicesToStart, null);
+      this(servicesToStart, null);
    }
+   
+   public ServiceContainer(String sevicesToStart, int serverIndex) throws Exception
+   {
+      this(sevicesToStart, null, serverIndex);
+   }
 
    /**
     * @param sevicesToStart - A comma separated list of services to be started. Available services:
@@ -265,7 +251,16 @@
       this.tm = tm;
       parseConfig(sevicesToStart);
       toUnbindAtExit = new ArrayList();
+      this.serverIndex = 0;
    }
+   
+   public ServiceContainer(String sevicesToStart, TransactionManager tm, int serverIndex) throws Exception
+   {
+      this.tm = tm;
+      parseConfig(sevicesToStart);
+      toUnbindAtExit = new ArrayList();
+      this.serverIndex = serverIndex;
+   }
 
    // Public --------------------------------------------------------
 
@@ -482,7 +477,7 @@
       String persistenceConfigFile =
          "server/default/deploy/" + databaseType + "-persistence-service.xml";
       
-      log.info("********* LOADING CONFIG FILE: " + persistenceConfigFile);
+      log.info("********* Using config file: " + persistenceConfigFile);
       
       URL persistenceConfigFileURL = getClass().getClassLoader().getResource(persistenceConfigFile);
       if (persistenceConfigFileURL == null)
@@ -497,8 +492,6 @@
       
       String props = persistenceManagerConfig.getAttributeValue("SqlProperties");
       
-      log.info("sql properties are: " + props);
-      
       if (props != null)
       {         
          ByteArrayInputStream is = new ByteArrayInputStream(props.getBytes());
@@ -522,7 +515,7 @@
       String persistenceConfigFile =
          "server/default/deploy/" + databaseType + "-persistence-service.xml";
       
-      log.info("********* LOADING CONFIG FILE: " + persistenceConfigFile);
+      log.info("********* Using config file: " + persistenceConfigFile);
       
       URL persistenceConfigFileURL = getClass().getClassLoader().getResource(persistenceConfigFile);
       if (persistenceConfigFileURL == null)
@@ -557,10 +550,19 @@
    {
       String databaseType = getDatabaseType();
       
-      String persistenceConfigFile =
-         "server/default/deploy/clustered-" + databaseType + "-persistence-service.xml";
+      String persistenceConfigFile;
+      if (databaseType.equals("hsqldb"))
+      {
+         persistenceConfigFile =
+            "server/default/deploy/" + databaseType + "-persistence-service.xml";
+      }
+      else
+      {
+         persistenceConfigFile =
+            "server/default/deploy/clustered-" + databaseType + "-persistence-service.xml";
+      }
       
-      log.info("********* LOADING CONFIG FILE: " + persistenceConfigFile);
+      log.info("********* Using config file: " + persistenceConfigFile);
       
       URL persistenceConfigFileURL = getClass().getClassLoader().getResource(persistenceConfigFile);
       if (persistenceConfigFileURL == null)
@@ -1110,14 +1112,16 @@
                       "socket.check_connection=false&" +
                       "leasePeriod=20000";
 
+      int portNumber = 9111 + serverIndex;
+      
       String locatorURI;
       if (multiplex)
       {
-         locatorURI = "multiplex://" + ipAddressOrHostName + ":9111" + params;
+         locatorURI = "multiplex://" + ipAddressOrHostName + ":" + portNumber + params;
       }
       else
       {
-         locatorURI = "socket://" + ipAddressOrHostName + ":9111" + params;
+         locatorURI = "socket://" + ipAddressOrHostName + ":" + portNumber + params;
       }
 
       log.debug("Using the following locator uri:" + locatorURI);

Modified: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainerConfiguration.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainerConfiguration.java	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainerConfiguration.java	2006-11-21 21:23:34 UTC (rev 1613)
@@ -6,19 +6,18 @@
  */
 package org.jboss.test.messaging.tools.jmx;
 
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Node;
-import org.w3c.dom.NamedNodeMap;
-import org.jboss.jms.util.XMLUtil;
-import org.jboss.jms.util.XMLException;
-
 import java.io.InputStream;
+import java.io.InputStreamReader;
 import java.io.Reader;
-import java.io.InputStreamReader;
+import java.util.HashMap;
+import java.util.Map;
 import java.util.StringTokenizer;
-import java.util.Map;
-import java.util.HashMap;
+import org.jboss.jms.util.XMLException;
+import org.jboss.jms.util.XMLUtil;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
 
 /**
  * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
@@ -95,7 +94,12 @@
    public String getDatabaseType()
    {
       DatabaseConfiguration dbc = (DatabaseConfiguration)dbConfigurations.get(database);
-      return dbc.getDatabaseType();
+      String databaseType = dbc.getDatabaseType();
+      if (databaseType.equals("jtds"))
+      {
+    	  databaseType="mssql";
+      }
+      return databaseType; 
    }
 
    public String getDatabaseConnectionURL()

Modified: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/rmi/LocalTestServer.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/rmi/LocalTestServer.java	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/rmi/LocalTestServer.java	2006-11-21 21:23:34 UTC (rev 1613)
@@ -26,13 +26,11 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
-
 import javax.jms.Destination;
 import javax.jms.Queue;
 import javax.jms.Topic;
 import javax.management.ObjectName;
 import javax.transaction.UserTransaction;
-
 import org.jboss.jms.server.DestinationManager;
 import org.jboss.jms.server.ServerPeer;
 import org.jboss.jms.util.XMLUtil;
@@ -79,6 +77,8 @@
 
    // List<ObjectName>
    private List connFactoryObjectNames;
+   
+   private int serverIndex;
 
    // Constructors --------------------------------------------------
 
@@ -88,27 +88,41 @@
 
       connFactoryObjectNames = new ArrayList();
    }
+   
+   public LocalTestServer(int serverIndex)
+   {
+      this();
+      
+      this.serverIndex = serverIndex;
+   }
 
    // Server implementation -----------------------------------------
 
-   public synchronized void start(String containerConfig) throws Exception
+   public synchronized void start(String containerConfig, boolean clustered) throws Exception
    {
       if (isStarted())
       {
          return;
       }
-
+      
       log.debug("starting service container");
 
-      sc = new ServiceContainer(containerConfig, null);
+      sc = new ServiceContainer(containerConfig, null, serverIndex);
       sc.start();
+      
+      log.info("********* STARTING SERVER DATABASE TYPE IS " + sc.getDatabaseType());
+      
+      if (this.getDatabaseType().equals("hsqldb") && clustered)
+      {
+         throw new IllegalStateException("The test server cannot be started in clustered mode with hsqldb as a database - must use a shared database");
+      }
 
       if ("none".equals(containerConfig))
       {
          return;
       }
 
-      startServerPeer(null, null, null);
+      startServerPeer(serverIndex, null, null, clustered);
 
       log.info("server started");
    }
@@ -211,12 +225,15 @@
       return sc != null;
    }
 
-   public void startServerPeer(String serverPeerID,
+   public void startServerPeer(int serverPeerID,
                                String defaultQueueJNDIContext,
-                               String defaultTopicJNDIContext) throws Exception
+                               String defaultTopicJNDIContext,
+                               boolean clustered) throws Exception
    {
       try
-      {
+      {         
+         log.info("******* STARTING SERVER PEER WITH ID " + serverPeerID);
+         
          log.debug("creating ServerPeer instance");
    
          // we are using the "default" service deployment descriptors available in
@@ -230,9 +247,21 @@
          }
    
          String databaseType = sc.getDatabaseType();
-         String persistenceConfigFile =
-            "server/default/deploy/" + databaseType + "-persistence-service.xml";
+         String persistenceConfigFile;
          
+         if (clustered && !databaseType.equals("hsqldb"))
+         {
+            //HSQL can't be used for clustered server peer - since it's not a shared database
+            
+            persistenceConfigFile =
+               "server/default/deploy/clustered-" + databaseType + "-persistence-service.xml";
+         }
+         else
+         {
+            persistenceConfigFile  =
+               "server/default/deploy/" + databaseType + "-persistence-service.xml";
+         }
+         
          log.info("********* LOADING CONFIG FILE: " + persistenceConfigFile);
          
          URL persistenceConfigFileURL = getClass().getClassLoader().getResource(persistenceConfigFile);
@@ -269,10 +298,8 @@
             (MBeanConfigurationElement)mdd.query("service", "ServerPeer").iterator().next();
    
          // overwrite the file configuration, if needed
-         if (serverPeerID != null)
-         {
-            serverPeerConfig.setConstructorArgumentValue(0, 0, serverPeerID);
-         }
+         serverPeerConfig.setConstructorArgumentValue(0, 0, String.valueOf(serverPeerID));
+         
          if (defaultQueueJNDIContext != null)
          {
             serverPeerConfig.setConstructorArgumentValue(0, 1, defaultQueueJNDIContext);
@@ -292,9 +319,7 @@
    
          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);
@@ -307,8 +332,6 @@
          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");
@@ -560,15 +583,15 @@
          getAttribute(serverPeerObjectName, "Instance");
    }
 
-   public void deployTopic(String name, String jndiName) throws Exception
+   public void deployTopic(String name, String jndiName, boolean clustered) throws Exception
    {
-      deployDestination(false, name, jndiName);
+      deployDestination(false, name, jndiName, clustered);
    }
 
    public void deployTopic(String name, String jndiName, int fullSize, int pageSize,
-                           int downCacheSize) throws Exception
+                           int downCacheSize, boolean clustered) throws Exception
    {
-      deployDestination(false, name, jndiName, fullSize, pageSize, downCacheSize);
+      deployDestination(false, name, jndiName, fullSize, pageSize, downCacheSize, clustered);
    }
 
    public void createTopic(String name, String jndiName) throws Exception
@@ -578,15 +601,15 @@
                 new String[] { "java.lang.String", "java.lang.String"} );
    }
 
-   public void deployQueue(String name, String jndiName) throws Exception
+   public void deployQueue(String name, String jndiName, boolean clustered) throws Exception
    {
-      deployDestination(true, name, jndiName);
+      deployDestination(true, name, jndiName, clustered);
    }
    
    public void deployQueue(String name, String jndiName, int fullSize, int pageSize,
-                           int downCacheSize) throws Exception
+                           int downCacheSize, boolean clustered) throws Exception
    {
-      deployDestination(true, name, jndiName, fullSize, pageSize, downCacheSize);
+      deployDestination(true, name, jndiName, fullSize, pageSize, downCacheSize, clustered);
    }
 
    public void createQueue(String name, String jndiName) throws Exception
@@ -596,7 +619,7 @@
                 new String[] { "java.lang.String", "java.lang.String"} );
    }
 
-   public void deployDestination(boolean isQueue, String name, String jndiName) throws Exception
+   public void deployDestination(boolean isQueue, String name, String jndiName, boolean clustered) throws Exception
    {
       String config =
          "<mbean code=\"org.jboss.jms.server.destination." + (isQueue ? "QueueService" : "TopicService") + "\"" +
@@ -604,6 +627,7 @@
          "       xmbean-dd=\"xmdesc/" + (isQueue ? "Queue" : "Topic" ) + "-xmbean.xml\">" +
          (jndiName != null ? "    <attribute name=\"JNDIName\">" + jndiName + "</attribute>" : "") +
          "       <depends optional-attribute-name=\"ServerPeer\">jboss.messaging:service=ServerPeer</depends>" +
+         "       <attribute name=\"Clustered\">" + String.valueOf(clustered) + "</attribute>" +
          "</mbean>";
 
       MBeanConfigurationElement mbean =
@@ -618,7 +642,8 @@
                                  String jndiName,
                                  int fullSize,
                                  int pageSize,
-                                 int downCacheSize) throws Exception
+                                 int downCacheSize,
+                                 boolean clustered) throws Exception
    {
       log.info("deploying queue, fullsize:" + fullSize + ", ps:" + pageSize + " dc size:" + downCacheSize);
       
@@ -631,6 +656,7 @@
          "    <attribute name=\"FullSize\">" + fullSize + "</attribute>" +
          "    <attribute name=\"PageSize\">" + pageSize + "</attribute>" +
          "    <attribute name=\"DownCacheSize\">" + downCacheSize + "</attribute>" +
+         "    <attribute name=\"Clustered\">" + String.valueOf(clustered) + "</attribute>" +
          "</mbean>";
 
       MBeanConfigurationElement mbean =
@@ -774,11 +800,6 @@
       return XMLUtil.elementToString(element);
    }
    
-   public void exit() throws Exception
-   {
-      destroy();
-   }
-      
    public Object executeCommand(Command command) throws Exception
    { 
       return command.execute();

Modified: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RMITestServer.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RMITestServer.java	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RMITestServer.java	2006-11-21 21:23:34 UTC (rev 1613)
@@ -25,10 +25,8 @@
 import java.rmi.registry.Registry;
 import java.rmi.server.UnicastRemoteObject;
 import java.util.Set;
-
 import javax.management.ObjectName;
 import javax.transaction.UserTransaction;
-
 import org.jboss.jms.server.DestinationManager;
 import org.jboss.jms.server.ServerPeer;
 import org.jboss.logging.Logger;
@@ -56,12 +54,17 @@
 
    private RMINamingDelegate namingDelegate;
 
-   public static final int RMI_REGISTRY_PORT = 25989;
+   //public static final int RMI_REGISTRY_PORT = 25989;
+   
+   //We allow for up to 5 rmi test servers running simultaneously
+   public static final int[] RMI_REGISTRY_PORTS = 
+      new int[] {25989, 25990, 25991, 25992, 25993};
+   
    public static final String RMI_SERVER_NAME = "messaging-rmi-server";
    public static final String NAMING_SERVER_NAME = "naming-rmi-server";
 
    private static Registry registry;
-
+   
    public static void main(String[] args) throws Exception
    {
       log.debug("initializing RMI runtime");
@@ -73,14 +76,27 @@
       }
 
       log.info("bind address: " + host);
+      
+      int index;
+      String registryIndex = System.getProperty("test.registry.index");
+      if (registryIndex == null)
+      {
+         //Use the 0th port
+         index = 0;
+      }
+      else
+      {
+         index = Integer.parseInt(registryIndex);         
+      }
+      int port = RMI_REGISTRY_PORTS[index];
 
       // let RMI know the bind address
       System.setProperty("java.rmi.server.hostname", host);
 
-      registry = LocateRegistry.createRegistry(RMI_REGISTRY_PORT);
-      log.debug("registry created");
+      registry = LocateRegistry.createRegistry(port);
+      log.debug("registry created at port: " + port);
 
-      RMITestServer testServer = new RMITestServer();
+      RMITestServer testServer = new RMITestServer(index);
       log.debug("RMI server created");
 
       registry.bind(RMI_SERVER_NAME, testServer);
@@ -108,11 +124,11 @@
       }
    }
 
-   public RMITestServer() throws Exception
+   public RMITestServer(int index) throws Exception
    {
       namingDelegate = new RMINamingDelegate();
 
-      server = new RemoteTestServer();
+      server = new RemoteTestServer(index);
    }
 
    public void configureSecurityForDestination(String destName, String config) throws Exception
@@ -125,23 +141,24 @@
       return server.deploy(mbeanConfiguration);
    }
 
-   public void deployQueue(String name, String jndiName) throws Exception
+   public void deployQueue(String name, String jndiName, boolean clustered) throws Exception
    {
-      server.deployQueue(name, jndiName);
+      server.deployQueue(name, jndiName, clustered);
    }
 
-   public void deployTopic(String name, String jndiName) throws Exception
+   public void deployTopic(String name, String jndiName, boolean clustered) throws Exception
    {
-      server.deployTopic(name, jndiName);
+      server.deployTopic(name, jndiName, clustered);
    }
    
    public void deployQueue(String name,
                            String jndiName,
                            int fullSize,
                            int pageSize,
-                           int downCacheSize) throws Exception
+                           int downCacheSize,
+                           boolean clustered) throws Exception
    {
-      server.deployQueue(name, jndiName, fullSize, pageSize, downCacheSize);
+      server.deployQueue(name, jndiName, fullSize, pageSize, downCacheSize, clustered);
    }
 
    public void createQueue(String name, String jndiName) throws Exception
@@ -153,9 +170,10 @@
                            String jndiName,
                            int fullSize,
                            int pageSize,
-                           int downCacheSize) throws Exception
+                           int downCacheSize,
+                           boolean clustered) throws Exception
    {
-      server.deployTopic(name, jndiName, fullSize, pageSize, downCacheSize);
+      server.deployTopic(name, jndiName, fullSize, pageSize, downCacheSize, clustered);
    }
 
    public void createTopic(String name, String jndiName) throws Exception
@@ -197,12 +215,11 @@
 
       registry.unbind(RMI_SERVER_NAME);
       registry.unbind(NAMING_SERVER_NAME);
-   }
-
-   public void exit() throws Exception
-   {
-      server.exit();
-
+      
+      //Now shutdown the process
+      
+      //TODO - we should shutdown cleanly - let main() exit - not kill the process
+      
       new Thread(new VMKiller(), "VM Killer").start();
    }
 
@@ -302,14 +319,15 @@
       server.setDefaultSecurityConfig(config);
    }
 
-   public void start(String containerConfig) throws Exception
+   public void start(String containerConfig, boolean clustered) throws Exception
    {
-      server.start(containerConfig);
+      server.start(containerConfig, clustered);
    }
 
-   public void startServerPeer(String serverPeerID, String defaultQueueJNDIContext, String defaultTopicJNDIContext) throws Exception
+   public void startServerPeer(int serverPeerID, String defaultQueueJNDIContext,
+                               String defaultTopicJNDIContext, boolean clustered) throws Exception
    {
-      server.startServerPeer(serverPeerID, defaultQueueJNDIContext, defaultTopicJNDIContext);
+      server.startServerPeer(serverPeerID, defaultQueueJNDIContext, defaultTopicJNDIContext, clustered);
    }
 
    public void stop() throws Exception

Modified: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RemoteTestServer.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RemoteTestServer.java	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RemoteTestServer.java	2006-11-21 21:23:34 UTC (rev 1613)
@@ -44,6 +44,11 @@
    // Attributes ----------------------------------------------------
 
    // Constructors --------------------------------------------------
+   
+   public RemoteTestServer(int serverIndex)
+   {
+      super(serverIndex);
+   }
 
    // Server implementation -----------------------------------------
 

Modified: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/rmi/Server.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/rmi/Server.java	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/rmi/Server.java	2006-11-21 21:23:34 UTC (rev 1613)
@@ -23,10 +23,8 @@
 
 import java.rmi.Remote;
 import java.util.Set;
-
 import javax.management.ObjectName;
 import javax.transaction.UserTransaction;
-
 import org.jboss.jms.server.DestinationManager;
 import org.jboss.jms.server.ServerPeer;
 import org.jboss.messaging.core.plugin.contract.MessageStore;
@@ -44,7 +42,7 @@
  */
 public interface Server extends Remote
 {
-   void start(String containerConfig) throws Exception;
+   void start(String containerConfig, boolean clustered) throws Exception;
    void stop() throws Exception;
    void destroy() throws Exception;
 
@@ -77,9 +75,10 @@
     * @param defaultQueueJNDIContext - if null, the jboss-service.xml value will be used.
     * @param defaultTopicJNDIContext - if null, the jboss-service.xml value will be used.
     */
-   void startServerPeer(String serverPeerID,
+   void startServerPeer(int serverPeerID,
                         String defaultQueueJNDIContext,
-                        String defaultTopicJNDIContext) throws Exception;
+                        String defaultTopicJNDIContext,
+                        boolean clustered) throws Exception;
    void stopServerPeer() throws Exception;
    boolean isServerPeerStarted() throws Exception;
 
@@ -133,13 +132,13 @@
    /**
     * Simulates a topic deployment (copying the topic descriptor in the deploy directory).
     */
-   void deployTopic(String name, String jndiName) throws Exception;
+   void deployTopic(String name, String jndiName, boolean clustered) throws Exception;
 
    /**
     * Simulates a topic deployment (copying the topic descriptor in the deploy directory).
     */
    void deployTopic(String name, String jndiName, int fullSize, int pageSize,
-                    int downCacheSize) throws Exception;
+                    int downCacheSize, boolean clustered) throws Exception;
 
    /**
     * Creates a topic programatically.
@@ -149,13 +148,13 @@
    /**
     * Simulates a queue deployment (copying the queue descriptor in the deploy directory).
     */
-   void deployQueue(String name, String jndiName) throws Exception;
+   void deployQueue(String name, String jndiName, boolean clustered) throws Exception;
 
    /**
     * Simulates a queue deployment (copying the queue descriptor in the deploy directory).
     */
    void deployQueue(String name, String jndiName, int fullSize, int pageSize,
-                    int downCacheSize) throws Exception;
+                    int downCacheSize, boolean clustered) throws Exception;
 
    /**
     * Creates a queue programatically.
@@ -207,8 +206,6 @@
     */
    String getDefaultSecurityConfig() throws Exception;
 
-   void exit() throws Exception;
-
    /**
     * Executes a command on the server
     * 

Modified: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/rmi/StopRMIServer.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/rmi/StopRMIServer.java	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/rmi/StopRMIServer.java	2006-11-21 21:23:34 UTC (rev 1613)
@@ -21,11 +21,10 @@
 */
 package org.jboss.test.messaging.tools.jmx.rmi;
 
+import java.rmi.ConnectException;
+import java.rmi.Naming;
 import org.jboss.logging.Logger;
 
-import java.rmi.Naming;
-import java.rmi.ConnectException;
-
 /**
  * A utility to stop runaway rmi servers.
  *
@@ -50,9 +49,22 @@
       {
          host = "localhost";
       }
+      
+      int index;
+      String registryIndex = System.getProperty("test.registry.index");
+      if (registryIndex == null)
+      {
+         //Use the 0th port
+         index = 0;
+      }
+      else
+      {
+         index = Integer.parseInt(registryIndex);         
+      }
+      int port = RMITestServer.RMI_REGISTRY_PORTS[index];
 
       String name =
-         "//" + host + ":" + RMITestServer.RMI_REGISTRY_PORT + "/" + RMITestServer.RMI_SERVER_NAME;
+         "//" + host + ":" + port + "/" + RMITestServer.RMI_SERVER_NAME;
 
       log.info("Stopping " + name);
 
@@ -67,11 +79,11 @@
          return;
       }
 
-      server.stop();
+      //We should shut down cleanly - not kill the process like we are currently doing
+      
+      server.destroy();
       log.info("RMI server stopped");
 
-      server.exit();
-      log.info("RMI server shut down");
    }
 
    // Attributes ----------------------------------------------------

Modified: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jndi/RemoteContext.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jndi/RemoteContext.java	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jndi/RemoteContext.java	2006-11-21 21:23:34 UTC (rev 1613)
@@ -23,13 +23,7 @@
 
 import java.rmi.Naming;
 import java.util.Hashtable;
-
-import javax.naming.Context;
-import javax.naming.Name;
-import javax.naming.NameParser;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-
+import javax.naming.*;
 import org.jboss.logging.Logger;
 import org.jboss.messaging.util.NotYetImplementedException;
 import org.jboss.test.messaging.tools.jmx.rmi.NamingDelegate;
@@ -53,13 +47,13 @@
    // Attributes ----------------------------------------------------
 
    private NamingDelegate namingDelegate;
-
+   
    // Constructors --------------------------------------------------
 
-   public RemoteContext() throws Exception
+   public RemoteContext(int remoteServerIndex) throws Exception
    {
       String n =
-         "//localhost:" + RMITestServer.RMI_REGISTRY_PORT + "/" + RMITestServer.NAMING_SERVER_NAME;
+         "//localhost:" + RMITestServer.RMI_REGISTRY_PORTS[remoteServerIndex] + "/" + RMITestServer.NAMING_SERVER_NAME;
       namingDelegate = (NamingDelegate)Naming.lookup(n);
    }
 

Modified: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jndi/RemoteInitialContextFactory.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jndi/RemoteInitialContextFactory.java	2006-11-21 19:00:05 UTC (rev 1612)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jndi/RemoteInitialContextFactory.java	2006-11-21 21:23:34 UTC (rev 1613)
@@ -21,13 +21,12 @@
 */
 package org.jboss.test.messaging.tools.jndi;
 
-import org.jboss.logging.Logger;
-
 import java.util.Hashtable;
-
 import javax.naming.Context;
 import javax.naming.NamingException;
 import javax.naming.spi.InitialContextFactory;
+import org.jboss.logging.Logger;
+import org.jboss.test.messaging.tools.jmx.rmi.RMITestServer;
 
 /**
  * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
@@ -43,19 +42,21 @@
 
    // Static --------------------------------------------------------
 
-   private static RemoteContext initialContext;
+   private static RemoteContext[] initialContexts = new RemoteContext[RMITestServer.RMI_REGISTRY_PORTS.length];
+   
+   private static final String REMOTE_SERVER_INDEX_KEY_NAME = "jboss.messaging.test.remoteserverindex";
 
-
    /**
     * @return the JNDI environment to use to get this InitialContextFactory.
     */
-   public static Hashtable getJNDIEnvironment()
+   public static Hashtable getJNDIEnvironment(int index)
    {
       Hashtable env = new Hashtable();
       env.put("java.naming.factory.initial",
               "org.jboss.test.messaging.tools.jndi.RemoteInitialContextFactory");
       env.put("java.naming.provider.url", "");
       env.put("java.naming.factory.url.pkgs", "");
+      env.put(REMOTE_SERVER_INDEX_KEY_NAME, String.valueOf(index));
       return env;
    }
 
@@ -67,11 +68,20 @@
 
    public Context getInitialContext(Hashtable environment) throws NamingException
    {
-      if (initialContext == null)
+      String s = (String)environment.get(REMOTE_SERVER_INDEX_KEY_NAME);
+      
+      if (s == null)
       {
+         throw new IllegalArgumentException("Initial context environment must contain entry for " + REMOTE_SERVER_INDEX_KEY_NAME);
+      }
+      
+      int remoteServerIndex = Integer.parseInt(s);
+      
+      if (initialContexts[remoteServerIndex] == null)
+      {
          try
          {
-            initialContext = new RemoteContext();
+            initialContexts[remoteServerIndex] = new RemoteContext(remoteServerIndex);
          }
          catch(Exception e)
          {
@@ -79,7 +89,7 @@
             throw new NamingException("Cannot get the remote context");
          }
       }
-      return initialContext;
+      return initialContexts[remoteServerIndex];
    }
 
    // Package protected ---------------------------------------------




More information about the jboss-cvs-commits mailing list