Search in sources :

Example 16 with ControlImple

use of com.arjuna.ats.internal.jts.orbspecific.ControlImple in project narayana by jbosstm.

the class ServerNestedStrictUnitTest method testCommit.

@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);
}
Also used : Control(org.omg.CosTransactions.Control) ServerControl(com.arjuna.ats.internal.jts.orbspecific.interposition.ServerControl) ServerControl(com.arjuna.ats.internal.jts.orbspecific.interposition.ServerControl) ServerStrictNestedAction(com.arjuna.ats.internal.jts.orbspecific.interposition.resources.strict.ServerStrictNestedAction) ArjunaTransactionImple(com.arjuna.ats.internal.jts.orbspecific.coordinator.ArjunaTransactionImple) ControlImple(com.arjuna.ats.internal.jts.orbspecific.ControlImple) Test(org.junit.Test)

Example 17 with ControlImple

use of com.arjuna.ats.internal.jts.orbspecific.ControlImple in project narayana by jbosstm.

the class ServerTopLevelOSIActionUnitTest method testCommit.

@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);
}
Also used : Control(org.omg.CosTransactions.Control) ServerControl(com.arjuna.ats.internal.jts.orbspecific.interposition.ServerControl) ServerControl(com.arjuna.ats.internal.jts.orbspecific.interposition.ServerControl) INVALID_TRANSACTION(org.omg.CORBA.INVALID_TRANSACTION) ArjunaTransactionImple(com.arjuna.ats.internal.jts.orbspecific.coordinator.ArjunaTransactionImple) ControlImple(com.arjuna.ats.internal.jts.orbspecific.ControlImple) ServerOSITopLevelAction(com.arjuna.ats.internal.jts.orbspecific.interposition.resources.osi.ServerOSITopLevelAction) Test(org.junit.Test)

Example 18 with ControlImple

use of com.arjuna.ats.internal.jts.orbspecific.ControlImple in project narayana by jbosstm.

the class ServerTopLevelOSIActionUnitTest method testCommitOnePhase.

@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);
}
Also used : Control(org.omg.CosTransactions.Control) ServerControl(com.arjuna.ats.internal.jts.orbspecific.interposition.ServerControl) ServerControl(com.arjuna.ats.internal.jts.orbspecific.interposition.ServerControl) ArjunaTransactionImple(com.arjuna.ats.internal.jts.orbspecific.coordinator.ArjunaTransactionImple) ControlImple(com.arjuna.ats.internal.jts.orbspecific.ControlImple) ServerOSITopLevelAction(com.arjuna.ats.internal.jts.orbspecific.interposition.resources.osi.ServerOSITopLevelAction) Test(org.junit.Test)

Example 19 with ControlImple

use of com.arjuna.ats.internal.jts.orbspecific.ControlImple in project narayana by jbosstm.

the class ServerTopLevelOSIActionUnitTest method testRollback.

@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();
}
Also used : Control(org.omg.CosTransactions.Control) ServerControl(com.arjuna.ats.internal.jts.orbspecific.interposition.ServerControl) ServerControl(com.arjuna.ats.internal.jts.orbspecific.interposition.ServerControl) INVALID_TRANSACTION(org.omg.CORBA.INVALID_TRANSACTION) ArjunaTransactionImple(com.arjuna.ats.internal.jts.orbspecific.coordinator.ArjunaTransactionImple) ControlImple(com.arjuna.ats.internal.jts.orbspecific.ControlImple) ServerOSITopLevelAction(com.arjuna.ats.internal.jts.orbspecific.interposition.resources.osi.ServerOSITopLevelAction) Test(org.junit.Test)

Example 20 with ControlImple

use of com.arjuna.ats.internal.jts.orbspecific.ControlImple in project narayana by jbosstm.

the class OSIInterposition method setupHierarchy.

/*
     * Currently assume that formatID and otid are not a unique combination,
     * i.e., if we see the same otid but with a different formatID it's
     * really the same transaction.
     */
public synchronized ControlImple setupHierarchy(PropagationContext context) throws SystemException {
    /*
	 * Map otid to a Uid.
	 */
    Uid theUid = OTIDMap.find(context.current.otid);
    ServerTopLevelAction proxyAction = present(theUid);
    ControlImple controlPtr = null;
    if (proxyAction == null) {
        /*
	     * Create a new proxyAction element and return the "current" transaction.
	     */
        controlPtr = createHierarchy(context, theUid);
    } else {
        controlPtr = checkHierarchy(proxyAction, context);
    }
    return controlPtr;
}
Also used : Uid(com.arjuna.ats.arjuna.common.Uid) ServerTopLevelAction(com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.ServerTopLevelAction) ControlImple(com.arjuna.ats.internal.jts.orbspecific.ControlImple)

Aggregations

ControlImple (com.arjuna.ats.internal.jts.orbspecific.ControlImple)41 Test (org.junit.Test)30 Control (org.omg.CosTransactions.Control)24 ServerControl (com.arjuna.ats.internal.jts.orbspecific.interposition.ServerControl)21 ArjunaTransactionImple (com.arjuna.ats.internal.jts.orbspecific.coordinator.ArjunaTransactionImple)19 TransactionFactoryImple (com.arjuna.ats.internal.jts.orbspecific.TransactionFactoryImple)10 Uid (com.arjuna.ats.arjuna.common.Uid)8 ServerTopLevelAction (com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.ServerTopLevelAction)7 INVALID_TRANSACTION (org.omg.CORBA.INVALID_TRANSACTION)7 PropagationContext (org.omg.CosTransactions.PropagationContext)5 SystemException (org.omg.CORBA.SystemException)4 ControlWrapper (com.arjuna.ats.internal.jts.ControlWrapper)3 ServerNestedAction (com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.ServerNestedAction)3 ServerOSITopLevelAction (com.arjuna.ats.internal.jts.orbspecific.interposition.resources.osi.ServerOSITopLevelAction)3 BAD_PARAM (org.omg.CORBA.BAD_PARAM)3 GlobalTransactionInfo (com.arjuna.ArjunaOTS.GlobalTransactionInfo)2 UidCoordinator (com.arjuna.ArjunaOTS.UidCoordinator)2 ServerControlWrapper (com.arjuna.ats.internal.jts.interposition.ServerControlWrapper)2 CurrentImple (com.arjuna.ats.internal.jts.orbspecific.CurrentImple)2 ServerOSINestedAction (com.arjuna.ats.internal.jts.orbspecific.interposition.resources.osi.ServerOSINestedAction)2