[jboss-cvs] JBoss Messaging SVN: r2326 - in trunk: src/main/org/jboss/jms/recovery and 6 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Feb 15 13:56:34 EST 2007


Author: timfox
Date: 2007-02-15 13:56:33 -0500 (Thu, 15 Feb 2007)
New Revision: 2326

Added:
   trunk/src/main/org/jboss/jms/recovery/MessagingXAResourceRecovery.java
Removed:
   trunk/src/main/org/jboss/jms/recovery/BridgeXAResourceRecovery.java
   trunk/src/main/org/jboss/jms/recovery/JMSProviderXAResourceRecovery.java
   trunk/tests/etc/bridge-recovery.properties
Modified:
   trunk/src/etc/xmdesc/Bridge-xmbean.xml
   trunk/src/main/org/jboss/jms/server/bridge/BridgeMBean.java
   trunk/src/main/org/jboss/jms/server/bridge/BridgeService.java
   trunk/tests/etc/jbossjta-properties.xml
   trunk/tests/src/org/jboss/test/messaging/jms/bridge/BridgeMBeanTest.java
   trunk/tests/src/org/jboss/test/messaging/jms/bridge/BridgeTestBase.java
   trunk/tests/src/org/jboss/test/messaging/jms/bridge/ReconnectTest.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:
http://jira.jboss.org/jira/browse/JBMESSAGING-805



Modified: trunk/src/etc/xmdesc/Bridge-xmbean.xml
===================================================================
--- trunk/src/etc/xmdesc/Bridge-xmbean.xml	2007-02-15 14:17:18 UTC (rev 2325)
+++ trunk/src/etc/xmdesc/Bridge-xmbean.xml	2007-02-15 18:56:33 UTC (rev 2326)
@@ -17,20 +17,20 @@
       <type>org.jboss.messaging.core.plugin.contract.MessagingComponent</type>
    </attribute>
 
-	<attribute access="read-write" getMethod="getSourceConnectionFactoryLookup"
-	   setMethod="setSourceConnectionFactoryLookup">
-	   <description>The source connection factory lookup</description>
-	   <name>SourceConnectionFactoryLookup</name>
+	<attribute access="read-write" getMethod="getSourceProviderAdaptorLookup"
+	   setMethod="setSourceProviderAdaptorLookup">
+	   <description>JNDI lookup for the source JMS provider Adaptor</description>
+	   <name>SourceProviderAdaptorLookup</name>
 	   <type>java.lang.String</type>
 	</attribute>
 	
-	<attribute access="read-write" getMethod="getTargetConnectionFactoryLookup"
-	   setMethod="setTargetConnectionFactoryLookup">
-	   <description>The target connection factory lookup</description>
-	   <name>TargetConnectionFactoryLookup</name>
+	<attribute access="read-write" getMethod="getTargetProviderAdaptorLookup"
+	   setMethod="setTargetProviderAdaptorLookup">
+	   <description>JNDI lookup for the target JMS provider Adaptor</description>
+	   <name>TargetProviderAdaptorLookup</name>
 	   <type>java.lang.String</type>
 	</attribute>	
-	
+		
 	<attribute access="read-write" getMethod="getSourceDestinationLookup"
 	   setMethod="setSourceDestinationLookup">
 	   <description>The source destination lookup</description>
@@ -147,18 +147,6 @@
 	   <type>boolean</type>
 	</attribute>	
 	
-	<attribute access="read-write" getMethod="getSourceJNDIProperties" setMethod="setSourceJNDIProperties">
-	   <description>The JNDI properties to use to lookup the source destination, or null if a local JNDI initial context should be used</description>
-	   <name>SourceJNDIProperties</name>
-	   <type>java.lang.String</type>
-	</attribute>	
-	
-	<attribute access="read-write" getMethod="getTargetJNDIProperties" setMethod="setTargetJNDIProperties">
-	   <description>The JNDI properties to use to lookup the target destination, or null if a local JNDI initial context should be used</description>
-	   <name>TargetJNDIProperties</name>
-	   <type>java.lang.String</type>
-	</attribute>			
-
    <!-- Managed operations -->
 
    <operation>

Deleted: trunk/src/main/org/jboss/jms/recovery/BridgeXAResourceRecovery.java
===================================================================
--- trunk/src/main/org/jboss/jms/recovery/BridgeXAResourceRecovery.java	2007-02-15 14:17:18 UTC (rev 2325)
+++ trunk/src/main/org/jboss/jms/recovery/BridgeXAResourceRecovery.java	2007-02-15 18:56:33 UTC (rev 2326)
@@ -1,293 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, 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.jms.recovery;
-
-import java.io.InputStream;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-import java.util.StringTokenizer;
-
-import javax.jms.XAConnection;
-import javax.jms.XAConnectionFactory;
-import javax.jms.XASession;
-import javax.naming.InitialContext;
-import javax.transaction.xa.XAResource;
-
-import org.jboss.logging.Logger;
-
-import com.arjuna.ats.jta.recovery.XAResourceRecovery;
-
-/**
- * 
- * A BridgeXAResourceRecovery
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- * @version <tt>$Revision: 1.1 $</tt>
- *
- * $Id$
- *
- */
-public class BridgeXAResourceRecovery implements XAResourceRecovery
-{
-   private boolean trace = log.isTraceEnabled();
-
-   private static final Logger log = Logger.getLogger(BridgeXAResourceRecovery.class);
-
-   private Hashtable jndiProperties;
-   
-   private String connectionFactoryLookup;
-   
-   private boolean hasMore;
-   
-   private String username;
-   
-   private String password;
-   
-   private XAConnection conn;
-   
-   private XAResource res;
-
-   public BridgeXAResourceRecovery()
-   {
-      if(trace) log.trace("Constructing BridgeXAResourceRecovery2..");
-   }
-
-   public boolean initialise(String config)
-   {
-      if (log.isTraceEnabled()) { log.trace(this + " intialise: " + config); }
-      
-      StringTokenizer tok = new StringTokenizer(config, ",");
-      
-      if (tok.countTokens() != 2)
-      {
-         log.error("Invalid config: " + config);
-         return false;
-      }
-      
-      String provider = tok.nextToken();
-      
-      String propsFile = tok.nextToken();
-      
-      try
-      {
-         //The config should point to a properties file on the classpath that holds the actual config
-         InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(propsFile);
-         
-         Properties props = new Properties();
-         
-         props.load(is);
-         
-         /*
-          * provider1.jndi.prop1=xxxx
-          * provider1.jndi.prop2=yyyy
-          * provider1.jndi.prop3=zzzz
-          * 
-          * provider1.xaconnectionfactorylookup=xyz
-          * provider1.username=bob
-          * provider1.password=blah
-          * 
-          * provider2.jndi.prop1=xxxx
-          * provider2.jndi.prop2=yyyy
-          * provider2.jndi.prop3=zzzz
-          * 
-          * provider2.xaconnectionfactorylookup=xyz
-          * provider2.username=xyz
-          * provider2.password=blah
-          *           
-          */
-         
-         Iterator iter = props.entrySet().iterator();
-         
-         String jndiPrefix = provider + ".jndi.";
-         
-         String cfKey = provider + ".xaconnectionfactorylookup";
-         
-         String usernameKey = provider + ".username";
-         
-         String passwordKey = provider + ".password";
-         
-         jndiProperties = new Hashtable();
-         
-         while (iter.hasNext())
-         {
-            Map.Entry entry = (Map.Entry)iter.next();
-            
-            String key = (String)entry.getKey();
-            String value = (String)entry.getValue();
-            
-            if (key.startsWith(jndiPrefix))
-            {
-               String actualKey = key.substring(jndiPrefix.length());
-               
-               jndiProperties.put(actualKey, value);
-            }
-            else if (key.equals(cfKey))
-            {
-               connectionFactoryLookup = value;
-            }
-            else if (key.equals(usernameKey))
-            {
-               username = value;
-            }
-            else if (key.equals(passwordKey))
-            {
-               password = value;
-            }
-         }
-         
-         if (connectionFactoryLookup == null)
-         {
-            log.error("Key " + cfKey + " does not exist in config");
-            return false;
-         }
-         
-         if (log.isTraceEnabled()) { log.trace(this + " initialised"); }
-         
-         hasMore = true;
-         
-         return true;
-      }
-      catch (Exception e)
-      {
-         log.error("Failed to load config file: " + config, e);
-         
-         return false;
-      }
-   }
-
-   public boolean hasMoreResources()
-   {
-      if (log.isTraceEnabled()) { log.trace(this + " hasMoreResources"); }
-            
-      /*
-       * The way hasMoreResources is supposed to work is as follows:
-       * For each "sweep" the recovery manager will call hasMoreResources, then if it returns
-       * true it will call getXAResource.
-       * It will repeat that until hasMoreResources returns false.
-       * Then the sweep is over.
-       * For the next sweep hasMoreResources should return true, etc.
-       * 
-       * In our case where we only need to return one XAResource per sweep,
-       * hasMoreResources should basically alternate between true and false.
-       * 
-       * And we return a new XAResource every time it is called.
-       * This makes this resilient to failure, since if the network fails
-       * between the XAResource and it's server, on the next pass a new one will
-       * be create and if the server is back up it will work.
-       * This means there is no need for an XAResourceWrapper which is a technique used in the 
-       * JMSProviderXAResourceRecovery
-       * The recovery manager will throw away the XAResource anyway after every sweep.
-       * 
-       */
-        
-      if (hasMore)
-      {
-         //Get a new XAResource
-         
-         try
-         {
-            if (conn != null)
-            {
-               conn.close();
-            }
-         }
-         catch (Exception ignore)
-         {         
-         }
-         
-         InitialContext ic = null;
-         
-         try
-         {
-            ic = new InitialContext(jndiProperties);
-            
-            XAConnectionFactory connectionFactory = (XAConnectionFactory)ic.lookup(connectionFactoryLookup);
-            
-            if (username == null)
-            {
-               conn = connectionFactory.createXAConnection();
-            }
-            else
-            {
-               conn = connectionFactory.createXAConnection(username, password);
-            }
-            
-            XASession session = conn.createXASession();
-            
-            res = session.getXAResource();
-            
-            //Note the connection is closed the next time the xaresource is created or by the finalizer
-            
-         }
-         catch (Exception e)
-         {
-            log.warn("Cannot create XAResource", e);
-            
-            hasMore = false;
-         }
-         finally
-         {
-            if (ic != null)
-            {
-               try
-               {
-                  ic.close();
-               }
-               catch (Exception ignore)
-               {               
-               }
-            }
-         }
-         
-      }
-      
-      boolean ret = hasMore;
-            
-      hasMore = !hasMore;
-      
-      return ret;      
-   }
-
-   public XAResource getXAResource()
-   {
-      if (log.isTraceEnabled()) { log.trace(this + " getXAResource"); }
-      
-      return res;
-   }
-   
-   protected void finalize()
-   {
-      try
-      {
-         if (conn != null)
-         {
-            conn.close();
-         }
-      }
-      catch (Exception ignore)
-      {         
-      }  
-   }
-}
-

