[jboss-svn-commits] JBL Code SVN: r31974 - in labs/jbosstm/trunk/ArjunaJTS/jts: classes/com/arjuna/ats/internal/jts/orbspecific/interposition/resources/arjuna and 4 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Sat Mar 6 05:50:42 EST 2010


Author: mark.little at jboss.com
Date: 2010-03-06 05:50:41 -0500 (Sat, 06 Mar 2010)
New Revision: 31974

Added:
   labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/
   labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerControlUnitTest.java
   labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerNestedActionUnitTest.java
   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/ServerRecoveryTopLevelUnitTest.java
   labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerSynchronizationUnitTest.java
   labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerTopLevelActionUnitTest.java
   labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerTopLevelOSIActionUnitTest.java
   labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerTransactionUnitTest.java
   labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/resources/TestBase.java
Modified:
   labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/interposition/resources/ServerSynchronization.java
   labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/interposition/resources/arjuna/ServerNestedAction.java
   labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/interposition/resources/osi/ServerOSITopLevelAction.java
Log:
https://jira.jboss.org/jira/browse/JBTM-715

Modified: labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/interposition/resources/ServerSynchronization.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/interposition/resources/ServerSynchronization.java	2010-03-05 21:12:36 UTC (rev 31973)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/interposition/resources/ServerSynchronization.java	2010-03-06 10:50:41 UTC (rev 31974)
@@ -37,12 +37,6 @@
 import com.arjuna.ats.jts.exceptions.ExceptionCodes;
 import com.arjuna.ats.jts.logging.*;
 
-import com.arjuna.orbportability.OA;
-
-import com.arjuna.ats.arjuna.common.Uid;
-
-import com.arjuna.common.util.logging.*;
-
 import org.omg.CosTransactions.*;
 import org.omg.CORBA.CompletionStatus;
 

Modified: labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/interposition/resources/arjuna/ServerNestedAction.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/interposition/resources/arjuna/ServerNestedAction.java	2010-03-05 21:12:36 UTC (rev 31973)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/interposition/resources/arjuna/ServerNestedAction.java	2010-03-06 10:50:41 UTC (rev 31974)
@@ -31,14 +31,8 @@
 
 package com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna;
 
-import com.arjuna.orbportability.*;
-
 import com.arjuna.ats.internal.arjuna.thread.ThreadActionData;
 
-import com.arjuna.ats.arjuna.common.*;
-import com.arjuna.ats.arjuna.coordinator.*;
-
-import com.arjuna.ats.jts.*;
 import com.arjuna.ats.jts.exceptions.ExceptionCodes;
 import com.arjuna.ats.jts.logging.*;
 
@@ -61,380 +55,446 @@
 
 /**
  * This looks like an atomic action, but is not actually derived from
- * BasicAction or OTS_Transaction. This is because of the way in which the
- * OTS creates and manipulates transactions.
- *
- * This is a nested action proxy.
- *
+ * BasicAction or OTS_Transaction. This is because of the way in which the OTS
+ * creates and manipulates transactions. This is a nested action proxy.
+ * 
  * @message com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.generror_2 {0} caught exception: {1}
  */
 
