[jboss-svn-commits] JBL Code SVN: r24206 - in labs/jbosstm/trunk/XTS: WS-T/dev/src11/com/arjuna/wst11/stub and 10 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Dec 2 08:58:17 EST 2008
Author: adinn
Date: 2008-12-02 08:58:17 -0500 (Tue, 02 Dec 2008)
New Revision: 24206
Added:
labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/stub/SubordinateDurable2PCStub.java
labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/stub/SubordinateVolatile2PCStub.java
labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mw/wst11/UserSubTransaction.java
labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/at/remote/UserSubTransactionImple.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst11/tests/junit/basic/SubTransactionCommit.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst11/tests/junit/basic/SubTransactionCommitFailInPrepare.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst11/tests/junit/basic/SubTransactionCommitRollbackInPrepare.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst11/tests/junit/basic/SubTransactionRollback.java
Modified:
labs/jbosstm/trunk/XTS/WS-T/build.xml
labs/jbosstm/trunk/XTS/WSCF/classes/com/arjuna/mwlabs/wscf/model/twophase/arjunacore/subordinate/SubordinateCoordinator.java
labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mw/wst11/deploy/WSTXInitialisation.java
labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/at/ContextFactoryImple.java
labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/at/remote/UserTransactionImple.java
labs/jbosstm/trunk/XTS/WSTX/config/wst11.xml
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/DemoDurableParticipant.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/DemoVolatileParticipant.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/FailureParticipant.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst11/tests/WSTX11TestSuite.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst11/tests/junit/ba/MultiClose.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst11/tests/junit/basic/SuspendCommitTransaction.java
Log:
added support for AT subtransactions and a UserSubTransaction class to create and manage them. Also added new WSTX tests to test them -- fix for JBTM-409
Modified: labs/jbosstm/trunk/XTS/WS-T/build.xml
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/build.xml 2008-12-02 13:56:05 UTC (rev 24205)
+++ labs/jbosstm/trunk/XTS/WS-T/build.xml 2008-12-02 13:58:17 UTC (rev 24206)
@@ -44,6 +44,7 @@
<!-- ================================================================== -->
<property name="deploy.dir" value="${jboss.server.dir}/deploy"/>
<property name="ws-c.home" value="../WS-C"/>
+ <property name="wscf.home" value="../WSCF"/>
<!-- ================================================================== -->
@@ -74,6 +75,7 @@
<property name="com.arjuna.xts.ext" location="../ext"/>
<property name="ws-c.build.dev.lib.dir" value="${ws-c.home}/build/dev/lib"/>
+ <property name="wscf.build.lib.dir" value="${wscf.home}/build/lib"/>
<property name="com.arjuna.buildsystem.lib.jars" value="buildsystem.jar"/>
@@ -87,6 +89,9 @@
<property name="ws-c.libs" value="ws-c.jar"/>
<property name="ws-c10.libs" value="ws-c10.jar"/>
<property name="ws-c11.libs" value="ws-c11.jar"/>
+ <property name="wscf.libs" value="wscf.jar"/>
+ <property name="wscf10.libs" value="wscf10.jar"/>
+ <property name="wscf11.libs" value="wscf11.jar"/>
<property name="javac.debug" value="on"/>
<property name="javac.optimize" value="off"/>
@@ -101,6 +106,16 @@
<fileset dir="${ws-c.build.dev.lib.dir}" includes="${ws-c11.libs}"/>
</path>
+ <path id="wscf.path">
+ <fileset dir="${wscf.build.lib.dir}" includes="${wscf.libs}"/>
+ </path>
+ <path id="wscf10.path">
+ <fileset dir="${wscf.build.lib.dir}" includes="${wscf10.libs}"/>
+ </path>
+ <path id="wscf11.path">
+ <fileset dir="${wscf.build.lib.dir}" includes="${wscf11.libs}"/>
+ </path>
+
<path id="lib.ext.path">
<fileset dir="${com.arjuna.jta.install.ext}" includes="${jta.ext.jars}"/>
<fileset dir="${com.arjuna.jta.install.lib}" includes="${jta.lib.jars}"/>
@@ -160,6 +175,7 @@
</path>
<path refid="lib.ext.path"/>
<path refid="ws-c10.path"/>
+ <path refid="wscf10.path"/>
</classpath>
<src path="${dev.src10.dir}"/>
</javac>
@@ -173,6 +189,7 @@
</path>
<path refid="lib.ext.path"/>
<path refid="ws-c11.path"/>
+ <path refid="wscf11.path"/>
</classpath>
<src path="${dev.src11.dir}"/>
</javac>
@@ -183,6 +200,7 @@
<classpath>
<path refid="lib.ext.path"/>
<path refid="ws-c.path"/>
+ <path refid="wscf.path"/>
</classpath>
<src path="${dev.src.dir}"/>
</javac>
@@ -318,6 +336,9 @@
<path refid="ws-c.path"/>
<path refid="ws-c10.path"/>
<path refid="ws-c11.path"/>
+ <path refid="wscf.path"/>
+ <path refid="wscf10.path"/>
+ <path refid="wscf11.path"/>
</classpath>
<src path="${tests.src.dir}"/>
</javac>
Added: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/stub/SubordinateDurable2PCStub.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/stub/SubordinateDurable2PCStub.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/stub/SubordinateDurable2PCStub.java 2008-12-02 13:58:17 UTC (rev 24206)
@@ -0,0 +1,81 @@
+package com.arjuna.wst11.stub;
+
+import com.arjuna.wst.*;
+import com.arjuna.mwlabs.wscf.model.twophase.arjunacore.subordinate.SubordinateCoordinator;
+import com.arjuna.ats.arjuna.coordinator.TwoPhaseOutcome;
+
+/**
+ * A durable participant registered on behalf of an interposed WS-AT coordinator in order to ensure that
+ * durable participants in the subtransaction prepared, committed and aborted at the right time.
+ */
+public class SubordinateDurable2PCStub implements Durable2PCParticipant
+{
+ public SubordinateDurable2PCStub(SubordinateCoordinator coordinator)
+ {
+ this.coordinator = coordinator;
+ }
+
+ /**
+ * This will be called when the parent coordinator is preparing its durable participants and should ensure
+ * that the interposed cooordinator does the same.
+ *
+ * @return the Vote returned by the subordinate coordinator.
+ * @throws com.arjuna.wst.WrongStateException if the subordinate coordinator does the same
+ * @throws com.arjuna.wst.SystemException if the subordinate coordinator does the same
+ */
+ public Vote prepare() throws WrongStateException, SystemException {
+ switch (coordinator.prepare())
+ {
+ case TwoPhaseOutcome.PREPARE_OK:
+ return new Prepared();
+ case TwoPhaseOutcome.PREPARE_READONLY:
+ return new ReadOnly();
+ case TwoPhaseOutcome.PREPARE_NOTOK:
+ default:
+ return new Aborted();
+ }
+ }
+
+ /**
+ * this will be called when the parent coordinator commits its durable participants and should ensure
+ * that the interposed cooordinator does the same
+ * @throws com.arjuna.wst.WrongStateException
+ * @throws com.arjuna.wst.SystemException
+ */
+
+ public void commit() throws WrongStateException, SystemException {
+ coordinator.commit();
+ }
+
+ /**
+ * this will be called when the parent coordinator rolls back its durable participants and should ensure
+ * that the interposed cooordinator does the same
+ * @throws com.arjuna.wst.WrongStateException
+ * @throws com.arjuna.wst.SystemException
+ */
+
+ public void rollback() throws WrongStateException, SystemException {
+ coordinator.rollback();
+ }
+
+ /**
+ * this should never get called
+ * @throws com.arjuna.wst.SystemException
+ */
+ public void unknown() throws SystemException {
+ coordinator.unknown();
+ }
+
+ /**
+ * this should never get called
+ * @throws com.arjuna.wst.SystemException
+ */
+ public void error() throws SystemException {
+ coordinator.error();
+ }
+
+ /**
+ * the interposed coordinator
+ */
+ private SubordinateCoordinator coordinator;
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/stub/SubordinateVolatile2PCStub.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/stub/SubordinateVolatile2PCStub.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/stub/SubordinateVolatile2PCStub.java 2008-12-02 13:58:17 UTC (rev 24206)
@@ -0,0 +1,73 @@
+package com.arjuna.wst11.stub;
+
+import com.arjuna.wst.*;
+import com.arjuna.mwlabs.wscf.model.twophase.arjunacore.subordinate.SubordinateCoordinator;
+
+/**
+ * A volatile participant registered on behalf of an interposed WS-AT coordinator in order to ensure that
+ * volatile participants in the subtransaction are prepared at the right time.
+ */
+public class SubordinateVolatile2PCStub implements Volatile2PCParticipant
+{
+ public SubordinateVolatile2PCStub(SubordinateCoordinator coordinator)
+ {
+ this.coordinator = coordinator;
+ }
+
+ /**
+ * This will be called when the parent coordinator is preparing its volatile participants and should ensure
+ * that the interposed cooordinator does the same.
+ *
+ * @return the Vote returned by the subordinate coordinator.
+ * @throws WrongStateException if the subordinate coordinator does the same
+ * @throws SystemException if the subordinate coordinator does the same
+ */
+ public Vote prepare() throws WrongStateException, SystemException {
+ if (coordinator.prepareVolatile()) {
+ return new Prepared();
+ } else {
+ return new Aborted();
+ }
+ }
+
+ /**
+ * this is called as part of the after completion processing and should ensure that the interposed
+ * coordinator performs its afterCompletion processing
+ * @throws WrongStateException
+ * @throws SystemException
+ */
+
+ public void commit() throws WrongStateException, SystemException {
+ coordinator.commitVolatile();
+ }
+
+ /**
+ * this is called as part of the after completion processing and should ensure that the interposed
+ * coordinator performs its afterCompletion processing
+ * @throws WrongStateException
+ * @throws SystemException
+ */
+
+ public void rollback() throws WrongStateException, SystemException {
+ coordinator.rollbackVolatile();
+ }
+
+ /**
+ * this should never get called
+ * @throws SystemException
+ */
+ public void unknown() throws SystemException {
+ }
+
+ /**
+ * this should never get called
+ * @throws SystemException
+ */
+ public void error() throws SystemException {
+ }
+
+ /**
+ * the interposed coordinator
+ */
+ private SubordinateCoordinator coordinator;
+}
Modified: labs/jbosstm/trunk/XTS/WSCF/classes/com/arjuna/mwlabs/wscf/model/twophase/arjunacore/subordinate/SubordinateCoordinator.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSCF/classes/com/arjuna/mwlabs/wscf/model/twophase/arjunacore/subordinate/SubordinateCoordinator.java 2008-12-02 13:56:05 UTC (rev 24205)
+++ labs/jbosstm/trunk/XTS/WSCF/classes/com/arjuna/mwlabs/wscf/model/twophase/arjunacore/subordinate/SubordinateCoordinator.java 2008-12-02 13:58:17 UTC (rev 24206)
@@ -78,8 +78,7 @@
* This implementation only supports coordination at the end of the
* activity.
*
- * @param CompletionStatus
- * cs The completion status to use when determining how to
+ * @param cs The completion status to use when determining how to
* execute the protocol.
*
* @exception WrongStateException
@@ -109,86 +108,151 @@
{
return ActionStatus.INVALID;
}
-
- public int doPrepare ()
+
+ /**
+ * this is driven by a volatile participant registered on behalf of the coordinator
+ *
+ * @return true if the beforeCompletion succeeds otherwise false.
+ */
+ public boolean prepareVolatile()
+ {
+ return super.beforeCompletion();
+ }
+
+ /**
+ * this is driven by a durable participant registered on behalf of the coordinator and does a
+ * normal prepare mninus the before completion processing which has already been performed
+ * @return the result of preparing the transaction
+ */
+
+ public int prepare ()
{
- if (super.beforeCompletion())
- return super.prepare(true);
- else
- {
- super.phase2Abort(true);
-
- return TwoPhaseOutcome.PREPARE_NOTOK;
- }
+ return super.prepare(true);
}
- public int doCommit ()
+ /**
+ * this is driven by a volatile participant registered on behalf of the coordinator
+ */
+ public void commitVolatile()
+ {
+ super.afterCompletion(finalStatus);
+ }
+
+ /**
+ * this is driven by a durable participant registered on behalf of the coordinator and does a
+ * normal commit minus the after completion processing which will be driven by a volatile
+ * participant also registerd for this coordinator..
+ */
+
+ public void commit ()
{
super.phase2Commit(true);
- int toReturn;
+ int status;
switch (super.getHeuristicDecision())
{
case TwoPhaseOutcome.PREPARE_OK:
case TwoPhaseOutcome.FINISH_OK:
- toReturn = super.status();
+ status = super.status();
break;
case TwoPhaseOutcome.HEURISTIC_ROLLBACK:
- toReturn = ActionStatus.H_ROLLBACK;
+ status = ActionStatus.H_ROLLBACK;
break;
case TwoPhaseOutcome.HEURISTIC_COMMIT:
- toReturn = ActionStatus.H_COMMIT;
+ status = ActionStatus.H_COMMIT;
break;
case TwoPhaseOutcome.HEURISTIC_MIXED:
- toReturn = ActionStatus.H_MIXED;
+ status = ActionStatus.H_MIXED;
break;
case TwoPhaseOutcome.HEURISTIC_HAZARD:
default:
- toReturn = ActionStatus.H_HAZARD;
+ status = ActionStatus.H_HAZARD;
break;
}
-
- super.afterCompletion(toReturn);
-
- return toReturn;
+
+ this.finalStatus = status;
}
- public int doRollback ()
+ /**
+ * this is driven by a volatile participant registered on behalf of the coordinator
+ */
+ public void rollbackVolatile()
+ {
+ super.afterCompletion(finalStatus);
+ }
+
+ /**
+ * this is driven by a durable participant registered on behalf of the coordinator and does a
+ * normal commit minus the after completion processing which will be driven by a volatile
+ * participant also registerd for this coordinator..
+ */
+ public void rollback ()
{
super.phase2Abort(true);
- int toReturn;
+ int status;
switch (super.getHeuristicDecision())
{
case TwoPhaseOutcome.PREPARE_OK:
case TwoPhaseOutcome.FINISH_OK:
- toReturn = super.status();
+ status = super.status();
break;
case TwoPhaseOutcome.HEURISTIC_ROLLBACK:
- toReturn = ActionStatus.H_ROLLBACK;
+ status = ActionStatus.H_ROLLBACK;
break;
case TwoPhaseOutcome.HEURISTIC_COMMIT:
- toReturn = ActionStatus.H_COMMIT;
+ status = ActionStatus.H_COMMIT;
break;
case TwoPhaseOutcome.HEURISTIC_MIXED:
- toReturn = ActionStatus.H_MIXED;
+ status = ActionStatus.H_MIXED;
break;
case TwoPhaseOutcome.HEURISTIC_HAZARD:
default:
- toReturn = ActionStatus.H_HAZARD;
+ status = ActionStatus.H_HAZARD;
break;
}
-
- super.afterCompletion(toReturn);
-
- return toReturn;
+
+ this.finalStatus = status;
}
- public int doOnePhaseCommit ()
- {
- return super.end(true);
- }
-
+ /**
+ * called by the durable participant during recovery processing
+ * TODO clarify when and why this gets called and what to do about it
+ */
+ public void unknown()
+ {
+ }
+
+ /**
+ * called by the durable participant during recovery processing
+ * TODO clarify when and why this gets called and what to do about it
+ */
+ public void error()
+ {
+ }
+
+ /**
+ * return a uid for the volatile participant registered on behalf of this corodinator
+ */
+ public String getVolatile2PhaseId()
+ {
+ return get_uid().stringForm() + "_V";
+ }
+
+ /**
+ * return a uid for the durable participant registered on behalf of this corodinator
+ */
+ public String getDurable2PhaseId()
+ {
+ return get_uid().stringForm() + "_D";
+ }
+
+
+ /**
+ * this saves the status after the subtransaction commit or rollback so it can be referred to during
+ * afterCompletion processing.
+ */
+ private int finalStatus = ActionStatus.CREATED;
}
Copied: labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mw/wst11/UserSubTransaction.java (from rev 23805, labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mw/wst11/UserTransaction.java)
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mw/wst11/UserSubTransaction.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mw/wst11/UserSubTransaction.java 2008-12-02 13:58:17 UTC (rev 24206)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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) 2005-2006,
+ * @author JBoss Inc.
+ */
+/*
+ * Copyright (C) 2003,
+ *
+ * Arjuna Technologies Limited,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: UserTransaction.java,v 1.8.4.1 2005/11/22 10:36:05 kconner Exp $
+ */
+
+package com.arjuna.mw.wst11;
+
+import com.arjuna.wst.SystemException;
+import com.arjuna.wst.TransactionRolledBackException;
+import com.arjuna.wst.UnknownTransactionException;
+import com.arjuna.wst.WrongStateException;
+
+/**
+ * This is the interface that allows transactions to be started and terminated.
+ * The messaging layer converts the Commit, Rollback and Notify messages into
+ * calls on this.
+ * Importantly, a UserTransaction does not represent a specific transaction,
+ * but rather is responsible for providing access to an implicit per-thread
+ * transaction context; it is similar to the UserTransaction in the JTA
+ * specification. Therefore, all of the UserTransaction methods implicitly act
+ * on the current thread of control.
+ *
+ * @author Mark Little (mark.little at arjuna.com)
+ * @version $Id: UserTransaction.java,v 1.8.4.1 2005/11/22 10:36:05 kconner Exp $
+ * @since XTS 1.0.
+ */
+
+public abstract class UserSubTransaction extends UserTransaction
+{
+ /**
+ * The transaction.
+ */
+ private static UserTransaction USER_TRANSACTION ;
+
+ /**
+ * Get the user transaction.
+ * @return the user transaction.
+ */
+ public static synchronized UserTransaction getUserTransaction()
+ {
+ return USER_TRANSACTION ;
+ }
+
+ /**
+ * Set the user transaction.
+ * @param userTransaction The user transaction.
+ */
+ public static synchronized void setUserTransaction(final UserTransaction userTransaction)
+ {
+ USER_TRANSACTION = userTransaction ;
+ }
+}
\ No newline at end of file
Property changes on: labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mw/wst11/UserSubTransaction.java
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mw/wst11/deploy/WSTXInitialisation.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mw/wst11/deploy/WSTXInitialisation.java 2008-12-02 13:56:05 UTC (rev 24205)
+++ labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mw/wst11/deploy/WSTXInitialisation.java 2008-12-02 13:58:17 UTC (rev 24206)
@@ -22,10 +22,7 @@
import com.arjuna.mw.wsas.utils.Configuration;
import com.arjuna.mw.wstx.logging.wstxLogger;
-import com.arjuna.mw.wst11.BusinessActivityManager;
-import com.arjuna.mw.wst11.TransactionManager;
-import com.arjuna.mw.wst11.UserBusinessActivity;
-import com.arjuna.mw.wst11.UserTransaction;
+import com.arjuna.mw.wst11.*;
import com.arjuna.services.framework.startup.Sequencer;
import com.arjuna.webservices.util.ClassLoaderHelper;
import com.arjuna.wsc11.common.Environment;
@@ -120,6 +117,7 @@
final Element docElem = doc.getDocumentElement() ;
final String userTx = getService(docElem, "UserTransaction") ;
+ final String userSubTx = getService(docElem, "UserSubTransaction") ;
final String txManager = getService(docElem, "TransactionManager") ;
final String userBa = getService(docElem, "UserBusinessActivity") ;
final String baManager = getService(docElem, "BusinessActivityManager") ;
@@ -129,6 +127,7 @@
throw new FileNotFoundException(wstxLogger.log_mesg.getString("com.arjuna.mw.wst11.deploy.WSTXI_23"));
}
UserTransaction.setUserTransaction((UserTransaction)ClassLoaderHelper.forName(getClass(), userTx).newInstance()) ;
+ UserSubTransaction.setUserTransaction((UserTransaction)ClassLoaderHelper.forName(getClass(), userSubTx).newInstance()) ;
TransactionManager.setTransactionManager((TransactionManager)ClassLoaderHelper.forName(getClass(), txManager).newInstance()) ;
UserBusinessActivity.setUserBusinessActivity((UserBusinessActivity)ClassLoaderHelper.forName(getClass(), userBa).newInstance()) ;
// we only have one choice for the 1.1 business activity manager
Modified: labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/at/ContextFactoryImple.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/at/ContextFactoryImple.java 2008-12-02 13:56:05 UTC (rev 24205)
+++ labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/at/ContextFactoryImple.java 2008-12-02 13:58:17 UTC (rev 24206)
@@ -40,22 +40,34 @@
import com.arjuna.mwlabs.wscf.model.twophase.arjunacore.ACCoordinator;
import com.arjuna.mwlabs.wscf.model.twophase.arjunacore.CoordinatorControl;
import com.arjuna.mwlabs.wscf.model.twophase.arjunacore.CoordinatorServiceImple;
+import com.arjuna.mwlabs.wscf.model.twophase.arjunacore.subordinate.SubordinateCoordinator;
import com.arjuna.mwlabs.wst11.at.context.ArjunaContextImple;
import com.arjuna.mwlabs.wst11.at.participants.CleanupSynchronization;
import com.arjuna.mwlabs.wst11.at.RegistrarImple;
import com.arjuna.webservices11.wsat.AtomicTransactionConstants;
+import com.arjuna.webservices11.wsat.processors.ParticipantProcessor;
import com.arjuna.webservices11.wsarj.InstanceIdentifier;
import com.arjuna.webservices11.wscoor.CoordinationConstants;
+import com.arjuna.webservices11.wscoor.client.WSCOORClient;
import com.arjuna.webservices11.ServiceRegistry;
import com.arjuna.wsc11.ContextFactory;
+import com.arjuna.wsc11.RegistrationCoordinator;
+import com.arjuna.wsc11.messaging.MessageId;
import com.arjuna.wsc.InvalidCreateParametersException;
import com.arjuna.wsc.InvalidProtocolException;
+import com.arjuna.wst.Volatile2PCParticipant;
+import com.arjuna.wst.Durable2PCParticipant;
+import com.arjuna.wst11.messaging.engines.ParticipantEngine;
+import com.arjuna.wst11.stub.SubordinateVolatile2PCStub;
+import com.arjuna.wst11.stub.SubordinateDurable2PCStub;
import org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContext;
import org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType;
import org.oasis_open.docs.ws_tx.wscoor._2006._06.Expires;
import javax.xml.ws.wsaddressing.W3CEndpointReference;
import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder;
+import javax.xml.ws.addressing.EndpointReference;
+import javax.xml.namespace.QName;
public class ContextFactoryImple implements ContextFactory, LocalFactory
{
@@ -124,6 +136,7 @@
{
try
{
+ if (currentContext == null) {
// make sure no transaction is currently associated
_coordManager.suspend();
@@ -178,6 +191,53 @@
_theRegistrar.associate();
return coordinationContext;
+ } else {
+ // we need to create a subordinate transaction and register it as both a durable and volatile
+ // participant with the registration service defined in the current context
+
+ SubordinateCoordinator subTx = (SubordinateCoordinator) createSubordinate();
+ // hmm, need to create wrappers here as the subTx is in WSCF which only knows
+ // about WSAS and WS-C and the participant is in WS-T
+ String vtppid = subTx.getVolatile2PhaseId();
+ String dtppid = subTx.getDurable2PhaseId();
+ Volatile2PCParticipant vtpp = new SubordinateVolatile2PCStub(subTx);
+ Durable2PCParticipant dtpp = new SubordinateDurable2PCStub(subTx);
+ final String messageId = MessageId.getMessageId() ;
+ W3CEndpointReference participant;
+ W3CEndpointReference coordinator;
+ participant= getParticipant(vtppid);
+ coordinator = RegistrationCoordinator.register(currentContext, messageId, participant, AtomicTransactionConstants.WSAT_SUB_PROTOCOL_VOLATILE_2PC) ;
+ ParticipantProcessor.getProcessor().activateParticipant(new ParticipantEngine(vtpp, vtppid, coordinator), vtppid) ;
+ participant= getParticipant(dtppid);
+ coordinator = RegistrationCoordinator.register(currentContext, messageId, participant, AtomicTransactionConstants.WSAT_SUB_PROTOCOL_DURABLE_2PC) ;
+ ParticipantProcessor.getProcessor().activateParticipant(new ParticipantEngine(dtpp, dtppid, coordinator), dtppid) ;
+
+ // ok now create the context
+ final ServiceRegistry serviceRegistry = ServiceRegistry.getRegistry() ;
+ final String registrationCoordinatorURI = serviceRegistry.getServiceURI(CoordinationConstants.REGISTRATION_SERVICE_NAME) ;
+
+ final CoordinationContext coordinationContext = new CoordinationContext() ;
+ coordinationContext.setCoordinationType(coordinationTypeURI);
+ CoordinationContextType.Identifier identifier = new CoordinationContextType.Identifier();
+ String txId = subTx.get_uid().stringForm();
+ identifier.setValue("urn:" + txId);
+ coordinationContext.setIdentifier(identifier) ;
+ Expires expiresInstance = currentContext.getExpires();
+ final long transactionExpires = (expiresInstance != null ? expiresInstance.getValue() : 0);
+ if (transactionExpires > 0)
+ {
+ expiresInstance = new Expires();
+ expiresInstance.setValue(transactionExpires);
+ coordinationContext.setExpires(expiresInstance);
+ }
+ W3CEndpointReference registrationCoordinator = getRegistrationCoordinator(registrationCoordinatorURI, txId);
+ coordinationContext.setRegistrationService(registrationCoordinator) ;
+
+ // now associate the tx id with the sub transaction
+
+ _theRegistrar.associate(subTx);
+ return coordinationContext;
+ }
}
catch (NoActivityException ex)
{
@@ -218,14 +278,34 @@
return null;
}
- private static W3CEndpointReference getRegistrationCoordinator(String registrationCoordinatorURI, ArjunaContextImple arjunaContext) {
+ private W3CEndpointReference getParticipant(final String id)
+ {
+ final QName serviceName = AtomicTransactionConstants.PARTICIPANT_SERVICE_QNAME;
+ final QName endpointName = AtomicTransactionConstants.PARTICIPANT_PORT_QNAME;
+ final String address = ServiceRegistry.getRegistry().getServiceURI(AtomicTransactionConstants.PARTICIPANT_SERVICE_NAME);
+ W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
+ builder.serviceName(serviceName);
+ builder.endpointName(endpointName);
+ builder.address(address);
+ InstanceIdentifier.setEndpointInstanceIdentifier(builder, id);
+ return builder.build();
+ }
+
+ private static W3CEndpointReference getRegistrationCoordinator(String registrationCoordinatorURI, ArjunaContextImple arjunaContext)
+ {
+ String identifier = arjunaContext.getTransactionIdentifier();
+ return getRegistrationCoordinator(registrationCoordinatorURI, identifier);
+ }
+
+ private static W3CEndpointReference getRegistrationCoordinator(String registrationCoordinatorURI, String identifier)
+ {
final W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
builder.serviceName(CoordinationConstants.REGISTRATION_SERVICE_QNAME);
builder.endpointName(CoordinationConstants.REGISTRATION_ENDPOINT_QNAME);
// strictly we shouldn't need to set the address because we are in the same web app as the
// coordinator but we have to as the W3CEndpointReference implementation is incomplete
builder.address(registrationCoordinatorURI);
- InstanceIdentifier.setEndpointInstanceIdentifier(builder, arjunaContext.getTransactionIdentifier());
+ InstanceIdentifier.setEndpointInstanceIdentifier(builder, identifier);
W3CEndpointReference registrationCoordinator = builder.build();
return registrationCoordinator;
}
Copied: labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/at/remote/UserSubTransactionImple.java (from rev 23805, labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/at/remote/UserTransactionImple.java)
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/at/remote/UserSubTransactionImple.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/at/remote/UserSubTransactionImple.java 2008-12-02 13:58:17 UTC (rev 24206)
@@ -0,0 +1,202 @@
+package com.arjuna.mwlabs.wst11.at.remote;
+
+import com.arjuna.mw.wst11.UserTransaction;
+import com.arjuna.mw.wst11.UserSubTransaction;
+import com.arjuna.mw.wst11.common.Environment;
+import com.arjuna.mw.wstx.logging.wstxLogger;
+import com.arjuna.mw.wsc11.context.Context;
+import com.arjuna.mwlabs.wst11.at.ContextImple;
+import com.arjuna.mwlabs.wst11.at.context.TxContextImple;
+import com.arjuna.mwlabs.wst.at.remote.ContextManager;
+import com.arjuna.webservices11.wsat.AtomicTransactionConstants;
+import com.arjuna.webservices.SoapFault;
+import com.arjuna.webservices11.wsarj.InstanceIdentifier;
+import com.arjuna.webservices11.wscoor.CoordinationConstants;
+import com.arjuna.webservices11.ServiceRegistry;
+import com.arjuna.wsc11.ActivationCoordinator;
+import com.arjuna.wsc.InvalidCreateParametersException;
+import com.arjuna.wsc11.messaging.MessageId;
+import com.arjuna.wst.SystemException;
+import com.arjuna.wst.TransactionRolledBackException;
+import com.arjuna.wst.UnknownTransactionException;
+import com.arjuna.wst.WrongStateException;
+import com.arjuna.wst11.stub.CompletionStub;
+import org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType;
+import org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContext;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder;
+import java.util.Hashtable;
+
+/**
+ * @message com.arjuna.mwlabs.wst11.at.remote.UserSubTransactionImple_1
+ * [com.arjuna.mwlabs.wst11.at.remote.UserSubTransactionImple_1] - Received
+ * context is null!
+ */
+public class UserSubTransactionImple extends UserTransactionImple
+{
+
+ public UserSubTransactionImple()
+ {
+ super();
+ }
+
+ public void begin () throws WrongStateException, SystemException
+ {
+ begin(0);
+ }
+
+ public void begin (int timeout) throws WrongStateException, SystemException
+ {
+ try
+ {
+ if (_ctxManager.currentTransaction() == null)
+ throw new WrongStateException();
+
+ Context ctx = startTransaction(timeout);
+
+ _ctxManager.resume(new TxContextImple(ctx));
+ }
+ catch (InvalidCreateParametersException ex)
+ {
+ tidyup();
+
+ throw new SystemException(ex.toString());
+ }
+ catch (UnknownTransactionException ex)
+ {
+ tidyup();
+
+ throw new SystemException(ex.toString());
+ }
+ catch (SystemException ex)
+ {
+ tidyup();
+
+ throw ex;
+ }
+ }
+
+ public void commit () throws TransactionRolledBackException,
+ UnknownTransactionException, SecurityException, SystemException, WrongStateException
+ {
+ tidyup();
+ throw new WrongStateException();
+ }
+
+ public void rollback () throws UnknownTransactionException, SecurityException, SystemException, WrongStateException
+ {
+ tidyup();
+ throw new WrongStateException();
+ }
+
+ public String transactionIdentifier ()
+ {
+ try
+ {
+ return _ctxManager.currentTransaction().toString();
+ }
+ catch (SystemException ex)
+ {
+ return "Unknown";
+ }
+ catch (NullPointerException ex)
+ {
+ return "Unknown";
+ }
+ }
+
+ public String toString ()
+ {
+ return transactionIdentifier();
+ }
+
+ /*
+ * Not sure if this is right as it doesn't map to registering a participant
+ * with the coordinator.
+ */
+
+ private final Context startTransaction(int timeout)
+ throws InvalidCreateParametersException,
+ SystemException
+ {
+ try
+ {
+ // TODO: tricks for per app _activationCoordinatorService config, perhaps:
+ //InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("/foo.properties");
+
+
+
+ final CoordinationContext current = currentCoordinationContext();
+ final Long expires = (timeout > 0 ? new Long(timeout) : null) ;
+ final String messageId = MessageId.getMessageId() ;
+ final CoordinationContextType coordinationContext = ActivationCoordinator.createCoordinationContext(
+ _activationCoordinatorService, messageId, AtomicTransactionConstants.WSAT_PROTOCOL, expires, current) ;
+ if (coordinationContext == null)
+ {
+ throw new SystemException(
+ wstxLogger.log_mesg.getString("com.arjuna.mwlabs.wst11.at.remote.UserSubTransactionImple_1"));
+ }
+ return new ContextImple(coordinationContext) ;
+ }
+ catch (final InvalidCreateParametersException icpe)
+ {
+ throw icpe ;
+ }
+ catch (final SoapFault sf)
+ {
+ throw new SystemException(sf.getMessage()) ;
+ }
+ catch (final Exception ex)
+ {
+ throw new SystemException(ex.toString());
+ }
+ }
+
+ /**
+ * get a CoordinationContext based on the one stasahed away in the current TxContext
+ */
+ public CoordinationContext currentCoordinationContext() throws SystemException
+ {
+ final TxContextImple txContext = (TxContextImple)_ctxManager.currentTransaction();
+ final CoordinationContextType savedContext = txContext.context().getCoordinationContext();
+ final CoordinationContext current = new CoordinationContext();
+ current.setCoordinationType(savedContext.getCoordinationType());
+ current.setExpires(savedContext.getExpires());
+ current.setIdentifier(savedContext.getIdentifier());
+ current.setRegistrationService(savedContext.getRegistrationService());
+ return current;
+ }
+
+ /**
+ * Create an endpoint for the local participant service labelled with the current context id which can be passed
+ * to the registration service and handed on to the registered coordinator to call back to this transaction
+ * @param id the current transaction context identifier
+ * @return
+ */
+ private W3CEndpointReference getCompletionParticipant(final String id)
+ {
+ final QName serviceName = AtomicTransactionConstants.COMPLETION_INITIATOR_SERVICE_QNAME;
+ final QName endpointName = AtomicTransactionConstants.COMPLETION_INITIATOR_PORT_QNAME;
+ final String address = ServiceRegistry.getRegistry().getServiceURI(AtomicTransactionConstants.COMPLETION_INITIATOR_SERVICE_NAME);
+ W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
+ builder.serviceName(serviceName);
+ builder.endpointName(endpointName);
+ builder.address(address);
+ InstanceIdentifier.setEndpointInstanceIdentifier(builder, id);
+ return builder.build();
+ }
+
+ private final void tidyup ()
+ {
+ try
+ {
+ _ctxManager.suspend();
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+}
\ No newline at end of file
Property changes on: labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/at/remote/UserSubTransactionImple.java
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/at/remote/UserTransactionImple.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/at/remote/UserTransactionImple.java 2008-12-02 13:56:05 UTC (rev 24205)
+++ labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/at/remote/UserTransactionImple.java 2008-12-02 13:58:17 UTC (rev 24206)
@@ -264,6 +264,10 @@
{
throw ex;
}
+ catch (WrongStateException ex)
+ {
+ throw ex;
+ }
catch (Exception ex)
{
ex.printStackTrace();
@@ -331,6 +335,10 @@
{
throw ex;
}
+ catch (WrongStateException ex)
+ {
+ throw ex;
+ }
catch (Exception ex)
{
throw new SystemException(ex.toString());
@@ -383,7 +391,7 @@
}
}
- private ContextManager _ctxManager = new ContextManager();
- private String _activationCoordinatorService;
+ protected ContextManager _ctxManager = new ContextManager();
+ protected String _activationCoordinatorService;
private Hashtable _completionCoordinators = new Hashtable();
}
Modified: labs/jbosstm/trunk/XTS/WSTX/config/wst11.xml
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/config/wst11.xml 2008-12-02 13:56:05 UTC (rev 24205)
+++ labs/jbosstm/trunk/XTS/WSTX/config/wst11.xml 2008-12-02 13:58:17 UTC (rev 24206)
@@ -20,10 +20,14 @@
@author JBoss Inc.
-->
<deployment>
- <service name="UserTransaction">
- <parameter name="className"
- value="com.arjuna.mwlabs.wst11.at.remote.UserTransactionImple"/>
- </service>
+ <service name="UserTransaction">
+ <parameter name="className"
+ value="com.arjuna.mwlabs.wst11.at.remote.UserTransactionImple"/>
+ </service>
+ <service name="UserSubTransaction">
+ <parameter name="className"
+ value="com.arjuna.mwlabs.wst11.at.remote.UserSubTransactionImple"/>
+ </service>
<service name="TransactionManager">
<parameter name="className"
value="com.arjuna.mwlabs.wst11.at.remote.TransactionManagerImple"/>
Modified: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/DemoDurableParticipant.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/DemoDurableParticipant.java 2008-12-02 13:56:05 UTC (rev 24205)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/DemoDurableParticipant.java 2008-12-02 13:58:17 UTC (rev 24206)
@@ -51,8 +51,20 @@
public DemoDurableParticipant ()
{
_passed = false;
+ _prepared = false;
+ _resolved = false;
}
+ public final boolean resolved ()
+ {
+ return _resolved;
+ }
+
+ public final boolean prepared ()
+ {
+ return _prepared;
+ }
+
public final boolean passed ()
{
return _passed;
@@ -62,6 +74,7 @@
{
System.out.println("DemoDurableParticipant.prepare for "+this);
+ _prepared = true;
return new Prepared();
}
@@ -69,6 +82,7 @@
{
System.out.println("DemoDurableParticipant.commit for "+this);
+ _resolved = true;
_passed = true;
}
@@ -76,6 +90,7 @@
{
System.out.println("DemoDurableParticipant.rollback for "+this);
+ _resolved = true;
_passed = false;
}
@@ -98,6 +113,8 @@
}
private boolean _passed;
+ private boolean _prepared;
+ private boolean _resolved;
private Uid _id = new Uid();
}
Modified: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/DemoVolatileParticipant.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/DemoVolatileParticipant.java 2008-12-02 13:56:05 UTC (rev 24205)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/DemoVolatileParticipant.java 2008-12-02 13:58:17 UTC (rev 24206)
@@ -47,12 +47,23 @@
public class DemoVolatileParticipant implements Volatile2PCParticipant
{
-
public DemoVolatileParticipant ()
{
_passed = false;
+ _prepared = false;
+ _resolved = false;
}
+ public final boolean resolved ()
+ {
+ return _resolved;
+ }
+
+ public final boolean prepared ()
+ {
+ return _prepared;
+ }
+
public final boolean passed ()
{
return _passed;
@@ -61,7 +72,8 @@
public Vote prepare () throws WrongStateException, SystemException
{
System.out.println("DemoVolatileParticipant.prepare for "+this);
-
+
+ _prepared = true;
return new Prepared();
}
@@ -69,6 +81,7 @@
{
System.out.println("DemoVolatileParticipant.commit for "+this);
+ _resolved = true;
_passed = true;
}
@@ -76,6 +89,7 @@
{
System.out.println("DemoVolatileParticipant.rollback for "+this);
+ _resolved = true;
_passed = false;
}
@@ -98,6 +112,8 @@
}
private boolean _passed;
+ private boolean _prepared;
+ private boolean _resolved;
private Uid _id = new Uid();
}
Modified: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/FailureParticipant.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/FailureParticipant.java 2008-12-02 13:56:05 UTC (rev 24205)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/FailureParticipant.java 2008-12-02 13:58:17 UTC (rev 24206)
@@ -55,7 +55,8 @@
{
_failurePoint = failurePoint;
_failureType = failureType;
- _passed = false;
+ _prepared = false;
+ _resolved = false;
}
public final boolean passed ()
@@ -63,10 +64,21 @@
return _passed;
}
+ public final boolean prepared ()
+ {
+ return _prepared;
+ }
+
+ public final boolean resolved ()
+ {
+ return _resolved;
+ }
+
public Vote prepare () throws WrongStateException, SystemException
{
System.out.println("FailureParticipant.prepare");
+ _prepared = true;
if (_failurePoint == FAIL_IN_PREPARE)
{
generateException();
@@ -81,6 +93,7 @@
{
System.out.println("FailureParticipant.commit");
+ _resolved = true;
if (_failurePoint == FAIL_IN_COMMIT)
generateException();
@@ -90,6 +103,7 @@
public void rollback () throws WrongStateException, SystemException
{
+ _resolved = true;
System.out.println("FailureParticipant.rollback");
if (_failurePoint == FAIL_IN_ROLLBACK)
@@ -101,6 +115,7 @@
public void commitOnePhase () throws WrongStateException, SystemException
{
+ _resolved = true;
System.out.println("FailureParticipant.commitOnePhase");
if (_failurePoint == FAIL_IN_ONE_PHASE)
@@ -133,6 +148,8 @@
private int _failurePoint;
private int _failureType;
private boolean _passed;
-
+ private boolean _prepared;
+ private boolean _resolved;
+
}
Modified: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst11/tests/WSTX11TestSuite.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst11/tests/WSTX11TestSuite.java 2008-12-02 13:56:05 UTC (rev 24205)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst11/tests/WSTX11TestSuite.java 2008-12-02 13:58:17 UTC (rev 24206)
@@ -31,44 +31,51 @@
// wst basic tests
// this test fails because the commit is retried forever instead of an exception being generated
//addTest(new junit.framework.TestSuite(CommitExceptionInCommit.class));
- addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.basic.CommitExceptionInPrepare.class));
- addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.basic.CommitRollbackInPrepare.class));
- addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.basic.MultiParticipants.class));
- addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.basic.NestedTransaction.class));
- addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.basic.NullCommitTransaction.class));
- addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.basic.NullRollbackTransaction.class));
- addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.basic.PrintTransaction.class));
- addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.basic.ResumeNullTransaction.class));
- addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.basic.RollbackExceptionInRollback.class));
- addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.basic.SingleParticipant.class));
- addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.basic.SuspendCommitTransaction.class));
- addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.basic.SuspendNullTransaction.class));
- addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.basic.SuspendResumeCommitTransaction.class));
- addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.basic.SuspendResumeParticipants.class));
- addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.basic.SuspendResumeSingleParticipant.class));
- addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.basic.SuspendTransaction.class));
- addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.basic.ThreadedTransaction.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst11.tests.junit.basic.CommitExceptionInPrepare.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst11.tests.junit.basic.CommitRollbackInPrepare.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst11.tests.junit.basic.MultiParticipants.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst11.tests.junit.basic.NestedTransaction.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst11.tests.junit.basic.NullCommitTransaction.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst11.tests.junit.basic.NullRollbackTransaction.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst11.tests.junit.basic.PrintTransaction.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst11.tests.junit.basic.ResumeNullTransaction.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst11.tests.junit.basic.RollbackExceptionInRollback.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst11.tests.junit.basic.SingleParticipant.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst11.tests.junit.basic.SuspendCommitTransaction.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst11.tests.junit.basic.SuspendNullTransaction.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst11.tests.junit.basic.SuspendResumeCommitTransaction.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst11.tests.junit.basic.SuspendResumeParticipants.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst11.tests.junit.basic.SuspendResumeSingleParticipant.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst11.tests.junit.basic.SuspendTransaction.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst11.tests.junit.basic.ThreadedTransaction.class));
+ // subtransaction tests
+ addTest(new junit.framework.TestSuite(com.arjuna.wst11.tests.junit.basic.SubTransactionCommit.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst11.tests.junit.basic.SubTransactionRollback.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst11.tests.junit.basic.SubTransactionCommitRollbackInPrepare.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst11.tests.junit.basic.SubTransactionCommitFailInPrepare.class));
+
+
// wst BA tests
- addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.ba.Cancel.class));
- addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.ba.Close.class));
- addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.ba.Compensate.class));
- addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.ba.ConfirmWithComplete.class));
- addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.ba.Exit.class));
- addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.ba.MultiCancel.class));
- addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.ba.MultiClose.class));
- addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.ba.MultiCompensate.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst11.tests.junit.ba.Cancel.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst11.tests.junit.ba.Close.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst11.tests.junit.ba.Compensate.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst11.tests.junit.ba.ConfirmWithComplete.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst11.tests.junit.ba.Exit.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst11.tests.junit.ba.MultiCancel.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst11.tests.junit.ba.MultiClose.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst11.tests.junit.ba.MultiCompensate.class));
// wstx basic tests
// these don't run at present because the WSCF protocol manager code cannot process the xml
// in UserTwoPhaseTx.xml and TwoPhaseTxManager.xml and wstx.UserTransactionFactory tries to
// use these documents to identify the transaction protocol it is meant to support
- //addTest(new junit.framework.TestSuite(com.arjuna.wstx.tests.junit.basic.NullCommitTransaction.class));
- //addTest(new junit.framework.TestSuite(com.arjuna.wstx.tests.junit.basic.NullNestedCommit.class));
- //addTest(new junit.framework.TestSuite(com.arjuna.wstx.tests.junit.basic.NullNestedRollback.class));
- //addTest(new junit.framework.TestSuite(com.arjuna.wstx.tests.junit.basic.NullRollbackOnly.class));
- //addTest(new junit.framework.TestSuite(com.arjuna.wstx.tests.junit.basic.NullRollbackTransaction.class));
- //addTest(new junit.framework.TestSuite(com.arjuna.wstx.tests.junit.basic.SingleParticipant.class));
- //addTest(new junit.framework.TestSuite(com.arjuna.wstx.tests.junit.basic.SynchronizationParticipant.class));
+ //addTest(new junit.framework.TestSuite(com.arjuna.wstx11.tests.junit.basic.NullCommitTransaction.class));
+ //addTest(new junit.framework.TestSuite(com.arjuna.wstx11.tests.junit.basic.NullNestedCommit.class));
+ //addTest(new junit.framework.TestSuite(com.arjuna.wstx11.tests.junit.basic.NullNestedRollback.class));
+ //addTest(new junit.framework.TestSuite(com.arjuna.wstx11.tests.junit.basic.NullRollbackOnly.class));
+ //addTest(new junit.framework.TestSuite(com.arjuna.wstx11.tests.junit.basic.NullRollbackTransaction.class));
+ //addTest(new junit.framework.TestSuite(com.arjuna.wstx11.tests.junit.basic.SingleParticipant.class));
+ //addTest(new junit.framework.TestSuite(com.arjuna.wstx11.tests.junit.basic.SynchronizationParticipant.class));
}
}
\ No newline at end of file
Modified: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst11/tests/junit/ba/MultiClose.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst11/tests/junit/ba/MultiClose.java 2008-12-02 13:56:05 UTC (rev 24205)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst11/tests/junit/ba/MultiClose.java 2008-12-02 13:58:17 UTC (rev 24206)
@@ -73,6 +73,6 @@
}
// the close should succeed even though the participant fails
uba.close();
- fail("expected SystemError");
+ assertTrue(p.passed());
}
}
\ No newline at end of file
Copied: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst11/tests/junit/basic/SubTransactionCommit.java (from rev 23805, labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst11/tests/junit/basic/MultiParticipants.java)
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst11/tests/junit/basic/SubTransactionCommit.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst11/tests/junit/basic/SubTransactionCommit.java 2008-12-02 13:58:17 UTC (rev 24206)
@@ -0,0 +1,82 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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) 2005-2006,
+ * @author JBoss Inc.
+ */
+/*
+ * Copyright (C) 2002,
+ *
+ * Arjuna Technologies Limited,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: MultiParticipants.java,v 1.6.8.1 2005/11/22 10:36:11 kconner Exp $
+ */
+
+package com.arjuna.wst11.tests.junit.basic;
+
+import com.arjuna.mw.wst11.TransactionManager;
+import com.arjuna.mw.wst11.UserTransaction;
+import com.arjuna.mw.wst11.UserSubTransaction;
+import com.arjuna.mw.wst.TxContext;
+import com.arjuna.wst.tests.DemoDurableParticipant;
+import com.arjuna.wst.tests.DemoVolatileParticipant;
+import com.arjuna.mwlabs.wst11.at.remote.UserSubTransactionImple;
+import junit.framework.TestCase;
+
+/**
+ * @author Mark Little (mark.little at arjuna.com)
+ * @version $Id: MultiParticipants.java,v 1.6.8.1 2005/11/22 10:36:11 kconner Exp $
+ * @since 1.0.
+ */
+
+public class SubTransactionCommit extends TestCase
+{
+
+ public static void testSubTransactionCommit()
+ throws Exception
+ {
+ final UserTransaction ut = UserTransaction.getUserTransaction();
+ final UserTransaction ust = UserSubTransaction.getUserTransaction();
+ final TransactionManager tm = TransactionManager.getTransactionManager();
+
+ final DemoDurableParticipant p1 = new DemoDurableParticipant();
+ final DemoVolatileParticipant p2 = new DemoVolatileParticipant();
+ final DemoDurableParticipant p3 = new DemoDurableParticipant();
+ final DemoVolatileParticipant p4 = new DemoVolatileParticipant();
+
+ ut.begin();
+ final TxContext tx = tm.suspend();
+ tm.resume(tx);
+ tm.enlistForDurableTwoPhase(p1, p1.identifier());
+ tm.enlistForVolatileTwoPhase(p2, p2.identifier());
+ ust.begin();
+ final TxContext stx = tm.suspend();
+ tm.resume(stx);
+ tm.enlistForDurableTwoPhase(p3, p3.identifier());
+ tm.enlistForVolatileTwoPhase(p4, p4.identifier());
+
+ tm.resume(tx);
+ ut.commit();
+ assertTrue(p1.prepared() && p1.resolved() && p1.passed());
+ assertTrue(p2.prepared() && p2.resolved() && p2.passed());
+ assertTrue(p3.prepared() && p3.resolved() && p3.passed());
+ assertTrue(p4.prepared() && p4.resolved() && p4.passed());
+ }
+}
\ No newline at end of file
Property changes on: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst11/tests/junit/basic/SubTransactionCommit.java
___________________________________________________________________
Name: svn:mergeinfo
+
Added: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst11/tests/junit/basic/SubTransactionCommitFailInPrepare.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst11/tests/junit/basic/SubTransactionCommitFailInPrepare.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst11/tests/junit/basic/SubTransactionCommitFailInPrepare.java 2008-12-02 13:58:17 UTC (rev 24206)
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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) 2005-2006,
+ * @author JBoss Inc.
+ */
+/*
+ * Copyright (C) 2002,
+ *
+ * Arjuna Technologies Limited,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: MultiParticipants.java,v 1.6.8.1 2005/11/22 10:36:11 kconner Exp $
+ */
+
+package com.arjuna.wst11.tests.junit.basic;
+
+import com.arjuna.mw.wst11.TransactionManager;
+import com.arjuna.mw.wst11.UserTransaction;
+import com.arjuna.mw.wst11.UserSubTransaction;
+import com.arjuna.mw.wst.TxContext;
+import com.arjuna.wst.tests.DemoDurableParticipant;
+import com.arjuna.wst.tests.DemoVolatileParticipant;
+import com.arjuna.wst.tests.FailureParticipant;
+import com.arjuna.wst.TransactionRolledBackException;
+import com.arjuna.wst.WrongStateException;
+import com.arjuna.mwlabs.wst11.at.remote.UserSubTransactionImple;
+import junit.framework.TestCase;
+
+/**
+ * @author Mark Little (mark.little at arjuna.com)
+ * @version $Id: MultiParticipants.java,v 1.6.8.1 2005/11/22 10:36:11 kconner Exp $
+ * @since 1.0.
+ */
+
+public class SubTransactionCommitFailInPrepare extends TestCase
+{
+
+ public static void testSubTransactionCommitFailInPrepare()
+ throws Exception
+ {
+ final UserTransaction ut = UserTransaction.getUserTransaction();
+ final UserTransaction ust = UserSubTransaction.getUserTransaction();
+ final TransactionManager tm = TransactionManager.getTransactionManager();
+
+ final DemoDurableParticipant p1 = new DemoDurableParticipant();
+ final DemoVolatileParticipant p2 = new DemoVolatileParticipant();
+ final FailureParticipant p3 = new FailureParticipant(FailureParticipant.FAIL_IN_PREPARE, FailureParticipant.WRONG_STATE);
+ final DemoVolatileParticipant p4 = new DemoVolatileParticipant();
+
+ ut.begin();
+ final TxContext tx = tm.suspend();
+ tm.resume(tx);
+ tm.enlistForDurableTwoPhase(p1, p1.identifier());
+ tm.enlistForVolatileTwoPhase(p2, p2.identifier());
+ ust.begin();
+ final TxContext stx = tm.suspend();
+ tm.resume(stx);
+ tm.enlistForDurableTwoPhase(p3, "failure in prepare");
+ tm.enlistForVolatileTwoPhase(p4, p4.identifier());
+
+ tm.resume(tx);
+ try {
+ ut.commit();
+ fail("expecting TransactionRolledBackException");
+ } catch (TransactionRolledBackException wse) {
+ // expect this
+ }
+ assertTrue(p1.prepared() && p1.resolved() && !p1.passed());
+ assertTrue(p2.prepared() && p2.resolved() && !p2.passed());
+ assertTrue(!p3.passed());
+ assertTrue(p4.prepared() && p4.resolved() && !p4.passed());
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst11/tests/junit/basic/SubTransactionCommitRollbackInPrepare.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst11/tests/junit/basic/SubTransactionCommitRollbackInPrepare.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst11/tests/junit/basic/SubTransactionCommitRollbackInPrepare.java 2008-12-02 13:58:17 UTC (rev 24206)
@@ -0,0 +1,89 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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) 2005-2006,
+ * @author JBoss Inc.
+ */
+/*
+ * Copyright (C) 2002,
+ *
+ * Arjuna Technologies Limited,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: MultiParticipants.java,v 1.6.8.1 2005/11/22 10:36:11 kconner Exp $
+ */
+
+package com.arjuna.wst11.tests.junit.basic;
+
+import com.arjuna.mw.wst11.TransactionManager;
+import com.arjuna.mw.wst11.UserTransaction;
+import com.arjuna.mw.wst11.UserSubTransaction;
+import com.arjuna.mw.wst.TxContext;
+import com.arjuna.wst.tests.DemoDurableParticipant;
+import com.arjuna.wst.tests.DemoVolatileParticipant;
+import com.arjuna.wst.tests.FailureParticipant;
+import com.arjuna.wst.TransactionRolledBackException;
+import com.arjuna.mwlabs.wst11.at.remote.UserSubTransactionImple;
+import junit.framework.TestCase;
+
+/**
+ * @author Mark Little (mark.little at arjuna.com)
+ * @version $Id: MultiParticipants.java,v 1.6.8.1 2005/11/22 10:36:11 kconner Exp $
+ * @since 1.0.
+ */
+
+public class SubTransactionCommitRollbackInPrepare extends TestCase
+{
+
+ public static void testSubTransactionCommitRollbackInPrepare()
+ throws Exception
+ {
+ final UserTransaction ut = UserTransaction.getUserTransaction();
+ final UserTransaction ust = UserSubTransaction.getUserTransaction();
+ final TransactionManager tm = TransactionManager.getTransactionManager();
+
+ final DemoDurableParticipant p1 = new DemoDurableParticipant();
+ final DemoVolatileParticipant p2 = new DemoVolatileParticipant();
+ final FailureParticipant p3 = new FailureParticipant(FailureParticipant.FAIL_IN_PREPARE, FailureParticipant.NONE);
+ final DemoVolatileParticipant p4 = new DemoVolatileParticipant();
+
+ ut.begin();
+ final TxContext tx = tm.suspend();
+ tm.resume(tx);
+ tm.enlistForDurableTwoPhase(p1, p1.identifier());
+ tm.enlistForVolatileTwoPhase(p2, p2.identifier());
+ ust.begin();
+ final TxContext stx = tm.suspend();
+ tm.resume(stx);
+ tm.enlistForDurableTwoPhase(p3, "failure in prepare");
+ tm.enlistForVolatileTwoPhase(p4, p4.identifier());
+
+ tm.resume(tx);
+ try {
+ ut.commit();
+ fail("expecting TransactionRolledBackException");
+ } catch (TransactionRolledBackException trbe) {
+ // expect this
+ }
+ assertTrue(p1.prepared() && p1.resolved() && !p1.passed());
+ assertTrue(p2.prepared() && p2.resolved() && !p2.passed());
+ assertTrue(!p3.passed());
+ assertTrue(p4.prepared() && p4.resolved() && !p4.passed());
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst11/tests/junit/basic/SubTransactionRollback.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst11/tests/junit/basic/SubTransactionRollback.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst11/tests/junit/basic/SubTransactionRollback.java 2008-12-02 13:58:17 UTC (rev 24206)
@@ -0,0 +1,83 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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) 2005-2006,
+ * @author JBoss Inc.
+ */
+/*
+ * Copyright (C) 2002,
+ *
+ * Arjuna Technologies Limited,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: MultiParticipants.java,v 1.6.8.1 2005/11/22 10:36:11 kconner Exp $
+ */
+
+package com.arjuna.wst11.tests.junit.basic;
+
+import com.arjuna.mw.wst11.TransactionManager;
+import com.arjuna.mw.wst11.UserTransaction;
+import com.arjuna.mw.wst11.UserSubTransaction;
+import com.arjuna.mw.wst.TxContext;
+import com.arjuna.wst.tests.DemoDurableParticipant;
+import com.arjuna.wst.tests.DemoVolatileParticipant;
+import com.arjuna.mwlabs.wst11.at.remote.UserSubTransactionImple;
+import junit.framework.TestCase;
+
+/**
+ * @author Mark Little (mark.little at arjuna.com)
+ * @version $Id: MultiParticipants.java,v 1.6.8.1 2005/11/22 10:36:11 kconner Exp $
+ * @since 1.0.
+ */
+
+public class SubTransactionRollback extends TestCase
+{
+
+ public static void testSubTransactionRollback()
+ throws Exception
+ {
+ final UserTransaction ut = UserTransaction.getUserTransaction();
+ final UserTransaction ust = UserSubTransaction.getUserTransaction();
+ final TransactionManager tm = TransactionManager.getTransactionManager();
+
+ final DemoDurableParticipant p1 = new DemoDurableParticipant();
+ final DemoVolatileParticipant p2 = new DemoVolatileParticipant();
+ final DemoDurableParticipant p3 = new DemoDurableParticipant();
+ final DemoVolatileParticipant p4 = new DemoVolatileParticipant();
+
+ ut.begin();
+ final TxContext tx = tm.suspend();
+ tm.resume(tx);
+ tm.enlistForDurableTwoPhase(p1, p1.identifier());
+ tm.enlistForVolatileTwoPhase(p2, p2.identifier());
+ ust.begin();
+ final TxContext stx = tm.suspend();
+ tm.resume(stx);
+ tm.enlistForDurableTwoPhase(p3, p3.identifier());
+ tm.enlistForVolatileTwoPhase(p4, p4.identifier());
+
+ tm.resume(tx);
+ ut.rollback();
+
+ assertTrue(p1.resolved() && !p1.passed());
+ assertTrue(p2.resolved() && !p2.passed());
+ assertTrue(p3.resolved() && !p3.passed());
+ assertTrue(p4.resolved() && !p4.passed());
+ }
+}
\ No newline at end of file
Modified: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst11/tests/junit/basic/SuspendCommitTransaction.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst11/tests/junit/basic/SuspendCommitTransaction.java 2008-12-02 13:56:05 UTC (rev 24205)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst11/tests/junit/basic/SuspendCommitTransaction.java 2008-12-02 13:58:17 UTC (rev 24206)
@@ -35,6 +35,7 @@
import com.arjuna.mw.wst.TxContext;
import com.arjuna.mw.wst11.UserTransaction;
import com.arjuna.wst.UnknownTransactionException;
+import com.arjuna.wst.WrongStateException;
import junit.framework.TestCase;
/**
@@ -69,7 +70,7 @@
try {
ut.commit();
}
- catch (UnknownTransactionException ex)
+ catch (WrongStateException ex)
{
// we should arrive here
}
More information about the jboss-svn-commits
mailing list