Deleted: trunk/src/main/org/jboss/jms/recovery/JMSProviderXAResourceRecovery.java
===================================================================
--- trunk/src/main/org/jboss/jms/recovery/JMSProviderXAResourceRecovery.java	2007-02-15 14:17:18 UTC (rev 2325)
+++ trunk/src/main/org/jboss/jms/recovery/JMSProviderXAResourceRecovery.java	2007-02-15 18:56:33 UTC (rev 2326)
@@ -1,104 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, 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.jms.recovery;
-
-import javax.transaction.xa.XAResource;
-
-import org.jboss.logging.Logger;
-
-import com.arjuna.ats.jta.recovery.XAResourceRecovery;
-
-/**
- * JMS Provider Adapter based recovery.
- * 
- * This should be done when recovery is being driven from a transaction manager deployed with JBoss AS
- * since it relies on JMSProviderLoader instances being deployed that correspond to the JMS providers
- * to recover for.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @author <a href="juha at jboss.com">Juha Lindfors</a>
- *
- * @version $Revision: 1.1 $
- */
-public class JMSProviderXAResourceRecovery implements XAResourceRecovery
-{
-   private boolean trace = log.isTraceEnabled();
-
-	private static final Logger log = Logger.getLogger(JMSProviderXAResourceRecovery.class);
-
-   /** The jms provider name */
-   private String providerName;
-
-   /** The delegate XAResource */
-   private XAResourceWrapper wrapper;
-
-   /** Whether the XAResource is working */
-   private boolean working = false;
-
-   public JMSProviderXAResourceRecovery()
-   {
-      if(trace)
-			log.trace("Constructing JMSProviderXAResourceRecovery..");
-   }
-
-   public boolean initialise(String p)
-   {
-      if(trace)
-			log.trace("Initialising JMSProviderXAResourceRecovery..");
-
-      this.providerName = p;
-      return true;
-   }
-
-   public boolean hasMoreResources()
-   {
-      // If the XAResource is already working
-      if (working)
-         return false;
-
-      // Have we initialized yet?
-      if (wrapper == null)
-      {
-         wrapper = new XAResourceWrapper();
-         wrapper.setProviderName(providerName);
-      }
-
-      // Test the connection
-      try
-      {
-         wrapper.getTransactionTimeout();
-         working = true;
-      }
-      catch (Exception ignored)
-      {
-         //System.out.println(ignored.getMessage());
-      }
-
-      // This will return false until we get a successful connection
-      return working;
-   }
-
-   public XAResource getXAResource()
-   {
-      return wrapper;
-   }
-}

