[jboss-cvs] JBoss Messaging SVN: r2715 - in trunk: docs/examples/http/etc and 20 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sat May 19 11:31:23 EDT 2007


Author: timfox
Date: 2007-05-19 11:31:23 -0400 (Sat, 19 May 2007)
New Revision: 2715

Added:
   trunk/tests/src/org/jboss/test/messaging/jms/clustering/DisableLoadBalancingAndFailoverTest.java
Modified:
   trunk/.classpath
   trunk/build-messaging.xml
   trunk/build-thirdparty.xml
   trunk/docs/examples/http/etc/messaging-http-service.xml
   trunk/src/etc/aop-messaging-client.xml
   trunk/src/etc/server/default/deploy/connection-factories-service.xml
   trunk/src/etc/xmdesc/ConnectionFactory-xmbean.xml
   trunk/src/main/org/jboss/jms/client/container/ClosedInterceptor.java
   trunk/src/main/org/jboss/jms/client/container/ClusteringAspect.java
   trunk/src/main/org/jboss/jms/client/delegate/ClientClusteredConnectionFactoryDelegate.java
   trunk/src/main/org/jboss/jms/client/delegate/DelegateSupport.java
   trunk/src/main/org/jboss/jms/client/remoting/ConsolidatedRemotingConnectionListener.java
   trunk/src/main/org/jboss/jms/message/JBossMessage.java
   trunk/src/main/org/jboss/jms/server/ConnectionFactoryManager.java
   trunk/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactory.java
   trunk/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java
   trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionFactoryEndpoint.java
   trunk/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java
   trunk/src/main/org/jboss/messaging/util/StreamUtils.java
   trunk/tests/etc/connection-factory-http.xml
   trunk/tests/etc/stress/log4j.xml
   trunk/tests/src/org/jboss/test/messaging/jms/DLQTest.java
   trunk/tests/src/org/jboss/test/messaging/jms/ExpiryQueueTest.java
   trunk/tests/src/org/jboss/test/messaging/jms/MessageWithReadResolveTest.java
   trunk/tests/src/org/jboss/test/messaging/jms/clustering/DistributedQueueTest.java
   trunk/tests/src/org/jboss/test/messaging/jms/clustering/HATest.java
   trunk/tests/src/org/jboss/test/messaging/jms/clustering/LoadBalancingTest.java
   trunk/tests/src/org/jboss/test/messaging/jms/clustering/base/ClusteringTestBase.java
   trunk/tests/src/org/jboss/test/messaging/jms/server/connectionfactory/ConnectionFactoryTest.java
   trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java
   trunk/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java
   trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/LocalTestServer.java
   trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RMITestServer.java
   trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/Server.java
Log:
Various small changes and fixes + implement supportsLoadBalancing and supportsfailover flags on connection factory


Modified: trunk/.classpath
===================================================================
--- trunk/.classpath	2007-05-18 18:50:58 UTC (rev 2714)
+++ trunk/.classpath	2007-05-19 15:31:23 UTC (rev 2715)
@@ -1,6 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
 	<classpathentry kind="src" path="docs/examples/queue-failover/src"/>
+	<classpathentry kind="src" path="docs/examples/web-service/src-client"/>
+	<classpathentry kind="src" path="docs/examples/web-service/src"/>
 	<classpathentry kind="src" path="docs/examples/mdb-failure/src"/>
 	<classpathentry kind="src" path="docs/examples/distributed-queue/src"/>
 	<classpathentry kind="src" path="output/gen-parsers"/>
@@ -57,5 +59,6 @@
 	<classpathentry kind="var" path="ANT_HOME/lib/ant.jar"/>
 	<classpathentry kind="var" path="ANT_HOME/lib/ant-junit.jar"/>
 	<classpathentry kind="lib" path="thirdparty/jboss/common/lib/jboss-common.jar"/>
+	<classpathentry kind="src" path=".apt_generated"/>
 	<classpathentry kind="output" path="bin"/>
 </classpath>

Modified: trunk/build-messaging.xml
===================================================================
--- trunk/build-messaging.xml	2007-05-18 18:50:58 UTC (rev 2714)
+++ trunk/build-messaging.xml	2007-05-19 15:31:23 UTC (rev 2715)
@@ -152,7 +152,7 @@
         JBoss dependencies.
         They must available in the repository and declared as <componentrefs> in build-thirdparty.xml.
 
-        NOTE: If one of JBoss dependencies (jboss-remoting.jar, jboss-serialization.jar) is locally
+        NOTE: If one of JBoss dependencies (jboss-remoting.jar) is locally
               present in ./lib, it will take precedence over the corresponding repository instance.
     -->
    <path id="jboss.dependencies.classpath">
@@ -160,7 +160,6 @@
       <path refid="jboss.aop.classpath"/>
       <path refid="jboss.remoting.classpath"/>
       <path refid="jboss.jbossts14.classpath"/>
-      <path refid="jboss.serialization.classpath"/>
    </path>
 
    <property name="jboss.j2ee.lib" value="${project.root}/lib/"/>
@@ -211,7 +210,6 @@
       <path refid="jboss.transaction.classpath"/>
       <path refid="jboss.jmx.classpath"/>
       <path refid="jboss.remoting.classpath"/>
-      <path refid="jboss.serialization.classpath"/>
       <path refid="jboss.classpath"/>
    </path>
 
@@ -440,7 +438,6 @@
          <zipfileset  src="${oswego.concurrent.lib}/concurrent.jar"/>
          <zipfileset  src="${apache.log4j.lib}/log4j.jar"/>
          <zipfileset  src="${apache.logging.lib}/commons-logging.jar"/>
-         <zipfileset  src="${jboss.serialization.lib}/jboss-serialization.jar"/>
       </jar>
    </target>
 
@@ -452,7 +449,7 @@
 
          <manifest>
             <attribute name="Class-path"
-                       value="jboss-aop.jar jboss-remoting.jar jboss-serialization.jar javassist.jar trove.jar jboss-common-core.jar jboss-common-client.jar jboss-j2ee.jar jboss-j2se.jar jnp-client.jar concurrent.jar log4j.jar commons-logging.jar"/>
+                       value="jboss-aop.jar jboss-remoting.jar javassist.jar trove.jar jboss-common-core.jar jboss-common-client.jar jboss-j2ee.jar jboss-j2se.jar jnp-client.jar concurrent.jar log4j.jar commons-logging.jar"/>
          </manifest>
          <fileset dir="${build.classes}">
             <!-- This structur is temporary until we partition the classes

Modified: trunk/build-thirdparty.xml
===================================================================
--- trunk/build-thirdparty.xml	2007-05-18 18:50:58 UTC (rev 2714)
+++ trunk/build-thirdparty.xml	2007-05-19 15:31:23 UTC (rev 2715)
@@ -89,7 +89,6 @@
       <componentref name="trove" version="1.0.2-brew"/>
       <componentref name="jboss/common" version="1.2.0.GA-brew"/>
       <componentref name="jboss/aop" version="1.5.5.GA"/>
-      <componentref name="jboss/serialization" version="1.0.3.GA"/>
       <componentref name="jboss/remoting" version="2.2.0.SP4"/>
       <componentref name="jboss/jbossts14" version="4.2.3.SP3"/>
 

Modified: trunk/docs/examples/http/etc/messaging-http-service.xml
===================================================================
--- trunk/docs/examples/http/etc/messaging-http-service.xml	2007-05-18 18:50:58 UTC (rev 2714)
+++ trunk/docs/examples/http/etc/messaging-http-service.xml	2007-05-19 15:31:23 UTC (rev 2715)
@@ -8,9 +8,7 @@
 
 <server>
 
-   <!--
-        This Connector will basically run as a standalone http server
-   -->
+   <!-- THIS IS ONLY USED BY TESTS SO SHOULD ONLY EXIST IN THE TESTS CONFIG, NOT IN THE MAIN CONFIG!! -->
    <mbean code="org.jboss.remoting.transport.Connector"
           name="jboss.messaging:service=Connector,transport=http"
           display-name="HTTP transport Connector">
@@ -27,9 +25,6 @@
                <attribute name="serverBindPort">4458</attribute>
                <attribute name="leasePeriod">10000</attribute>
                <attribute name="callbackStore">org.jboss.remoting.callback.CallbackStore</attribute>
-
-
-
                <attribute name="callbackPollPeriod" isParam="true">100</attribute>
             </invoker>
             <handlers>

Modified: trunk/src/etc/aop-messaging-client.xml
===================================================================
--- trunk/src/etc/aop-messaging-client.xml	2007-05-18 18:50:58 UTC (rev 2714)
+++ trunk/src/etc/aop-messaging-client.xml	2007-05-19 15:31:23 UTC (rev 2715)
@@ -21,10 +21,12 @@
        Clustered ConnectionFactory Stack
    -->
 
+   <!--
    <bind pointcut="execution(* org.jboss.jms.client.delegate.ClientClusteredConnectionFactoryDelegate->$implementing{org.jboss.jms.delegate.ConnectionFactoryDelegate}(..))">
       <interceptor-ref name="org.jboss.jms.client.container.ClientLogInterceptor"/>      
       <interceptor-ref name="org.jboss.jms.client.container.ExceptionInterceptor"/>
    </bind>
+   -->
    <bind pointcut="execution(* org.jboss.jms.client.delegate.ClientClusteredConnectionFactoryDelegate->createConnectionDelegate(..))">
       <advice name="handleCreateConnectionDelegate" aspect="org.jboss.jms.client.container.ClusteringAspect"/>
    </bind>
@@ -33,10 +35,12 @@
         (Non-clustered) ConnectionFactory Stack
    -->
 
+<!--
    <bind pointcut="execution(* org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate->$implementing{org.jboss.jms.delegate.ConnectionFactoryDelegate}(..))">
       <interceptor-ref name="org.jboss.jms.client.container.ClientLogInterceptor"/>
       <interceptor-ref name="org.jboss.jms.client.container.ExceptionInterceptor"/>
    </bind>   
+   -->
    <bind pointcut="execution(* org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate->createConnectionDelegate(..))">
       <advice name="handleCreateConnectionDelegate" aspect="org.jboss.jms.client.container.StateCreationAspect"/>
    </bind>
@@ -46,9 +50,11 @@
    -->
 
    <bind pointcut="execution(* org.jboss.jms.client.delegate.ClientConnectionDelegate->$implementing{org.jboss.jms.delegate.ConnectionDelegate}(..))">
-      <interceptor-ref name="org.jboss.jms.client.container.ClientLogInterceptor"/>
+   <!--
+      <interceptor-ref name="org.jboss.jms.client.container.ClientLogInterceptor"/>      
       <interceptor-ref name="org.jboss.jms.client.container.ExceptionInterceptor"/>
