Search in sources :

Example 31 with ArjunaTransactionImple

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

the class ServerTopLevelActionUnitTest 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());
    ServerTopLevelAction act = new ServerTopLevelAction(sc);
    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) ServerTopLevelAction(com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.ServerTopLevelAction) INVALID_TRANSACTION(org.omg.CORBA.INVALID_TRANSACTION) ArjunaTransactionImple(com.arjuna.ats.internal.jts.orbspecific.coordinator.ArjunaTransactionImple) ControlImple(com.arjuna.ats.internal.jts.orbspecific.ControlImple) Test(org.junit.Test)

Example 32 with ArjunaTransactionImple

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

the class ServerTopLevelActionUnitTest 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());
    ServerTopLevelAction act = new ServerTopLevelAction(sc);
    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) ServerTopLevelAction(com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.ServerTopLevelAction) ArjunaTransactionImple(com.arjuna.ats.internal.jts.orbspecific.coordinator.ArjunaTransactionImple) ControlImple(com.arjuna.ats.internal.jts.orbspecific.ControlImple) Test(org.junit.Test)

Example 33 with ArjunaTransactionImple

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

the class ServerTopLevelActionUnitTest 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());
    ServerTopLevelAction act = new ServerTopLevelAction(sc);
    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) ServerTopLevelAction(com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.ServerTopLevelAction) INVALID_TRANSACTION(org.omg.CORBA.INVALID_TRANSACTION) ArjunaTransactionImple(com.arjuna.ats.internal.jts.orbspecific.coordinator.ArjunaTransactionImple) ControlImple(com.arjuna.ats.internal.jts.orbspecific.ControlImple) Test(org.junit.Test)

Aggregations

ArjunaTransactionImple (com.arjuna.ats.internal.jts.orbspecific.coordinator.ArjunaTransactionImple)33 Test (org.junit.Test)30 ServerControl (com.arjuna.ats.internal.jts.orbspecific.interposition.ServerControl)20 Control (org.omg.CosTransactions.Control)20 ControlImple (com.arjuna.ats.internal.jts.orbspecific.ControlImple)19 Uid (com.arjuna.ats.arjuna.common.Uid)9 ExtendedResourceRecord (com.arjuna.ats.internal.jts.resources.ExtendedResourceRecord)7 DemoArjunaResource (com.hp.mwtests.ts.jts.orbspecific.resources.DemoArjunaResource)7 ServerTopLevelAction (com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.ServerTopLevelAction)4 INVALID_TRANSACTION (org.omg.CORBA.INVALID_TRANSACTION)4 HeuristicHazard (org.omg.CosTransactions.HeuristicHazard)4 ServerNestedAction (com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.ServerNestedAction)3 ServerOSITopLevelAction (com.arjuna.ats.internal.jts.orbspecific.interposition.resources.osi.ServerOSITopLevelAction)3 ServerOSINestedAction (com.arjuna.ats.internal.jts.orbspecific.interposition.resources.osi.ServerOSINestedAction)2 ServerStrictNestedAction (com.arjuna.ats.internal.jts.orbspecific.interposition.resources.strict.ServerStrictNestedAction)2 ExtendedCrashRecord (com.hp.mwtests.ts.jta.jts.common.ExtendedCrashRecord)2 RecoveryCoordinator (org.omg.CosTransactions.RecoveryCoordinator)2 AbstractRecord (com.arjuna.ats.arjuna.coordinator.AbstractRecord)1 BasicAction (com.arjuna.ats.arjuna.coordinator.BasicAction)1 RecordTypeMap (com.arjuna.ats.arjuna.coordinator.abstractrecord.RecordTypeMap)1