-public class ServerNestedAction extends ServerResource implements org.omg.CosTransactions.SubtransactionAwareResourceOperations
+public class ServerNestedAction extends ServerResource implements
+        org.omg.CosTransactions.SubtransactionAwareResourceOperations
 {
-    
+
     /**
      * Create local transactions with same ids as remote.
-     *
+     * 
      * @message com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.ipfailed_2 {0} - could not register interposed hierarchy!
      */
 
-public ServerNestedAction (ServerControl myControl)
+    public ServerNestedAction(ServerControl myControl)
     {
-	super(myControl);
+        super(myControl);
 
-	if (jtsLogger.logger.isDebugEnabled())
-	{
-	    jtsLogger.logger.debug(DebugLevel.CONSTRUCTORS, VisibilityLevel.VIS_PUBLIC,
-					       com.arjuna.ats.jts.logging.FacilityCode.FAC_OTS, "ServerNestedAction::ServerNestedAction ( "+_theUid+" )");
-	}
+        if (jtsLogger.logger.isDebugEnabled())
+        {
+            jtsLogger.logger.debug(DebugLevel.CONSTRUCTORS,
+                    VisibilityLevel.VIS_PUBLIC,
+                    com.arjuna.ats.jts.logging.FacilityCode.FAC_OTS,
+                    "ServerNestedAction::ServerNestedAction ( " + _theUid
+                            + " )");
+        }
 
-	_theResource = null;
-	_resourceRef = null;
-	
-	if (_theControl != null)
-	{
-	    _theResource = new org.omg.CosTransactions.SubtransactionAwareResourcePOATie(this);
+        _theResource = null;
+        _resourceRef = null;
 
-	    ORBManager.getPOA().objectIsReady(_theResource);
+        if (_theControl != null)
+        {
+            _theResource = new org.omg.CosTransactions.SubtransactionAwareResourcePOATie(
+                    this);
 
-	    _resourceRef = org.omg.CosTransactions.SubtransactionAwareResourceHelper.narrow(ORBManager.getPOA().corbaReference(_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);
-	     */
-	    
-	    Coordinator realCoordinator = _theControl.originalCoordinator();
+            ORBManager.getPOA().objectIsReady(_theResource);
 
-	    if (!(_valid = registerSubTran(realCoordinator)))
-	    {
-		if (jtsLogger.loggerI18N.isWarnEnabled())
-		{
-		    jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.ipfailed_2",
-					      new Object[] {"ServerNestedAction"});
-		}
+            _resourceRef = org.omg.CosTransactions.SubtransactionAwareResourceHelper
+                    .narrow(ORBManager.getPOA().corbaReference(_theResource));
 
-		/*
-		 * Failed to register. Valid is set, and the interposition
-		 * controller will now deal with this.
-		 */
+            /*
+             * 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);
+             */
 
-		realCoordinator = null;
-	    }
-	}
+            Coordinator realCoordinator = _theControl.originalCoordinator();
+
+            if (!(_valid = registerSubTran(realCoordinator)))
+            {
+                if (jtsLogger.loggerI18N.isWarnEnabled())
+                {
+                    jtsLogger.loggerI18N
+                            .warn(
+                                    "com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.ipfailed_2",
+                                    new Object[]
+                                    { "ServerNestedAction" });
+                }
+
+                /*
+                 * Failed to register. Valid is set, and the interposition
+                 * controller will now deal with this.
+                 */
+
+                realCoordinator = null;
+            }
+        }
     }
 
     /**
      * @message com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.nullcontrol_1 {0} - attempt to commit with null control!
      */
 
-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, "ServerNestedAction::commit_subtransaction : "+_theUid);
-	}
+        if (jtsLogger.logger.isDebugEnabled())
+        {
+            jtsLogger.logger.debug(DebugLevel.FUNCTIONS,
+                    VisibilityLevel.VIS_PUBLIC,
+                    com.arjuna.ats.jts.logging.FacilityCode.FAC_OTS,
+                    "ServerNestedAction::commit_subtransaction : " + _theUid);
+        }
 
-	if (_theControl == null)
-	{
-	    if (jtsLogger.loggerI18N.isWarnEnabled())
-	    {
-		jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.nullcontrol_1",
-					      new Object[] {"ServerNestedAction.commit_subtransaction"});
-	    }
+        if (_theControl == null)
+        {
+            if (jtsLogger.loggerI18N.isWarnEnabled())
+            {
+                jtsLogger.loggerI18N
+                        .warn(
+                                "com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.nullcontrol_1",
+                                new Object[]
+                                { "ServerNestedAction.commit_subtransaction" });
+            }
 
-	    throw new INVALID_TRANSACTION(ExceptionCodes.SERVERAA_NO_CONTROL, CompletionStatus.COMPLETED_NO);
-	}
+            throw new INVALID_TRANSACTION(ExceptionCodes.SERVERAA_NO_CONTROL,
+                    CompletionStatus.COMPLETED_NO);
+        }
 
-	if (_theControl.isWrapper())
-	{
-	    destroyResource();
-	    return;
-	}
-		
-	ServerTransaction theTransaction = (ServerTransaction) _theControl.getImplHandle();
-	
-	//	ThreadActionData.pushAction(theTransaction);
-    
-	/*
-	 * Do nothing about propagation since we should already be
-	 * registered with the parent, i.e., ignore the parent
-	 * parameter.
-	 */
+        if (_theControl.isWrapper())
+        {
+            destroyResource();
+            return;
+        }
 
-	/*
-	 * We should not get exceptions here.
-	 */
-	
-	try
-	{
-	    theTransaction.commit(false);
-	}
-	catch (TRANSACTION_ROLLEDBACK e1)
-	{
-	    if (jtsLogger.loggerI18N.isWarnEnabled())
-	    {
-		jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.generror_2",
-					  new Object[] {"ServerNestedAction.commit_subtransaction", e1});
-	    }
+        ServerTransaction theTransaction = (ServerTransaction) _theControl
+                .getImplHandle();
 
-	    throw e1;
-	}
-	catch (INVALID_TRANSACTION e5)
-	{
-	    if (jtsLogger.loggerI18N.isWarnEnabled())
-	    {
-		jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.generror_2",
-					  new Object[] {"ServerNestedAction.commit_subtransaction", e5});
-	    }
+        // ThreadActionData.pushAction(theTransaction);
 