-      <interceptor-ref name="org.jboss.jms.client.container.ClosedInterceptor"/>               
+      -->
+      <interceptor-ref name="org.jboss.jms.client.container.ClosedInterceptor"/>                     
    </bind>
    <bind pointcut="execution(* org.jboss.jms.client.delegate.ClientConnectionDelegate->$implementing{org.jboss.jms.delegate.ConnectionEndpoint}(..))">
       <interceptor-ref name="org.jboss.jms.client.container.FailoverValveInterceptor"/>         
@@ -98,9 +104,11 @@
    -->
 
    <bind pointcut="execution(* org.jboss.jms.client.delegate.ClientSessionDelegate->$implementing{org.jboss.jms.delegate.SessionDelegate}(..))">
-      <interceptor-ref name="org.jboss.jms.client.container.ClientLogInterceptor"/>
+   <!--
+      <interceptor-ref name="org.jboss.jms.client.container.ClientLogInterceptor"/>      
       <interceptor-ref name="org.jboss.jms.client.container.ExceptionInterceptor"/>
-      <interceptor-ref name="org.jboss.jms.client.container.ClosedInterceptor"/>             
+      -->
+      <interceptor-ref name="org.jboss.jms.client.container.ClosedInterceptor"/>                   
    </bind>
    <bind pointcut="execution(* org.jboss.jms.client.delegate.ClientSessionDelegate->$implementing{org.jboss.jms.delegate.SessionEndpoint}(..))">
       <interceptor-ref name="org.jboss.jms.client.container.FailoverValveInterceptor"/>         
@@ -192,9 +200,11 @@
    -->
 
    <bind pointcut="execution(* org.jboss.jms.client.delegate.ClientConsumerDelegate->$implementing{org.jboss.jms.delegate.ConsumerDelegate}(..))">
-      <interceptor-ref name="org.jboss.jms.client.container.ClientLogInterceptor"/>
+   <!--
+      <interceptor-ref name="org.jboss.jms.client.container.ClientLogInterceptor"/>      
       <interceptor-ref name="org.jboss.jms.client.container.ExceptionInterceptor"/>
-      <interceptor-ref name="org.jboss.jms.client.container.ClosedInterceptor"/>          
+      -->
+      <interceptor-ref name="org.jboss.jms.client.container.ClosedInterceptor"/>                
    </bind>  
    <bind pointcut="execution(* org.jboss.jms.client.delegate.ClientConsumerDelegate->$implementing{org.jboss.jms.delegate.ConsumerEndpoint}(..))">
       <interceptor-ref name="org.jboss.jms.client.container.FailoverValveInterceptor"/>         
@@ -229,9 +239,11 @@
         Producer Stack
    -->   
    <bind pointcut="execution(* org.jboss.jms.client.delegate.ClientProducerDelegate->$implementing{org.jboss.jms.delegate.ProducerDelegate}(..))">
-      <interceptor-ref name="org.jboss.jms.client.container.ClientLogInterceptor"/>
+   <!--
+      <interceptor-ref name="org.jboss.jms.client.container.ClientLogInterceptor"/>           
       <interceptor-ref name="org.jboss.jms.client.container.ExceptionInterceptor"/>
-      <interceptor-ref name="org.jboss.jms.client.container.ClosedInterceptor"/>  
+      -->
+      <interceptor-ref name="org.jboss.jms.client.container.ClosedInterceptor"/>        
    </bind>        
    <bind pointcut="execution(* org.jboss.jms.client.delegate.ClientProducerDelegate->getDeliveryMode())">
       <advice name="handleGetDeliveryMode" aspect="org.jboss.jms.client.container.ProducerAspect"/>         
@@ -284,9 +296,11 @@
         Browser Stack
    -->
    <bind pointcut="execution(* org.jboss.jms.client.delegate.ClientBrowserDelegate->$implementing{org.jboss.jms.delegate.BrowserDelegate}(..))">
-      <interceptor-ref name="org.jboss.jms.client.container.ClientLogInterceptor"/>
+   <!--
+      <interceptor-ref name="org.jboss.jms.client.container.ClientLogInterceptor"/>      
       <interceptor-ref name="org.jboss.jms.client.container.ExceptionInterceptor"/>
-      <interceptor-ref name="org.jboss.jms.client.container.ClosedInterceptor"/>
+    -->
+      <interceptor-ref name="org.jboss.jms.client.container.ClosedInterceptor"/>      
    </bind>   
    <bind pointcut="execution(* org.jboss.jms.client.delegate.ClientBrowserDelegate->$implementing{org.jboss.jms.delegate.BrowserEndpoint}(..))">
       <interceptor-ref name="org.jboss.jms.client.container.FailoverValveInterceptor"/>         

Modified: trunk/src/etc/server/default/deploy/connection-factories-service.xml
===================================================================
--- trunk/src/etc/server/default/deploy/connection-factories-service.xml	2007-05-18 18:50:58 UTC (rev 2714)
+++ trunk/src/etc/server/default/deploy/connection-factories-service.xml	2007-05-19 15:31:23 UTC (rev 2715)
@@ -8,6 +8,10 @@
 
 <server>
 
+   <!-- The default connection factory does not support automatic failover or load balancing-
+        this is so we can maintain compatiblity with applications written for JBoss MQ which use this
+        connection factory.
+   -->     
    <mbean code="org.jboss.jms.server.connectionfactory.ConnectionFactory"
       name="jboss.messaging.connectionfactory:service=ConnectionFactory"
       xmbean-dd="xmdesc/ConnectionFactory-xmbean.xml">
@@ -23,18 +27,15 @@
             <binding>java:/XAConnectionFactory</binding>
          </bindings>
       </attribute>
-
-      <attribute name="Clustered">true</attribute>
-      <attribute name="LoadBalancingFactory">org.jboss.jms.client.plugin.RoundRobinLoadBalancingFactory</attribute>
    </mbean>
 
-   <!--
-        A "local" non-clustered ConnectionFactory that doesn't have neither load balancing nor
-        failover capabilities. It creates connections to the server node that deployed it.
+   <!-- A clustered connection factory that supports automatic failover and load balancing of created
+        connections.
+        This factory is not suitable to be used by MDBs,
+        see http://www.jboss.com/index.html?module=bb&op=viewtopic&t=108961
    -->
-
    <mbean code="org.jboss.jms.server.connectionfactory.ConnectionFactory"
-      name="jboss.messaging.connectionfactory:service=NonClusteredConnectionFactory"
+      name="jboss.messaging.connectionfactory:service=ClusteredConnectionFactory"
       xmbean-dd="xmdesc/ConnectionFactory-xmbean.xml">
       <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
       <depends optional-attribute-name="Connector">jboss.messaging:service=Connector,transport=bisocket</depends>
@@ -42,14 +43,15 @@
 
       <attribute name="JNDIBindings">
          <bindings>
-            <binding>/NonClusteredConnectionFactory</binding>
-            <binding>/NonClusteredXAConnectionFactory</binding>
-            <binding>java:/NonClusteredConnectionFactory</binding>
-            <binding>java:/NonClusteredXAConnectionFactory</binding>
+            <binding>/ClusteredConnectionFactory</binding>
+            <binding>/ClusteredXAConnectionFactory</binding>
+            <binding>java:/ClusteredConnectionFactory</binding>
+            <binding>java:/ClusteredXAConnectionFactory</binding>
          </bindings>
       </attribute>
 
-      <attribute name="Clustered">false</attribute>
+      <attribute name="SupportsFailover">true</attribute>
+      <attribute name="SupportsLoadBalancing">true</attribute>      
    </mbean>
 
 </server>
\ No newline at end of file

Modified: trunk/src/etc/xmdesc/ConnectionFactory-xmbean.xml
===================================================================
--- trunk/src/etc/xmdesc/ConnectionFactory-xmbean.xml	2007-05-18 18:50:58 UTC (rev 2714)
+++ trunk/src/etc/xmdesc/ConnectionFactory-xmbean.xml	2007-05-19 15:31:23 UTC (rev 2715)
@@ -88,11 +88,17 @@
       <type>javax.management.ObjectName</type>
    </attribute>
 
-   <attribute access="read-write" getMethod="isClustered" setMethod="setClustered">
-      <description>Is this a clustered connection factory?</description>
-      <name>Clustered</name>
+   <attribute access="read-write" getMethod="isSupportsFailover" setMethod="setSupportsFailover">
+      <description>Does this connection factory support transparent failover?</description>
+      <name>SupportsFailover</name>
       <type>boolean</type>
    </attribute>
+   
+   <attribute access="read-write" getMethod="isSupportsLoadBalancing" setMethod="setSupportsLoadBalancing">
+      <description>Does this connection factory support internal load balancing on createConnection(...) requests?</description>
+      <name>SupportsLoadBalancing</name>
+      <type>boolean</type>
+   </attribute>   
 
    <attribute access="read-write" getMethod="getLoadBalancingFactory" setMethod="setLoadBalancingFactory">
       <description>The pluggable load balancing policy factory that is used to decide the next cluster node to create a clustered connection to</description>

Modified: trunk/src/main/org/jboss/jms/client/container/ClosedInterceptor.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/container/ClosedInterceptor.java	2007-05-18 18:50:58 UTC (rev 2714)
+++ trunk/src/main/org/jboss/jms/client/container/ClosedInterceptor.java	2007-05-19 15:31:23 UTC (rev 2715)
@@ -169,6 +169,20 @@
       {
          return invocation.invokeNext();
       }
