Search in sources :

Example 6 with ExtendedResourceRecord

use of com.arjuna.ats.internal.jts.resources.ExtendedResourceRecord 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 ExtendedResourceRecord

use of com.arjuna.ats.internal.jts.resources.ExtendedResourceRecord 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 ExtendedResourceRecord

use of com.arjuna.ats.internal.jts.resources.ExtendedResourceRecord 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

Uid (com.arjuna.ats.arjuna.common.Uid)8 ExtendedResourceRecord (com.arjuna.ats.internal.jts.resources.ExtendedResourceRecord)8 ArjunaTransactionImple (com.arjuna.ats.internal.jts.orbspecific.coordinator.ArjunaTransactionImple)7 DemoArjunaResource (com.hp.mwtests.ts.jts.orbspecific.resources.DemoArjunaResource)7 Test (org.junit.Test)7 ArjunaSubtranAwareResource (com.arjuna.ArjunaOTS.ArjunaSubtranAwareResource)1 OTSAbstractRecord (com.arjuna.ArjunaOTS.OTSAbstractRecord)1 AbstractRecord (com.arjuna.ats.arjuna.coordinator.AbstractRecord)1 InputObjectState (com.arjuna.ats.arjuna.state.InputObjectState)1 OutputObjectState (com.arjuna.ats.arjuna.state.OutputObjectState)1 ResourceRecord (com.arjuna.ats.internal.jts.resources.ResourceRecord)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 PrintWriter (java.io.PrintWriter)1 BAD_PARAM (org.omg.CORBA.BAD_PARAM)1 SystemException (org.omg.CORBA.SystemException)1