[jboss-cvs] JBoss Messaging SVN: r3089 - in trunk/tests/src/org/jboss/test/messaging: tools/container and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Sep 7 19:13:40 EDT 2007


Author: clebert.suconic at jboss.com
Date: 2007-09-07 19:13:39 -0400 (Fri, 07 Sep 2007)
New Revision: 3089

Modified:
   trunk/tests/src/org/jboss/test/messaging/jms/XARecoveryTest.java
   trunk/tests/src/org/jboss/test/messaging/tools/container/ServiceContainer.java
Log:
http://jira.jboss.com/jira/browse/JBMESSAGING-1066 - fix

Modified: trunk/tests/src/org/jboss/test/messaging/jms/XARecoveryTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/XARecoveryTest.java	2007-09-05 20:41:45 UTC (rev 3088)
+++ trunk/tests/src/org/jboss/test/messaging/jms/XARecoveryTest.java	2007-09-07 23:13:39 UTC (rev 3089)
@@ -36,6 +36,7 @@
 import org.jboss.jms.tx.MessagingXid;
 import org.jboss.jms.tx.ResourceManagerFactory;
 import org.jboss.test.messaging.tools.ServerManagement;
+import org.jboss.test.messaging.tools.container.ServiceContainer;
 
 import com.arjuna.ats.arjuna.common.Uid;
 import com.arjuna.ats.jta.xa.XidImple;
@@ -68,6 +69,14 @@
 
    // TestCase overrides -------------------------------------------
 
+
+   protected void setUp() throws Exception
+   {
+      // if this is not set testMockCoordinatorRecoveryWithJBossTSXids will create an invalid ObjectStore
+      ServiceContainer.setupObjectStoreDir();
+      super.setUp();
+   }
+
    public void tearDown() throws Exception
    {
       super.tearDown();

Modified: trunk/tests/src/org/jboss/test/messaging/tools/container/ServiceContainer.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/container/ServiceContainer.java	2007-09-05 20:41:45 UTC (rev 3088)
+++ trunk/tests/src/org/jboss/test/messaging/tools/container/ServiceContainer.java	2007-09-07 23:13:39 UTC (rev 3089)
@@ -881,9 +881,49 @@
       if (recoveryManager != null)
       {
          recoveryManager.stop();
-      }      
+      }
    }
 
+
+   static boolean storeAlreadySet = false;
+
+   // Recovery doesn't play well with reseting the ObjectStore, so we do that per VM
+   public static void setupObjectStoreDir()
+   {
+      String name = "TestObjectStore-";
+      if (!storeAlreadySet)
+      {
+         storeAlreadySet = true;
+         String objectStoreDir = System.getProperty("objectstore.dir");
+         log.trace("ObjectStoreDir===" + objectStoreDir);
+
+         //We must ensure each node has its own object store
+
+         String newObjectStore = name + new GUID().toString();
+
+         if (objectStoreDir != null)
+         {
+            newObjectStore = objectStoreDir + "/" + newObjectStore;
+         }
+
+         log.info("Setting com.arjuna.ats.arjuna.common.Environment.OBJECTSTORE_DIR to " + newObjectStore);
+
+         System.setProperty(com.arjuna.ats.arjuna.common.Environment.OBJECTSTORE_DIR, newObjectStore);
+
+         //We must also make sure the node identifier is unique for each node
+         //Otherwise xids might overlap
+         String arjunanodeId = "TestNodeID-" + new GUID().toString();
+
+         log.info("Setting com.arjuna.ats.arjuna.common.Environment.XA_NODE_IDENTIFIER to " + arjunanodeId);
+
+         System.setProperty(com.arjuna.ats.arjuna.common.Environment.XA_NODE_IDENTIFIER, arjunanodeId);
+
+         log.info("Setting objectstore.dir to " + newObjectStore);
+      }
+   }
+
+   
+
    public String toString()
    {
       return "ServiceContainer[" + Integer.toHexString(hashCode()) + "]";
@@ -1045,38 +1085,15 @@
       // hsqldbServer.stop();
    }
 
+
    private void startTransactionManager() throws Exception
    {
       if (tm == null)
       {
 
-         String objectStoreDir = System.getProperty("objectstore.dir");
-         log.trace("ObjectStoreDir===" + objectStoreDir);
-
-         //We must ensure each node has its own object store
-         String newObjectStore = "TestObjectStore-" + new GUID().toString();
-
-         if (objectStoreDir != null)
-         {
-            newObjectStore = objectStoreDir + "/" + newObjectStore;
-         }
-         
-         log.info("Setting com.arjuna.ats.arjuna.common.Environment.OBJECTSTORE_DIR to " + newObjectStore);
-
-         System.setProperty(com.arjuna.ats.arjuna.common.Environment.OBJECTSTORE_DIR, newObjectStore);  
-         
-         //We must also make sure the node identifier is unique for each node
-         //Otherwise xids might overlap
-         String arjunanodeId = "TestNodeID-" + new GUID().toString();
-         
-         log.info("Setting com.arjuna.ats.arjuna.common.Environment.XA_NODE_IDENTIFIER to " + arjunanodeId);
-         
-         System.setProperty(com.arjuna.ats.arjuna.common.Environment.XA_NODE_IDENTIFIER, arjunanodeId);
-         
-         log.info("Setting objectstore.dir to " + newObjectStore);
-      	
+         setupObjectStoreDir();
          log.info("Starting arjuna tx mgr");
-         tm = com.arjuna.ats.jta.TransactionManager.transactionManager();                       
+         tm = com.arjuna.ats.jta.TransactionManager.transactionManager();
       }
 
       TransactionManagerJMXWrapper mbean = new TransactionManagerJMXWrapper(tm);




More information about the jboss-cvs-commits mailing list