+      catch (Throwable t)
+      {
+      	if (isClosing || isClose)
+      	{
+	      	//We swallow exceptions in close/closing, this is because if the connection fails, it is naturally for code to then close
+	      	//in a finally block, it would not then be appropriate to throw an exception. This is a common technique
+	      	if (trace)
+	      	{
+	      		log.trace("Failed to close", t);
+	      	}
+	      	return new Long(-1);
+      	}
+      	throw t;
+      }
       finally
       {                  
          if (isClosing)
@@ -296,6 +310,8 @@
          }
          catch (Throwable t)
          {
+         	//We swallow exceptions in close/closing, this is because if the connection fails, it is naturally for code to then close
+         	//in a finally block, it would not then be appropriate to throw an exception. This is a common technique
             if (trace)
             {
                log.trace("Failed to close", t);

Modified: trunk/src/main/org/jboss/jms/client/container/ClusteringAspect.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/container/ClusteringAspect.java	2007-05-18 18:50:58 UTC (rev 2714)
+++ trunk/src/main/org/jboss/jms/client/container/ClusteringAspect.java	2007-05-19 15:31:23 UTC (rev 2715)
@@ -31,7 +31,7 @@
  * - To choose the next node to create a physical connection to, based on a pluggable load balancing
  *   policy.
  * - To handle physical connection creation (by delegating it to a non-clustered ConnectionFactory
- *   delegate) and instal failure listeners.
+ *   delegate) and install failure listeners.
  * - etc.
  *
  * It's a PER_INSTANCE aspect (one of these per each clustered ConnectionFactory instance)
@@ -83,8 +83,10 @@
       {
          clusteredDelegate = (ClientClusteredConnectionFactoryDelegate)invocation.getTargetObject();
       }
+      
+      boolean supportsFailover = clusteredDelegate.isSupportsFailover();
 
-      // the method handles both the case of a first connection creation attempt and a retry during
+      // the method handles both the case of a first connection creation attempt and a reconnect after
       // a client-side failover. The difference is given by the failedNodeID (-1 for first attempt)
 
       MethodInvocation mi = (MethodInvocation)invocation;
@@ -111,12 +113,14 @@
             {
                if (failedNodeID != null && failedNodeID.intValue() >= 0)
                {
+               	//It's a reconnect after failover
                   delegate = getFailoverDelegateForNode(failedNodeID);
                   failedNodeIDToServer = failedNodeID.intValue();
                }
                else
                {
-                  LoadBalancingPolicy loadBalancingPolicy = clusteredDelegate.getLoadBalancingPolicy();
+               	//It's a first time create connection
+                  LoadBalancingPolicy loadBalancingPolicy = clusteredDelegate.getLoadBalancingPolicy();                  
                   delegate = (ClientConnectionFactoryDelegate)loadBalancingPolicy.getNext();
                }
             }
@@ -133,33 +137,42 @@
                // valid connection
 
                log.debug(this + " got local connection delegate " + cd);
+               
+               if (supportsFailover)
+               {
+	               ConnectionState state = (ConnectionState)((DelegateSupport)cd).getState();
+	
+	               state.initializeFailoverCommandCenter();
+	
+	               FailoverCommandCenter fcc = state.getFailoverCommandCenter();
+	
+	               // add a connection listener to detect failure; the consolidated remoting connection
+	               // listener must be already in place and configured
+	               state.getRemotingConnection().getConnectionListener().
+	                  setDelegateListener(new ConnectionFailureListener(fcc, state.getRemotingConnection()));
+	
+	               log.debug(this + " installed failure listener on " + cd);
+	
+	               // also cache the username and the password into state, useful in case
+	               // FailoverCommandCenter needs to create a new connection instead of a failed on
+	               state.setUsername(username);
+	               state.setPassword(password);
+	
+	               // also add a reference to the clustered ConnectionFactory delegate, useful in case
+	               // FailoverCommandCenter needs to create a new connection instead of a failed on
+	               state.setClusteredConnectionFactoryDeleage(clusteredDelegate);
+               }
 
-               ConnectionState state = (ConnectionState)((DelegateSupport)cd).getState();
-
-               state.initializeFailoverCommandCenter();
-
-               FailoverCommandCenter fcc = state.getFailoverCommandCenter();
-
-               // add a connection listener to detect failure; the consolidated remoting connection
-               // listener must be already in place and configured
-               state.getRemotingConnection().getConnectionListener().
-                  setDelegateListener(new ConnectionFailureListener(fcc, state.getRemotingConnection()));
-
-               log.debug(this + " installed failure listener on " + cd);
-
-               // also cache the username and the password into state, useful in case
-               // FailoverCommandCenter needs to create a new connection instead of a failed on
-               state.setUsername(username);
-               state.setPassword(password);
-
-               // also add a reference to the clustered ConnectionFactory delegate, useful in case
-               // FailoverCommandCenter needs to create a new connection instead of a failed on
-               state.setClusteredConnectionFactoryDeleage(clusteredDelegate);
-
-               return new CreateConnectionResult(cd);
+               return res;
             }
             else
             {
+            	// This should never occur if we are not doing failover
+            	if (!supportsFailover)
+            	{
+            		throw new IllegalStateException("Doesn't support failover so must return a connection delegate");
+            	}
+            	
                // we did not get a valid connection to the node we've just tried
 
                int actualServerID = res.getActualFailoverNodeID();
@@ -234,10 +247,18 @@
       {
          throw new IllegalArgumentException("nodeID must be 0 or positive");
       }
-
+      
       Map failoverMap = clusteredDelegate.getFailoverMap();
+      
+      //Sanity check
+      if (failoverMap.size() != delegates.length)
+      {
+      	throw new IllegalStateException("Unable to failover. Number of servers is not the same as number of connection factories. " +
+      			                           "It is likely you haven't deployed the connection factory on all nodes in the cluster.");
+      }
+      
       Integer failoverNodeID = (Integer)failoverMap.get(nodeID);
-
+      
       // FailoverNodeID is not on the map, that means the ConnectionFactory was updated by another
       // connection in another server. So we will have to guess the failoverID by numeric order.
       // In case we guessed the new server wrongly we will have to rely on redirect from failover.

Modified: trunk/src/main/org/jboss/jms/client/delegate/ClientClusteredConnectionFactoryDelegate.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/ClientClusteredConnectionFactoryDelegate.java	2007-05-18 18:50:58 UTC (rev 2714)
+++ trunk/src/main/org/jboss/jms/client/delegate/ClientClusteredConnectionFactoryDelegate.java	2007-05-19 15:31:23 UTC (rev 2715)
@@ -68,16 +68,22 @@
    private Map failoverMap;
 
    private LoadBalancingPolicy loadBalancingPolicy;
+   
+   private boolean supportsFailover;
+   
+   private boolean supportsLoadBalancing;
 
    // Constructors ---------------------------------------------------------------------------------
 
    public ClientClusteredConnectionFactoryDelegate(ClientConnectionFactoryDelegate[] delegates,
                                                    Map failoverMap,
-                                                   LoadBalancingPolicy loadBalancingPolicy)
+                                                   LoadBalancingPolicy loadBalancingPolicy,
+                                                   boolean supportsFailover)
    {
       this.delegates = delegates;
       this.failoverMap = failoverMap;
       this.loadBalancingPolicy = loadBalancingPolicy;
+      this.supportsFailover = supportsFailover;
    }
 
    // ConnectionFactoryDelegate implementation -----------------------------------------------------
@@ -156,7 +162,12 @@
    {
       return loadBalancingPolicy;
    }
-
+   
+   public boolean isSupportsFailover()
+   {
+   	return supportsFailover;
+   }
+   
    /** Method used to update the delegate and failoverMap during viewChange */
    public synchronized void updateFailoverInfo(ClientConnectionFactoryDelegate[] delegates,
                                                Map failoverMap)
@@ -164,7 +175,10 @@
       this.delegates = delegates;
       this.failoverMap = failoverMap;
 
-      loadBalancingPolicy.updateView(delegates);
+      if (supportsLoadBalancing)
+      {
+      	loadBalancingPolicy.updateView(delegates);
+      }
    }
 
    public String toString()

Modified: trunk/src/main/org/jboss/jms/client/delegate/DelegateSupport.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/DelegateSupport.java	2007-05-18 18:50:58 UTC (rev 2714)
+++ trunk/src/main/org/jboss/jms/client/delegate/DelegateSupport.java	2007-05-19 15:31:23 UTC (rev 2715)
@@ -218,7 +218,6 @@
          (t instanceof IOException) ||
          (t instanceof ConnectionFailedException))
       {
-         log.warn("Captured Exception:" + t, t);
          return new MessagingNetworkFailureException((Exception)t);
       }
       //This can occur if failure happens when Client.connect() is called
@@ -237,7 +236,6 @@
                         (initCause instanceof IOException) ||
                         (initCause instanceof ConnectionFailedException))
                {
-                  log.warn("Captured Exception:" + initCause, initCause);
                   return new MessagingNetworkFailureException((Exception)initCause);
                }
                initCause = initCause.getCause();
@@ -246,7 +244,6 @@
          }
       }
          
-      log.error("Failed", t);
       return new MessagingJMSException("Failed to invoke", t);
       
    }

Modified: trunk/src/main/org/jboss/jms/client/remoting/ConsolidatedRemotingConnectionListener.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/remoting/ConsolidatedRemotingConnectionListener.java	2007-05-18 18:50:58 UTC (rev 2714)
+++ trunk/src/main/org/jboss/jms/client/remoting/ConsolidatedRemotingConnectionListener.java	2007-05-19 15:31:23 UTC (rev 2715)
@@ -41,9 +41,6 @@
 
    private ExceptionListener jmsExceptionListener;
 
-   // List<ConnectionListener>
-   //private List delegateListeners;
-   
    private ConnectionFailureListener remotingListener;
 
    // Constructors ---------------------------------------------------------------------------------

Modified: trunk/src/main/org/jboss/jms/message/JBossMessage.java
===================================================================
--- trunk/src/main/org/jboss/jms/message/JBossMessage.java	2007-05-18 18:50:58 UTC (rev 2714)
+++ trunk/src/main/org/jboss/jms/message/JBossMessage.java	2007-05-19 15:31:23 UTC (rev 2715)
@@ -95,6 +95,12 @@
    
    public static final String JMS_JBOSS_SCHEDULED_DELIVERY_PROP_NAME = "JMS_JBOSS_SCHEDULED_DELIVERY";
    
+   public static final String JBOSS_MESSAGING_ORIG_DESTINATION = "JBM_ORIG_DESTINATION";
+
+   public static final String JBOSS_MESSAGING_ORIG_MESSAGE_ID = "JBM_ORIG_MESSAGE_ID";
+   
+   public static final String JBOSS_MESSAGING_ACTUAL_EXPIRY_TIME = "JBM_ACTUAL_EXPIRY";
+   
    private static final Logger log = Logger.getLogger(JBossMessage.class);   
       
    // Static --------------------------------------------------------

Modified: trunk/src/main/org/jboss/jms/server/ConnectionFactoryManager.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/ConnectionFactoryManager.java	2007-05-18 18:50:58 UTC (rev 2714)
+++ trunk/src/main/org/jboss/jms/server/ConnectionFactoryManager.java	2007-05-19 15:31:23 UTC (rev 2715)
@@ -45,8 +45,9 @@
                                  int defaultTempQueuePageSize,
                                  int defaultTempQueueDownCacheSize,
                                  int dupsOKBatchSize,
-                                 boolean clustered,
+                                 boolean supportsFailover,
+                                 boolean supportsLoadBalancing,
                                  LoadBalancingFactory loadBalancingPolicy) throws Exception;
 
-   void unregisterConnectionFactory(String uniqueName, boolean clustered) throws Exception;
+   void unregisterConnectionFactory(String uniqueName, boolean supportsFailover, boolean supportsLoadBalancing) throws Exception;
 }

