[jboss-svn-commits] JBL Code SVN: r24121 - in labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance: implementations/local and 1 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Nov 27 10:05:10 EST 2008


Author: mmusgrov
Date: 2008-11-27 10:05:10 -0500 (Thu, 27 Nov 2008)
New Revision: 24121

Added:
   labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/products/
   labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/products/AtomikosTxWrapper.java
   labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/products/BaseWrapper.java
   labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/products/BitronixTxWrapper.java
   labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/products/JBossTSTxWrapper.java
   labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/products/TxWrapper.java
Modified:
   labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/PerformanceTest.java
   labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/implementations/local/NestedOnePhaseTrx.java
   labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/implementations/local/NestedTrx.java
   labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/implementations/local/NestedTwoPhaseTrx.java
   labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/implementations/local/OnePhaseTrx.java
   labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/implementations/local/TopLevelTrx.java
   labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/implementations/local/TwoPhaseTrx.java
Log:
Update the HP-TS performance suite to support other TM products.

JBTM-395


Modified: labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/PerformanceTest.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/PerformanceTest.java	2008-11-27 14:12:19 UTC (rev 24120)
+++ labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/PerformanceTest.java	2008-11-27 15:05:10 UTC (rev 24121)
@@ -20,13 +20,23 @@
  */
 package com.hp.mwtests.performance;
 