Copied: trunk/src/main/org/jboss/jms/recovery/MessagingXAResourceRecovery.java (from rev 2323, trunk/src/main/org/jboss/jms/recovery/BridgeXAResourceRecovery.java)
===================================================================
--- trunk/src/main/org/jboss/jms/recovery/MessagingXAResourceRecovery.java	                        (rev 0)
+++ trunk/src/main/org/jboss/jms/recovery/MessagingXAResourceRecovery.java	2007-02-15 18:56:33 UTC (rev 2326)
@@ -0,0 +1,272 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.jms.recovery;
+
+import java.util.StringTokenizer;
+
+import javax.jms.XAConnection;
+import javax.jms.XAConnectionFactory;
+import javax.jms.XASession;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.transaction.xa.XAResource;
+
+import org.jboss.jms.jndi.JMSProviderAdapter;
+import org.jboss.logging.Logger;
+
+import com.arjuna.ats.jta.recovery.XAResourceRecovery;
+
+/**
+ * 
+ * A XAResourceRecovery instance that can be used to recover any JMS provider.
+ * 
+ * 
+ * This class will create a new XAConnection/XASession/XAResource on each sweep from the recovery manager.
+ * 
+ * It can probably be optimised to keep the same XAResource between sweeps and only recreate if
+ * a problem with the connection to the provider is detected, but considering that typical sweep periods
+ * are of the order of 10s of seconds to several minutes, then the extra complexity of the code required
+ * for that does not seem to be a good tradeoff.
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @version <tt>$Revision: 1.1 $</tt>
+ *
+ * $Id$
+ *
+ */
+public class MessagingXAResourceRecovery implements XAResourceRecovery
+{
+   private boolean trace = log.isTraceEnabled();
+
+   private static final Logger log = Logger.getLogger(MessagingXAResourceRecovery.class);
+   
+   private String providerAdaptorName;
+   
+   private JMSProviderAdapter providerAdaptor;
+
+   private boolean hasMore;
+   
+   private String username;
+   
+   private String password;
+   
+   private XAConnection conn;
+   
+   private XAResource res;
+
+   public MessagingXAResourceRecovery()
+   {
+      if(trace) log.trace("Constructing BridgeXAResourceRecovery");
+   }
+
+   public boolean initialise(String config)
+   {
+      if (log.isTraceEnabled()) { log.trace(this + " intialise: " + config); }
+      
+      StringTokenizer tok = new StringTokenizer(config, ",");
+      
+      //First (mandatory) param is the provider adaptor name
+      
+      if (!tok.hasMoreTokens())
+      {
+         throw new IllegalArgumentException("Must specify provider adaptor name in config");
+      }
+      
+      providerAdaptorName = tok.nextToken();
+      
+      InitialContext ic = null;
+      
+      try
+      {
+         ic = new InitialContext();
+         
+         providerAdaptor = (JMSProviderAdapter)ic.lookup(providerAdaptorName);         
+      }
+      catch (Exception e)
+      {
+         log.error("Failed to look up provider adaptor", e);
+         
+         return false;
+      }
+      finally
+      {
+         if (ic != null)
+         {
+            try
+            {
+               ic.close();
+            }
+            catch (Exception ignore)
+            {               
+            }
+         }
+      }
+      
+      //Next two (optional) parameters are the username and password to use for creating the connection
+      //for recovery
+      
+      if (tok.hasMoreTokens())
+      {
+         username = tok.nextToken();
+         
+         if (!tok.hasMoreTokens())
+         {
+            throw new IllegalArgumentException("If username is specified, password must be specified too");
+         }
+         
+         password = tok.nextToken();
+      }
+         
+      hasMore = true;
+      
+      if (log.isTraceEnabled()) { log.trace(this + " initialised"); }      
+      
+      return true;      
+   }
+
+   public boolean hasMoreResources()
+   {
+      if (log.isTraceEnabled()) { log.trace(this + " hasMoreResources"); }
+      
+      if (providerAdaptor == null)
+      {
+         return false;
+      }
+            
+      /*
+       * The way hasMoreResources is supposed to work is as follows:
+       * For each "sweep" the recovery manager will call hasMoreResources, then if it returns
+       * true it will call getXAResource.
+       * It will repeat that until hasMoreResources returns false.
+       * Then the sweep is over.
+       * For the next sweep hasMoreResources should return true, etc.
+       * 
+       * In our case where we only need to return one XAResource per sweep,
+       * hasMoreResources should basically alternate between true and false.
+       * 
+       * And we return a new XAResource every time it is called.
+       * This makes this resilient to failure, since if the network fails
+       * between the XAResource and it's server, on the next pass a new one will
+       * be create and if the server is back up it will work.
+       * This means there is no need for an XAResourceWrapper which is a technique used in the 
+       * old JMSProviderXAResourceRecovery
+       * The recovery manager will throw away the XAResource after every sweep.
+       * 
+       */
+        
+      if (hasMore)
+      {
+         //Get a new XAResource
+         
+         try
+         {
+            if (conn != null)
+            {
+               conn.close();
+            }
+         }
+         catch (Exception ignore)
+         {         
+         }
+         
+         Context ic = null;
+         
+         try
+         {
+            ic = providerAdaptor.getInitialContext();
+            
+            Object obj = ic.lookup(providerAdaptor.getFactoryRef());
+            
+            if (!(obj instanceof XAConnectionFactory))
+            {
+               throw new IllegalArgumentException("Connection factory from jms provider is not a XAConnectionFactory");
+            }
+            
+            XAConnectionFactory connectionFactory = (XAConnectionFactory)obj;
+            
+            if (username == null)
+            {
+               conn = connectionFactory.createXAConnection();
+            }
+            else
+            {
+               conn = connectionFactory.createXAConnection(username, password);
+            }
+            
+            XASession session = conn.createXASession();
+            
+            res = session.getXAResource();
+            
+            //Note the connection is closed the next time the xaresource is created or by the finalizer
+            
+         }
+         catch (Exception e)
+         {
+            log.warn("Cannot create XAResource", e);
+            
+            hasMore = false;
+         }
+         finally
+         {
+            if (ic != null)
+            {
+               try
+               {
+                  ic.close();
+               }
+               catch (Exception ignore)
+               {               
+               }
+            }
+         }
+         
+      }
+      
+      boolean ret = hasMore;
+            
+      hasMore = !hasMore;
+      
+      return ret;      
+   }
+
+   public XAResource getXAResource()
+   {
+      if (log.isTraceEnabled()) { log.trace(this + " getXAResource"); }
+      
+      return res;
+   }
+   
+   protected void finalize()
+   {
+      try
+      {
+         if (conn != null)
+         {
+            conn.close();
+         }
+      }
+      catch (Exception ignore)
+      {         
+      }  
+   }
+}
+

