Search in sources :

Example 21 with ArjunaTransactionImple

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

the class ExtendedResourceUnitTest method testNestedAbort.

@Test
public void testNestedAbort() throws Exception {
    DemoArjunaResource ares = new DemoArjunaResource();
    OTSImpleManager.current().begin();
    ArjunaTransactionImple tx = OTSImpleManager.current().getControlWrapper().getImple().getImplHandle();
    OTSImpleManager.current().begin();
    ExtendedResourceRecord res = new ExtendedResourceRecord(false, new Uid(), ares.getReference(), tx.getControlHandle().get_coordinator(), new Uid(), OTSImpleManager.current().getControlWrapper().getImple().getImplHandle());
    assertEquals(res.nestedPrepare(), TwoPhaseOutcome.PREPARE_OK);
    assertEquals(res.nestedAbort(), TwoPhaseOutcome.FINISH_OK);
    OTSImpleManager.current().rollback();
    OTSImpleManager.current().rollback();
}
Also used : Uid(com.arjuna.ats.arjuna.common.Uid) ExtendedResourceRecord(com.arjuna.ats.internal.jts.resources.ExtendedResourceRecord) DemoArjunaResource(com.hp.mwtests.ts.jts.orbspecific.resources.DemoArjunaResource) ArjunaTransactionImple(com.arjuna.ats.internal.jts.orbspecific.coordinator.ArjunaTransactionImple) Test(org.junit.Test)

Example 22 with ArjunaTransactionImple

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

the class ExtendedResourceUnitTest method testTopLevelAbort.

@Test
public void testTopLevelAbort() throws Exception {
    DemoArjunaResource ares = new DemoArjunaResource();
    OTSImpleManager.current().begin();
    ArjunaTransactionImple tx = OTSImpleManager.current().getControlWrapper().getImple().getImplHandle();
    ExtendedResourceRecord res = new ExtendedResourceRecord(false, new Uid(), ares.getReference(), tx.getControlHandle().get_coordinator(), new Uid(), OTSImpleManager.current().getControlWrapper().getImple().getImplHandle());
    assertEquals(res.topLevelPrepare(), TwoPhaseOutcome.PREPARE_OK);
    assertEquals(res.topLevelAbort(), TwoPhaseOutcome.FINISH_OK);
    OTSImpleManager.current().rollback();
}
Also used : Uid(com.arjuna.ats.arjuna.common.Uid) ExtendedResourceRecord(com.arjuna.ats.internal.jts.resources.ExtendedResourceRecord) DemoArjunaResource(com.hp.mwtests.ts.jts.orbspecific.resources.DemoArjunaResource) ArjunaTransactionImple(com.arjuna.ats.internal.jts.orbspecific.coordinator.ArjunaTransactionImple) Test(org.junit.Test)

Example 23 with ArjunaTransactionImple

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

the class ExtendedResourceUnitTest method testNestedOnePhase.

@Test
public void testNestedOnePhase() throws Exception {
    DemoArjunaResource ares = new DemoArjunaResource();
    OTSImpleManager.current().begin();
    ArjunaTransactionImple tx = OTSImpleManager.current().getControlWrapper().getImple().getImplHandle();
    OTSImpleManager.current().begin();
    ExtendedResourceRecord res = new ExtendedResourceRecord(false, new Uid(), ares.getReference(), tx.getControlHandle().get_coordinator(), new Uid(), OTSImpleManager.current().getControlWrapper().getImple().getImplHandle());
    assertEquals(res.nestedOnePhaseCommit(), TwoPhaseOutcome.FINISH_OK);
    OTSImpleManager.current().rollback();
    OTSImpleManager.current().rollback();
}
Also used : Uid(com.arjuna.ats.arjuna.common.Uid) ExtendedResourceRecord(com.arjuna.ats.internal.jts.resources.ExtendedResourceRecord) DemoArjunaResource(com.hp.mwtests.ts.jts.orbspecific.resources.DemoArjunaResource) ArjunaTransactionImple(com.arjuna.ats.internal.jts.orbspecific.coordinator.ArjunaTransactionImple) Test(org.junit.Test)

Example 24 with ArjunaTransactionImple

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

the class JacORBGenericRecoveryCreatorSuccessUnitTest method testSuccess.

@Test
public void testSuccess() throws Exception {
    JacOrbRCServiceInit init = new JacOrbRCServiceInit();
    JacOrbRecoveryInit rinit = new JacOrbRecoveryInit();
    init.startRCservice();
    RecoveryCreator creator = RecoveryCreator.getCreator();
    GenericRecoveryCreator generic = null;
    if (creator instanceof GenericRecoveryCreator)
        generic = (GenericRecoveryCreator) creator;
    assertTrue(generic != null);
    DemoResource demo = new DemoResource();
    ArjunaTransactionImple tx = new ArjunaTransactionImple(null);
    Object[] params = new Object[1];
    params[0] = tx;
    RecoveryCoordinator rc = generic.create(demo.getResource(), params);
    assertTrue(rc != null);
    generic.destroy(rc);
    generic.destroyAll(params);
    JacOrbRCServiceInit.shutdownRCService();
}
Also used : DemoResource(com.hp.mwtests.ts.jts.orbspecific.resources.DemoResource) JacOrbRCServiceInit(com.arjuna.ats.internal.jts.orbspecific.jacorb.recoverycoordinators.JacOrbRCServiceInit) JacOrbRecoveryInit(com.arjuna.ats.internal.jts.orbspecific.jacorb.recoverycoordinators.JacOrbRecoveryInit) ArjunaTransactionImple(com.arjuna.ats.internal.jts.orbspecific.coordinator.ArjunaTransactionImple) RecoveryCoordinator(org.omg.CosTransactions.RecoveryCoordinator) RecoveryCreator(com.arjuna.ats.internal.jts.recovery.RecoveryCreator) GenericRecoveryCreator(com.arjuna.ats.internal.jts.recovery.recoverycoordinators.GenericRecoveryCreator) GenericRecoveryCreator(com.arjuna.ats.internal.jts.recovery.recoverycoordinators.GenericRecoveryCreator) Test(org.junit.Test)

Example 25 with ArjunaTransactionImple

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

the class ServerNestedOSIActionUnitTest 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());
    ServerOSINestedAction act = new ServerOSINestedAction(sc, true);
    act.rollback_subtransaction();
}
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) ServerOSINestedAction(com.arjuna.ats.internal.jts.orbspecific.interposition.resources.osi.ServerOSINestedAction) 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