Modified: trunk/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactory.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactory.java	2007-05-18 18:50:58 UTC (rev 2714)
+++ trunk/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactory.java	2007-05-19 15:31:23 UTC (rev 2715)
@@ -20,6 +20,10 @@
 
 /**
  * A deployable JBoss Messaging connection factory.
+ * 
+ * The default connection factory does not support load balancing or
+ * automatic failover.
+ * 
  *
  * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
@@ -35,27 +39,37 @@
    
    // Attributes -----------------------------------------------------------------------------------
 
-   protected String clientID;
-   protected JNDIBindings jndiBindings;
-   protected int prefetchSize = 150;
-   protected boolean clustered;
-   protected LoadBalancingFactory loadBalancingFactory;
+   private String clientID;
    
-   protected int defaultTempQueueFullSize = 200000;
-   protected int defaultTempQueuePageSize = 2000;
-   protected int defaultTempQueueDownCacheSize = 2000;
+   private JNDIBindings jndiBindings;
    
-   protected int dupsOKBatchSize = 1000;
+   private int prefetchSize = 150;
+   
+   private boolean supportsFailover;
+   
+   private boolean supportsLoadBalancing;
+   
+   private LoadBalancingFactory loadBalancingFactory;
+   
+   private int defaultTempQueueFullSize = 200000;
+   
+   private int defaultTempQueuePageSize = 2000;
+   
+   private int defaultTempQueueDownCacheSize = 2000;
+   
+   private int dupsOKBatchSize = 1000;
 
-   protected ObjectName serverPeerObjectName;
-   protected ConnectionFactoryManager connectionFactoryManager;
+   private ObjectName serverPeerObjectName;
    
-   protected ConnectorManager connectorManager;
-   protected ConnectionManager connectionManager;
+   private ConnectionFactoryManager connectionFactoryManager;
+   
+   private ConnectorManager connectorManager;
+   
+   private ConnectionManager connectionManager;
       
-   protected ObjectName connectorObjectName;
+   private ObjectName connectorObjectName;
 
-   protected boolean started;
+   private boolean started;
 
    // Constructors ---------------------------------------------------------------------------------
 
@@ -128,7 +142,7 @@
             registerConnectionFactory(getServiceName().getCanonicalName(), clientID, jndiBindings,
                                       locatorURI, enablePing, prefetchSize,
                                       defaultTempQueueFullSize, defaultTempQueuePageSize,                                      
-                                      defaultTempQueueDownCacheSize, dupsOKBatchSize, clustered,
+                                      defaultTempQueueDownCacheSize, dupsOKBatchSize, supportsFailover, supportsLoadBalancing,
                                       loadBalancingFactory);
       
          InvokerLocator locator = new InvokerLocator(locatorURI);
@@ -161,7 +175,7 @@
          started = false;
          
          connectionFactoryManager.
-            unregisterConnectionFactory(getServiceName().getCanonicalName(), clustered);
+            unregisterConnectionFactory(getServiceName().getCanonicalName(), supportsFailover, supportsLoadBalancing);
          connectorManager.unregisterConnector(connectorObjectName.getCanonicalName());
          
          log.info(this + " undeployed");
@@ -267,20 +281,35 @@
       return connectorObjectName;
    }
    
-   public boolean isClustered()
+   public boolean isSupportsFailover()
    {
-      return clustered;
+      return supportsFailover;
    }
    
-   public void setClustered(boolean clustered)
+   public void setSupportsFailover(boolean supportsFailover)
    {
       if (started)
       {
-         log.warn("Clustered can only be changed when connection factory is stopped");
+         log.warn("supportsFailover can only be changed when connection factory is stopped");
          return;
       }
-      this.clustered = clustered;
+      this.supportsFailover = supportsFailover;
    }
+   
+   public boolean isSupportsLoadBalancing()
+   {
+      return supportsLoadBalancing;
+   }
+   
+   public void setSupportsLoadBalancing(boolean supportsLoadBalancing)
+   {
+      if (started)
+      {
+         log.warn("supportsLoadBalancing can only be changed when connection factory is stopped");
+         return;
+      }
+      this.supportsLoadBalancing = supportsLoadBalancing;
+   }
 
    public String getLoadBalancingFactory()
    {

Modified: trunk/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java	2007-05-18 18:50:58 UTC (rev 2714)
+++ trunk/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java	2007-05-19 15:31:23 UTC (rev 2715)
@@ -42,6 +42,7 @@
 import org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate;
 import org.jboss.jms.client.plugin.LoadBalancingFactory;
 import org.jboss.jms.client.plugin.LoadBalancingPolicy;
+import org.jboss.jms.client.plugin.NoLoadBalancingLoadBalancingFactory;
 import org.jboss.jms.delegate.ConnectionFactoryDelegate;
 import org.jboss.jms.server.ConnectionFactoryManager;
 import org.jboss.jms.server.ServerPeer;
@@ -119,12 +120,15 @@
                                                       int defaultTempQueuePageSize,
                                                       int defaultTempQueueDownCacheSize,
                                                       int dupsOKBatchSize,
-                                                      boolean clustered,
+                                                      boolean supportsFailover,
+                                                      boolean supportsLoadBalancing,
                                                       LoadBalancingFactory loadBalancingFactory)
       throws Exception
    {
       log.debug(this + " registering connection factory '" + uniqueName +
          "', bindings: " + jndiBindings);
+      
+      log.info("REGISTERING CF " + uniqueName + " supports failover: " + supportsFailover + " suppors LB " + supportsLoadBalancing);
 
       // Sanity check
       if (delegates.containsKey(uniqueName))
@@ -147,12 +151,24 @@
 
       ConnectionFactoryDelegate delegate = null;
 
-      if (clustered)
+      if (supportsFailover || supportsLoadBalancing)
       {
          setupReplicator();
       }
+      
+      if (supportsFailover && replicator == null)
+      {
+      	log.warn("supportsFailover attribute is true on connection factory: " + uniqueName + " but post office is non clustered. " +
+      			   "So connection factory will *not* support failover");
+      }
+      
+      if (supportsLoadBalancing && replicator == null)
+      {
+      	log.warn("supportsLoadBalancing attribute is true on connection factory: " + uniqueName + " but post office is non clustered. " +
+      			   "So connection factory will *not* support load balancing");
+      }
 
-      boolean creatingClustered = clustered && replicator != null;
+      boolean creatingClustered = (supportsFailover || supportsLoadBalancing) && replicator != null;
 
       ClientConnectionFactoryDelegate localDelegate =
          new ClientConnectionFactoryDelegate(id, serverPeer.getServerPeerID(),
@@ -170,19 +186,28 @@
       if (creatingClustered)
       {
          // Replicate the change - we will ignore this locally
+      	
+      	log.info("REPLICATING CF!!");
 
          replicator.put(CF_PREFIX + uniqueName, localDelegate);
 
          // Create a clustered delegate
+         
+         if (!supportsLoadBalancing)
+         {
+         	loadBalancingFactory = new NoLoadBalancingLoadBalancingFactory(localDelegate);
+         }
 
          Map localDelegates = replicator.get(CF_PREFIX + uniqueName);
-         delegate = createClusteredDelegate(localDelegates.values(), loadBalancingFactory);
+         delegate = createClusteredDelegate(localDelegates.values(), loadBalancingFactory, supportsFailover);
 
          log.debug(this + " created clustered delegate " + delegate);
       }
       else
       {
          delegate = localDelegate;
+         
+         log.info("NOT REPLICATING CF!!");
       }
 
       log.trace(this + " adding delegates factory " + uniqueName + " pointing to " + delegate);
@@ -206,7 +231,7 @@
       Dispatcher.instance.registerTarget(id, advised);
    }
 
-   public synchronized void unregisterConnectionFactory(String uniqueName, boolean clustered)
+   public synchronized void unregisterConnectionFactory(String uniqueName, boolean supportsFailover, boolean supportsLoadBalancing)
       throws Exception
    {
       log.trace("ConnectionFactory " + uniqueName + " being unregistered");
@@ -240,7 +265,7 @@
          throw new IllegalArgumentException("Cannot find factory with name " + uniqueName);
       }
 
-      if (clustered)
+      if (supportsFailover || supportsLoadBalancing)
       {
          setupReplicator();
 
@@ -251,10 +276,9 @@
             if (!replicator.remove(CF_PREFIX + uniqueName))
             {
                throw new IllegalStateException("Cannot find replicant to remove: " +
-                  CF_PREFIX + uniqueName);
+                                               CF_PREFIX + uniqueName);
             }
          }
-
       }
 
       Dispatcher.instance.unregisterTarget(endpoint.getID(), endpoint);
@@ -417,7 +441,8 @@
     * @param localDelegates - Collection<ClientConnectionFactoryDelegate>
     */
    private ClientClusteredConnectionFactoryDelegate
-      createClusteredDelegate(Collection localDelegates, LoadBalancingFactory loadBalancingFactory)
+      createClusteredDelegate(Collection localDelegates, LoadBalancingFactory loadBalancingFactory,
+      		                  boolean supportsFailover)
       throws Exception
    {
       log.trace(this + " creating a clustered ConnectionFactoryDelegate based on " + localDelegates);
@@ -444,7 +469,10 @@
       }
 
       LoadBalancingPolicy lbp = loadBalancingFactory.createLoadBalancingPolicy(delegates);