Modified: trunk/src/main/org/jboss/jms/server/bridge/BridgeMBean.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/bridge/BridgeMBean.java	2007-02-15 14:17:18 UTC (rev 2325)
+++ trunk/src/main/org/jboss/jms/server/bridge/BridgeMBean.java	2007-02-15 18:56:33 UTC (rev 2326)
@@ -33,14 +33,16 @@
  */
 public interface BridgeMBean
 {
-   String getSourceConnectionFactoryLookup();
+   // JMX attributes
    
-   String getTargetConnectionFactoryLookup();
+   void setSourceProviderAdaptorLookup(String lookup);
    
-   void setSourceConnectionFactoryLookup(String lookup);
+   String getSourceProviderAdaptorLookup();
    
-   void setTargetConnectionFactoryLookup(String lookup);
+   void setTargetProviderAdaptorLookup(String lookup);
    
+   String getTargetProviderAdaptorLookup();
+   
    String getSourceDestinationLookup();
 
    String getTargetDestinationLookup();
@@ -101,16 +103,8 @@
 
    boolean isPaused();
 
-   String getSourceJNDIProperties();
+   // JMX operations
    
-   void setSourceJNDIProperties(String props);
-   
-   String getTargetJNDIProperties();
-   
-   void setTargetJNDIProperties(String props);
-   
-   // JMX attributes
-   
    void pause() throws Exception;
    
    void resume() throws Exception;

Modified: trunk/src/main/org/jboss/jms/server/bridge/BridgeService.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/bridge/BridgeService.java	2007-02-15 14:17:18 UTC (rev 2325)
+++ trunk/src/main/org/jboss/jms/server/bridge/BridgeService.java	2007-02-15 18:56:33 UTC (rev 2326)
@@ -21,12 +21,11 @@
  */
 package org.jboss.jms.server.bridge;
 
-import java.io.ByteArrayInputStream;
-import java.util.Properties;
-
 import javax.jms.Destination;
+import javax.naming.Context;
 import javax.naming.InitialContext;
 
+import org.jboss.jms.jndi.JMSProviderAdapter;
 import org.jboss.messaging.core.plugin.contract.MessagingComponent;
 import org.jboss.messaging.core.plugin.contract.ServerPlugin;
 import org.jboss.system.ServiceMBeanSupport;
@@ -45,17 +44,14 @@
 {
    private Bridge bridge;
    
-   private String sourceJNDIProperties;
+   private String sourceDestinationLookup;
    
-   private String targetJNDIProperties;
+   private String targetDestinationLookup;
    
-   private String sourceConnectionFactoryLookup;
+   private String sourceProviderAdaptorLookup;
    
-   private String targetConnectionFactoryLookup;
+   private String targetProviderAdaptorLookup;
    
-   private String sourceDestinationLookup;
-   
-   private String targetDestinationLookup;
       
    public BridgeService()
    {
@@ -64,34 +60,34 @@
    
    // JMX attributes ----------------------------------------------------------------
    
-   public synchronized String getSourceConnectionFactoryLookup()
+   public synchronized String getSourceProviderAdaptorLookup()
    {
-      return this.sourceConnectionFactoryLookup;
+      return sourceProviderAdaptorLookup;
    }
    
-   public synchronized String getTargetConnectionFactoryLookup()
+   public synchronized void setSourceProviderAdaptorLookup(String lookup)
    {
-      return this.targetConnectionFactoryLookup;
-   }
-   
-   public synchronized void setSourceConnectionFactoryLookup(String lookup)
-   {
       if (bridge.isStarted())
       {
-         log.warn("Cannot set SourceConnectionFactoryLookup when bridge is started");
-         return;
+          log.warn("Cannot set SourceProviderAdaptorLookup when bridge is started");
+          return;
       }
-      this.sourceConnectionFactoryLookup = checkAndTrim(lookup);
-   }      
+      sourceProviderAdaptorLookup = checkAndTrim(lookup);
+   }
    
-   public synchronized void setTargetConnectionFactoryLookup(String lookup)
+   public synchronized String getTargetProviderAdaptorLookup()
    {
+      return targetProviderAdaptorLookup;
+   }
+   
+   public synchronized void setTargetProviderAdaptorLookup(String lookup)
+   {
       if (bridge.isStarted())
       {
-         log.warn("Cannot set DestConnectionFactoryLookup when bridge is started");
-         return;
+          log.warn("Cannot set TargetProviderAdaptorLookup when bridge is started");
+          return;
       }
-      this.targetConnectionFactoryLookup = checkAndTrim(lookup);
+      targetProviderAdaptorLookup = checkAndTrim(lookup);
    }
    
    public String getSourceDestinationLookup()
@@ -259,36 +255,6 @@
       return bridge.isStarted();
    }
 
-   public synchronized String getSourceJNDIProperties()
-   {
-      return sourceJNDIProperties;
-   }
-   
-   public synchronized void setSourceJNDIProperties(String props)
-   {
-      if (bridge.isStarted())
-      {
-         log.warn("Cannot set SourceJNDIProperties when bridge is started");
-         return;
-      }
-      this.sourceJNDIProperties = checkAndTrim(props);
-   }
-   
-   public synchronized String getTargetJNDIProperties()
-   {
-      return targetJNDIProperties;
-   }
-   
-   public synchronized void setTargetJNDIProperties(String props)
-   {
-      if (bridge.isStarted())
-      {
-         log.warn("Cannot set TargetJNDIProperties when bridge is started");
-         return;
-      }
-      this.targetJNDIProperties = checkAndTrim(props);
-   }
-
    public MessagingComponent getInstance()
    {
       return bridge;
@@ -314,64 +280,60 @@
       
       super.startService();
       
-      Properties sourceProps = null;
-      
-      if (sourceJNDIProperties != null)
+      if (this.sourceProviderAdaptorLookup == null)
       {
-         sourceProps = createProps(sourceJNDIProperties);
+         throw new IllegalArgumentException("sourceProviderAdaptorLookup cannot be null");
       }
       
-      Properties targetProps = null;
-      
-      if (targetJNDIProperties != null)
+      if (this.targetProviderAdaptorLookup == null)
       {
-         targetProps = createProps(targetJNDIProperties);
+         throw new IllegalArgumentException("targetProviderAdaptorLookup cannot be null");
       }
       
-      InitialContext icSource = null;
-      
-      if (sourceProps == null)
+      if (sourceDestinationLookup == null)
       {
-         icSource = new InitialContext();
+         throw new IllegalArgumentException("Source destination lookup cannot be null");
       }
-      else
-      {
-         icSource = new InitialContext(sourceProps);
-      }
       
-      if (sourceDestinationLookup == null)
+      if (targetDestinationLookup == null)
       {
-         throw new IllegalArgumentException("Source destination lookup cannot be null");
+         throw new IllegalArgumentException("Target destination lookup cannot be null");
       }
-      Destination sourceDest = (Destination)icSource.lookup(sourceDestinationLookup);
       
-      InitialContext icDest = null;
+      InitialContext ic = new InitialContext();
       
-      if (targetProps == null)
+      JMSProviderAdapter sourceAdaptor = (JMSProviderAdapter)ic.lookup(sourceProviderAdaptorLookup);
+
+      boolean sameSourceAndTarget = sourceProviderAdaptorLookup.equals(targetProviderAdaptorLookup);
+      
+      JMSProviderAdapter targetAdaptor;
+      
+      if (sameSourceAndTarget)
       {
-         icDest = new InitialContext();
+         targetAdaptor = sourceAdaptor;
       }
       else
       {
-         icDest = new InitialContext(targetProps);
+         targetAdaptor = (JMSProviderAdapter)ic.lookup(targetProviderAdaptorLookup);
       }
       
-      if (targetDestinationLookup == null)
-      {
-         throw new IllegalArgumentException("Target destination lookup cannot be null");
-      }
-      Destination targetDest = (Destination)icDest.lookup(targetDestinationLookup);
+      Context icSource = sourceAdaptor.getInitialContext();
+      
+      Context icTarget = targetAdaptor.getInitialContext();
+      
+      Destination sourceDest = (Destination)icSource.lookup(sourceDestinationLookup);
+      
+      Destination targetDest = (Destination)icTarget.lookup(targetDestinationLookup);
             
-      if (sourceConnectionFactoryLookup == null)
-      {
-         throw new IllegalArgumentException("Source connection factory lookup cannot be null");
-      }
+      String sourceCFRef = sourceAdaptor.getFactoryRef();
       
+      String targetCFRef = targetAdaptor.getFactoryRef();
+      
       ConnectionFactoryFactory sourceCff =
-         new JNDIConnectionFactoryFactory(sourceProps, sourceConnectionFactoryLookup);
+         new JNDIConnectionFactoryFactory(sourceAdaptor.getProperties(), sourceCFRef);
       
       ConnectionFactoryFactory destCff =
-         new JNDIConnectionFactoryFactory(targetProps, targetConnectionFactoryLookup);
+         new JNDIConnectionFactoryFactory(targetAdaptor.getProperties(), targetCFRef);
       
       bridge.setSourceDestination(sourceDest);
       
@@ -409,19 +371,5 @@
          }
       }
       return s;
-   }
-   
-   private Properties createProps(String propsString) throws Exception
-   {
-      ByteArrayInputStream is = new ByteArrayInputStream(propsString.getBytes());
-      
-      Properties props = new Properties();
-      
-      props.load(is);   
-      
-      return props;
-   }
-
-
-
+   }   
 }

Deleted: trunk/tests/etc/bridge-recovery.properties
===================================================================
--- trunk/tests/etc/bridge-recovery.properties	2007-02-15 14:17:18 UTC (rev 2325)
+++ trunk/tests/etc/bridge-recovery.properties	2007-02-15 18:56:33 UTC (rev 2326)
@@ -1,9 +0,0 @@
-#Only valid for testing the bridge recovery from within the test suite 
-
-server0.jndi.java.naming.factory.initial=org.jboss.test.messaging.tools.jndi.RemoteInitialContextFactory
-server0.jndi.jboss.messaging.test.server.index=0
-server0.xaconnectionfactorylookup=/XAConnectionFactory
-
-server1.jndi.java.naming.factory.initial=org.jboss.test.messaging.tools.jndi.RemoteInitialContextFactory
-server1.jndi.jboss.messaging.test.server.index=1
-server1.xaconnectionfactorylookup=/XAConnectionFactory

Modified: trunk/tests/etc/jbossjta-properties.xml
===================================================================
--- trunk/tests/etc/jbossjta-properties.xml	2007-02-15 14:17:18 UTC (rev 2325)
+++ trunk/tests/etc/jbossjta-properties.xml	2007-02-15 18:56:33 UTC (rev 2326)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
 <!-- Arjuna JTA config for JBoss Messaging test suite
-This config has some quicker settings (lik recovery period) than you would
+This config has some quicker settings (like recovery period) than you would
 probably have in a real production config, this is so the tests don't take aeons to run -->
 
 <transaction-service>
@@ -248,13 +248,10 @@
         provider2.xaconnectionfactorylookup=xyz
         -->
 