-	    throw e5;
-	}
-	catch (HeuristicMixed e2)
-	{
-	    if (jtsLogger.loggerI18N.isWarnEnabled())
-	    {
-		jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.generror_2",
-					  new Object[] {"ServerNestedAction.commit_subtransaction", e2});
-	    }
+        /*
+         * Do nothing about propagation since we should already be registered
+         * with the parent, i.e., ignore the parent parameter.
+         */
 
-	    /*
-	     * Can't rethrow heuristic exceptions for subtransactions!
-	     */
-	    
-	    throw new BAD_OPERATION(ExceptionCodes.HEURISTIC_COMMIT, CompletionStatus.COMPLETED_MAYBE);
-	}
-	catch (HeuristicHazard e3)
-	{
-	    if (jtsLogger.loggerI18N.isWarnEnabled())
-	    {
-		jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.generror_2",
-					  new Object[] {"ServerNestedAction.commit_subtransaction", e3});
-	    }
+        /*
+         * We should not get exceptions here.
+         */
 
-	    throw new BAD_OPERATION(ExceptionCodes.HEURISTIC_COMMIT, CompletionStatus.COMPLETED_MAYBE);
-	}
-	catch (SystemException e4)
-	{
-	    if (jtsLogger.loggerI18N.isWarnEnabled())
-	    {
-		jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.generror_2",
-					  new Object[] {"ServerNestedAction.commit_subtransaction", e4});
-	    }
+        try
+        {
+            theTransaction.commit(false);
+        }
+        catch (TRANSACTION_ROLLEDBACK e1)
+        {
+            if (jtsLogger.loggerI18N.isWarnEnabled())
+            {
+                jtsLogger.loggerI18N
+                        .warn(
+                                "com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.generror_2",
+                                new Object[]
+                                { "ServerNestedAction.commit_subtransaction",
+                                        e1 });
+            }
 
-	    throw e4;
-	}
-	catch (Exception e5)
-	{
-	    if (jtsLogger.loggerI18N.isWarnEnabled())
-	    {
-		jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.generror_2",
-					  new Object[] {"ServerNestedAction.commit_subtransaction", e5});
-	    }
+            throw e1;
+        }
+        catch (INVALID_TRANSACTION e5)
+        {
+            if (jtsLogger.loggerI18N.isWarnEnabled())
+            {
+                jtsLogger.loggerI18N
+                        .warn(
+                                "com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.generror_2",
+                                new Object[]
+                                { "ServerNestedAction.commit_subtransaction",
+                                        e5 });
+            }
 
-	    throw new UNKNOWN(e5.toString());
-	}
-	finally
-	{
-	    ThreadActionData.popAction();
-	    destroyResource();
-	}
+            throw e5;
+        }
+        catch (HeuristicMixed e2)
+        {
+            if (jtsLogger.loggerI18N.isWarnEnabled())
+            {
+                jtsLogger.loggerI18N
+                        .warn(
+                                "com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.generror_2",
+                                new Object[]
+                                { "ServerNestedAction.commit_subtransaction",
+                                        e2 });
+            }
+
+            /*
+             * Can't rethrow heuristic exceptions for subtransactions!
+             */
+
+            throw new BAD_OPERATION(ExceptionCodes.HEURISTIC_COMMIT,
+                    CompletionStatus.COMPLETED_MAYBE);
+        }
+        catch (HeuristicHazard e3)
+        {
+            if (jtsLogger.loggerI18N.isWarnEnabled())
+            {
+                jtsLogger.loggerI18N
+                        .warn(
+                                "com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.generror_2",
+                                new Object[]
+                                { "ServerNestedAction.commit_subtransaction",
+                                        e3 });
+            }
+
+            throw new BAD_OPERATION(ExceptionCodes.HEURISTIC_COMMIT,
+                    CompletionStatus.COMPLETED_MAYBE);
+        }
+        catch (SystemException e4)
+        {
+            if (jtsLogger.loggerI18N.isWarnEnabled())
+            {
+                jtsLogger.loggerI18N
+                        .warn(
+                                "com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.generror_2",
+                                new Object[]
+                                { "ServerNestedAction.commit_subtransaction",
+                                        e4 });
+            }
+
+            throw e4;
+        }
+        catch (Exception e5)
+        {
+            if (jtsLogger.loggerI18N.isWarnEnabled())
+            {
+                jtsLogger.loggerI18N
+                        .warn(
+                                "com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.generror_2",
+                                new Object[]
+                                { "ServerNestedAction.commit_subtransaction",
+                                        e5 });
+            }
+
+            throw new UNKNOWN(e5.toString());
+        }
+        finally
+        {
+            ThreadActionData.popAction();
+            destroyResource();
+        }
     }
 
     /**
      * @message com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.nullcontrol_2 {0} - attempt to rollback transaction will null control!
      */
 
