Search in sources :

Example 6 with DemoArjunaResource

use of com.hp.mwtests.ts.jts.orbspecific.resources.DemoArjunaResource 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 7 with DemoArjunaResource

use of com.hp.mwtests.ts.jts.orbspecific.resources.DemoArjunaResource 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 8 with DemoArjunaResource

use of com.hp.mwtests.ts.jts.orbspecific.resources.DemoArjunaResource 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)

Aggregations

DemoArjunaResource (com.hp.mwtests.ts.jts.orbspecific.resources.DemoArjunaResource)8 Test (org.junit.Test)8 Uid (com.arjuna.ats.arjuna.common.Uid)7 ArjunaTransactionImple (com.arjuna.ats.internal.jts.orbspecific.coordinator.ArjunaTransactionImple)7 ExtendedResourceRecord (com.arjuna.ats.internal.jts.resources.ExtendedResourceRecord)7 InputObjectState (com.arjuna.ats.arjuna.state.InputObjectState)1 OutputObjectState (com.arjuna.ats.arjuna.state.OutputObjectState)1 ORB (com.arjuna.orbportability.ORB)1 RootOA (com.arjuna.orbportability.RootOA)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 PrintWriter (java.io.PrintWriter)1 SystemException (org.omg.CORBA.SystemException)1 UserException (org.omg.CORBA.UserException)1