-        <property name="com.arjuna.ats.jta.recovery.XAResourceRecovery.JBMESSAGINGBRIDGE_SERVER0" value="org.jboss.jms.recovery.BridgeXAResourceRecovery;server0,bridge-recovery.properties"/>
-        <property name="com.arjuna.ats.jta.recovery.XAResourceRecovery.JBMESSAGINGBRIDGE_SERVER1" value="org.jboss.jms.recovery.BridgeXAResourceRecovery;server1,bridge-recovery.properties"/>
+        <property name="com.arjuna.ats.jta.recovery.XAResourceRecovery.JBMESSAGINGBRIDGE_SERVER0" value="org.jboss.jms.recovery.MessagingXAResourceRecovery;adaptor1"/>
+        <property name="com.arjuna.ats.jta.recovery.XAResourceRecovery.JBMESSAGINGBRIDGE_SERVER1" value="org.jboss.jms.recovery.MessagingXAResourceRecovery;adaptor2"/>
 
         <!--
-        <property name="com.arjuna.ats.jta.recovery.XAResourceRecovery.JBM_BRIDGE_TEST" value="org.jboss.test.messaging.jms.bridge.NullXAResourceRecovery"/>
-        -->
-        <!--
         Support subtransactions in the JTA layer?
         Default is NO.
       -->

Modified: trunk/tests/src/org/jboss/test/messaging/jms/bridge/BridgeMBeanTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/bridge/BridgeMBeanTest.java	2007-02-15 14:17:18 UTC (rev 2325)
+++ trunk/tests/src/org/jboss/test/messaging/jms/bridge/BridgeMBeanTest.java	2007-02-15 18:56:33 UTC (rev 2326)
@@ -21,7 +21,6 @@
  */
 package org.jboss.test.messaging.jms.bridge;
 
-import java.io.ByteArrayOutputStream;
 import java.util.Properties;
 
 import javax.jms.Connection;
@@ -35,9 +34,11 @@
 import javax.management.ObjectName;
 import javax.naming.InitialContext;
 
+import org.jboss.jms.jndi.JMSProviderAdapter;
 import org.jboss.jms.server.bridge.Bridge;
 import org.jboss.logging.Logger;
 import org.jboss.test.messaging.tools.ServerManagement;