-public void rollback_subtransaction () throws SystemException
+    public void rollback_subtransaction () throws SystemException
     {
-	if (jtsLogger.logger.isDebugEnabled())
-	{
-	    jtsLogger.logger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
-					       com.arjuna.ats.jts.logging.FacilityCode.FAC_OTS, "ServerNestedAction::rollback_subtransaction : "+_theUid);
-	}
+        if (jtsLogger.logger.isDebugEnabled())
+        {
+            jtsLogger.logger.debug(DebugLevel.FUNCTIONS,
+                    VisibilityLevel.VIS_PUBLIC,
+                    com.arjuna.ats.jts.logging.FacilityCode.FAC_OTS,
+                    "ServerNestedAction::rollback_subtransaction : " + _theUid);
+        }
 
-	if (_theControl == null)
-	{
-	    if (jtsLogger.loggerI18N.isWarnEnabled())
-	    {
-		jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.nullcontrol_2",
-					  new Object[] {"ServerNestedAction.rollback_subtransaction"});
-	    }
+        if (_theControl == null)
+        {
+            if (jtsLogger.loggerI18N.isWarnEnabled())
+            {
+                jtsLogger.loggerI18N
+                        .warn(
+                                "com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.nullcontrol_2",
+                                new Object[]
+                                { "ServerNestedAction.rollback_subtransaction" });
+            }
 
-	    throw new INVALID_TRANSACTION(ExceptionCodes.SERVERAA_NO_CONTROL, CompletionStatus.COMPLETED_NO);
-	}
+            throw new INVALID_TRANSACTION(ExceptionCodes.SERVERAA_NO_CONTROL,
+                    CompletionStatus.COMPLETED_NO);
+        }
 
-	if (_theControl.isWrapper())
-	{
-	    destroyResource();
-	    return;
-	}
+        if (_theControl.isWrapper())
+        {
+            destroyResource();
+            return;
+        }
 
-	ServerTransaction theTransaction = (ServerTransaction) _theControl.getImplHandle();
-	
-	//	ThreadActionData.pushAction(theTransaction);
+        ServerTransaction theTransaction = (ServerTransaction) _theControl
+                .getImplHandle();
 
-	try
-	{
-	    if (!valid())
-		theTransaction.doPhase2Abort();
-	    else
-		theTransaction.rollback();
-	}
-	catch (SystemException e)
-	{
-	    throw e;
-	}
-	catch (Exception ex)
-	{
-	    throw new UNKNOWN(ex.toString());
-	}
-	finally
-	{
-	    ThreadActionData.popAction();
-	    destroyResource();
-	}
+        // ThreadActionData.pushAction(theTransaction);
+
+        try
+        {
+            if (!valid())
+                theTransaction.doPhase2Abort();
+            else
+                theTransaction.rollback();
+        }
+        catch (SystemException e)
+        {
+            throw e;
+        }
+        catch (Exception ex)
+        {
+            throw new UNKNOWN(ex.toString());
+        }
+        finally
+        {
+            ThreadActionData.popAction();
+            destroyResource();
+        }
     }
 
     /*
      * These methods should never be called.
      */
 
-public org.omg.CosTransactions.Vote prepare () throws SystemException, HeuristicMixed, HeuristicHazard
+    public org.omg.CosTransactions.Vote prepare () throws SystemException,
+            HeuristicMixed, HeuristicHazard
     {
-	throw new BAD_OPERATION(ExceptionCodes.SERVERAA_PREPARE, CompletionStatus.COMPLETED_NO);
+        throw new BAD_OPERATION(ExceptionCodes.SERVERAA_PREPARE,
+                CompletionStatus.COMPLETED_NO);
     }
 
-public void rollback () throws SystemException, HeuristicCommit, HeuristicMixed, HeuristicHazard
+    public void rollback () throws SystemException, HeuristicCommit,
+            HeuristicMixed, HeuristicHazard
     {
     }
-    
-public void commit () throws SystemException, NotPrepared, HeuristicRollback, HeuristicMixed, HeuristicHazard
+
+    public void commit () throws SystemException, NotPrepared,
+            HeuristicRollback, HeuristicMixed, HeuristicHazard
     {
     }
 
-public void forget () throws SystemException
+    public void forget () throws SystemException
     {
     }
 
-public void commit_one_phase () throws HeuristicHazard, SystemException
+    public void commit_one_phase () throws HeuristicHazard, SystemException
     {
     }
 
-public SubtransactionAwareResource theResource ()
+    public SubtransactionAwareResource theResource ()
     {
-	return _resourceRef;
+        return _resourceRef;
     }