+import com.hp.mwtests.performance.products.TxWrapper;
+
 public abstract class PerformanceTest
 {
     private String[]    _configs = null;
     private String[]    _params = null;
+    private static String PRODUCT_CLASS_PARAM = "productClass=";
+    private String wrapperClass = "com.hp.mwtests.performance.products.JBossTSTxWrapper";
+    private TxWrapper wrapper;
 
     protected abstract void work() throws Exception;
 
+    protected boolean requiresNestedTxSupport()
+    {
+        return false;
+    }
+
     public void setServiceConfigs( String[] configs )
     {
         _configs = configs;
@@ -35,6 +45,15 @@
     void setParameters(String[] params)
     {
         _params = params;
+
+        for (String param : _params)
+        {
+            if (param.startsWith(PRODUCT_CLASS_PARAM))
+            {
+                wrapperClass = param.substring(PRODUCT_CLASS_PARAM.length());
+                break;
+            }
+        }
     }
 
     public boolean isParameterDefined(String param)
@@ -60,8 +79,30 @@
         return _configs[index];
     }
 
+    public TxWrapper getTxWrapper()
+    {
+        return wrapper.createWrapper();
+    }
+
+    private void initTest() throws Exception
+    {
+        try
+        {
+            wrapper = (TxWrapper) Class.forName(wrapperClass).newInstance();
+        }
+        catch (Exception e)
+        {
+            throw new IllegalArgumentException("Unable to instantiate transaction class: " + e);
+        }
+
+        if (requiresNestedTxSupport() && !wrapper.supportsNestedTx())
+            throw new IllegalArgumentException("Product " + wrapper.getName() + " does not support nested transactions");
+    }
+
     public void performWork( int numberOfIterations ) throws Exception
     {
+        initTest();
+
         for (int count=0;count<numberOfIterations;count++)
         {
             work();

Modified: labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/implementations/local/NestedOnePhaseTrx.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/implementations/local/NestedOnePhaseTrx.java	2008-11-27 14:12:19 UTC (rev 24120)
+++ labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/implementations/local/NestedOnePhaseTrx.java	2008-11-27 15:05:10 UTC (rev 24121)
@@ -21,17 +21,22 @@
 package com.hp.mwtests.performance.implementations.local;
 
 import com.hp.mwtests.performance.PerformanceTest;
+import com.hp.mwtests.performance.products.TxWrapper;
 import com.hp.mwtests.performance.records.DummyResource;
-import com.arjuna.ats.arjuna.AtomicAction;
 
 public class NestedOnePhaseTrx extends PerformanceTest
 {
+    protected boolean requiresNestedTxSupport()
+    {
+        return true;
+    }
+
     protected void work() throws Exception
     {
         try
         {
-            AtomicAction tx1 = new AtomicAction();
-            AtomicAction tx2 = new AtomicAction();
+            TxWrapper tx1 = getTxWrapper();
+            TxWrapper tx2 = getTxWrapper();
 
             tx1.begin();      // Top level
             tx2.begin();      // Nested level

Modified: labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/implementations/local/NestedTrx.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/implementations/local/NestedTrx.java	2008-11-27 14:12:19 UTC (rev 24120)
+++ labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/implementations/local/NestedTrx.java	2008-11-27 15:05:10 UTC (rev 24121)
@@ -21,16 +21,21 @@
 package com.hp.mwtests.performance.implementations.local;
 
 import com.hp.mwtests.performance.PerformanceTest;
-import com.arjuna.ats.arjuna.AtomicAction;
+import com.hp.mwtests.performance.products.TxWrapper;
 
 public class NestedTrx extends PerformanceTest
 {
+    protected boolean requiresNestedTxSupport()
+    {
+        return true;
+    }
+
     protected void work() throws Exception
     {
         try
         {
-            AtomicAction tx1 = new AtomicAction();
-            AtomicAction tx2 = new AtomicAction();
+            TxWrapper tx1 = getTxWrapper();
+            TxWrapper tx2 = getTxWrapper();
 
             tx1.begin();         // Top level begin
             tx2.begin();         // Nested level begin

Modified: labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/implementations/local/NestedTwoPhaseTrx.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/implementations/local/NestedTwoPhaseTrx.java	2008-11-27 14:12:19 UTC (rev 24120)
+++ labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/implementations/local/NestedTwoPhaseTrx.java	2008-11-27 15:05:10 UTC (rev 24121)
@@ -21,17 +21,22 @@
 package com.hp.mwtests.performance.implementations.local;
 
 import com.hp.mwtests.performance.PerformanceTest;
+import com.hp.mwtests.performance.products.TxWrapper;
 import com.hp.mwtests.performance.records.DummyResource;
-import com.arjuna.ats.arjuna.AtomicAction;
 
 public class NestedTwoPhaseTrx extends PerformanceTest
 {
+    protected boolean requiresNestedTxSupport()
+    {
+        return true;
+    }
+
     protected void work() throws Exception
     {
         try
         {
-            AtomicAction tx1 = new AtomicAction();
-            AtomicAction tx2 = new AtomicAction();
+            TxWrapper tx1 = getTxWrapper();
+            TxWrapper tx2 = getTxWrapper();
 
             tx1.begin();      // Top level
             tx2.begin();      // Nested level

Modified: labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/implementations/local/OnePhaseTrx.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/implementations/local/OnePhaseTrx.java	2008-11-27 14:12:19 UTC (rev 24120)
+++ labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/implementations/local/OnePhaseTrx.java	2008-11-27 15:05:10 UTC (rev 24121)
@@ -21,8 +21,8 @@
 package com.hp.mwtests.performance.implementations.local;
 
 import com.hp.mwtests.performance.PerformanceTest;
+import com.hp.mwtests.performance.products.TxWrapper;
 import com.hp.mwtests.performance.records.DummyResource;
-import com.arjuna.ats.arjuna.AtomicAction;
 
 public class OnePhaseTrx extends PerformanceTest
 {
@@ -30,7 +30,7 @@
     {
         try
         {
-            AtomicAction tx = new AtomicAction();
+            TxWrapper tx = getTxWrapper();
             tx.begin();   // Top level begin
 
             //enlist the single participant (resource) one-phase commit

Modified: labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/implementations/local/TopLevelTrx.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/implementations/local/TopLevelTrx.java	2008-11-27 14:12:19 UTC (rev 24120)
+++ labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/implementations/local/TopLevelTrx.java	2008-11-27 15:05:10 UTC (rev 24121)
@@ -21,7 +21,7 @@
 package com.hp.mwtests.performance.implementations.local;
 
 import com.hp.mwtests.performance.PerformanceTest;
-import com.arjuna.ats.arjuna.AtomicAction;
+import com.hp.mwtests.performance.products.TxWrapper;
 
 public class TopLevelTrx extends PerformanceTest
 {
@@ -29,7 +29,7 @@
     {
         try
         {
-            AtomicAction tx = new AtomicAction();
+            TxWrapper tx = getTxWrapper();
 
             tx.begin();  // Top level begin
 

Modified: labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/implementations/local/TwoPhaseTrx.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/implementations/local/TwoPhaseTrx.java	2008-11-27 14:12:19 UTC (rev 24120)
+++ labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/implementations/local/TwoPhaseTrx.java	2008-11-27 15:05:10 UTC (rev 24121)
@@ -23,11 +23,8 @@
 // Top-level transactions with two enlisted participants.
 // (two phase commit/rollback)
 
-import com.arjuna.ats.arjuna.AtomicAction;
-import com.arjuna.ats.arjuna.coordinator.*;
-import com.arjuna.ats.arjuna.common.*;
-
 import com.hp.mwtests.performance.PerformanceTest;
+import com.hp.mwtests.performance.products.TxWrapper;
 import com.hp.mwtests.performance.records.DummyResource;
 
 
@@ -37,7 +34,7 @@
     {
         try
         {
-            AtomicAction tx = new AtomicAction();
+            TxWrapper tx = getTxWrapper();
             tx.begin(); // Top level begin
 
             // enlist two participants (resource) two-phase commit

Added: labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/products/AtomikosTxWrapper.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/products/AtomikosTxWrapper.java	                        (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/products/AtomikosTxWrapper.java	2008-11-27 15:05:10 UTC (rev 24121)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * (C) 2008
+ * @author JBoss Inc.
+ */
+package com.hp.mwtests.performance.products;
+
+import javax.transaction.Transaction;
+import javax.transaction.SystemException;
+
+/**
+ * To include this class in the Performance Test Suite (ie class PerformanceTestWrapper) simply include
+ * it as an argument the JVM:
+ *     -DproductClass=com.hp.mwtests.performance.products.AtomikosTxWrapper
+ * 
+ * Before running this wrapper remember to:
+ * - uncomment the lines marked with TODO;
+ * - include the product jars on the classpath
+ * - recompile (eg add them to jts.classpath qa/tests/build-jts.xml)
+ * - put javax.transaction jar on the classpath
+ *          (http://mvnrepository.com/artifact/geronimo-spec/geronimo-spec-jta)
+ * - set the location of the product properties file:
+ *   -Dcom.atomikos.icatch.file=<path to atomikos property file>
+ */
+public class AtomikosTxWrapper extends BaseWrapper implements TxWrapper
+{
+
+    public TxWrapper createWrapper()
+    {
+        return new AtomikosTxWrapper();
+    }
+
+    public int begin()
+    {
+        throw new RuntimeException("Not supported - please uncomment Atomikos dependencies in class AtomikosTxWrapper");
+//        setUserTransaction(new com.atomikos.icatch.jta.UserTransactionImp()); // TODO uncomment this line
+
+//        return super.begin(); // TODO uncomment this line
+    }
+
+    public Transaction getTransaction() throws SystemException
+    {
+        throw new RuntimeException("Not supported - please uncomment Atomikos dependencies in class AtomikosTxWrapper");
+//        return com.atomikos.icatch.jta.TransactionManagerImp.getTransactionManager().getTransaction(); // TODO uncomment this line
+    }
+
+    public boolean supportsNestedTx()
+    {
+        return true;
+    }
+
+    public String getName()
+    {
+        return "Atomikos";
+    }
+}

Added: labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/products/BaseWrapper.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/products/BaseWrapper.java	                        (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/products/BaseWrapper.java	2008-11-27 15:05:10 UTC (rev 24121)
@@ -0,0 +1,130 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * (C) 2008
+ * @author JBoss Inc.
+ */
+package com.hp.mwtests.performance.products;
+
+import com.arjuna.ats.arjuna.coordinator.ActionStatus;
+import com.arjuna.ats.arjuna.coordinator.AbstractRecord;
+import com.arjuna.ats.arjuna.coordinator.AddOutcome;
+
+import javax.transaction.*;
+import javax.transaction.xa.XAResource;
+
+/**
+ * TODO
+ */
+abstract public class BaseWrapper
+{
+    private UserTransaction tx;
+
+    protected void setUserTransaction(UserTransaction tx)
+    {
+        this.tx = tx;
+    }
+
+    abstract public Transaction getTransaction() throws SystemException;
+
+    public int begin()
+    {
+        try
+        {
+            tx.begin();
+            return ActionStatus.RUNNING;
+        }
+        catch (SystemException e)
+        {
+            return ActionStatus.INVALID;
+        }
+        catch (NotSupportedException e)
+        {
+            return ActionStatus.INVALID;
+        }
+    }
+
+    public int commit()
+    {
+        if (tx == null)
+            return ActionStatus.INVALID;
+
+        try
+        {
+            tx.commit();
+            return ActionStatus.COMMITTED;
+        }
+        catch (HeuristicMixedException e)
+        {
+            return ActionStatus.H_MIXED;
+        }
+        catch (HeuristicRollbackException e)
+        {
+            return ActionStatus.H_ROLLBACK;
+        }
+        catch (RollbackException e)
+        {
+            return ActionStatus.ABORTED;
+        }
+        catch (SystemException e)
+        {
+            return ActionStatus.INVALID;
+        }
+    }
+
+    public int abort()
+    {
+        if (tx == null)
+            return ActionStatus.INVALID;
+
+        try
+        {
+            tx.rollback();
+            return ActionStatus.ABORTED;
+        }
+        catch (SystemException e)
+        {
+            return ActionStatus.INVALID;
+        }
+    }
+
+    public int add(XAResource xares)
+    {
+        try
+        {
+            getTransaction().enlistResource(xares);
+        }
+        catch (Exception e)  //RollbackException, IllegalStateException, SystemException
+        {
+            return AddOutcome.AR_REJECTED;
+        }
+
+        return AddOutcome.AR_ADDED;
+    }
+
+    protected XAResource toXAResource(AbstractRecord record, boolean verbose)
+    {
+//        return new com.hp.mwtests.ts.jta.common.DummyXA(verbose);
+        return new org.jboss.jbossts.qa.CrashRecovery13Impls.RecoveryXAResource();
+    }
+
+    public int add(AbstractRecord record)
+    {
+        return add(toXAResource(record, false));
+    }
+
+}

Added: labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/products/BitronixTxWrapper.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/products/BitronixTxWrapper.java	                        (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/products/BitronixTxWrapper.java	2008-11-27 15:05:10 UTC (rev 24121)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * (C) 2008
+ * @author JBoss Inc.
+ */
+package com.hp.mwtests.performance.products;
+
+import javax.transaction.Transaction;
+import javax.transaction.SystemException;
+
+/**
+ * To include this class in the Performance Test Suite (ie class PerformanceTestWrapper) simply include
+ * it as an argument the JVM:
+ *     -DproductClass=com.hp.mwtests.performance.products.BitronixTxWrapper
+ *
+ * Before running this wrapper remember to:
+ * - uncomment the lines marked with TODO;
+ * - include the product jars on the classpath;
+ * - recompile (eg add them to jts.classpath qa/tests/build-jts.xml)
+ * - put javax.transaction jar on the classpath
+ *       (http://mvnrepository.com/artifact/geronimo-spec/geronimo-spec-jta)
+ * - set the location of the product properties file:
+ *   -Dbitronix.tm.configuration=<path to bitronix property file>
+ *  JVMARGS="-Dbitronix.tm.configuration=$RESDIR/btm.properties -Dcom.atomikos.icatch.file=$RESDIR/atomikos.properties
+ */
+public class BitronixTxWrapper extends BaseWrapper implements TxWrapper
+{
+    public BitronixTxWrapper()
+    {
+    }
+
+    public TxWrapper createWrapper()
+    {
+        return new BitronixTxWrapper();
+    }
+
+    public Transaction getTransaction() throws SystemException
+    {
+        throw new RuntimeException("Not supported - please uncomment Bitronix dependencies in class BitronixTxWrapper");
+//        return bitronix.tm.TransactionManagerServices.getTransactionManager().getCurrentTransaction(); //TODO
+    }
+
+    public int begin()
+    {
+          throw new RuntimeException("Not supported - please uncomment Bitronix dependencies in class BitronixTxWrapper");
+//        setUserTransaction(bitronix.tm.TransactionManagerServices.getTransactionManager()); //TODO
+
+//        return super.begin(); //TODO
+    }
+
+    public boolean supportsNestedTx()
+    {
+        return false;
+    }
+
+    public String getName()
+    {
+        return "Bitronix";
+    }
+}

Added: labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/products/JBossTSTxWrapper.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/products/JBossTSTxWrapper.java	                        (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/products/JBossTSTxWrapper.java	2008-11-27 15:05:10 UTC (rev 24121)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * (C) 2008
+ * @author JBoss Inc.
+ */
+package com.hp.mwtests.performance.products;
+
+import com.arjuna.ats.arjuna.AtomicAction;
+import com.arjuna.ats.arjuna.coordinator.AbstractRecord;
+
+import javax.transaction.Transaction;
+import javax.transaction.SystemException;
+
+/**
+ * TODO
+ */
+public class JBossTSTxWrapper implements TxWrapper
+{
+    AtomicAction tx;
+
+    public JBossTSTxWrapper()
+    {
+    }
+
+    public TxWrapper createWrapper()
+    {
+        return new JBossTSTxWrapper();
+    }
+
+    public Transaction getTransaction() throws SystemException
+    {
+        return com.arjuna.ats.jta.TransactionManager.transactionManager().getTransaction();
+    }
+
+    public int begin()
+    {
+        this.tx = new AtomicAction();
+        
+        return tx.begin();
+    }
+
+    public int commit()
+    {
+        return tx.commit();
+    }
+
+    public int abort()
+    {
+        return tx.abort();
+    }
+
+    public int add(AbstractRecord record)
+    {
+        return tx.add(record);
+    }
+
+    public boolean supportsNestedTx()
+    {
+        return true;
+    }
+
+    public String getName()
+    {
+        return "JBossTS";
+    }
+}

Added: labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/products/TxWrapper.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/products/TxWrapper.java	                        (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/products/TxWrapper.java	2008-11-27 15:05:10 UTC (rev 24121)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * (C) 2008
+ * @author JBoss Inc.
+ */
+package com.hp.mwtests.performance.products;
+
+import com.arjuna.ats.arjuna.coordinator.AbstractRecord;
+
+import javax.transaction.Transaction;
+import javax.transaction.SystemException;
+import javax.transaction.xa.XAResource;
+
+/**
+ * Minimal interface that TM products should implement for controlling
+ * transactions.
+ * @see BaseWrapper for the default implementation of this interface from which
+ * other implementations may subclass
+ */
+public interface TxWrapper
+{
+    /**
+     * Objtain a new wrapper
+     * @return a wrapper arround a real transaction
+     */
+    TxWrapper createWrapper();
+
+    /**
+     * Start a new transaction
+     * @return one of the com.arjuna.ats.arjuna.coordinator.ActionStatus constants
+     */
+    int begin();
+
+    /**
+     * Commit the current transaction
+     * @return one of the com.arjuna.ats.arjuna.coordinator.ActionStatus constants
+     */
+    int commit();
+    int abort();
+
+    /**
+     * Enlist a resource within the current transaction. For JTA products other than JBossTS
+     * this record should be converted to an XAResource and enlisted with the transaction
+     * @param record
+     * @return one of the com.arjuna.ats.arjuna.coordinator.AddOutcome constants
+     */
+    int add(AbstractRecord record);
+    Transaction getTransaction() throws SystemException;
+    boolean supportsNestedTx();
+    String getName();
+}




More information about the jboss-svn-commits mailing list