+import org.jboss.test.messaging.tools.TestJMSProviderAdaptor;
 
 /**
  * A BridgeMBeanTest
@@ -67,8 +68,6 @@
       
       nodeCount = 3;
       
-      useArjuna = true;
-
       super.setUp();
    }
    
@@ -89,19 +88,27 @@
       Properties props2 = new Properties();
       props2.putAll(ServerManagement.getJNDIEnvironment(2));
       
-      String sprops1 = tableToString(props1);
+      JMSProviderAdapter sourceAdaptor = new TestJMSProviderAdaptor(props1, "/XAConnectionFactory", "adaptor1");
       
-      String sprops2 = tableToString(props2);
+      JMSProviderAdapter targetAdaptor = new TestJMSProviderAdaptor(props2, "/XAConnectionFactory", "adaptor2");
       
-      ObjectName on = deployBridge(0, "Bridge1", "/XAConnectionFactory", "/XAConnectionFactory",
+      ServerManagement.installJMSProviderAdaptor(0, "adaptor1", sourceAdaptor);
+      
+      ServerManagement.installJMSProviderAdaptor(0, "adaptor2", targetAdaptor);
+      
+      log.info("Deploying bridge");
+      
+      ObjectName on = deployBridge(0, "Bridge1", "adaptor1", "adaptor2",
                                    "/queue/sourceQueue", "/queue/targetQueue",
                                    null, null, null, null,
                                    Bridge.QOS_AT_MOST_ONCE, null, 1,
-                                   -1, null, null, 5000, -1,
-                                   sprops1, sprops2);
+                                   -1, null, null, 5000, -1);
+      log.info("Deployed bridge");
       
       ServerManagement.getServer(0).invoke(on, "create", new Object[0], new String[0]);
       
+      log.info("Created bridge");
+      
       Connection connSource = null;
       
       Connection connTarget = null;
@@ -152,7 +159,9 @@
          
          //Start it
          
+         log.info("Starting bridge");
          ServerManagement.getServer(0).invoke(on, "start", new Object[0], new String[0]);
+         log.info("Started bridge");
          
          //Now should receive the messages
                   
@@ -275,6 +284,10 @@
          {
             //Ignore            
          }
+         
+         ServerManagement.uninstallJMSProviderAdaptor(0, "adaptor1");
+         
+         ServerManagement.uninstallJMSProviderAdaptor(0, "adaptor2");
       }
    }
          
@@ -295,17 +308,20 @@
          Properties props2 = new Properties();
          props2.putAll(ServerManagement.getJNDIEnvironment(2));
          
-         String sprops1 = tableToString(props1);
+         JMSProviderAdapter sourceAdaptor = new TestJMSProviderAdaptor(props1, "/XAConnectionFactory", "adaptor1");
          
-         String sprops2 = tableToString(props2);
+         JMSProviderAdapter targetAdaptor = new TestJMSProviderAdaptor(props2, "/XAConnectionFactory", "adaptor2");
          
-         on = deployBridge(0, "Bridge1", "/XAConnectionFactory", "/XAConnectionFactory",
-                                      "/queue/sourceQueue", "/queue/targetQueue",
-                                      null, null, null, null,
-                                      Bridge.QOS_ONCE_AND_ONLY_ONCE, null, 1,
-                                      -1, null, null, 5000, -1,
-                                      sprops1, sprops2);
+         ServerManagement.installJMSProviderAdaptor(0, "adaptor1", sourceAdaptor);
          
+         ServerManagement.installJMSProviderAdaptor(0, "adaptor2", targetAdaptor);
+         
+         on = deployBridge(0, "Bridge1", "adaptor1", "adaptor2",
+                           "/queue/sourceQueue", "/queue/targetQueue",
+                           null, null, null, null,
+                           Bridge.QOS_ONCE_AND_ONLY_ONCE, null, 1,
+                           -1, null, null, 5000, -1);
+         
          log.trace("Constructed bridge");
          
          ServerManagement.getServer(0).invoke(on, "create", new Object[0], new String[0]);
@@ -313,21 +329,21 @@
          log.trace("Created bridge");
             
          {
-            String cfLookup = (String)ServerManagement.getAttribute(on, "SourceConnectionFactoryLookup");
-            assertEquals("/XAConnectionFactory", cfLookup);
-            ServerManagement.setAttribute(on, "SourceConnectionFactoryLookup", "/Wibble");
-            cfLookup = (String)ServerManagement.getAttribute(on, "SourceConnectionFactoryLookup");
-            assertEquals("/Wibble", cfLookup);
-            ServerManagement.setAttribute(on, "SourceConnectionFactoryLookup", "/XAConnectionFactory");
+            String lookup = (String)ServerManagement.getAttribute(on, "SourceProviderAdaptorLookup");
+            assertEquals("adaptor1", lookup);
+            ServerManagement.setAttribute(on, "SourceProviderAdaptorLookup", "blah");
+            lookup = (String)ServerManagement.getAttribute(on, "SourceProviderAdaptorLookup");
+            assertEquals("blah", lookup);
+            ServerManagement.setAttribute(on, "SourceProviderAdaptorLookup", "adaptor1");
          }
               
          {
-            String cfLookup = (String)ServerManagement.getAttribute(on, "TargetConnectionFactoryLookup");
-            assertEquals("/XAConnectionFactory", cfLookup);
-            ServerManagement.setAttribute(on, "TargetConnectionFactoryLookup", "/Wibble");
-            cfLookup = (String)ServerManagement.getAttribute(on, "TargetConnectionFactoryLookup");
-            assertEquals("/Wibble", cfLookup);
-            ServerManagement.setAttribute(on, "TargetConnectionFactoryLookup", "/XAConnectionFactory");
+            String lookup = (String)ServerManagement.getAttribute(on, "TargetProviderAdaptorLookup");
+            assertEquals("adaptor2", lookup);
+            ServerManagement.setAttribute(on, "TargetProviderAdaptorLookup", "blah");
+            lookup = (String)ServerManagement.getAttribute(on, "TargetProviderAdaptorLookup");
+            assertEquals("blah", lookup);
+            ServerManagement.setAttribute(on, "TargetProviderAdaptorLookup", "adaptor2");
          }
          
          {
@@ -461,19 +477,19 @@
          //Should not be able to change attributes when bridge is started - need to stop first         
          
          {
-            String cfLookup = (String)ServerManagement.getAttribute(on, "SourceConnectionFactoryLookup");
-            assertEquals("/XAConnectionFactory", cfLookup);
-            ServerManagement.setAttribute(on, "SourceConnectionFactoryLookup", "/Wibble");
-            cfLookup = (String)ServerManagement.getAttribute(on, "SourceConnectionFactoryLookup");
-            assertEquals("/XAConnectionFactory", cfLookup);            
+            String cfLookup = (String)ServerManagement.getAttribute(on, "SourceProviderAdaptorLookup");
+            assertEquals("adaptor1", cfLookup);
+            ServerManagement.setAttribute(on, "SourceProviderAdaptorLookup", "blah");
+            cfLookup = (String)ServerManagement.getAttribute(on, "SourceProviderAdaptorLookup");
+            assertEquals("adaptor1", cfLookup);            
          }
          
          {
-            String cfLookup = (String)ServerManagement.getAttribute(on, "TargetConnectionFactoryLookup");
-            assertEquals("/XAConnectionFactory", cfLookup);
-            ServerManagement.setAttribute(on, "TargetConnectionFactoryLookup", "/Wibble");
-            cfLookup = (String)ServerManagement.getAttribute(on, "TargetConnectionFactoryLookup");
-            assertEquals("/XAConnectionFactory", cfLookup);
+            String cfLookup = (String)ServerManagement.getAttribute(on, "TargetProviderAdaptorLookup");
+            assertEquals("adaptor2", cfLookup);
+            ServerManagement.setAttribute(on, "TargetProviderAdaptorLookup", "blah");
+            cfLookup = (String)ServerManagement.getAttribute(on, "TargetProviderAdaptorLookup");
+            assertEquals("adaptor2", cfLookup); 
          }
          
          {
@@ -616,35 +632,29 @@
          
          ServerManagement.undeployQueue("sourceQueue", 1);
          ServerManagement.undeployQueue("targetQueue", 2);
+         
+         ServerManagement.uninstallJMSProviderAdaptor(0, "adaptor1");
+         ServerManagement.uninstallJMSProviderAdaptor(0, "adaptor2");
       }
             
    }
    
-   private String tableToString(Properties t) throws Exception
-   {
-      ByteArrayOutputStream boa = new ByteArrayOutputStream();      
-      
-      t.store(boa, "");
-      
-      return new String(boa.toByteArray());
-   }
    
-   private ObjectName deployBridge(int server, String bridgeName, String sourceCFLookup, String targetCFLookup,
+   private ObjectName deployBridge(int server, String bridgeName,
+            String sourceProviderAdaptorLookup, String targetProviderAdaptorLookup,
             String sourceDestLookup, String targetDestLookup,
             String sourceUsername, String sourcePassword,
             String targetUsername, String targetPassword,
             int qos, String selector, int maxBatchSize,
             long maxBatchTime, String subName, String clientID,
-            long failureRetryInterval, int maxRetries,
-            String sourceJNDIProperties,
-            String targetJNDIProperties) throws Exception
+            long failureRetryInterval, int maxRetries) throws Exception
    {
       String config = 
          "<mbean code=\"org.jboss.jms.server.bridge.BridgeService\" " +
          "name=\"jboss.messaging:service=Bridge,name=" + bridgeName + "\" " +
          "xmbean-dd=\"xmdesc/Bridge-xmbean.xml\">" +      
-         "<attribute name=\"SourceConnectionFactoryLookup\">" + sourceCFLookup + "</attribute>"+      
-         "<attribute name=\"TargetConnectionFactoryLookup\">" + targetCFLookup + "</attribute>"+     
+         "<attribute name=\"SourceProviderAdaptorLookup\">" + sourceProviderAdaptorLookup + "</attribute>"+      
+         "<attribute name=\"TargetProviderAdaptorLookup\">" + targetProviderAdaptorLookup + "</attribute>"+     
          "<attribute name=\"SourceDestinationLookup\">" + sourceDestLookup + "</attribute>"+     
          "<attribute name=\"TargetDestinationLookup\">" + targetDestLookup + "</attribute>";
       if (sourceUsername != null)
@@ -680,20 +690,6 @@
       }
       config += "<attribute name=\"FailureRetryInterval\">" + failureRetryInterval + "</attribute>"+      
       "<attribute name=\"MaxRetries\">" + maxRetries +"</attribute>";
-      if (sourceJNDIProperties != null)
-      {
-         config += "<attribute name=\"SourceJNDIProperties\"><![CDATA["+
-         sourceJNDIProperties +
-         "]]>"+
-         "</attribute>";
-      }
-      if (targetJNDIProperties != null)
-      {
-         config += "<attribute name=\"TargetJNDIProperties\"><![CDATA["+
-         targetJNDIProperties +
-         "]]>"+
-         "</attribute>";
-      }
       config += "</mbean>";
       
       return ServerManagement.getServer(server).deploy(config);            

Modified: trunk/tests/src/org/jboss/test/messaging/jms/bridge/BridgeTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/bridge/BridgeTestBase.java	2007-02-15 14:17:18 UTC (rev 2325)
+++ trunk/tests/src/org/jboss/test/messaging/jms/bridge/BridgeTestBase.java	2007-02-15 18:56:33 UTC (rev 2326)
@@ -79,136 +79,125 @@
 
    protected void setUp() throws Exception
    {
+      if (!ServerManagement.isRemote())
+      {
+         throw new IllegalStateException("This test should only be run in remote mode");
+      }
+      
       super.setUp();
        
       log.info("Starting " + nodeCount + " servers");
+                     
+      for (int i = 0; i < nodeCount; i++)
+      {
+         // make sure all servers are created and started; make sure that database is zapped
+         // ONLY for the first server, the others rely on values they expect to find in shared
+         // tables; don't clear the database for those.
+            ServerManagement.start(i, "all", i == 0);
+      }
       
-      if (ServerManagement.isRemote())
-      {                 
-         for (int i = 0; i < nodeCount; i++)
-         {
-            // make sure all servers are created and started; make sure that database is zapped
-            // ONLY for the first server, the others rely on values they expect to find in shared
-            // tables; don't clear the database for those.
-            if (useArjuna)
-            {
-               ServerManagement.start(i, "all,-transaction,jbossjta,xarecovery", i == 0);
-            }
-            else
-            {
-               ServerManagement.start(i, "all", i == 0);
-            }
-         }
+      //We need a local transaction and recovery manager
+      //We must start this after the remote servers have been created or it won't
+      //have deleted the database and the recovery manager may attempt to recover transactions
+      if (useArjuna)
+      {
+         sc = new ServiceContainer("jbossjta");   
+      }
+      else
+      {
+         sc = new ServiceContainer("transaction");
+      }
+      sc.start(false);
+      
+      ServerManagement.undeployQueue("sourceQueue", 0);
+      
+      ServerManagement.undeployTopic("sourceTopic", 0);  
+      
+      ServerManagement.undeployQueue("localDestQueue", 0);
          
-         //We need a local transaction and recovery manager
-         //We must start this after the remote servers have been created or it won't
-         //have deleted the database and the recovery manager may attempt to recover transactions
-         if (useArjuna)
-         {
-            sc = new ServiceContainer("jbossjta");            
-         }
-         else
-         {
-            sc = new ServiceContainer("transaction");
-         }
-         sc.start(false);
+      ServerManagement.undeployQueue("destQueue", 1); 
+      
+      ServerManagement.deployQueue("sourceQueue", 0);
+      
+      ServerManagement.deployTopic("sourceTopic", 0);  
+      
+      ServerManagement.deployQueue("localDestQueue", 0);
          
-         ServerManagement.undeployQueue("sourceQueue", 0);
-         
-         ServerManagement.undeployTopic("sourceTopic", 0);  
-         
-         ServerManagement.undeployQueue("localDestQueue", 0);
-            
-         ServerManagement.undeployQueue("destQueue", 1); 
-         
-         ServerManagement.deployQueue("sourceQueue", 0);
-         
-         ServerManagement.deployTopic("sourceTopic", 0);  
-         
-         ServerManagement.deployQueue("localDestQueue", 0);
-            
-         ServerManagement.deployQueue("destQueue", 1);         
-      }                  
+      ServerManagement.deployQueue("destQueue", 1);                        
    }
 
    protected void tearDown() throws Exception
-   { 
-      if (ServerManagement.isRemote())
-      {         
+   {       
+      try
+      {
+         ServerManagement.undeployQueue("sourceQueue", 0);
+      }
+      catch (Exception e)
+      {
+         log.error("Failed to undeploy", e);
+      }
+      
+      try
+      {
+         ServerManagement.undeployTopic("sourceTopic", 0);
+      }
+      catch (Exception e)
+      {
+         log.error("Failed to undeploy", e);
+      }
+      
+      try
+      {
+         ServerManagement.undeployQueue("destQueue", 1);
+      }
+      catch (Exception e)
+      {
+         log.error("Failed to undeploy", e);
+      }
+      
+      try
+      {
+         ServerManagement.undeployQueue("localDestQueue", 0);
+      }
+      catch (Exception e)
+      {
+         log.error("Failed to undeploy", e);
+      }
+      
+      
+      
+      for (int i = 0; i < nodeCount; i++)
+      {
          try
          {
-            ServerManagement.undeployQueue("sourceQueue", 0);
+            if (ServerManagement.isStarted(i))
+            {
+               ServerManagement.log(ServerManagement.INFO, "Undeploying Server " + i, i);
+               
+               ServerManagement.stop(i);
+            }
          }
          catch (Exception e)
          {
-            log.error("Failed to undeploy", e);
+            log.error("Failed to stop server", e);
          }
-         
+      }
+      
+      for (int i = 1; i < nodeCount; i++)
+      {
          try
          {
-            ServerManagement.undeployTopic("sourceTopic", 0);
+            ServerManagement.kill(i);
          }
          catch (Exception e)
          {
-            log.error("Failed to undeploy", e);
+            log.error("Failed to kill server", e);
          }
-         
-         try
-         {
-            ServerManagement.undeployQueue("destQueue", 1);
-         }
-         catch (Exception e)
-         {
-            log.error("Failed to undeploy", e);
-         }
-         
-         try
-         {
-            ServerManagement.undeployQueue("localDestQueue", 0);
-         }
-         catch (Exception e)
-         {
-            log.error("Failed to undeploy", e);
-         }
-         
-         
-         
-         for (int i = 0; i < nodeCount; i++)
-         {
-            try
-            {
-               if (ServerManagement.isStarted(i))
-               {
-                  ServerManagement.log(ServerManagement.INFO, "Undeploying Server " + i, i);
-                  
-                  ServerManagement.stop(i);
-               }
-            }
-            catch (Exception e)
-            {
-               log.error("Failed to stop server", e);
-            }
-         }
-         
-         for (int i = 1; i < nodeCount; i++)
-         {
-            try
-            {
-               ServerManagement.kill(i);
-            }
-            catch (Exception e)
-            {
-               log.error("Failed to kill server", e);
-            }
-         }
-         
-         sc.stop();
       }
       
+      sc.stop();
       
-      
-      super.tearDown();
-      
+      super.tearDown();      
    }
    
    protected void setUpAdministeredObjects() throws Exception
@@ -414,7 +403,7 @@
             TextMessage tm = (TextMessage)cons.receive(5000);
             
             assertNotNull(tm);
-            
+              
             assertEquals("message" + (i + start), tm.getText());
          } 
 

Modified: trunk/tests/src/org/jboss/test/messaging/jms/bridge/ReconnectTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/bridge/ReconnectTest.java	2007-02-15 14:17:18 UTC (rev 2325)
+++ trunk/tests/src/org/jboss/test/messaging/jms/bridge/ReconnectTest.java	2007-02-15 18:56:33 UTC (rev 2326)
@@ -21,9 +21,13 @@
  */
 package org.jboss.test.messaging.jms.bridge;
 