-      return new ClientClusteredConnectionFactoryDelegate(delegates, failoverMap, lbp);
+      
+      log.info("Using lod balancing policy:" + lbp);
+      
+      return new ClientClusteredConnectionFactoryDelegate(delegates, failoverMap, lbp, supportsFailover);
    }
 
    private void rebindConnectionFactory(Context ic, JNDIBindings jndiBindings,

Modified: trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionFactoryEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionFactoryEndpoint.java	2007-05-18 18:50:58 UTC (rev 2714)
+++ trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionFactoryEndpoint.java	2007-05-19 15:31:23 UTC (rev 2715)
@@ -131,6 +131,8 @@
                                                           ServerInvokerCallbackHandler callbackHandler)
       throws JMSException      
    {
+   	log.info("CREATING CONNECTION, USERNAME=" + username + " PASSWORD=" + password + " FAILED NODE ID=" + failedNodeID, new Exception());
+   	
       try
       {
          if (failedNodeID == -1)

Modified: trunk/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java	2007-05-18 18:50:58 UTC (rev 2714)
+++ trunk/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java	2007-05-19 15:31:23 UTC (rev 2715)
@@ -118,12 +118,6 @@
    
    static final String TEMP_QUEUE_MESSAGECOUNTER_PREFIX = "TempQueue.";
    
-   public static final String JBOSS_MESSAGING_ORIG_DESTINATION = "JBM_ORIG_DESTINATION";
-
-   public static final String JBOSS_MESSAGING_ORIG_MESSAGE_ID = "JBM_ORIG_MESSAGE_ID";
-   
-   public static final String JBOSS_MESSAGING_ACTUAL_EXPIRY_TIME = "JBM_ACTUAL_EXPIRY";
-   
    // Static ---------------------------------------------------------------------------------------
 
    // Attributes -----------------------------------------------------------------------------------
@@ -1060,15 +1054,15 @@
       
       String origDest = msg.getJMSDestination().toString();
             
-      copy.setStringProperty(JBOSS_MESSAGING_ORIG_MESSAGE_ID, origMessageId);
+      copy.setStringProperty(JBossMessage.JBOSS_MESSAGING_ORIG_MESSAGE_ID, origMessageId);
       
-      copy.setStringProperty(JBOSS_MESSAGING_ORIG_DESTINATION, origDest);
+      copy.setStringProperty(JBossMessage.JBOSS_MESSAGING_ORIG_DESTINATION, origDest);
       
       if (expiry)
       {
          long actualExpiryTime = System.currentTimeMillis();
          
-         copy.setLongProperty(JBOSS_MESSAGING_ACTUAL_EXPIRY_TIME, actualExpiryTime);
+         copy.setLongProperty(JBossMessage.JBOSS_MESSAGING_ACTUAL_EXPIRY_TIME, actualExpiryTime);
       }
       
       return copy;

Modified: trunk/src/main/org/jboss/messaging/util/StreamUtils.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/StreamUtils.java	2007-05-18 18:50:58 UTC (rev 2714)
+++ trunk/src/main/org/jboss/messaging/util/StreamUtils.java	2007-05-19 15:31:23 UTC (rev 2715)
@@ -37,8 +37,6 @@
 import java.util.Set;
 
 import org.jboss.jms.destination.JBossDestination;
-import org.jboss.serial.io.JBossObjectInputStream;
-import org.jboss.serial.io.JBossObjectOutputStream;
 
 /**
  * A StreamUtils
@@ -82,15 +80,7 @@
    public static final byte SERIALIZABLE = 12;
    
    public static final byte DESTINATION = 13;
-   
-   private static boolean useJBossSerialization = false;
-   
-   public static void setUseJBossSerialization(boolean use)
-   {
-      useJBossSerialization = use;
-   }
-
-         
+           
    public static Object readObject(DataInputStream in, boolean longStrings)
       throws IOException, ClassNotFoundException
    {
@@ -159,15 +149,7 @@
          }
          case SERIALIZABLE:
          {
-            ObjectInputStream ois;
-            if (useJBossSerialization)
-            {
-               ois = new JBossObjectInputStream(in, Thread.currentThread().getContextClassLoader());
-            }
-            else
-            {
-               ois = new ObjectInputStreamWithClassLoader(in);
-            }
+            ObjectInputStream ois = new ObjectInputStreamWithClassLoader(in);           
                         
             value = ois.readObject();
             break;
@@ -262,16 +244,7 @@
       else if (object instanceof Serializable)
       {
          out.writeByte(SERIALIZABLE);
-         ObjectOutputStream oos;
-         
-         if (useJBossSerialization)
-         {
-            oos = new JBossObjectOutputStream(out);
-         }
-         else
-         {
-            oos = new ObjectOutputStream(out);
-         }
+         ObjectOutputStream oos = new ObjectOutputStream(out);         
                   
          oos.writeObject(object);
          oos.flush();

Modified: trunk/tests/etc/connection-factory-http.xml
===================================================================
--- trunk/tests/etc/connection-factory-http.xml	2007-05-18 18:50:58 UTC (rev 2714)
+++ trunk/tests/etc/connection-factory-http.xml	2007-05-19 15:31:23 UTC (rev 2715)
@@ -25,8 +25,8 @@
          </bindings>
       </attribute>
 
-      <attribute name="Clustered">true</attribute>
-      <attribute name="LoadBalancingFactory">org.jboss.jms.client.plugin.RoundRobinLoadBalancingFactory</attribute>
+      <attribute name="SupportsFailover">true</attribute>
+      <attribute name="SupportsLoadBalancing">true</attribute> 
    </mbean>
 
 </server>
\ No newline at end of file

Modified: trunk/tests/etc/stress/log4j.xml
===================================================================
--- trunk/tests/etc/stress/log4j.xml	2007-05-18 18:50:58 UTC (rev 2714)
+++ trunk/tests/etc/stress/log4j.xml	2007-05-19 15:31:23 UTC (rev 2715)
@@ -70,10 +70,6 @@
    <!-- Limit categories -->
    <!-- ================ -->
 
-   <category name="org.jboss.serial">
-      <priority value="INFO"/>
-   </category>
-
    <category name="org.jboss">
       <priority value="DEBUG"/>
    </category>

Modified: trunk/tests/src/org/jboss/test/messaging/jms/DLQTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/DLQTest.java	2007-05-18 18:50:58 UTC (rev 2714)
+++ trunk/tests/src/org/jboss/test/messaging/jms/DLQTest.java	2007-05-19 15:31:23 UTC (rev 2715)
@@ -39,7 +39,7 @@
 import javax.naming.NameNotFoundException;
 
 import org.jboss.jms.destination.JBossQueue;
-import org.jboss.jms.server.endpoint.ServerSessionEndpoint;
+import org.jboss.jms.message.JBossMessage;
 import org.jboss.test.messaging.MessagingTestCase;
 import org.jboss.test.messaging.tools.ServerManagement;
 
@@ -458,10 +458,10 @@
             
             // Check the headers
             String origDest =
-               tm.getStringProperty(ServerSessionEndpoint.JBOSS_MESSAGING_ORIG_DESTINATION);
+               tm.getStringProperty(JBossMessage.JBOSS_MESSAGING_ORIG_DESTINATION);
             
             String origMessageId =
-               tm.getStringProperty(ServerSessionEndpoint.JBOSS_MESSAGING_ORIG_MESSAGE_ID);
+               tm.getStringProperty(JBossMessage.JBOSS_MESSAGING_ORIG_MESSAGE_ID);
             
             assertEquals(queue.toString(), origDest);
             

Modified: trunk/tests/src/org/jboss/test/messaging/jms/ExpiryQueueTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/ExpiryQueueTest.java	2007-05-18 18:50:58 UTC (rev 2714)
+++ trunk/tests/src/org/jboss/test/messaging/jms/ExpiryQueueTest.java	2007-05-19 15:31:23 UTC (rev 2715)
@@ -40,7 +40,7 @@
 import javax.naming.NameNotFoundException;
 
 import org.jboss.jms.destination.JBossQueue;
-import org.jboss.jms.server.endpoint.ServerSessionEndpoint;
+import org.jboss.jms.message.JBossMessage;
 import org.jboss.test.messaging.MessagingTestCase;
 import org.jboss.test.messaging.tools.ServerManagement;
 
@@ -408,13 +408,13 @@
             
             // Check the headers
             String origDest =
-               tm.getStringProperty(ServerSessionEndpoint.JBOSS_MESSAGING_ORIG_DESTINATION);
+               tm.getStringProperty(JBossMessage.JBOSS_MESSAGING_ORIG_DESTINATION);
             
             String origMessageId =
-               tm.getStringProperty(ServerSessionEndpoint.JBOSS_MESSAGING_ORIG_MESSAGE_ID);
+               tm.getStringProperty(JBossMessage.JBOSS_MESSAGING_ORIG_MESSAGE_ID);
             
             long actualExpiryTime =
-               tm.getLongProperty(ServerSessionEndpoint.JBOSS_MESSAGING_ACTUAL_EXPIRY_TIME);
+               tm.getLongProperty(JBossMessage.JBOSS_MESSAGING_ACTUAL_EXPIRY_TIME);
             
             assertEquals(topic.toString(), origDest);
             

Modified: trunk/tests/src/org/jboss/test/messaging/jms/MessageWithReadResolveTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/MessageWithReadResolveTest.java	2007-05-18 18:50:58 UTC (rev 2714)
+++ trunk/tests/src/org/jboss/test/messaging/jms/MessageWithReadResolveTest.java	2007-05-19 15:31:23 UTC (rev 2715)
@@ -21,8 +21,6 @@
  */
 package org.jboss.test.messaging.jms;
 
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
 import java.io.Serializable;
 
 import javax.jms.Connection;
@@ -35,8 +33,6 @@
 import javax.naming.InitialContext;
 
 import org.jboss.jms.client.JBossConnectionFactory;
-import org.jboss.serial.io.JBossObjectInputStream;
-import org.jboss.serial.io.JBossObjectOutputStream;
 import org.jboss.test.messaging.MessagingTestCase;
 import org.jboss.test.messaging.tools.ServerManagement;
 
@@ -139,6 +135,10 @@
    }
    
    /* Now test using serialization directly */
+   
+   /*
+    * 
+    * We don't currently use JBoss Serialization
    public void testUseSerializationDirectly() throws Exception
    {
       TestMessage tm = new TestMessage(456, false);
@@ -164,6 +164,7 @@
       ois.close();
             
    }
+   */
    
    // Package protected ---------------------------------------------
    

Added: trunk/tests/src/org/jboss/test/messaging/jms/clustering/DisableLoadBalancingAndFailoverTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/clustering/DisableLoadBalancingAndFailoverTest.java	                        (rev 0)
+++ trunk/tests/src/org/jboss/test/messaging/jms/clustering/DisableLoadBalancingAndFailoverTest.java	2007-05-19 15:31:23 UTC (rev 2715)
@@ -0,0 +1,501 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.test.messaging.jms.clustering;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.ExceptionListener;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.management.ObjectName;
+
+import org.jboss.jms.client.FailoverEvent;
+import org.jboss.jms.client.JBossConnection;
+import org.jboss.test.messaging.jms.clustering.base.ClusteringTestBase;
+import org.jboss.test.messaging.tools.ServerManagement;
+
+import EDU.oswego.cs.dl.util.concurrent.Latch;
+
+/**
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @version <tt>$Revision: 2685 $</tt>
+ *
+ * $Id: FailoverTest.java 2685 2007-05-15 07:56:12Z timfox $
+ */
+public class DisableLoadBalancingAndFailoverTest extends ClusteringTestBase
+{
+   // Constants ------------------------------------------------------------------------------------
+
+   // Static ---------------------------------------------------------------------------------------
+
+   // Attributes -----------------------------------------------------------------------------------
+	
+	protected ConnectionFactory nonClusteredCF1;
+	
+	protected ConnectionFactory nonClusteredCF2;
+	
+	protected ConnectionFactory lbCF1;
+	
+	protected ConnectionFactory lbCF2;
+	
+	protected ConnectionFactory foCF;
+
+   // Constructors ---------------------------------------------------------------------------------
+
+   public DisableLoadBalancingAndFailoverTest(String name)
+   {
+      super(name);
+   }
+
+   // Public ---------------------------------------------------------------------------------------
+   
+   public void testNoFailoverNoLoadBalancing1() throws Exception
+   {
+   	//If no load balancing then always on local node
+   	this.noFailover(nonClusteredCF1);
+   }
+   
+   public void testNoFailoverNoLoadBalancing2() throws Exception
+   {
+   	this.noFailoverWithExceptionListener(nonClusteredCF1, nonClusteredCF2);   	
+   }
+   	
+   public void testNoFailoverNoLoadBalancing3() throws Exception
+   {
+   	this.noLoadBalancing(nonClusteredCF1);
+   }
+   
+   public void testNoFailoverLoadBalancing1() throws Exception
+   {
+   	this.noFailover(lbCF1);
+   }
+   
+   public void testNoFailoverLoadBalancing2() throws Exception
+   {
+   	this.noFailoverWithExceptionListener(lbCF1, lbCF2);   	
+   }
+   	
+   public void testNoFailoverLoadBalancing3() throws Exception
+   {
+   	this.loadBalancing(lbCF1);
+   }
+   
+   public void testFailoverNoLoadBalancing1() throws Exception
+   {
+   	this.failover(foCF);
+   }
+   	
+   public void testFailoverNoLoadBalancing2() throws Exception
+   {
+   	this.noLoadBalancing(foCF);
+   }
+   
+   // Protected -------------------------------------------------------------------------------------
+
+   protected void noLoadBalancing(ConnectionFactory theCF) throws Exception
+   {
+   	Connection conn = null;      
+
+      try
+      {
+      	conn = theCF.createConnection();
+      	
+      	int serverID = ((JBossConnection)conn).getServerID();
+      	
+         conn.close();
+         
+         conn = theCF.createConnection();
+      	
+         assertEquals(serverID, ((JBossConnection)conn).getServerID());
+         
+         conn.close();
+         
+         conn = theCF.createConnection();
+      	
+         assertEquals(serverID, ((JBossConnection)conn).getServerID());
+         
+         conn.close();
+         
+         conn = theCF.createConnection();
+      	
+         assertEquals(serverID, ((JBossConnection)conn).getServerID());
+         
+         conn.close();
+         
+         conn = theCF.createConnection();
+      	
+         assertEquals(serverID, ((JBossConnection)conn).getServerID());                
+      }
+      finally
+      {
+         if (conn != null)
+         {
+            conn.close();
+         }
+      }
+   }
+   
+   protected void loadBalancing(ConnectionFactory theCF) throws Exception
+   {
+   	Connection conn = null;      
+
+      try
+      {
+      	log.info("In test **************");
+      	      	
+      	conn = theCF.createConnection();
+      	
+      	int serverID = ((JBossConnection)conn).getServerID();
+      	log.info("server id is " + serverID);
+      	
+         conn.close();
+         
+         conn = theCF.createConnection();
+      	
+         serverID = ++serverID % 3;
+         assertEquals(serverID, ((JBossConnection)conn).getServerID());
+         
+      	log.info("server id is " + serverID);
+         
+         conn.close();
+         
+         conn = theCF.createConnection();
+      	
+         serverID = ++serverID % 3;
+         assertEquals(serverID, ((JBossConnection)conn).getServerID());
+      	log.info("server id is " + serverID);
+         
+         conn.close();
+         
+         conn = theCF.createConnection();
+      	
+         serverID = ++serverID % 3;
+         assertEquals(serverID, ((JBossConnection)conn).getServerID());
+      	log.info("server id is " + serverID);
+         
+         conn.close();
+         
+         conn = theCF.createConnection();
+      	
+         serverID = ++serverID % 3;
+         assertEquals(serverID, ((JBossConnection)conn).getServerID());
+      	log.info("server id is " + serverID);
+      }
+      finally
+      {
+         if (conn != null)
+         {
+            conn.close();
+         }
+      }
+   }
+   
+   
+   protected void noFailover(ConnectionFactory theCF) throws Exception
+   {
+      Connection conn = null;      
+
+      try
+      {
+      	do
+      	{
+      		if (conn != null)
+      		{
+      			conn.close();
+      		}
+      		conn = theCF.createConnection();
+      	}
+      	while (((JBossConnection)conn).getServerID() != 1);
+      	
+         assertEquals(1, ((JBossConnection)conn).getServerID());
+         
+         Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         
+         MessageProducer prod = sess.createProducer(queue[1]);
+         
+         conn.start();
+         
+         TextMessage tm = sess.createTextMessage("uhasduihd");
+         
+         //Now kill server 1
+         
+         log.info("KILLING SERVER 1");
+         ServerManagement.kill(1);
+         log.info("KILLED SERVER 1");
+         
+         Thread.sleep(5000);
+         
+         long start = System.currentTimeMillis();
+         try
+         {
+         	prod.send(tm);
+         		
+         	// We shouldn't get here
+            fail();
+         }
+         catch (org.jboss.jms.exception.MessagingNetworkFailureException e)
+         {
+         	//OK - this is what we should get
+         	long end = System.currentTimeMillis();
+         	
+         	//Make sure it doesn't take too long
+         	assertTrue((end - start) <= 20);
+         }                 
+      }
+      finally
+      {
+         if (conn != null)
+         {
+            conn.close();
+         }
+      }
+   }
+         
+   protected void noFailoverWithExceptionListener(ConnectionFactory theCF1, ConnectionFactory theCF2) throws Exception
+   {
+      Connection conn = null;      
+
+      try
+      {
+      	do
+      	{
+      		if (conn != null)
+      		{
+      			conn.close();
+      		}
+      		conn = theCF1.createConnection();
+      	}
+      	while (((JBossConnection)conn).getServerID() != 1);
+      	
+      	MyListener listener = new MyListener();
+      	
+      	conn.setExceptionListener(listener);
+      	
+         assertEquals(1, ((JBossConnection)conn).getServerID());
+         
+         //Now kill server 1
+         
+         log.info("KILLING SERVER 1");
+         ServerManagement.kill(1);
+         log.info("KILLED SERVER 1");
+         
+         JMSException e = listener.waitForException(20000);
+         
+         assertNotNull(e);
+         
+         assertTrue(e.getMessage().equals("Failure on underlying remoting connection"));
+         
+         //Now try and recreate connection on different node
+         
+         conn.close();
+         
+         conn = theCF2.createConnection();
+         
+         Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+         MessageProducer prod = sess.createProducer(queue[2]);
+         
+         MessageConsumer cons = sess.createConsumer(queue[2]);
+
+         conn.start();
+
+         TextMessage tm = sess.createTextMessage("uhasduihd");
+         
+         prod.send(tm);
+         
+         TextMessage rm = (TextMessage)cons.receive(1000);
+         
+         assertNotNull(rm);
+         
+         assertEquals(tm.getText(), tm.getText());
+           
+      }
+      finally
+      {
+         if (conn != null)
+         {
+            conn.close();
+         }
+      }
+   }
+   
+   protected void failover(ConnectionFactory theCF) throws Exception
+   {
+      Connection conn = null;      
+
+      try
+      {
+      	do
+      	{
+      		if (conn != null)
+      		{
+      			conn.close();
+      		}
+      		conn = theCF.createConnection();
+      	}
+      	while (((JBossConnection)conn).getServerID() != 1);
+      	
+      	// register a failover listener
+         SimpleFailoverListener failoverListener = new SimpleFailoverListener();
+         ((JBossConnection)conn).registerFailoverListener(failoverListener);
+      	
+         assertEquals(1, ((JBossConnection)conn).getServerID());
+         
+         Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         
+         MessageProducer prod = sess.createProducer(queue[1]);
+         
+         MessageConsumer cons = sess.createConsumer(queue[1]);
+         
+         conn.start();
+         
+         TextMessage tm = sess.createTextMessage("uhasduihd");
+         
+         //Now kill server 1
+         
+         log.info("KILLING SERVER 1");
+         ServerManagement.kill(1);
+         log.info("KILLED SERVER 1");
+         
+         // wait for the client-side failover to complete
+
+         while(true)
+         {
+            FailoverEvent event = failoverListener.getEvent(120000);
+            if (event != null && FailoverEvent.FAILOVER_COMPLETED == event.getType())
+            {
+               break;
+            }
+            if (event == null)
+            {
+               fail("Did not get expected FAILOVER_COMPLETED event");
+            }
+         }
+
+         // failover complete
+         log.info("failover completed");
+         
+         prod.send(tm);
+         
+         TextMessage rm = (TextMessage)cons.receive(2000);
+         
+         assertNotNull(rm);
+         
+         assertEquals(tm.getText(), rm.getText());         		                
+      }
+      finally
+      {
+         if (conn != null)
+         {
+            conn.close();
+         }
+      }
+   }
+   
+   protected void setUp() throws Exception
+   {
+      nodeCount = 3;
+
+      super.setUp();
+      
+      nonClusteredCF1 = (ConnectionFactory)ic[1].lookup("/ConnectionFactory");
+      
+      nonClusteredCF2 = (ConnectionFactory)ic[2].lookup("/ConnectionFactory");
+      
+      //Deploy a connection factory with load balancing but no failover on node0
+      ServerManagement.getServer(0).deployConnectionFactory("org.jboss.messaging:service=LBConnectionFactory",
+      		                                   new String[] { "/LBConnectionFactory" }, false, true);
+      
+      //Deploy a connection factory with load balancing but no failover on node1
+      ServerManagement.getServer(1).deployConnectionFactory("org.jboss.messaging:service=LBConnectionFactory",
+      		                                   new String[] { "/LBConnectionFactory" }, false, true);
+      
+      //Deploy a connection factory with load balancing but no failover on node2
+      ServerManagement.getServer(2).deployConnectionFactory("org.jboss.messaging:service=LBConnectionFactory",
+      		                                   new String[] { "/LBConnectionFactory" }, false, true);
+      
+      this.lbCF1 = (ConnectionFactory)ic[1].lookup("/LBConnectionFactory");      
+      
+      this.lbCF2 = (ConnectionFactory)ic[2].lookup("/LBConnectionFactory");
+      
+      //Deploy a connection factory with failover but no load balancing on node 0
+      ServerManagement.getServer(0).deployConnectionFactory("org.jboss.messaging:service=FOConnectionFactory",
+            new String[] { "/FOConnectionFactory" }, true, false);
+      
+      //Deploy a connection factory with failover but no load balancing on node 1
+      ServerManagement.getServer(1).deployConnectionFactory("org.jboss.messaging:service=FOConnectionFactory",
+            new String[] { "/FOConnectionFactory" }, true, false);
+      
+      //Deploy a connection factory with failover but no load balancing on node 2
+      ServerManagement.getServer(2).deployConnectionFactory("org.jboss.messaging:service=FOConnectionFactory",
+            new String[] { "/FOConnectionFactory" }, true, false);
+
+      this.foCF = (ConnectionFactory)ic[1].lookup("/FOConnectionFactory");
+
+      log.debug("setup done");
+   }
+
+   protected void tearDown() throws Exception
+   {
+   	try
+   	{
+   		ServerManagement.getServer(1).undeployConnectionFactory(new ObjectName("org.jboss.messaging:service=LBConnectionFactory"));
+   	}
+   	catch (Exception ignore)
+   	{   		
+   	}
+      
+   	try
+   	{
+         ServerManagement.getServer(2).undeployConnectionFactory(new ObjectName("org.jboss.messaging:service=LBConnectionFactory"));
+   	}
+   	catch (Exception ignore)
+   	{   		
+   	}
+   	
+   	try
+   	{
+         ServerManagement.getServer(1).undeployConnectionFactory(new ObjectName("org.jboss.messaging:service=FOConnectionFactory"));
+   	}
+   	catch (Exception ignore)
+   	{   		
+   	}
+   	
+      super.tearDown();      
+   }
+
+
+
+   // Inner classes --------------------------------------------------------------------------------
+   
+	private class MyListener implements ExceptionListener
+	{
+		private JMSException e;
+		
+		Latch l = new Latch();
+
+		public void onException(JMSException e)
+		{
+			this.e = e;
+			
+			l.release();
+		}
+		
+		JMSException waitForException(long timeout) throws Exception
+		{
+			l.attempt(timeout);
+			
+			return e;
+		}
+		
+	}	
+   
+   
+}

Modified: trunk/tests/src/org/jboss/test/messaging/jms/clustering/DistributedQueueTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/clustering/DistributedQueueTest.java	2007-05-18 18:50:58 UTC (rev 2714)
+++ trunk/tests/src/org/jboss/test/messaging/jms/clustering/DistributedQueueTest.java	2007-05-19 15:31:23 UTC (rev 2715)
@@ -77,7 +77,7 @@
          ic0 = new InitialContext(ServerManagement.getJNDIEnvironment(0));
          ic1 = new InitialContext(ServerManagement.getJNDIEnvironment(1));
 
-         ConnectionFactory cf = (ConnectionFactory)ic0.lookup("/ConnectionFactory");
+         ConnectionFactory cf = (ConnectionFactory)ic0.lookup("/ClusteredConnectionFactory");
          Queue queue0 = (Queue)ic0.lookup("/queue/testDistributedQueue");
          Queue queue1 = (Queue)ic1.lookup("/queue/testDistributedQueue");
 

Modified: trunk/tests/src/org/jboss/test/messaging/jms/clustering/HATest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/clustering/HATest.java	2007-05-18 18:50:58 UTC (rev 2714)
+++ trunk/tests/src/org/jboss/test/messaging/jms/clustering/HATest.java	2007-05-19 15:31:23 UTC (rev 2715)
@@ -96,7 +96,7 @@
     */
    public void testCloseOnFailover() throws Exception
    {
-      JBossConnectionFactory factory = (JBossConnectionFactory) ic[0].lookup("/ConnectionFactory");
+      JBossConnectionFactory factory = (JBossConnectionFactory) ic[0].lookup("/ClusteredConnectionFactory");
 
       Connection conn1 = factory.createConnection();
       Connection conn2 = factory.createConnection();
@@ -156,7 +156,7 @@
     */
    public void testRoundRobinConnectionCreation() throws Exception
    {
-      JBossConnectionFactory factory =  (JBossConnectionFactory )ic[0].lookup("/ConnectionFactory");
+      JBossConnectionFactory factory =  (JBossConnectionFactory )ic[0].lookup("/ClusteredConnectionFactory");
 
       ClientClusteredConnectionFactoryDelegate delegate =
          (ClientClusteredConnectionFactoryDelegate)factory.getDelegate();
@@ -279,7 +279,7 @@
    public void testDefaultFailoverMap() throws Exception
    {
       {
-         JBossConnectionFactory factory =  (JBossConnectionFactory )ic[0].lookup("/ConnectionFactory");
+         JBossConnectionFactory factory =  (JBossConnectionFactory )ic[0].lookup("/ClusteredConnectionFactory");
 
          ClientClusteredConnectionFactoryDelegate delegate =
             (ClientClusteredConnectionFactoryDelegate)factory.getDelegate();
@@ -338,7 +338,7 @@
       {
          //Lookup another connection factory
 
-         JBossConnectionFactory factory =  (JBossConnectionFactory )ic[1].lookup("/ConnectionFactory");
+         JBossConnectionFactory factory =  (JBossConnectionFactory )ic[1].lookup("/ClusteredConnectionFactory");
 
          log.info("Got connection factory");
 
@@ -386,7 +386,7 @@
       {
          //Lookup another connection factory
 
-         JBossConnectionFactory factory =  (JBossConnectionFactory )ic[2].lookup("/ConnectionFactory");
+         JBossConnectionFactory factory =  (JBossConnectionFactory )ic[2].lookup("/ClusteredConnectionFactory");
 
          ClientClusteredConnectionFactoryDelegate delegate =
             (ClientClusteredConnectionFactoryDelegate)factory.getDelegate();
@@ -412,7 +412,7 @@
       ServerManagement.start(0, "all");
 
       {
-         JBossConnectionFactory factory =  (JBossConnectionFactory )ic[0].lookup("/ConnectionFactory");
+         JBossConnectionFactory factory =  (JBossConnectionFactory )ic[0].lookup("/ClusteredConnectionFactory");
 
          log.info("Got connection factory");
 
@@ -453,7 +453,7 @@
       ServerManagement.start(1, "all");
 
       {
-         JBossConnectionFactory factory =  (JBossConnectionFactory )ic[1].lookup("/ConnectionFactory");
+         JBossConnectionFactory factory =  (JBossConnectionFactory )ic[1].lookup("/ClusteredConnectionFactory");
 
          log.info("Got connection factory");
 
@@ -499,7 +499,7 @@
 
    public void testSimpleFailover() throws Exception
    {
-      JBossConnectionFactory factory =  (JBossConnectionFactory )ic[0].lookup("/ConnectionFactory");
+      JBossConnectionFactory factory =  (JBossConnectionFactory )ic[0].lookup("/ClusteredConnectionFactory");
 
       ClientClusteredConnectionFactoryDelegate delegate =
          (ClientClusteredConnectionFactoryDelegate)factory.getDelegate();
@@ -637,7 +637,7 @@
 
    public void testFailoverWithUnackedMessagesClientAcknowledge() throws Exception
    {
-      JBossConnectionFactory factory =  (JBossConnectionFactory )ic[0].lookup("/ConnectionFactory");
+      JBossConnectionFactory factory =  (JBossConnectionFactory )ic[0].lookup("/ClusteredConnectionFactory");
 
       ClientClusteredConnectionFactoryDelegate delegate =
          (ClientClusteredConnectionFactoryDelegate)factory.getDelegate();
@@ -832,7 +832,7 @@
    TODO: Reactivate this test when http://jira.jboss.org/jira/browse/JBMESSAGING-883 is done
    public void testFailoverWithUnackedMessagesTransactional() throws Exception
    {
-      JBossConnectionFactory factory =  (JBossConnectionFactory )ic[0].lookup("/ConnectionFactory");
+      JBossConnectionFactory factory =  (JBossConnectionFactory )ic[0].lookup("/ClusteredConnectionFactory");
 
       ClientClusteredConnectionFactoryDelegate delegate =
          (ClientClusteredConnectionFactoryDelegate)factory.getDelegate();

Modified: trunk/tests/src/org/jboss/test/messaging/jms/clustering/LoadBalancingTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/clustering/LoadBalancingTest.java	2007-05-18 18:50:58 UTC (rev 2714)
+++ trunk/tests/src/org/jboss/test/messaging/jms/clustering/LoadBalancingTest.java	2007-05-19 15:31:23 UTC (rev 2715)
@@ -59,7 +59,7 @@
       {
          InitialContext ic = new InitialContext(ServerManagement.getJNDIEnvironment(0));
 
-         ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
+         ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ClusteredConnectionFactory");
 
          JBossConnectionFactory jbcf = (JBossConnectionFactory)cf;
          ClientClusteredConnectionFactoryDelegate clusteredDelegate =
@@ -107,7 +107,7 @@
       {
          InitialContext ic0 = new InitialContext(ServerManagement.getJNDIEnvironment(0));
 
-         ConnectionFactory cf = (ConnectionFactory)ic0.lookup("/ConnectionFactory");
+         ConnectionFactory cf = (ConnectionFactory)ic0.lookup("/ClusteredConnectionFactory");
 
          JBossConnectionFactory jbcf = (JBossConnectionFactory)cf;
          ClientClusteredConnectionFactoryDelegate clusteredDelegate =
@@ -158,7 +158,7 @@
       // clear the database for those.
 
       ServiceAttributeOverrides override = new ServiceAttributeOverrides();
-      override.put(new ObjectName("jboss.messaging.connectionfactory:service=ConnectionFactory"),
+      override.put(new ObjectName("jboss.messaging.connectionfactory:service=ClusteredConnectionFactory"),
          "LoadBalancingFactory", "org.jboss.jms.client.plugin.RandomLoadBalancingFactory");
       ServerManagement.start(0, "all", override, true);
 
@@ -166,7 +166,7 @@
       {
          InitialContext ic0 = new InitialContext(ServerManagement.getJNDIEnvironment(0));
 
-         ConnectionFactory cf = (ConnectionFactory)ic0.lookup("/ConnectionFactory");
+         ConnectionFactory cf = (ConnectionFactory)ic0.lookup("/ClusteredConnectionFactory");
 
          JBossConnectionFactory jbcf = (JBossConnectionFactory)cf;
          ClientClusteredConnectionFactoryDelegate clusteredDelegate =
@@ -214,7 +214,7 @@
       // clear the database for those.
 
       ServiceAttributeOverrides override = new ServiceAttributeOverrides();
-      override.put(new ObjectName("jboss.messaging.connectionfactory:service=ConnectionFactory"),
+      override.put(new ObjectName("jboss.messaging.connectionfactory:service=ClusteredConnectionFactory"),
          "LoadBalancingFactory", "org.jboss.jms.client.plugin.RandomLoadBalancingFactory");
       ServerManagement.start(0, "all", override, true);
       ServerManagement.start(1, "all", override, false);
@@ -223,7 +223,7 @@
       {
          InitialContext ic0 = new InitialContext(ServerManagement.getJNDIEnvironment(0));
 
-         ConnectionFactory cf = (ConnectionFactory)ic0.lookup("/ConnectionFactory");
+         ConnectionFactory cf = (ConnectionFactory)ic0.lookup("/ClusteredConnectionFactory");
 
          JBossConnectionFactory jbcf = (JBossConnectionFactory)cf;
          ClientClusteredConnectionFactoryDelegate clusteredDelegate =

Modified: trunk/tests/src/org/jboss/test/messaging/jms/clustering/base/ClusteringTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/clustering/base/ClusteringTestBase.java	2007-05-18 18:50:58 UTC (rev 2714)
+++ trunk/tests/src/org/jboss/test/messaging/jms/clustering/base/ClusteringTestBase.java	2007-05-19 15:31:23 UTC (rev 2715)
@@ -112,7 +112,7 @@
 
       // We only need to lookup one connection factory since it will be clustered so we will
       // actually create connections on different servers (round robin).
-      cf = (ConnectionFactory)ic[0].lookup("/ConnectionFactory");
+      cf = (ConnectionFactory)ic[0].lookup("/ClusteredConnectionFactory");
 
       drainQueues();
    }
@@ -280,7 +280,7 @@
       {
          // TODO This is a dangerous hack, relying on an arbitrary distribution algorithm
          // (round-robin in this case). If we want a connection to a specific node, we should be
-         // able to look up something like "/ConnectionFactory0"
+         // able to look up something like "/ClusteredConnectionFactory0"
          
          for(int i = 0; i < nodeCount; i++)
          {

Modified: trunk/tests/src/org/jboss/test/messaging/jms/server/connectionfactory/ConnectionFactoryTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/server/connectionfactory/ConnectionFactoryTest.java	2007-05-18 18:50:58 UTC (rev 2714)
+++ trunk/tests/src/org/jboss/test/messaging/jms/server/connectionfactory/ConnectionFactoryTest.java	2007-05-19 15:31:23 UTC (rev 2715)
@@ -89,12 +89,11 @@
 
    public void testDefaultConnectionFactory() throws Exception
    {
-      // I expect at least "/ConnectionFactory" and "/XAConnectionFactory", they should be
-      // configured by default in jboss-service.xml
+      // These should be configured by default in connection-factories-service.xml
 
       ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory");
       log.debug("ConnectionFactory: " + cf);
-
+      
       XAConnectionFactory xacf = (XAConnectionFactory)initialContext.lookup("/XAConnectionFactory");
       log.debug("ConnectionFactory: " + xacf);
 
@@ -103,6 +102,18 @@
 
       xacf = (XAConnectionFactory)initialContext.lookup("java:/XAConnectionFactory");
       log.debug("ConnectionFactory: " + xacf);
+      
+      cf = (ConnectionFactory)initialContext.lookup("/ClusteredConnectionFactory");
+      log.debug("ConnectionFactory: " + cf);
+
+      xacf = (XAConnectionFactory)initialContext.lookup("/ClusteredXAConnectionFactory");
+      log.debug("ConnectionFactory: " + xacf);
+
+      cf = (ConnectionFactory)initialContext.lookup("java:/ClusteredConnectionFactory");
+      log.debug("ConnectionFactory: " + cf);
+
+      xacf = (XAConnectionFactory)initialContext.lookup("java:/ClusteredXAConnectionFactory");
+      log.debug("ConnectionFactory: " + xacf);
    }
 
    public void testDeployment() throws Exception

Modified: trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java	2007-05-18 18:50:58 UTC (rev 2714)
+++ trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java	2007-05-19 15:31:23 UTC (rev 2715)
@@ -1036,6 +1036,15 @@
    }
 
    public static void deployConnectionFactory(String objectName,
+													       String[] jndiBindings,
+													       boolean supportsFailover, boolean supportsLoadBalancing)
+   throws Exception
+   {
+   	servers[0].getServer().deployConnectionFactory(objectName,
+   			jndiBindings,supportsFailover, supportsLoadBalancing);
+   }
+
+   public static void deployConnectionFactory(String objectName,
                                               String[] jndiBindings,
                                               int prefetchSize)
       throws Exception

Modified: trunk/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java	2007-05-18 18:50:58 UTC (rev 2714)
+++ trunk/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java	2007-05-19 15:31:23 UTC (rev 2715)
@@ -144,7 +144,6 @@
    // List<ObjectName>
    private List connFactoryObjectNames = new ArrayList();
 
-
    static
    {
       try
@@ -1626,15 +1625,28 @@
       {
          throw new Exception("Cannot find " + connFactoryConfigFile + " in the classpath");
       }
+      
+      connFactoryObjectNames.clear();
 
       ServiceDeploymentDescriptor cfdd =
          new ServiceDeploymentDescriptor(connFactoryConfigFileURL);
+      
+      
       List connFactoryElements = cfdd.query("service", "ConnectionFactory");
-      if (connFactoryElements.isEmpty())
+
+      for (Iterator i = connFactoryElements.iterator(); i.hasNext();)
       {
-         connFactoryElements = cfdd.query("service", "HTTPConnectionFactory");
+         MBeanConfigurationElement connFactoryElement = (MBeanConfigurationElement) i.next();
+         ObjectName on = registerAndConfigureService(connFactoryElement);
+         overrideAttributes(on, attrOverrides);
+         // dependencies have been automatically injected already
+         invoke(on, "create", new Object[0], new String[0]);
+         invoke(on, "start", new Object[0], new String[0]);
+         connFactoryObjectNames.add(on);
       }
-      connFactoryObjectNames.clear();
+      
+      connFactoryElements = cfdd.query("service", "ClusteredConnectionFactory");
+
       for (Iterator i = connFactoryElements.iterator(); i.hasNext();)
       {
          MBeanConfigurationElement connFactoryElement = (MBeanConfigurationElement) i.next();
@@ -1645,6 +1657,19 @@
          invoke(on, "start", new Object[0], new String[0]);
          connFactoryObjectNames.add(on);
       }
+      
+      connFactoryElements = cfdd.query("service", "HTTPConnectionFactory");
+
+      for (Iterator i = connFactoryElements.iterator(); i.hasNext();)
+      {
+         MBeanConfigurationElement connFactoryElement = (MBeanConfigurationElement) i.next();
+         ObjectName on = registerAndConfigureService(connFactoryElement);
+         overrideAttributes(on, attrOverrides);
+         // dependencies have been automatically injected already
+         invoke(on, "create", new Object[0], new String[0]);
+         invoke(on, "start", new Object[0], new String[0]);
+         connFactoryObjectNames.add(on);
+      }
    }
 
 

Modified: trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/LocalTestServer.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/LocalTestServer.java	2007-05-18 18:50:58 UTC (rev 2714)
+++ trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/LocalTestServer.java	2007-05-19 15:31:23 UTC (rev 2715)
@@ -718,21 +718,42 @@
                                        String[] jndiBindings,
                                        int prefetchSize) throws Exception
    {
-      deployConnectionFactory(objectName, jndiBindings, prefetchSize, -1, -1, -1);
+      deployConnectionFactory(objectName, jndiBindings, prefetchSize, -1, -1, -1, false, false);
    }
 
    public void deployConnectionFactory(String objectName,
                                        String[] jndiBindings) throws Exception
    {
-      deployConnectionFactory(objectName, jndiBindings, -1, -1, -1, -1);
+      deployConnectionFactory(objectName, jndiBindings, -1, -1, -1, -1, false, false);
    }
+   
+   public void deployConnectionFactory(String objectName,
+         String[] jndiBindings,
+         int prefetchSize,
+         int defaultTempQueueFullSize,
+         int defaultTempQueuePageSize,
+         int defaultTempQueueDownCacheSize) throws Exception
+   {
+   	this.deployConnectionFactory(objectName, jndiBindings, prefetchSize, defaultTempQueueFullSize,
+   			defaultTempQueuePageSize, defaultTempQueueDownCacheSize, false, false);   			
+   }
+   
+   public void deployConnectionFactory(String objectName,
+         String[] jndiBindings,
+         boolean supportsFailover, boolean supportsLoadBalancing) throws Exception
+   {
+   	this.deployConnectionFactory(objectName, jndiBindings, -1, -1,
+   			-1, -1, supportsFailover, supportsLoadBalancing);   			
+   }
 
-   public void deployConnectionFactory(String objectName,
+   private void deployConnectionFactory(String objectName,
                                        String[] jndiBindings,
                                        int prefetchSize,
                                        int defaultTempQueueFullSize,
                                        int defaultTempQueuePageSize,
-                                       int defaultTempQueueDownCacheSize) throws Exception
+                                       int defaultTempQueueDownCacheSize,
+                                       boolean supportsFailover,
+                                       boolean supportsLoadBalancing) throws Exception
    {
       log.trace("deploying connection factory with name: " + objectName);
       
@@ -763,6 +784,9 @@
       {
          config += "<attribute name=\"PrefetchSize\">" + prefetchSize + "</attribute>";
       }
+      
+      config += "<attribute name=\"SupportsFailover\">" + supportsFailover + "</attribute>";
+      config += "<attribute name=\"SupportsLoadBalancing\">" + supportsLoadBalancing + "</attribute>";
 
       config += "<attribute name=\"JNDIBindings\"><bindings>";
 

Modified: trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RMITestServer.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RMITestServer.java	2007-05-18 18:50:58 UTC (rev 2714)
+++ trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RMITestServer.java	2007-05-19 15:31:23 UTC (rev 2715)
@@ -420,6 +420,12 @@
       server.deployConnectionFactory(objectName, jndiBindings, prefetchSize,
                                      defaultTempQueueFullSize, defaultTempQueuePageSize, defaultTempQueueDownCacheSize);
    }
+   
+   public void deployConnectionFactory(String objectName,
+         String[] jndiBindings, boolean supportsFailover, boolean supportsLoadBalancing) throws Exception
+   {
+   	server.deployConnectionFactory(objectName, jndiBindings, supportsFailover, supportsLoadBalancing);
+   }
 
    public void undeployConnectionFactory(ObjectName objectName) throws Exception
    {

Modified: trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/Server.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/Server.java	2007-05-18 18:50:58 UTC (rev 2714)
+++ trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/Server.java	2007-05-19 15:31:23 UTC (rev 2715)
@@ -220,7 +220,14 @@
                                 int prefetchSize,
                                 int defaultTempQueueFullSize,
                                 int defaultTempQueuePageSize,
-                                int defaultTempQueueDownCacheSize) throws Exception;
+                                int defaultTempQueueDownCacheSize
+                                ) throws Exception;
+   
+   void deployConnectionFactory(String objectName,
+								         String[] jndiBindings,
+								         boolean supportsFailover,
+								         boolean supportsLoadBalancing       
+								         ) throws Exception;
 
    void deployConnectionFactory(String objectName,
                                 String[] jndiBindings,




More information about the jboss-cvs-commits mailing list