- 
-protected ServerNestedAction ()
+
+    protected ServerNestedAction()
     {
-	if (jtsLogger.logger.isDebugEnabled())
-	{
-	    jtsLogger.logger.debug(DebugLevel.CONSTRUCTORS, VisibilityLevel.VIS_PROTECTED,
-					       com.arjuna.ats.jts.logging.FacilityCode.FAC_OTS, "ServerNestedAction::ServerNestedAction ()");
-	}
+        if (jtsLogger.logger.isDebugEnabled())
+        {
+            jtsLogger.logger.debug(DebugLevel.CONSTRUCTORS,
+                    VisibilityLevel.VIS_PROTECTED,
+                    com.arjuna.ats.jts.logging.FacilityCode.FAC_OTS,
+                    "ServerNestedAction::ServerNestedAction ()");
+        }
 
-	_theResource = null;
-	_resourceRef = null;
+        _theResource = null;
+        _resourceRef = null;
     }
 
     /**
      * @message com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.childerror Could not remove child {0} from {1}
      */
 
-protected final synchronized void destroyResource ()
+    protected final synchronized void destroyResource ()
     {
-	if (!_destroyed)
-	{
-	    _destroyed = true;
-	    
-	    if (_parent != null)
-	    {
-		/*
-		 * Now try to garbage collect this resource. Since it was
-		 * registered as a subtranaware resource it won't get called
-		 * again.
-		 */
-	    
-		if (!_parent.removeChild(this))
-		{
-		    if (jtsLogger.loggerI18N.isWarnEnabled())
-		    {
-			jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.childerror",
-						  new Object[] {get_uid(), _parent.get_uid()});
-		    }
-		}
-	    }
+        if (!_destroyed)
+        {
+            _destroyed = true;
 
-	    if (_theResource != null)
-	    {
-		ORBManager.getPOA().shutdownObject(_theResource);
-		_theResource = null;
-	    }
-	}
+            if (_parent != null)
+            {
+                /*
+                 * Now try to garbage collect this resource. Since it was
+                 * registered as a subtranaware resource it won't get called
+                 * again.
+                 */
 
-	tidyup();
+                if (!_parent.removeChild(this))
+                {
+                    if (jtsLogger.loggerI18N.isWarnEnabled())
+                    {
+                        jtsLogger.loggerI18N
+                                .warn(
+                                        "com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.childerror",
+                                        new Object[]
+                                        { get_uid(), _parent.get_uid() });
+                    }
+                }
+            }
+
+            if (_theResource != null)
+            {
+                ORBManager.getPOA().shutdownObject(_theResource);
+                _theResource = null;
+            }
+        }
+
+        tidyup();
     }
 
     /**
      * @message com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.nullcoord {0} - could not register as no Coordinator has been given!
      */
 
-protected boolean registerSubTran (Coordinator theCoordinator)
+    protected boolean registerSubTran (Coordinator theCoordinator)
     {
-	boolean result = false;
+        boolean result = false;
 
-	if (theCoordinator != null)
-	{
-	    try
-	    {
-		theCoordinator.register_subtran_aware(_resourceRef);
-		result = true;
-	    }
-	    catch (Inactive e)
-	    {
-		if (jtsLogger.loggerI18N.isWarnEnabled())
-		{
-		    jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.generror_2",
-					      new Object[] {"ServerNestedAction.registerSubTran", e});
-		}
-	    }
-	    catch (NotSubtransaction e)
-	    {
-		if (jtsLogger.loggerI18N.isWarnEnabled())
-		{
-		    jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.generror_2",
-					      new Object[] {"ServerNestedAction.registerSubTran", e});
-		}
-	    }
-	    catch (SystemException e)
-	    {
-		if (jtsLogger.loggerI18N.isWarnEnabled())
-		{
-		    jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.generror_2",
-					      new Object[] {"ServerNestedAction.registerSubTran", e});
-		}
-	    }
-	}
-	else
-	{
-	    if (jtsLogger.loggerI18N.isWarnEnabled())
-	    {
-		jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.nullcoord",
-					  new Object[] {"ServerNestedAction.registerSubTran"});
-	    }
-	}
+        if (theCoordinator != null)
+        {
+            try
+            {
+                theCoordinator.register_subtran_aware(_resourceRef);
+                result = true;
+            }
+            catch (Inactive e)
+            {
+                if (jtsLogger.loggerI18N.isWarnEnabled())
+                {
+                    jtsLogger.loggerI18N
+                            .warn(
+                                    "com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.generror_2",
+                                    new Object[]
+                                    { "ServerNestedAction.registerSubTran", e });
+                }
+            }
+            catch (NotSubtransaction e)
+            {
+                if (jtsLogger.loggerI18N.isWarnEnabled())
+                {
+                    jtsLogger.loggerI18N
+                            .warn(
+                                    "com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.generror_2",
+                                    new Object[]
+                                    { "ServerNestedAction.registerSubTran", e });
+                }
+            }
+            catch (SystemException e)
+            {
+                if (jtsLogger.loggerI18N.isWarnEnabled())
+                {
+                    jtsLogger.loggerI18N
+                            .warn(
+                                    "com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.generror_2",
+                                    new Object[]
+                                    { "ServerNestedAction.registerSubTran", e });
+                }
+            }
+        }
+        else
+        {
+            if (jtsLogger.loggerI18N.isWarnEnabled())
+            {
+                jtsLogger.loggerI18N
+                        .warn(
+                                "com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.nullcoord",
+                                new Object[]
+                                { "ServerNestedAction.registerSubTran" });
+            }
+        }
 