+import java.util.Properties;
+
+import org.jboss.jms.jndi.JMSProviderAdapter;
 import org.jboss.jms.server.bridge.Bridge;
 import org.jboss.logging.Logger;
 import org.jboss.test.messaging.tools.ServerManagement;
+import org.jboss.test.messaging.tools.TestJMSProviderAdaptor;
 import org.jboss.test.messaging.tools.aop.PoisonInterceptor;
 
 /**
@@ -55,12 +59,36 @@
       
       useArjuna = true;
       
-      super.setUp();                
+      super.setUp();         
+      
+      //Now install local JMSProviderAdaptor classes
+      
+      Properties props0 = new Properties();
+      props0.putAll(ServerManagement.getJNDIEnvironment(0));
+      
+      Properties props1 = new Properties();
+      props1.putAll(ServerManagement.getJNDIEnvironment(1));
+        
+      JMSProviderAdapter sourceAdaptor = new TestJMSProviderAdaptor(props0, "/XAConnectionFactory", "adaptor1");
+      
+      JMSProviderAdapter targetAdaptor = new TestJMSProviderAdaptor(props1, "/XAConnectionFactory", "adaptor2");
+      
+      sc.installJMSProviderAdaptor("adaptor1", sourceAdaptor);
+      
+      sc.installJMSProviderAdaptor("adaptor2", targetAdaptor);
+      
+      sc.startRecoveryManager();      
    }
 
    protected void tearDown() throws Exception
-   {      
-      super.tearDown();      
+   {            
+      sc.stopRecoveryManager();
+      
+      sc.uninstallJMSProviderAdaptor("adaptor1");
+      
+      sc.uninstallJMSProviderAdaptor("adaptor2");
+      
+      super.tearDown();            
    }
       
    // Crash and reconnect
@@ -157,7 +185,7 @@
          
          //Send some messages
          
-         sendMessages(cf0, sourceQueue, 0, NUM_MESSAGES /2 , persistent);
+         sendMessages(cf0, sourceQueue, 0, NUM_MESSAGES / 2 , persistent);
          
          //Verify none are received
          

Modified: trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java	2007-02-15 14:17:18 UTC (rev 2325)
+++ trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java	2007-02-15 18:56:33 UTC (rev 2326)
@@ -21,30 +21,33 @@
 */
 package org.jboss.test.messaging.tools;
 
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
 import java.rmi.Naming;
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 import java.util.Set;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.List;
-import java.util.Iterator;
-import java.util.ArrayList;
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
+
+import javax.management.Notification;
+import javax.management.NotificationListener;
 import javax.management.ObjectName;
-import javax.management.NotificationListener;
-import javax.management.Notification;
 import javax.transaction.UserTransaction;
+
+import org.jboss.jms.jndi.JMSProviderAdapter;
 import org.jboss.jms.server.DestinationManager;
 import org.jboss.logging.Logger;
 import org.jboss.messaging.core.plugin.contract.MessageStore;
 import org.jboss.messaging.core.plugin.contract.PersistenceManager;
 import org.jboss.remoting.ServerInvocationHandler;
+import org.jboss.test.messaging.tools.jmx.ServiceAttributeOverrides;
 import org.jboss.test.messaging.tools.jmx.rmi.LocalTestServer;
+import org.jboss.test.messaging.tools.jmx.rmi.NotificationListenerID;
 import org.jboss.test.messaging.tools.jmx.rmi.RMITestServer;
 import org.jboss.test.messaging.tools.jmx.rmi.Server;
