[jboss-svn-commits] JBL Code SVN: r31975 - in labs/jbosstm/trunk/ArjunaJTS/jts: classes/com/arjuna/ats/internal/jts/interposition/resources/strict and 11 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Sat Mar 6 18:46:19 EST 2010
Author: mark.little at jboss.com
Date: 2010-03-06 18:46:19 -0500 (Sat, 06 Mar 2010)
New Revision: 31975
Added:
labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/interposition/
labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/interposition/RestrictedInterpositionUnitTest.java
labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/interposition/StrictInterpositionUnitTest.java
labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/local/transactions/AtomicTransactionUnitTest.java
labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/local/transactions/ThreadUnitTest.java
labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/local/transactions/TxAssociationUnitTest.java
labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/local/transactions/TxErrorUnitTest.java
labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerNestedRestrictedUnitTest.java
labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerNestedStrictUnitTest.java
labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerTopLevelRestrictedUnitTest.java
labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerTopLevelStrictUnitTest.java
labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/recovery/
labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/recovery/RecoveryCoordinatorUnitTest.java
labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/recovery/RecoveryEnablementUnitTest.java
labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/xa/
labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/xa/TxUnitTest.java
Modified:
labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/interposition/resources/restricted/RestrictedInterposition.java
labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/interposition/resources/strict/StrictInterpositionCreator.java
labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/interposition/resources/restricted/ServerRestrictedNestedAction.java
labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/interposition/resources/restricted/ServerRestrictedTopLevelAction.java
labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/interposition/resources/strict/ServerStrictNestedAction.java
labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/interposition/resources/strict/ServerStrictTopLevelAction.java
labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/jts/extensions/AtomicTransaction.java
labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/jts/recovery/RecoveryEnvironment.java
labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerNestedOSIActionUnitTest.java
Log:
https://jira.jboss.org/jira/browse/JBTM-715
Modified: labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/interposition/resources/restricted/RestrictedInterposition.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/interposition/resources/restricted/RestrictedInterposition.java 2010-03-06 10:50:41 UTC (rev 31974)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/interposition/resources/restricted/RestrictedInterposition.java 2010-03-06 23:46:19 UTC (rev 31975)
@@ -33,7 +33,6 @@
import com.arjuna.ats.arjuna.common.*;
-import com.arjuna.ats.jts.exceptions.ExceptionCodes;
import com.arjuna.ats.jts.utils.Utility;
import com.arjuna.ats.internal.jts.orbspecific.ControlImple;
@@ -44,469 +43,476 @@
import com.arjuna.ats.internal.jts.interposition.resources.arjuna.*;
import org.omg.CosTransactions.*;
-import org.omg.CORBA.CompletionStatus;
import org.omg.CORBA.SystemException;
-import org.omg.CORBA.UNKNOWN;
import org.omg.CORBA.TRANSACTION_ROLLEDBACK;
public class RestrictedInterposition extends Interposition
{
-public RestrictedInterposition ()
+ public RestrictedInterposition()
{
}
-public static ControlImple create (PropagationContext context) throws SystemException
+ public static ControlImple create (PropagationContext context)
+ throws SystemException
{
- if (__list != null)
- return __list.setupHierarchy(context);
- else
- return null;
+ if (__list != null)
+ return __list.setupHierarchy(context);
+ else
+ return null;
}
/*
- * Assume that all actions in the imported hierarchy are of the same
- * type, i.e., all JBoss transactions.
- *
- * Because of the way garbage collection works in the ORB we have to
- * run an explicit garbage collection phase for finished hierarchies.
+ * Assume that all actions in the imported hierarchy are of the same type,
+ * i.e., all JBoss transactions. Because of the way garbage collection works
+ * in the ORB we have to run an explicit garbage collection phase for
+ * finished hierarchies.
*/
-public synchronized ControlImple setupHierarchy (PropagationContext context) throws SystemException
+ public synchronized ControlImple setupHierarchy (PropagationContext context)
+ throws SystemException
{
- ControlImple controlPtr = null;
- Uid theUid = null;
- ServerTopLevelAction proxyAction = null;
+ ControlImple controlPtr = null;
+ Uid theUid = null;
+ ServerTopLevelAction proxyAction = null;
- if (context.parents.length == 0)
- theUid = Utility.otidToUid(context.current.otid);
- else
- theUid = Utility.otidToUid(context.parents[context.parents.length-1].otid);
+ if (context.parents.length == 0)
+ theUid = Utility.otidToUid(context.current.otid);
+ else
+ theUid = Utility
+ .otidToUid(context.parents[context.parents.length - 1].otid);
- proxyAction = super.present(theUid);
+ proxyAction = super.present(theUid);
- if (proxyAction == null)
- {
- /*
- * Create a new proxyAction element and return the
- * "current" transaction.
- */
+ if (proxyAction == null)
+ {
+ /*
+ * Create a new proxyAction element and return the "current"
+ * transaction.
+ */
- controlPtr = createHierarchy(context, theUid);
- }
- else
- {
- /*
- * Check hierarchy of existing element.
- */
+ controlPtr = createHierarchy(context, theUid);
+ }
+ else
+ {
+ /*
+ * Check hierarchy of existing element.
+ */
- controlPtr = checkHierarchy(proxyAction, context);
- }
+ controlPtr = checkHierarchy(proxyAction, context);
+ }
- return controlPtr;
+ return controlPtr;
}
-protected synchronized ControlImple createHierarchy (PropagationContext ctx, Uid tlUid) throws SystemException
+ protected synchronized ControlImple createHierarchy (
+ PropagationContext ctx, Uid tlUid) throws SystemException
{
- /*
- * Start at the parent and work our way down to "current". The current
- * transaction is not in the IDL sequence, but sent as separate field
- * of the propagation context. This tends to make the code more
- * complex than it would be if the entire hierarchy was represented in
- * one place.
- */
+ /*
+ * Start at the parent and work our way down to "current". The current
+ * transaction is not in the IDL sequence, but sent as separate field of
+ * the propagation context. This tends to make the code more complex
+ * than it would be if the entire hierarchy was represented in one
+ * place.
+ */
- int depth = ctx.parents.length;
- ServerTopLevelAction tlAction = null;
- Coordinator tmpCoord = null;
- Terminator tmpTerm = null;
+ int depth = ctx.parents.length;
+ ServerTopLevelAction tlAction = null;
+ Coordinator tmpCoord = null;
+ Terminator tmpTerm = null;
- /*
- * First deal with top-level transaction, which may be
- * the current transaction.
- */
+ /*
+ * First deal with top-level transaction, which may be the current
+ * transaction.
+ */
- if (depth == 0)
- {
- tmpCoord = ctx.current.coord;
- tmpTerm = ctx.current.term;
- }
- else
- {
- tmpCoord = ctx.parents[depth-1].coord;
- tmpTerm = ctx.parents[depth-1].term;
- }
+ if (depth == 0)
+ {
+ tmpCoord = ctx.current.coord;
+ tmpTerm = ctx.current.term;
+ }
+ else
+ {
+ tmpCoord = ctx.parents[depth - 1].coord;
+ tmpTerm = ctx.parents[depth - 1].term;
+ }
- ServerControl control = ServerFactory.create_transaction(tlUid, null, null,
- tmpCoord, tmpTerm, ctx.timeout);
+ ServerControl control = ServerFactory.create_transaction(tlUid, null,
+ null, tmpCoord, tmpTerm, ctx.timeout);
- tlAction = new ServerRestrictedTopLevelAction(control);
+ tlAction = new ServerRestrictedTopLevelAction(control);
- if (!tlAction.valid())
- {
- /*
- * Just deal with current transaction. Others must have been
- * registered successfully, and will be deal with automatically
- * when the parent transaction terminates.
- */
+ if (!tlAction.valid())
+ {
+ /*
+ * Just deal with current transaction. Others must have been
+ * registered successfully, and will be deal with automatically when
+ * the parent transaction terminates.
+ */
- try
- {
- tlAction.rollback();
- tlAction = null;
- }
- catch (Exception e)
- {
- }
+ try
+ {
+ tlAction.rollback();
+ tlAction = null;
+ }
+ catch (Exception e)
+ {
+ }
- throw new TRANSACTION_ROLLEDBACK();
- }
+ throw new TRANSACTION_ROLLEDBACK();
+ }
- ServerTopLevelAction newElement = tlAction;
+ ServerTopLevelAction newElement = tlAction;
- super._head.add(newElement);
+ super._head.add(newElement);
- if (depth > 0) // current is a nested transaction
- {
- /*
- * Now deal with any nested transactions.
- * As we create, register with the original transactions.
- */
+ if (depth > 0) // current is a nested transaction
+ {
+ /*
+ * Now deal with any nested transactions. As we create, register
+ * with the original transactions.
+ */
- ServerRestrictedNestedAction nestedAction = null;
+ ServerRestrictedNestedAction nestedAction = null;
- for (int i = depth -2; i >= 0; i--)
- {
- tmpCoord = ctx.parents[i].coord;
- tmpTerm = ctx.parents[i].term;
+ for (int i = depth - 2; i >= 0; i--)
+ {
+ tmpCoord = ctx.parents[i].coord;
+ tmpTerm = ctx.parents[i].term;
- control = ServerFactory.create_subtransaction(Utility.otidToUid(ctx.parents[i].otid),
- tmpCoord, tmpTerm, control);
+ control = ServerFactory.create_subtransaction(Utility
+ .otidToUid(ctx.parents[i].otid), tmpCoord, tmpTerm,
+ control);
- nestedAction = new ServerRestrictedNestedAction(control);
+ nestedAction = new ServerRestrictedNestedAction(control);
- if (!nestedAction.valid())
- {
- /*
- * Just deal with current transaction. Others must have been
- * registered successfully, and will be deal with automatically
- * when the parent transaction terminates.
- */
+ if (!nestedAction.valid())
+ {
+ /*
+ * Just deal with current transaction. Others must have been
+ * registered successfully, and will be deal with
+ * automatically when the parent transaction terminates.
+ */
- try
- {
- nestedAction.rollback();
- nestedAction = null;
- }
- catch (Exception e)
- {
- }
+ try
+ {
+ nestedAction.rollback();
+ nestedAction = null;
+ }
+ catch (Exception e)
+ {
+ }
- throw new TRANSACTION_ROLLEDBACK();
- }
+ throw new TRANSACTION_ROLLEDBACK();
+ }
- /*
- * Add transaction resource to list.
- */
+ /*
+ * Add transaction resource to list.
+ */
- tlAction.addChild(nestedAction);
- }
+ tlAction.addChild(nestedAction);
+ }
- /*
- * Now deal with current transaction. If there is only one transaction we do nothing.
- */
+ /*
+ * Now deal with current transaction. If there is only one
+ * transaction we do nothing.
+ */
- tmpCoord = ctx.current.coord;
- tmpTerm = ctx.current.term;
+ tmpCoord = ctx.current.coord;
+ tmpTerm = ctx.current.term;
- control = ServerFactory.create_subtransaction(Utility.otidToUid(ctx.current.otid),
- tmpCoord, tmpTerm, control);
- nestedAction = new ServerRestrictedNestedAction(control);
+ control = ServerFactory.create_subtransaction(Utility
+ .otidToUid(ctx.current.otid), tmpCoord, tmpTerm, control);
+ nestedAction = new ServerRestrictedNestedAction(control);
- if (!nestedAction.valid())
- {
- /*
- * Just deal with current transaction. Others must have been
- * registered successfully, and will be deal with automatically
- * when the parent transaction terminates.
- */
+ if (!nestedAction.valid())
+ {
+ /*
+ * Just deal with current transaction. Others must have been
+ * registered successfully, and will be deal with automatically
+ * when the parent transaction terminates.
+ */
- try
- {
- nestedAction.rollback();
- nestedAction = null;
- }
- catch (Exception e)
- {
- }
+ try
+ {
+ nestedAction.rollback();
+ nestedAction = null;
+ }
+ catch (Exception e)
+ {
+ }
- throw new TRANSACTION_ROLLEDBACK();
- }
+ throw new TRANSACTION_ROLLEDBACK();
+ }
- tlAction.addChild(nestedAction);
- }
+ tlAction.addChild(nestedAction);
+ }
- return control;
+ return control;
}
/*
- * Work our way down the hierarchy, aborting any actions which are no
- * longer valid, and creating any new ones. These new actions must be
- * nested actions.
+ * Work our way down the hierarchy, aborting any actions which are no longer
+ * valid, and creating any new ones. These new actions must be nested
+ * actions.
*/
-protected synchronized ControlImple checkHierarchy (ServerTopLevelAction hier,
- PropagationContext context) throws SystemException
+ protected synchronized ControlImple checkHierarchy (
+ ServerTopLevelAction hier, PropagationContext context)
+ throws SystemException
{
- ServerRestrictedTopLevelAction tlAction = (ServerRestrictedTopLevelAction) hier;
- ServerControl control = tlAction.control(); // top-level's control
- int depth = context.parents.length;
- int differenceIndex = -1; // index of the new transactions in the hierarchy
- ServerRestrictedNestedAction nestedAction = tlAction.child(); // top-level's nested action
+ ServerRestrictedTopLevelAction tlAction = (ServerRestrictedTopLevelAction) hier;
+ ServerControl control = tlAction.control(); // top-level's control
+ int depth = context.parents.length;
+ int differenceIndex = -1; // index of the new transactions in the
+ // hierarchy
+ ServerRestrictedNestedAction nestedAction = tlAction.child(); //top-level
+ // 's
+ // nested
+ // action
- /*
- * Abort any old actions before we check whether we need to create
- * additional ones.
- *
- * To get here we have already checked the id of the parent
- * transaction, i.e., depth -1.
- *
- * Remember: the context hierarchy *does not* include the current
- * transaction!
- */
+ /*
+ * Abort any old actions before we check whether we need to create
+ * additional ones. To get here we have already checked the id of the
+ * parent transaction, i.e., depth -1. Remember: the context hierarchy
+ * does not include the current transaction!
+ */
- if (depth == 0)
- {
- /*
- * If there are no transactions in the sent hierarchy then
- * current is the only nested transaction. So, abort the
- * rest of our local hierarchy.
- */
+ if (depth == 0)
+ {
+ /*
+ * If there are no transactions in the sent hierarchy then current
+ * is the only nested transaction. So, abort the rest of our local
+ * hierarchy.
+ */
- if (nestedAction != null)
- {
- tlAction.abortChild(nestedAction); // automatically removed from resource list
- nestedAction = null;
- control = tlAction.deepestControl();
- }
- }
- else
- {
- /*
- * Start at -2 and work our way down the hierarchy. We
- * use -2 since the length gives us the number of elements,
- * which is 0 to n-1, and the n-1th element is the top-level
- * transaction, which we have dealt with to get this far.
- */
+ if (nestedAction != null)
+ {
+ tlAction.abortChild(nestedAction); // automatically removed from
+ // resource list
+ nestedAction = null;
+ control = tlAction.deepestControl();
+ }
+ }
+ else
+ {
+ /*
+ * Start at -2 and work our way down the hierarchy. We use -2 since
+ * the length gives us the number of elements, which is 0 to n-1,
+ * and the n-1th element is the top-level transaction, which we have
+ * dealt with to get this far.
+ */
- for (int i = depth -2; (i >= 0) && (nestedAction != null); i--)
- {
- if (nestedAction.get_uid().equals(Utility.otidToUid(context.parents[i].otid)))
- {
- /*
- * nestedAction *always* points to the next transaction
- * in the hierarchy when we leave this loop.
- */
+ for (int i = depth - 2; (i >= 0) && (nestedAction != null); i--)
+ {
+ if (nestedAction.get_uid().equals(
+ Utility.otidToUid(context.parents[i].otid)))
+ {
+ /*
+ * nestedActionalways points to the next transaction in the
+ * hierarchy when we leave this loop.
+ */
- nestedAction = nestedAction.child();
+ nestedAction = nestedAction.child();
- if ((nestedAction == null) && (i > 0))
- {
- differenceIndex = i -1;
- control = tlAction.deepestControl();
- }
- }
- else
- {
- /*
- * Uids not equal, so abort. No need to continue down the
- * hierarchy, as aborting from this point will implicitly
- * abort out children.
- */
+ if ((nestedAction == null) && (i > 0))
+ {
+ differenceIndex = i - 1;
+ control = tlAction.deepestControl();
+ }
+ }
+ else
+ {
+ /*
+ * Uids not equal, so abort. No need to continue down the
+ * hierarchy, as aborting from this point will implicitly
+ * abort out children.
+ */
- differenceIndex = i; // remember for later so that we can add new actions.
+ differenceIndex = i; // remember for later so that we can
+ // add new actions.
- tlAction.abortChild(nestedAction);
- nestedAction = null;
- control = tlAction.deepestControl();
+ tlAction.abortChild(nestedAction);
+ nestedAction = null;
+ control = tlAction.deepestControl();
- break;
- }
- }
+ break;
+ }
+ }
- /*
- * Do we have anything left in the sent hierarchy (other than
- * current)? If so, add it now.
- */
+ /*
+ * Do we have anything left in the sent hierarchy (other than
+ * current)? If so, add it now.
+ */
- if (differenceIndex != -1)
- {
- Coordinator tmpCoord;
- Terminator tmpTerm;
+ if (differenceIndex != -1)
+ {
+ Coordinator tmpCoord;
+ Terminator tmpTerm;
- for (int j = differenceIndex; j >= 0; j--)
- {
- tmpCoord = context.parents[j].coord;
- tmpTerm = context.parents[j].term;
+ for (int j = differenceIndex; j >= 0; j--)
+ {
+ tmpCoord = context.parents[j].coord;
+ tmpTerm = context.parents[j].term;
- control = ServerFactory.create_subtransaction(Utility.otidToUid(context.parents[j].otid),
- tmpCoord, tmpTerm, control);
- nestedAction = new ServerRestrictedNestedAction(control);
+ control = ServerFactory.create_subtransaction(Utility
+ .otidToUid(context.parents[j].otid), tmpCoord,
+ tmpTerm, control);
+ nestedAction = new ServerRestrictedNestedAction(control);
- if (!nestedAction.valid())
- {
- /*
- * Just deal with current transaction. Others must have been
- * registered successfully, and will be deal with automatically
- * when the parent transaction terminates.
- */
+ if (!nestedAction.valid())
+ {
+ /*
+ * Just deal with current transaction. Others must have
+ * been registered successfully, and will be deal with
+ * automatically when the parent transaction terminates.
+ */
- try
- {
- nestedAction.rollback(); // does dispose as well!
- nestedAction = null;
- }
- catch (Exception e)
- {
- }
+ try
+ {
+ nestedAction.rollback(); // does dispose as well!
+ nestedAction = null;
+ }
+ catch (Exception e)
+ {
+ }
- throw new TRANSACTION_ROLLEDBACK();
- }
+ throw new TRANSACTION_ROLLEDBACK();
+ }
- tlAction.addChild(nestedAction);
- }
+ tlAction.addChild(nestedAction);
+ }
- nestedAction = null;
- }
- else
- {
- if (nestedAction != null)
- {
- /*
- * If current transaction has a child then we should
- * abort it, since it does not exist in the hierarchy
- * we have just received.
- */
+ nestedAction = null;
+ }
+ else
+ {
+ if (nestedAction != null)
+ {
+ /*
+ * If current transaction has a child then we should abort
+ * it, since it does not exist in the hierarchy we have just
+ * received.
+ */
- nestedAction = nestedAction.child();
+ nestedAction = nestedAction.child();
- if (nestedAction != null)
- {
- tlAction.abortChild(nestedAction);
- nestedAction = null;
- control = tlAction.deepestControl();
- }
- }
- }
- }
+ if (nestedAction != null)
+ {
+ tlAction.abortChild(nestedAction);
+ nestedAction = null;
+ control = tlAction.deepestControl();
+ }
+ }
+ }
+ }
- boolean newCurrent = false;
- Uid sentCurrent = Utility.otidToUid(context.current.otid);
+ boolean newCurrent = false;
+ Uid sentCurrent = Utility.otidToUid(context.current.otid);
- /*
- * If differentIndex is not -1 then we already found a difference
- * between the sent hierarchy and the one we already had, so we
- * must have a new current.
- */
+ /*
+ * If differentIndex is not -1 then we already found a difference
+ * between the sent hierarchy and the one we already had, so we must
+ * have a new current.
+ */
- if (differenceIndex == -1)
- {
- /*
- * Now determine whether we have to create any new nested actions.
- */
+ if (differenceIndex == -1)
+ {
+ /*
+ * Now determine whether we have to create any new nested actions.
+ */
- Uid currentUid = null;
+ Uid currentUid = null;
- /*
- * Get hold of our local notion of current.
- */
+ /*
+ * Get hold of our local notion of current.
+ */
- if (nestedAction == null)
- {
- nestedAction = tlAction.child();
+ if (nestedAction == null)
+ {
+ nestedAction = tlAction.child();
- if (nestedAction != null)
- {
- while (nestedAction.child() != null)
- nestedAction = nestedAction.child();
+ if (nestedAction != null)
+ {
+ while (nestedAction.child() != null)
+ nestedAction = nestedAction.child();
- currentUid = nestedAction.get_uid();
- }
- else
- currentUid = tlAction.get_uid();
- }
- else
- currentUid = nestedAction.get_uid();
+ currentUid = nestedAction.get_uid();
+ }
+ else
+ currentUid = tlAction.get_uid();
+ }
+ else
+ currentUid = nestedAction.get_uid();
- /*
- * Is our notion of the current transaction the same as
- * that sent?
- */
+ /*
+ * Is our notion of the current transaction the same as that sent?
+ */
- if (currentUid.notEquals(sentCurrent))
- {
- newCurrent = true;
- }
- }
- else
- newCurrent = true;
+ if (currentUid.notEquals(sentCurrent))
+ {
+ newCurrent = true;
+ }
+ }
+ else
+ newCurrent = true;
- if (newCurrent)
- {
- if (depth == 1)
- {
- /*
- * Old current is gone.
- */
+ if (newCurrent)
+ {
+ if (depth == 1)
+ {
+ /*
+ * Old current is gone.
+ */
- nestedAction = tlAction.child();
+ nestedAction = tlAction.child();
- if (nestedAction != null)
- {
- tlAction.abortChild(nestedAction);
- nestedAction = null;
- }
+ if (nestedAction != null)
+ {
+ tlAction.abortChild(nestedAction);
+ nestedAction = null;
+ }
- control = (ServerControl) tlAction.control();
- }
- else
- control = tlAction.deepestControl();
+ control = (ServerControl) tlAction.control();
+ }
+ else
+ control = tlAction.deepestControl();
- TransIdentity currentID = context.current;
+ TransIdentity currentID = context.current;
- control = ServerFactory.create_subtransaction(sentCurrent,
- currentID.coord, currentID.term, control);
- nestedAction = new ServerRestrictedNestedAction(control);
+ control = ServerFactory.create_subtransaction(sentCurrent,
+ currentID.coord, currentID.term, control);
+ nestedAction = new ServerRestrictedNestedAction(control);
- if (!nestedAction.valid())
- {
- /*
- * Just deal with current transaction. Others must have been
- * registered successfully, and will be deal with automatically
- * when the parent transaction terminates.
- */
+ if (!nestedAction.valid())
+ {
+ /*
+ * Just deal with current transaction. Others must have been
+ * registered successfully, and will be deal with automatically
+ * when the parent transaction terminates.
+ */
- try
- {
- nestedAction.rollback(); // does dispose as well!
- nestedAction = null;
- }
- catch (Exception e)
- {
- }
+ try
+ {
+ nestedAction.rollback(); // does dispose as well!
+ nestedAction = null;
+ }
+ catch (Exception e)
+ {
+ }
- throw new TRANSACTION_ROLLEDBACK();
- }
+ throw new TRANSACTION_ROLLEDBACK();
+ }
- tlAction.addChild(nestedAction);
+ tlAction.addChild(nestedAction);
- nestedAction = null;
- }
+ nestedAction = null;
+ }
- return control;
+ return control;
}
-private static RestrictedInterposition __list = new RestrictedInterposition();
+ private static RestrictedInterposition __list = new RestrictedInterposition();
}
Modified: labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/interposition/resources/strict/StrictInterpositionCreator.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/interposition/resources/strict/StrictInterpositionCreator.java 2010-03-06 10:50:41 UTC (rev 31974)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/interposition/resources/strict/StrictInterpositionCreator.java 2010-03-06 23:46:19 UTC (rev 31975)
@@ -43,14 +43,15 @@
public class StrictInterpositionCreator implements FactoryCreator
{
-public ControlImple recreateLocal (PropagationContext ctx) throws SystemException
+ public ControlImple recreateLocal (PropagationContext ctx)
+ throws SystemException
{
- return StrictInterposition.create(ctx);
+ return StrictInterposition.create(ctx);
}
-public Control recreate (PropagationContext ctx) throws SystemException
+ public Control recreate (PropagationContext ctx) throws SystemException
{
- return recreateLocal(ctx).getControl();
+ return recreateLocal(ctx).getControl();
}
};
Modified: labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/interposition/resources/restricted/ServerRestrictedNestedAction.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/interposition/resources/restricted/ServerRestrictedNestedAction.java 2010-03-06 10:50:41 UTC (rev 31974)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/interposition/resources/restricted/ServerRestrictedNestedAction.java 2010-03-06 23:46:19 UTC (rev 31975)
@@ -31,25 +31,13 @@
package com.arjuna.ats.internal.jts.orbspecific.interposition.resources.restricted;
-import com.arjuna.ats.arjuna.common.*;
-
-import com.arjuna.ats.jts.exceptions.ExceptionCodes;
import com.arjuna.ats.jts.logging.*;
-import com.arjuna.ats.internal.jts.interposition.*;
-import com.arjuna.ats.internal.jts.interposition.resources.arjuna.*;
import com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.*;
import com.arjuna.ats.internal.jts.orbspecific.interposition.*;
-import com.arjuna.ats.internal.jts.orbspecific.ControlImple;
import com.arjuna.common.util.logging.*;
-import org.omg.CosTransactions.*;
-import org.omg.CORBA.CompletionStatus;
-
-import org.omg.CORBA.SystemException;
-import org.omg.CORBA.UNKNOWN;
-
import java.util.List;
public class ServerRestrictedNestedAction extends ServerNestedAction
@@ -81,8 +69,8 @@
}
/**
- * @message com.arjuna.ats.internal.jts.orbspecific.interposition.resources.restricted.contxfound_1 {0} - found concurrent transactions!
- * @message com.arjuna.ats.internal.jts.orbspecific.interposition.resources.restricted.contx_1 {0} Concurrent children found for restricted interposition!
+ * @message com.arjuna.ats.internal.jts.orbspecific.interposition.resources.restricted.contxfound_1 {0} - found concurrent ({1}) transactions!
+ * @message com.arjuna.ats.internal.jts.orbspecific.interposition.resources.restricted.contx_1 Concurrent children found for restricted interposition!
*/
public final synchronized ServerRestrictedNestedAction child ()
@@ -91,19 +79,20 @@
List<ServerNestedAction> children = getChildren();
// There should be only one child!
- if (children.size() != 1)
+ if (children.size() > 1)
{
if (jtsLogger.loggerI18N.isWarnEnabled())
{
jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.orbspecific.interposition.resources.restricted.contxfound_1",
- new Object[] {"ServerRestrictedNestedAction.child"});
+ new Object[] {"ServerRestrictedNestedAction.child", children.size()});
}
- throw new com.arjuna.ats.jts.exceptions.TxError(jtsLogger.loggerI18N.getString("com.arjuna.ats.internal.jts.orbspecific.interposition.resources.restricted.contx_2"));
+ throw new com.arjuna.ats.jts.exceptions.TxError(jtsLogger.loggerI18N.getString("com.arjuna.ats.internal.jts.orbspecific.interposition.resources.restricted.contx_1"));
}
else
{
- toReturn = (ServerRestrictedNestedAction) children.remove(0);
+ if (children.size() == 1)
+ toReturn = (ServerRestrictedNestedAction) children.remove(0);
}
return toReturn;
Modified: labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/interposition/resources/restricted/ServerRestrictedTopLevelAction.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/interposition/resources/restricted/ServerRestrictedTopLevelAction.java 2010-03-06 10:50:41 UTC (rev 31974)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/interposition/resources/restricted/ServerRestrictedTopLevelAction.java 2010-03-06 23:46:19 UTC (rev 31975)
@@ -93,7 +93,7 @@
}
/**
- * @message com.arjuna.ats.internal.jts.orbspecific.interposition.resources.restricted.contxfound_3 {0} - found concurrent transactions!
+ * @message com.arjuna.ats.internal.jts.orbspecific.interposition.resources.restricted.contxfound_3 {0} - found concurrent ({1}) transactions!
* @message com.arjuna.ats.internal.jts.orbspecific.interposition.resources.restricted.contx_4 {0} Concurrent children found for restricted interposition!
*/
public final synchronized ServerRestrictedNestedAction child ()
@@ -102,19 +102,20 @@
List<ServerNestedAction> children = getChildren();
// There should be only one child!
- if (children.size() != 1)
+ if (children.size() > 1)
{
if (jtsLogger.loggerI18N.isWarnEnabled())
{
jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.orbspecific.interposition.resources.restricted.contxfound_3",
- new Object[] {"ServerRestrictedTopLevelAction.child"});
+ new Object[] {"ServerRestrictedTopLevelAction.child", children.size()});
}
throw new com.arjuna.ats.jts.exceptions.TxError(jtsLogger.loggerI18N.getString("com.arjuna.ats.internal.jts.orbspecific.interposition.resources.restricted.contx_4"));
}
else
{
- toReturn = (ServerRestrictedNestedAction) children.remove(0);
+ if (children.size() == 1)
+ toReturn = (ServerRestrictedNestedAction) children.remove(0);
}
return toReturn;
Modified: labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/interposition/resources/strict/ServerStrictNestedAction.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/interposition/resources/strict/ServerStrictNestedAction.java 2010-03-06 10:50:41 UTC (rev 31974)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/interposition/resources/strict/ServerStrictNestedAction.java 2010-03-06 23:46:19 UTC (rev 31975)
@@ -31,142 +31,139 @@
package com.arjuna.ats.internal.jts.orbspecific.interposition.resources.strict;
-import com.arjuna.orbportability.OA;
-
-import com.arjuna.ats.arjuna.common.*;
-
-import com.arjuna.ats.jts.exceptions.ExceptionCodes;
import com.arjuna.ats.jts.logging.*;
import com.arjuna.ats.internal.jts.ORBManager;
-import com.arjuna.ats.internal.jts.interposition.*;
-import com.arjuna.ats.internal.jts.interposition.resources.arjuna.*;
import com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.*;
import com.arjuna.ats.internal.jts.orbspecific.interposition.*;
-import com.arjuna.ats.internal.jts.orbspecific.ControlImple;
import com.arjuna.common.util.logging.*;
import org.omg.CosTransactions.*;
-import org.omg.CORBA.CompletionStatus;
import org.omg.CORBA.SystemException;
-import org.omg.CORBA.UNKNOWN;
public class ServerStrictNestedAction extends ServerNestedAction
{
/*
- * Create local transactions with same ids as remote.
- * The base class is responsible for registering us with the
- * parent transaction.
+ * Create local transactions with same ids as remote. The base class is
+ * responsible for registering us with the parent transaction.
*/
-public ServerStrictNestedAction (ServerControl control, boolean doRegister)
+ public ServerStrictNestedAction(ServerControl control, boolean doRegister)
{
- super(control);
+ super(control);
- if (jtsLogger.logger.isDebugEnabled())
- {
- jtsLogger.logger.debug(DebugLevel.CONSTRUCTORS, VisibilityLevel.VIS_PUBLIC,
- com.arjuna.ats.jts.logging.FacilityCode.FAC_OTS, "ServerStrictNestedAction::ServerStrictNestedAction ( "+_theUid+" )");
- }
+ if (jtsLogger.logger.isDebugEnabled())
+ {
+ jtsLogger.logger.debug(DebugLevel.CONSTRUCTORS,
+ VisibilityLevel.VIS_PUBLIC,
+ com.arjuna.ats.jts.logging.FacilityCode.FAC_OTS,
+ "ServerStrictNestedAction::ServerStrictNestedAction ( "
+ + _theUid + " )");
+ }
- _registered = false;
- _theResource = null;
+ _registered = false;
+ _theResource = null;
- if (_theControl != null)
- {
- _theResource = new org.omg.CosTransactions.SubtransactionAwareResourcePOATie(this);
+ if (_theControl != null)
+ {
+ _theResource = new org.omg.CosTransactions.SubtransactionAwareResourcePOATie(
+ this);
- ORBManager.getPOA().objectIsReady(_theResource);
-
- /*
- * Would like to be able to attach a thread filter
- * to this object if process-filters aren't supported.
- * However, currently this won't work as we can't have
- * two different filter types working at the same
- * time.
- *
- * ATTACH_THREAD_FILTER_(_theResource);
- */
-
- if (doRegister)
- interposeResource();
- }
+ ORBManager.getPOA().objectIsReady(_theResource);
+
+ /*
+ * Would like to be able to attach a thread filter to this object if
+ * process-filters aren't supported. However, currently this won't
+ * work as we can't have two different filter types working at the
+ * same time. ATTACH_THREAD_FILTER_(_theResource);
+ */
+
+ if (doRegister)
+ interposeResource();
+ }
}
/**
* @message com.arjuna.ats.internal.jts.orbspecific.interposition.resources.strict.ipfailed {0} - could not register interposed hierarchy!
*/
-public boolean interposeResource ()
+ public boolean interposeResource ()
{
- if (!_registered)
- {
- _registered = true;
+ if (!_registered)
+ {
+ _registered = true;
- if ((_theResource != null) && (_theControl != null))
- {
- Coordinator realCoordinator = _theControl.originalCoordinator();
+ if ((_theResource != null) && (_theControl != null))
+ {
+ Coordinator realCoordinator = _theControl.originalCoordinator();
- if (!(_valid = registerSubTran(realCoordinator)))
- {
- if (jtsLogger.loggerI18N.isWarnEnabled())
- {
- jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.orbspecific.interposition.resources.strict.ipfailed",
- new Object[] {"ServerStrictNestedAction"});
- }
-
- /*
- * Failed to register. Valid is set, and the interposition
- * controller will now deal with this.
- */
- }
+ if (!(_valid = registerSubTran(realCoordinator)))
+ {
+ if (jtsLogger.loggerI18N.isWarnEnabled())
+ {
+ jtsLogger.loggerI18N
+ .warn(
+ "com.arjuna.ats.internal.jts.orbspecific.interposition.resources.strict.ipfailed",
+ new Object[]
+ { "ServerStrictNestedAction" });
+ }
- realCoordinator = null;
- }
- else
- _valid = false;
- }
+ /*
+ * Failed to register. Valid is set, and the interposition
+ * controller will now deal with this.
+ */
+ }
- return _valid;
+ realCoordinator = null;
+ }
+ else
+ _valid = false;
+ }
+
+ return _valid;
}
/*
- * Since we may be called multiple times if we are nested and are
- * propagated to our parents, we remember the initial response and return
- * it subsequently.
+ * Since we may be called multiple times if we are nested and are propagated
+ * to our parents, we remember the initial response and return it
+ * subsequently.
*/
-public void commit_subtransaction (Coordinator parent) throws SystemException
+ public void commit_subtransaction (Coordinator parent)
+ throws SystemException
{
- if (jtsLogger.logger.isDebugEnabled())
- {
- jtsLogger.logger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
- com.arjuna.ats.jts.logging.FacilityCode.FAC_OTS, "ServerStrictNestedAction::commit_subtransaction : "+_theUid);
- }
+ if (jtsLogger.logger.isDebugEnabled())
+ {
+ jtsLogger.logger.debug(DebugLevel.FUNCTIONS,
+ VisibilityLevel.VIS_PUBLIC,
+ com.arjuna.ats.jts.logging.FacilityCode.FAC_OTS,
+ "ServerStrictNestedAction::commit_subtransaction : "
+ + _theUid);
+ }
- try
- {
- super.commit_subtransaction(parent);
+ try
+ {
+ super.commit_subtransaction(parent);
- /*
- * Now register a resource with our parent if required.
- */
+ /*
+ * Now register a resource with our parent if required.
+ */
- if (super._parent != null)
- super._parent.interposeResource();
- }
- catch (SystemException e)
- {
- if (super._parent != null)
- super._parent.interposeResource();
+ if (super._parent != null)
+ super._parent.interposeResource();
+ }
+ catch (SystemException e)
+ {
+ if (super._parent != null)
+ super._parent.interposeResource();
- throw e;
- }
+ throw e;
+ }
}
-private boolean _registered;
-
+ private boolean _registered;
+
}
Modified: labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/interposition/resources/strict/ServerStrictTopLevelAction.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/interposition/resources/strict/ServerStrictTopLevelAction.java 2010-03-06 10:50:41 UTC (rev 31974)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/interposition/resources/strict/ServerStrictTopLevelAction.java 2010-03-06 23:46:19 UTC (rev 31975)
@@ -31,28 +31,16 @@
package com.arjuna.ats.internal.jts.orbspecific.interposition.resources.strict;
-import com.arjuna.orbportability.OA;
-
-import com.arjuna.ats.arjuna.common.*;
-
-import com.arjuna.ats.jts.exceptions.ExceptionCodes;
import com.arjuna.ats.jts.logging.*;
import com.arjuna.ats.internal.jts.ORBManager;
-import com.arjuna.ats.internal.jts.interposition.*;
-import com.arjuna.ats.internal.jts.interposition.resources.arjuna.*;
import com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.*;
import com.arjuna.ats.internal.jts.orbspecific.interposition.*;
-import com.arjuna.ats.internal.jts.orbspecific.ControlImple;
import com.arjuna.common.util.logging.*;
import org.omg.CosTransactions.*;
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.SystemException;
-import org.omg.CORBA.UNKNOWN;
-
public class ServerStrictTopLevelAction extends ServerTopLevelAction
{
/*
Modified: labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/jts/extensions/AtomicTransaction.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/jts/extensions/AtomicTransaction.java 2010-03-06 10:50:41 UTC (rev 31974)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/jts/extensions/AtomicTransaction.java 2010-03-06 23:46:19 UTC (rev 31975)
@@ -693,7 +693,7 @@
synchronized (_theStatus)
{
- if (_theAction != null)
+ if (_theAction == null)
throw new NoTransaction();
}
Modified: labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/jts/recovery/RecoveryEnvironment.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/jts/recovery/RecoveryEnvironment.java 2010-03-06 10:50:41 UTC (rev 31974)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/jts/recovery/RecoveryEnvironment.java 2010-03-06 23:46:19 UTC (rev 31975)
@@ -41,9 +41,4 @@
public static final String OTS_ISSUE_RECOVERY_ROLLBACK = "com.arjuna.ats.jts.recovery.issueRecoveryRollback" ;
public static final String COMMITTED_TRANSACTION_RETRY_LIMIT = "com.arjuna.ats.jts.recovery.commitTransactionRetryLimit";
public static final String ASSUMED_OBJECT_NOT_EXIST = "com.arjuna.ats.jts.recovery.assumedObjectNotExist" ;
-
- /** Not used */
- private RecoveryEnvironment()
- {
- }
}
Added: labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/interposition/RestrictedInterpositionUnitTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/interposition/RestrictedInterpositionUnitTest.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/interposition/RestrictedInterpositionUnitTest.java 2010-03-06 23:46:19 UTC (rev 31975)
@@ -0,0 +1,68 @@
+/*
+ * 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) 2004,
+ *
+ * Arjuna Technologies Ltd,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: xidcheck.java 2342 2006-03-30 13:06:17Z $
+ */
+
+package com.hp.mwtests.ts.jts.interposition;
+
+import org.junit.Test;
+import org.omg.CosTransactions.Control;
+import org.omg.CosTransactions.PropagationContext;
+
+import com.arjuna.ats.internal.jts.OTSImpleManager;
+import com.arjuna.ats.internal.jts.interposition.resources.restricted.RestrictedInterposition;
+import com.arjuna.ats.internal.jts.interposition.resources.restricted.RestrictedInterpositionCreator;
+import com.arjuna.ats.internal.jts.orbspecific.ControlImple;
+import com.hp.mwtests.ts.jts.resources.TestBase;
+
+import static org.junit.Assert.*;
+
+public class RestrictedInterpositionUnitTest extends TestBase
+{
+ @Test
+ public void test () throws Exception
+ {
+ RestrictedInterposition inter = new RestrictedInterposition();
+
+ OTSImpleManager.current().begin();
+ OTSImpleManager.current().begin();
+
+ PropagationContext ctx = OTSImpleManager.current().get_control().get_coordinator().get_txcontext();
+
+ ControlImple cont = inter.setupHierarchy(ctx);
+
+ RestrictedInterpositionCreator creator = new RestrictedInterpositionCreator();
+
+ assertTrue(creator.recreateLocal(ctx) != null);
+ assertTrue(creator.recreate(ctx) != null);
+
+ OTSImpleManager.current().rollback();
+ OTSImpleManager.current().rollback();
+ }
+}
Added: labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/interposition/StrictInterpositionUnitTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/interposition/StrictInterpositionUnitTest.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/interposition/StrictInterpositionUnitTest.java 2010-03-06 23:46:19 UTC (rev 31975)
@@ -0,0 +1,63 @@
+/*
+ * 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) 2004,
+ *
+ * Arjuna Technologies Ltd,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: xidcheck.java 2342 2006-03-30 13:06:17Z $
+ */
+
+package com.hp.mwtests.ts.jts.interposition;
+
+import org.junit.Test;
+import org.omg.CosTransactions.Control;
+import org.omg.CosTransactions.PropagationContext;
+
+import com.arjuna.ats.internal.jts.OTSImpleManager;
+import com.arjuna.ats.internal.jts.interposition.resources.strict.StrictInterpositionCreator;
+import com.arjuna.ats.internal.jts.orbspecific.ControlImple;
+import com.hp.mwtests.ts.jts.resources.TestBase;
+
+import static org.junit.Assert.*;
+
+public class StrictInterpositionUnitTest extends TestBase
+{
+ @Test
+ public void test () throws Exception
+ {
+ StrictInterpositionCreator creator = new StrictInterpositionCreator();
+
+ OTSImpleManager.current().begin();
+ OTSImpleManager.current().begin();
+
+ PropagationContext ctx = OTSImpleManager.current().get_control().get_coordinator().get_txcontext();
+
+ assertTrue(creator.recreateLocal(ctx) != null);
+ assertTrue(creator.recreate(ctx) != null);
+
+ OTSImpleManager.current().rollback();
+ OTSImpleManager.current().rollback();
+ }
+}
Added: labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/local/transactions/AtomicTransactionUnitTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/local/transactions/AtomicTransactionUnitTest.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/local/transactions/AtomicTransactionUnitTest.java 2010-03-06 23:46:19 UTC (rev 31975)
@@ -0,0 +1,142 @@
+/*
+ * 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) 2004,
+ *
+ * Arjuna Technologies Ltd,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: xidcheck.java 2342 2006-03-30 13:06:17Z $
+ */
+
+package com.hp.mwtests.ts.jts.local.transactions;
+
+import org.junit.Test;
+import org.omg.CORBA.TRANSACTION_ROLLEDBACK;
+
+import com.arjuna.ats.arjuna.common.Uid;
+import com.arjuna.ats.internal.jts.OTSImpleManager;
+import com.arjuna.ats.jts.extensions.AtomicTransaction;
+import com.hp.mwtests.ts.jts.orbspecific.resources.DemoResource;
+import com.hp.mwtests.ts.jts.orbspecific.resources.DemoSubTranResource;
+import com.hp.mwtests.ts.jts.orbspecific.resources.demosync;
+import com.hp.mwtests.ts.jts.resources.TestBase;
+
+import static org.junit.Assert.*;
+
+
+public class AtomicTransactionUnitTest extends TestBase
+{
+ @Test
+ public void test () throws Exception
+ {
+ AtomicTransaction A = new AtomicTransaction();
+
+ A.begin();
+
+ assertTrue(A.get_transaction_name() != null);
+
+ A.set_timeout(10);
+
+ assertEquals(A.get_timeout(), 10);
+
+ assertTrue(A.getTimeout() != -1);
+ assertTrue(A.get_txcontext() != null);
+ assertTrue(A.get_uid().notEquals(Uid.nullUid()));
+ assertTrue(A.control() != null);
+
+ assertFalse(A.equals(null));
+ assertTrue(A.equals(A));
+ assertFalse(A.equals(new AtomicTransaction()));
+
+ A.rollback();
+ }
+
+ @Test
+ public void testCommit () throws Exception
+ {
+ AtomicTransaction A = new AtomicTransaction();
+
+ A.begin();
+
+ assertTrue(A.get_txcontext() != null);
+
+ A.registerResource(new DemoResource().getResource());
+
+ AtomicTransaction B = new AtomicTransaction();
+
+ B.begin();
+
+ B.registerSubtranAware(new DemoSubTranResource().getReference());
+
+ B.commit(true);
+
+ A.commit(true);
+
+ A = new AtomicTransaction();
+
+ A.begin();
+
+ A.rollbackOnly();
+
+ try
+ {
+ A.commit(true);
+
+ fail();
+ }
+ catch (final TRANSACTION_ROLLEDBACK ex)
+ {
+ }
+ }
+
+ @Test
+ public void testRollback () throws Exception
+ {
+ AtomicTransaction A = new AtomicTransaction();
+
+ A.begin();
+
+ A.registerSynchronization(new demosync(false).getReference());
+
+ A.rollback();
+ }
+
+ @Test
+ public void testSuspendResume () throws Exception
+ {
+ AtomicTransaction A = new AtomicTransaction();
+
+ A.begin();
+
+ assertTrue(A.control() != null);
+
+ A.suspend();
+
+ assertEquals(OTSImpleManager.current().get_control(), null);
+
+ A.resume();
+
+ assertTrue(OTSImpleManager.current() != null);
+ }
+}
Added: labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/local/transactions/ThreadUnitTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/local/transactions/ThreadUnitTest.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/local/transactions/ThreadUnitTest.java 2010-03-06 23:46:19 UTC (rev 31975)
@@ -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) 2004,
+ *
+ * Arjuna Technologies Ltd,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: xidcheck.java 2342 2006-03-30 13:06:17Z $
+ */
+
+package com.hp.mwtests.ts.jts.local.transactions;
+
+import org.junit.Test;
+
+import com.arjuna.ats.internal.jts.OTSImpleManager;
+import com.arjuna.ats.jts.thread.OTSThread;
+import com.hp.mwtests.ts.jts.resources.TestBase;
+
+import static org.junit.Assert.*;
+
+class DummyThread extends OTSThread
+{
+ public void run ()
+ {
+ super.run();
+
+ if (OTSImpleManager.current().get_control() != null)
+ _transactional = true;
+
+ terminate();
+ }
+
+ public boolean transactional ()
+ {
+ return _transactional;
+ }
+
+ private boolean _transactional = false;
+}
+
+
+public class ThreadUnitTest extends TestBase
+{
+ @Test
+ public void test () throws Exception
+ {
+ OTSImpleManager.current().begin();
+
+ DummyThread t = new DummyThread();
+
+ t.start();
+
+ t.join();
+
+ assertTrue(t.transactional());
+ }
+}
Added: labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/local/transactions/TxAssociationUnitTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/local/transactions/TxAssociationUnitTest.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/local/transactions/TxAssociationUnitTest.java 2010-03-06 23:46:19 UTC (rev 31975)
@@ -0,0 +1,56 @@
+/*
+ * 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) 2004,
+ *
+ * Arjuna Technologies Ltd,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: xidcheck.java 2342 2006-03-30 13:06:17Z $
+ */
+
+package com.hp.mwtests.ts.jts.local.transactions;
+
+import org.junit.Test;
+
+import com.arjuna.ats.jts.extensions.DebugTxAssociation;
+import com.hp.mwtests.ts.jts.resources.TestBase;
+
+import static org.junit.Assert.*;
+
+public class TxAssociationUnitTest extends TestBase
+{
+ @Test
+ public void test () throws Exception
+ {
+ DebugTxAssociation tx = new DebugTxAssociation();
+
+ tx.begin(null);
+ tx.commit(null);
+ tx.rollback(null);
+ tx.suspend(null);
+ tx.resume(null);
+
+ assertEquals(tx.name(), "Debug");
+ }
+}
Added: labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/local/transactions/TxErrorUnitTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/local/transactions/TxErrorUnitTest.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/local/transactions/TxErrorUnitTest.java 2010-03-06 23:46:19 UTC (rev 31975)
@@ -0,0 +1,50 @@
+/*
+ * 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) 2004,
+ *
+ * Arjuna Technologies Ltd,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: xidcheck.java 2342 2006-03-30 13:06:17Z $
+ */
+
+package com.hp.mwtests.ts.jts.local.transactions;
+
+import org.junit.Test;
+
+import com.arjuna.ats.jts.exceptions.TxError;
+import com.hp.mwtests.ts.jts.resources.TestBase;
+
+import static org.junit.Assert.*;
+
+public class TxErrorUnitTest extends TestBase
+{
+ @Test
+ public void test () throws Exception
+ {
+ TxError tx = new TxError();
+
+ tx = new TxError("foobar");
+ }
+}
Modified: labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerNestedOSIActionUnitTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerNestedOSIActionUnitTest.java 2010-03-06 10:50:41 UTC (rev 31974)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerNestedOSIActionUnitTest.java 2010-03-06 23:46:19 UTC (rev 31975)
@@ -53,6 +53,8 @@
ServerControl sc = new ServerControl(tx.get_uid(), theControl, tx, theControl.get_coordinator(), theControl.get_terminator());
ServerOSINestedAction act = new ServerOSINestedAction(sc, true);
+ assertFalse(act.interposeResource());
+
act.commit_subtransaction(null);
}
Added: labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerNestedRestrictedUnitTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerNestedRestrictedUnitTest.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerNestedRestrictedUnitTest.java 2010-03-06 23:46:19 UTC (rev 31975)
@@ -0,0 +1,59 @@
+/*
+ * 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) 2004,
+ *
+ * Arjuna Technologies Ltd,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: xidcheck.java 2342 2006-03-30 13:06:17Z $
+ */
+
+package com.hp.mwtests.ts.jts.orbspecific.interposition;
+
+import org.junit.Test;
+import org.omg.CosTransactions.Control;
+
+import com.arjuna.ats.internal.jts.orbspecific.ControlImple;
+import com.arjuna.ats.internal.jts.orbspecific.coordinator.ArjunaTransactionImple;
+import com.arjuna.ats.internal.jts.orbspecific.interposition.ServerControl;
+import com.arjuna.ats.internal.jts.orbspecific.interposition.resources.restricted.ServerRestrictedNestedAction;
+import com.hp.mwtests.ts.jts.resources.TestBase;
+
+import static org.junit.Assert.*;
+
+public class ServerNestedRestrictedUnitTest extends TestBase
+{
+ @Test
+ public void test () throws Exception
+ {
+ ControlImple cont = new ControlImple(null, null);
+ Control theControl = cont.getControl();
+ ArjunaTransactionImple tx = cont.getImplHandle();
+ ServerControl sc = new ServerControl(tx.get_uid(), theControl, tx, theControl.get_coordinator(), theControl.get_terminator());
+ ServerRestrictedNestedAction act = new ServerRestrictedNestedAction(sc);
+
+ assertTrue(act.deepestControl() != null);
+ assertEquals(act.child(), null);
+ }
+}
Added: labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerNestedStrictUnitTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerNestedStrictUnitTest.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerNestedStrictUnitTest.java 2010-03-06 23:46:19 UTC (rev 31975)
@@ -0,0 +1,72 @@
+/*
+ * 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) 2004,
+ *
+ * Arjuna Technologies Ltd,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: xidcheck.java 2342 2006-03-30 13:06:17Z $
+ */
+
+package com.hp.mwtests.ts.jts.orbspecific.interposition;
+
+import org.junit.Test;
+import org.omg.CosTransactions.Control;
+
+import com.arjuna.ats.internal.jts.orbspecific.ControlImple;
+import com.arjuna.ats.internal.jts.orbspecific.coordinator.ArjunaTransactionImple;
+import com.arjuna.ats.internal.jts.orbspecific.interposition.ServerControl;
+import com.arjuna.ats.internal.jts.orbspecific.interposition.resources.strict.ServerStrictNestedAction;
+import com.hp.mwtests.ts.jts.resources.TestBase;
+
+import static org.junit.Assert.*;
+
+public class ServerNestedStrictUnitTest extends TestBase
+{
+ @Test
+ public void testCommit () throws Exception
+ {
+ ControlImple cont = new ControlImple(null, null);
+ Control theControl = cont.getControl();
+ ArjunaTransactionImple tx = cont.getImplHandle();
+ ServerControl sc = new ServerControl(tx.get_uid(), theControl, tx, theControl.get_coordinator(), theControl.get_terminator());
+ ServerStrictNestedAction act = new ServerStrictNestedAction(sc, true);
+
+ assertFalse(act.interposeResource());
+
+ act.commit_subtransaction(null);
+ }
+
+ @Test
+ public void testRollback () throws Exception
+ {
+ ControlImple cont = new ControlImple(null, null);
+ Control theControl = cont.getControl();
+ ArjunaTransactionImple tx = cont.getImplHandle();
+ ServerControl sc = new ServerControl(tx.get_uid(), theControl, tx, theControl.get_coordinator(), theControl.get_terminator());
+ ServerStrictNestedAction act = new ServerStrictNestedAction(sc, true);
+
+ act.rollback_subtransaction();
+ }
+}
Added: labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerTopLevelRestrictedUnitTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerTopLevelRestrictedUnitTest.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerTopLevelRestrictedUnitTest.java 2010-03-06 23:46:19 UTC (rev 31975)
@@ -0,0 +1,62 @@
+/*
+ * 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) 2004,
+ *
+ * Arjuna Technologies Ltd,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: xidcheck.java 2342 2006-03-30 13:06:17Z $
+ */
+
+package com.hp.mwtests.ts.jts.orbspecific.interposition;
+
+import org.junit.Test;
+import org.omg.CORBA.INVALID_TRANSACTION;
+import org.omg.CosTransactions.Control;
+import org.omg.CosTransactions.Vote;
+
+import com.arjuna.ats.internal.jts.orbspecific.ControlImple;
+import com.arjuna.ats.internal.jts.orbspecific.coordinator.ArjunaTransactionImple;
+import com.arjuna.ats.internal.jts.orbspecific.interposition.ServerControl;
+import com.arjuna.ats.internal.jts.orbspecific.interposition.resources.restricted.ServerRestrictedTopLevelAction;
+import com.hp.mwtests.ts.jts.resources.TestBase;
+
+import static org.junit.Assert.*;
+
+public class ServerTopLevelRestrictedUnitTest extends TestBase
+{
+ @Test
+ public void testCommit () throws Exception
+ {
+ ControlImple cont = new ControlImple(null, null);
+ Control theControl = cont.getControl();
+ ArjunaTransactionImple tx = cont.getImplHandle();
+ ServerControl sc = new ServerControl(tx.get_uid(), theControl, tx, theControl.get_coordinator(), theControl.get_terminator());
+ ServerRestrictedTopLevelAction act = new ServerRestrictedTopLevelAction(sc);
+
+ assertTrue(act.type() != null);
+ assertTrue(act.child() == null);
+ assertTrue(act.deepestControl() != null);
+ }
+}
Added: labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerTopLevelStrictUnitTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerTopLevelStrictUnitTest.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerTopLevelStrictUnitTest.java 2010-03-06 23:46:19 UTC (rev 31975)
@@ -0,0 +1,61 @@
+/*
+ * 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) 2004,
+ *
+ * Arjuna Technologies Ltd,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: xidcheck.java 2342 2006-03-30 13:06:17Z $
+ */
+
+package com.hp.mwtests.ts.jts.orbspecific.interposition;
+
+import org.junit.Test;
+import org.omg.CORBA.INVALID_TRANSACTION;
+import org.omg.CosTransactions.Control;
+import org.omg.CosTransactions.Vote;
+
+import com.arjuna.ats.internal.jts.orbspecific.ControlImple;
+import com.arjuna.ats.internal.jts.orbspecific.coordinator.ArjunaTransactionImple;
+import com.arjuna.ats.internal.jts.orbspecific.interposition.ServerControl;
+import com.arjuna.ats.internal.jts.orbspecific.interposition.resources.strict.ServerStrictTopLevelAction;
+import com.hp.mwtests.ts.jts.resources.TestBase;
+
+import static org.junit.Assert.*;
+
+public class ServerTopLevelStrictUnitTest extends TestBase
+{
+ @Test
+ public void test () throws Exception
+ {
+ ControlImple cont = new ControlImple(null, null);
+ Control theControl = cont.getControl();
+ ArjunaTransactionImple tx = cont.getImplHandle();
+ ServerControl sc = new ServerControl(tx.get_uid(), theControl, tx, theControl.get_coordinator(), theControl.get_terminator());
+ ServerStrictTopLevelAction act = new ServerStrictTopLevelAction(sc, true);
+
+ assertTrue(act.interposeResource());
+ assertTrue(act.type() != null);
+ }
+}
Added: labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/recovery/RecoveryCoordinatorUnitTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/recovery/RecoveryCoordinatorUnitTest.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/recovery/RecoveryCoordinatorUnitTest.java 2010-03-06 23:46:19 UTC (rev 31975)
@@ -0,0 +1,54 @@
+/*
+ * 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) 2004,
+ *
+ * Arjuna Technologies Ltd,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: xidcheck.java 2342 2006-03-30 13:06:17Z $
+ */
+
+package com.hp.mwtests.ts.jts.orbspecific.recovery;
+
+import org.junit.Test;
+
+import com.arjuna.ats.arjuna.common.Uid;
+import com.arjuna.ats.internal.jts.orbspecific.recovery.recoverycoordinators.GenericRecoveryCoordinator;
+import com.hp.mwtests.ts.jts.resources.TestBase;
+
+import static org.junit.Assert.*;
+
+public class RecoveryCoordinatorUnitTest extends TestBase
+{
+ @Test
+ public void testGeneric () throws Exception
+ {
+ GenericRecoveryCoordinator rec = new GenericRecoveryCoordinator(new Uid(), new Uid(), new Uid(), false);
+
+ rec.replay_completion(null);
+
+ assertTrue(GenericRecoveryCoordinator.makeId(new Uid(), new Uid(), new Uid(), true) != null);
+ assertEquals(GenericRecoveryCoordinator.reconstruct("foobar"), null);
+ }
+}
Added: labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/recovery/RecoveryEnablementUnitTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/recovery/RecoveryEnablementUnitTest.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/recovery/RecoveryEnablementUnitTest.java 2010-03-06 23:46:19 UTC (rev 31975)
@@ -0,0 +1,56 @@
+/*
+ * 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) 2004,
+ *
+ * Arjuna Technologies Ltd,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: xidcheck.java 2342 2006-03-30 13:06:17Z $
+ */
+
+package com.hp.mwtests.ts.jts.orbspecific.recovery;
+
+import org.junit.Test;
+
+import com.arjuna.ats.internal.jts.orbspecific.recovery.RecoveryEnablement;
+import com.hp.mwtests.ts.jts.resources.TestBase;
+
+import static org.junit.Assert.*;
+
+public class RecoveryEnablementUnitTest extends TestBase
+{
+ @Test
+ public void test () throws Exception
+ {
+ RecoveryEnablement rec = new RecoveryEnablement();
+
+ assertTrue(rec.startRCservice());
+
+ RecoveryEnablement.isNotANormalProcess();
+
+ assertFalse(RecoveryEnablement.isNormalProcess());
+
+ assertTrue(RecoveryEnablement.getRecoveryManagerTag() != null);
+ }
+}
Added: labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/xa/TxUnitTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/xa/TxUnitTest.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/xa/TxUnitTest.java 2010-03-06 23:46:19 UTC (rev 31975)
@@ -0,0 +1,60 @@
+/*
+ * 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) 2004,
+ *
+ * Arjuna Technologies Ltd,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: xidcheck.java 2342 2006-03-30 13:06:17Z $
+ */
+
+package com.hp.mwtests.ts.jts.xa;
+
+import org.junit.Test;
+
+import com.arjuna.ats.jts.tx.tx;
+import com.hp.mwtests.ts.jts.resources.TestBase;
+
+import static org.junit.Assert.*;
+
+public class TxUnitTest extends TestBase
+{
+ @Test
+ public void test () throws Exception
+ {
+ assertEquals(tx.tx_open(), tx.TX_OK);
+ assertEquals(tx.tx_close(), tx.TX_OK);
+ assertEquals(tx.tx_allow_nesting(), tx.TX_OK);
+
+ assertEquals(tx.tx_set_transaction_timeout(10), tx.TX_OK);
+ assertEquals(tx.tx_begin(), tx.TX_OK);
+ assertEquals(tx.tx_set_commit_return(1), tx.TX_OK);
+ assertEquals(tx.tx_commit(), tx.TX_OK);
+
+ assertEquals(tx.tx_begin(), tx.TX_OK);
+ assertEquals(tx.tx_rollback(), tx.TX_OK);
+
+ assertEquals(tx.tx_set_transaction_control(1), tx.TX_FAIL);
+ }
+}
More information about the jboss-svn-commits
mailing list