-	return result;
+        return result;
     }
 
-protected org.omg.CosTransactions.SubtransactionAwareResourcePOATie _theResource;
-protected SubtransactionAwareResource _resourceRef;
- 
+    protected org.omg.CosTransactions.SubtransactionAwareResourcePOATie _theResource;
+
+    protected SubtransactionAwareResource _resourceRef;
+
 }

Modified: labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/interposition/resources/osi/ServerOSITopLevelAction.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/interposition/resources/osi/ServerOSITopLevelAction.java	2010-03-05 21:12:36 UTC (rev 31973)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/interposition/resources/osi/ServerOSITopLevelAction.java	2010-03-06 10:50:41 UTC (rev 31974)
@@ -31,12 +31,8 @@
 
 package com.arjuna.ats.internal.jts.orbspecific.interposition.resources.osi;
 
-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.orbspecific.ControlImple;
 import com.arjuna.ats.internal.jts.orbspecific.interposition.*;
 import com.arjuna.ats.internal.jts.orbspecific.interposition.resources.strict.*;
 import com.arjuna.ats.internal.jts.interposition.resources.osi.*;
@@ -44,10 +40,8 @@
 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 ServerOSITopLevelAction extends ServerStrictTopLevelAction
 {

Added: labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerControlUnitTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerControlUnitTest.java	                        (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerControlUnitTest.java	2010-03-06 10:50:41 UTC (rev 31974)
@@ -0,0 +1,64 @@
+/*
+ * 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.hp.mwtests.ts.jts.resources.TestBase;
+
+import static org.junit.Assert.*;
+
+public class ServerControlUnitTest 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());
+        
+        assertTrue(sc.isWrapper());
+        assertTrue(sc.get_coordinator() != null);
+        assertTrue(sc.get_terminator() != null);
+        
+        assertEquals(sc.getParentImple(), null);
+        assertTrue(sc.forgetHeuristics());
+        assertTrue(sc.toString() != null);
+        
+        sc.destroy();
+    }
+}

Added: labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerNestedActionUnitTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerNestedActionUnitTest.java	                        (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerNestedActionUnitTest.java	2010-03-06 10:50:41 UTC (rev 31974)
@@ -0,0 +1,97 @@
+/*
+ * 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.BAD_OPERATION;
+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.arjuna.ServerNestedAction;
+import com.hp.mwtests.ts.jts.resources.TestBase;
+
+import static org.junit.Assert.*;
+
+public class ServerNestedActionUnitTest 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()); 
+        ServerNestedAction act = new ServerNestedAction(sc);
+        
+        try
+        {
+            act.prepare();
+            
+            fail();
+        }
+        catch (final BAD_OPERATION ex)
+        {
+        }
+        
+        act.commit();
+        act.rollback();
+        act.commit_one_phase();
+        
+        assertTrue(act.theResource() != null);
+    }
+    
+    @Test
+    public void testNestedCommit () 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()); 
+        ServerNestedAction act = new ServerNestedAction(sc);
+        
+        act.commit_subtransaction(null);
+    }
+    
+    @Test
+    public void testNestedRollback () 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()); 
+        ServerNestedAction act = new ServerNestedAction(sc);
+        
+        act.rollback_subtransaction();
+    }
+}

Added: 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	                        (rev 0)
+++ 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)
@@ -0,0 +1,70 @@
+/*
+ * 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.osi.ServerOSINestedAction;
+import com.hp.mwtests.ts.jts.resources.TestBase;
+
+import static org.junit.Assert.*;
+
+public class ServerNestedOSIActionUnitTest 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()); 
+        ServerOSINestedAction act = new ServerOSINestedAction(sc, true);
+        
+        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()); 
+        ServerOSINestedAction act = new ServerOSINestedAction(sc, true);
+        
+        act.rollback_subtransaction();
+    }
+}

Added: labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerRecoveryTopLevelUnitTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerRecoveryTopLevelUnitTest.java	                        (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerRecoveryTopLevelUnitTest.java	2010-03-06 10:50:41 UTC (rev 31974)
@@ -0,0 +1,73 @@
+/*
+ * 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.BAD_OPERATION;
+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.arjuna.ServerNestedAction;
+import com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.ServerRecoveryTopLevelAction;
+import com.hp.mwtests.ts.jts.resources.TestBase;
+
+import static org.junit.Assert.*;
+
+class DummyServerRecovery extends ServerRecoveryTopLevelAction
+{
+    public DummyServerRecovery(ServerControl control)
+    {
+        super(control);
+    }
+    
+    public void destroyResource ()
+    {
+        super.destroyResource();
+    }
+}
+
+public class ServerRecoveryTopLevelUnitTest 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()); 
+        DummyServerRecovery act = new DummyServerRecovery(sc);
+        
+        act.destroyResource();
+    }
+}

Added: labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerSynchronizationUnitTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerSynchronizationUnitTest.java	                        (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerSynchronizationUnitTest.java	2010-03-06 10:50:41 UTC (rev 31974)
@@ -0,0 +1,86 @@
+/*
+ * 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.BAD_OPERATION;
+import org.omg.CosTransactions.Status;
+
+import com.arjuna.ats.arjuna.common.Uid;
+import com.arjuna.ats.internal.jts.orbspecific.interposition.coordinator.ServerTransaction;
+import com.arjuna.ats.internal.jts.orbspecific.interposition.resources.ServerSynchronization;
+import com.hp.mwtests.ts.jts.resources.TestBase;
+
+import static org.junit.Assert.*;
+
+public class ServerSynchronizationUnitTest extends TestBase
+{
+    @Test
+    public void test () throws Exception
+    {
+        ServerTransaction sc = new ServerTransaction(new Uid(), null);
+        ServerSynchronization sync = new ServerSynchronization(sc);
+        
+        sync.before_completion();
+        sync.after_completion(Status.StatusCommitted);
+        
+        assertTrue(sync.getSynchronization() != null);
+        
+        sync.destroy();
+    }
+    
+    @Test
+    public void testNull () throws Exception
+    {
+        ServerSynchronization sync = new ServerSynchronization(null);
+        
+        try
+        {
+            sync.before_completion();
+            
+            fail();
+        }
+        catch (final BAD_OPERATION ex)
+        {
+        }
+        
+        try
+        {
+            sync.after_completion(Status.StatusCommitted);
+            
+            fail();
+        }
+        catch (final BAD_OPERATION ex)
+        {
+        }
+    }
+}

Added: labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerTopLevelActionUnitTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerTopLevelActionUnitTest.java	                        (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerTopLevelActionUnitTest.java	2010-03-06 10:50:41 UTC (rev 31974)
@@ -0,0 +1,111 @@
+/*
+ * 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.BAD_OPERATION;
+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.arjuna.ServerTopLevelAction;
+import com.hp.mwtests.ts.jts.resources.TestBase;
+
+import static org.junit.Assert.*;
+
+public class ServerTopLevelActionUnitTest 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()); 
+        ServerTopLevelAction act = new ServerTopLevelAction(sc);
+        
+        assertEquals(act.prepare(), Vote.VoteReadOnly);
+        
+        try
+        {
+            act.commit();
+            
+            fail();
+        }
+        catch (final INVALID_TRANSACTION ex)
+        {
+        }
+        
+        assertTrue(act.getReference() != null);
+    }
+    
+    @Test
+    public void testCommitOnePhase () 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()); 
+        ServerTopLevelAction act = new ServerTopLevelAction(sc);
+
+        act.commit_one_phase();
+        
+        assertTrue(act.type() != 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()); 
+        ServerTopLevelAction act = new ServerTopLevelAction(sc);
+        
+        assertEquals(act.prepare(), Vote.VoteReadOnly);
+        
+        try
+        {
+            act.rollback();
+            
+            fail();
+        }
+        catch (final INVALID_TRANSACTION ex)
+        {
+        }
+        
+        act.forget();
+    }
+}

Added: labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerTopLevelOSIActionUnitTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerTopLevelOSIActionUnitTest.java	                        (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerTopLevelOSIActionUnitTest.java	2010-03-06 10:50:41 UTC (rev 31974)
@@ -0,0 +1,110 @@
+/*
+ * 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.osi.ServerOSITopLevelAction;
+import com.hp.mwtests.ts.jts.resources.TestBase;
+
+import static org.junit.Assert.*;
+
+public class ServerTopLevelOSIActionUnitTest 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()); 
+        ServerOSITopLevelAction act = new ServerOSITopLevelAction(sc, true);
+        
+        assertEquals(act.prepare(), Vote.VoteReadOnly);
+        
+        try
+        {
+            act.commit();
+            
+            fail();
+        }
+        catch (final INVALID_TRANSACTION ex)
+        {
+        }
+        
+        assertTrue(act.getReference() != null);
+    }
+    
+    @Test
+    public void testCommitOnePhase () 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()); 
+        ServerOSITopLevelAction act = new ServerOSITopLevelAction(sc, true);
+
+        act.commit_one_phase();
+        
+        assertTrue(act.type() != 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()); 
+        ServerOSITopLevelAction act = new ServerOSITopLevelAction(sc, true);
+        
+        assertEquals(act.prepare(), Vote.VoteReadOnly);
+        
+        try
+        {
+            act.rollback();
+            
+            fail();
+        }
+        catch (final INVALID_TRANSACTION ex)
+        {
+        }
+        
+        act.forget();
+    }
+}

Added: labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerTransactionUnitTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerTransactionUnitTest.java	                        (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/orbspecific/interposition/ServerTransactionUnitTest.java	2010-03-06 10:50:41 UTC (rev 31974)
@@ -0,0 +1,109 @@
+/*
+ * 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.Status;
+
+import com.arjuna.ats.arjuna.ObjectType;
+import com.arjuna.ats.arjuna.common.Uid;
+import com.arjuna.ats.arjuna.coordinator.TwoPhaseOutcome;
+import com.arjuna.ats.arjuna.state.InputObjectState;
+import com.arjuna.ats.arjuna.state.OutputObjectState;
+import com.arjuna.ats.internal.jts.orbspecific.interposition.coordinator.ServerTransaction;
+import com.hp.mwtests.ts.jts.orbspecific.resources.demosync;
+import com.hp.mwtests.ts.jts.resources.TestBase;
+
+import static org.junit.Assert.*;
+
+public class ServerTransactionUnitTest extends TestBase
+{
+    @Test
+    public void test () throws Exception
+    {
+        ServerTransaction sc = new ServerTransaction(new Uid(), null);
+        
+        assertTrue(sc.type() != null);
+        assertTrue(ServerTransaction.typeName() != null);
+        assertTrue(sc.getSavingUid().notEquals(Uid.nullUid()));
+        
+        OutputObjectState os = new OutputObjectState();
+        
+        assertTrue(sc.save_state(os, ObjectType.ANDPERSISTENT));
+        
+        InputObjectState is = new InputObjectState(os);
+        
+        assertTrue(sc.restore_state(is, ObjectType.ANDPERSISTENT));
+        
+        sc.setRecoveryCoordinator(null);
+    }
+    
+    @Test
+    public void testPrepareCommit () throws Exception
+    {
+        ServerTransaction sc = new ServerTransaction(new Uid(), null);
+
+        sc.register_synchronization(new demosync(false).getReference());
+        
+        sc.doBeforeCompletion();
+        
+        assertEquals(sc.doPrepare(), TwoPhaseOutcome.PREPARE_READONLY);
+        assertEquals(sc.doPhase2Commit(), TwoPhaseOutcome.FINISH_OK);
+        
+        sc.doAfterCompletion(Status.StatusCommitted);
+    }
+    
+    @Test
+    public void testPrepareRollback () throws Exception
+    {
+        ServerTransaction sc = new ServerTransaction(new Uid(), null);
+
+        assertEquals(sc.doPrepare(), TwoPhaseOutcome.PREPARE_READONLY);  // readonly so we commit here
+        assertEquals(sc.doPhase2Abort(), TwoPhaseOutcome.HEURISTIC_COMMIT);
+    }
+    
+    @Test
+    public void testOnePhaseCommit () throws Exception
+    {
+        ServerTransaction sc = new ServerTransaction(new Uid(), null);
+
+        sc.doCommit(true);
+    }
+    
+    @Test
+    public void testRollback () throws Exception
+    {
+        ServerTransaction sc = new ServerTransaction(new Uid(), null);
+
+        sc.rollback();
+    }
+}

Added: labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/resources/TestBase.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/resources/TestBase.java	                        (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/resources/TestBase.java	2010-03-06 10:50:41 UTC (rev 31974)
@@ -0,0 +1,69 @@
+/*
+ * 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.resources;
+
+import org.junit.Test;
+import org.junit.Before;
+import org.junit.After;
+
+import com.arjuna.ats.internal.jts.ORBManager;
+import com.arjuna.orbportability.OA;
+import com.arjuna.orbportability.ORB;
+import com.arjuna.orbportability.RootOA;
+
+import static org.junit.Assert.*;
+
+public class TestBase
+{   
+    @Before
+    public void setUp () throws Exception
+    {
+        myORB = ORB.getInstance("test");
+        myOA = OA.getRootOA(myORB);
+
+        myORB.initORB(new String[] {}, null);
+        myOA.initOA();
+
+        ORBManager.setORB(myORB);
+        ORBManager.setPOA(myOA);
+    }
+    
+    @After
+    public void tearDown () throws Exception
+    {
+        myOA.destroy();
+        myORB.shutdown();
+    }
+    
+    private ORB myORB = null;
+    private RootOA myOA = null;
+}



More information about the jboss-svn-commits mailing list