-import org.jboss.test.messaging.tools.jmx.rmi.NotificationListenerID;
-import org.jboss.test.messaging.tools.jmx.ServiceAttributeOverrides;
 import org.jboss.test.messaging.tools.jndi.InVMInitialContextFactory;
 import org.jboss.test.messaging.tools.jndi.RemoteInitialContextFactory;
 
@@ -1100,6 +1103,22 @@
       insureStarted(serverIndex);
       return servers[serverIndex].getServer().getRemotingTransport();
    }
+   
+   public static void installJMSProviderAdaptor(int serverIndex, String jndi, JMSProviderAdapter adaptor)
+      throws Exception
+   {
+      insureStarted(serverIndex);
+      
+      servers[serverIndex].getServer().installJMSProviderAdaptor(jndi, adaptor);
+   }
+   
+   public static void uninstallJMSProviderAdaptor(int serverIndex, String jndi)
+      throws Exception
+   {
+      insureStarted(serverIndex);
+      
+      servers[serverIndex].getServer().uninstallJMSProviderAdaptor(jndi);
+   }
 
    // Attributes ----------------------------------------------------
 

Modified: trunk/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java	2007-02-15 14:17:18 UTC (rev 2325)
+++ trunk/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java	2007-02-15 18:56:33 UTC (rev 2326)
@@ -59,6 +59,7 @@
 
 import org.hsqldb.Server;
 import org.hsqldb.persist.HsqlProperties;
+import org.jboss.jms.jndi.JMSProviderAdapter;
 import org.jboss.jms.jndi.JNDIProviderAdapter;
 import org.jboss.jms.server.ServerPeer;
 import org.jboss.jms.server.remoting.JMSServerInvocationHandler;
@@ -213,7 +214,6 @@
 
    private boolean transaction;
    private boolean jbossjta; //To use the ex-Arjuna tx mgr
-   private boolean xarecovery; //To use the ex-Arjuna recovery manager
    private boolean database;
    private boolean jca;
    private boolean remoting;
@@ -402,7 +402,7 @@
 
          registerClassLoader();
 
-         if (jbossjta || xarecovery)
+         if (jbossjta)
          {
             deleteObjectStore();
          }
@@ -440,11 +440,6 @@
             dropAllTables();
          }
 
-         if (xarecovery)
-         {
-            startRecoveryManager();
-         }
-
          if (remoting)
          {
             startRemoting(attrOverrides, config.getRemotingTransport(), REMOTING_OBJECT_NAME);
@@ -536,14 +531,6 @@
          stopService(HTTP_REMOTING_OBJECT_NAME);
       }
 
-      if (jbossjta)
-      {
-         if (recoveryManager != null)
-         {
-            recoveryManager.stop();
-         }
-      }
-
       if (jca)
       {
          stopWrapperDataSourceService();
@@ -926,7 +913,40 @@
    {
       return config.isClustered();
    }
+   
+   public void installJMSProviderAdaptor(String jndi, JMSProviderAdapter adaptor) throws Exception
+   {
+      log.info("Binding adaptor " + adaptor + " in JNDI: " + jndi);
+      initialContext.bind(jndi, adaptor);
 
+   }
+
+   public void uninstallJMSProviderAdaptor(String jndi) throws Exception
+   {
+      initialContext.unbind(jndi);
+   }
+   
+   public void startRecoveryManager()
+   {
+      log.info("Starting arjuna recovery manager");
+
+      //Need to start the recovery manager manually - if deploying
+      //inside JBoss this wouldn't be necessary - since you would use
+      //the TransactionManagerService MBean which would start the recovery manager
+      //for you
+      recoveryManager = RecoveryManager.manager(RecoveryManager.INDIRECT_MANAGEMENT);
+
+      log.info("Started recovery manager");
+   }
+   
+   public void stopRecoveryManager()
+   {
+      if (recoveryManager != null)
+      {
+         recoveryManager.stop();
+      }      
+   }
+
    public String toString()
    {
       return "ServiceContainer[" + Integer.toHexString(hashCode()) + "]";
@@ -1158,19 +1178,8 @@
       }
    }
 
-   private void startRecoveryManager()
-   {
-      log.info("Starting arjuna recovery manager");
 
-      //Need to start the recovery manager manually - if deploying
-      //inside JBoss this wouldn't be necessary - since you would use
-      //the TransactionManagerService MBean which would start the recovery manager
-      //for you
-      recoveryManager = RecoveryManager.manager(RecoveryManager.INDIRECT_MANAGEMENT);
 
-      log.info("Started recovery manager");
-   }
-
    private void startCachedConnectionManager(ObjectName on) throws Exception
    {
       CachedConnectionManager ccm = new CachedConnectionManager();
@@ -1690,14 +1699,6 @@
                jbossjta = false;
             }
          }
-         else if ("xarecovery".equals(tok))
-         {           
-            xarecovery = true;
-            if (minus)
-            {
-               xarecovery = false;
-            }
-         }
          else if ("database".equals(tok))
          {
             database = true;

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-02-15 14:17:18 UTC (rev 2325)
+++ trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/LocalTestServer.java	2007-02-15 18:56:33 UTC (rev 2326)
@@ -35,6 +35,7 @@
 import javax.transaction.UserTransaction;
 
 import org.jboss.aop.AspectXmlLoader;
+import org.jboss.jms.jndi.JMSProviderAdapter;
 import org.jboss.jms.server.DestinationManager;
 import org.jboss.jms.server.ServerPeer;
 import org.jboss.jms.util.XMLUtil;
@@ -848,7 +849,17 @@
       
       PoisonInterceptor.setType(type);
    }
+   
+   public void installJMSProviderAdaptor(String jndi, JMSProviderAdapter adaptor) throws Exception
+   {
+      sc.installJMSProviderAdaptor(jndi, adaptor);
+   }
 
+   public void uninstallJMSProviderAdaptor(String jndi) throws Exception
+   {
+      sc.uninstallJMSProviderAdaptor(jndi);
+   }
+
    // Public ---------------------------------------------------------------------------------------
 
    // Package protected ----------------------------------------------------------------------------

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-02-15 14:17:18 UTC (rev 2325)
+++ trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RMITestServer.java	2007-02-15 18:56:33 UTC (rev 2326)
@@ -32,6 +32,8 @@
 import javax.management.ObjectName;
 import javax.management.NotificationListener;
 import javax.transaction.UserTransaction;
+
+import org.jboss.jms.jndi.JMSProviderAdapter;
 import org.jboss.jms.server.DestinationManager;
 import org.jboss.jms.server.ServerPeer;
 import org.jboss.logging.Logger;
@@ -458,7 +460,17 @@
    {
       server.poisonTheServer(type);
    }
+   
+   public void installJMSProviderAdaptor(String jndi, JMSProviderAdapter adaptor) throws Exception
+   {
+      server.installJMSProviderAdaptor(jndi, adaptor);
+   }
 
+   public void uninstallJMSProviderAdaptor(String jndi) throws Exception
+   {
+      server.uninstallJMSProviderAdaptor(jndi);
+   }
+
    // Public --------------------------------------------------------
 
    // Package protected ---------------------------------------------

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-02-15 14:17:18 UTC (rev 2325)
+++ trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/Server.java	2007-02-15 18:56:33 UTC (rev 2326)
@@ -29,6 +29,7 @@
 import javax.management.ObjectName;
 import javax.transaction.UserTransaction;
 
+import org.jboss.jms.jndi.JMSProviderAdapter;
 import org.jboss.jms.server.DestinationManager;
 import org.jboss.jms.server.ServerPeer;
 import org.jboss.messaging.core.plugin.contract.MessageStore;
@@ -273,5 +274,9 @@
    List pollNotificationListener(long listenerID) throws Exception;
 
    void poisonTheServer(int type) throws Exception;
+   
+   void installJMSProviderAdaptor(String jndi, JMSProviderAdapter adaptor) throws Exception;
+   
+   void uninstallJMSProviderAdaptor(String jndi) throws Exception;
 
 }




More information about the jboss-cvs-commits mailing list