Search in sources :

Example 6 with XAOnePhaseResource

use of com.arjuna.ats.internal.jta.resources.arjunacore.XAOnePhaseResource in project narayana by jbosstm.

the class OnePhaseUnitTest method testCommit.

@Test
public void testCommit() {
    SampleOnePhaseResource res = new SampleOnePhaseResource();
    XidImple xid = new XidImple(new Uid());
    XAOnePhaseResource xares = new XAOnePhaseResource(res, xid, null);
    assertEquals(xares.commit(), TwoPhaseOutcome.FINISH_OK);
    assertTrue(res.onePhaseCalled());
}
Also used : XidImple(com.arjuna.ats.jta.xa.XidImple) Uid(com.arjuna.ats.arjuna.common.Uid) XAOnePhaseResource(com.arjuna.ats.internal.jta.resources.arjunacore.XAOnePhaseResource) SampleOnePhaseResource(com.hp.mwtests.ts.jta.common.SampleOnePhaseResource) Test(org.junit.Test)

Example 7 with XAOnePhaseResource

use of com.arjuna.ats.internal.jta.resources.arjunacore.XAOnePhaseResource in project narayana by jbosstm.

the class ForgetTest method testCommitHeuristic.

@Test
public void testCommitHeuristic() {
    SampleOnePhaseResource res = new SampleOnePhaseResource(SampleOnePhaseResource.ErrorType.heurcom);
    XidImple xid = new XidImple(new Uid());
    XAOnePhaseResource xares = new XAOnePhaseResource(res, xid, null);
    assertEquals(xares.commit(), TwoPhaseOutcome.FINISH_OK);
    assertTrue(res.forgetCalled());
}
Also used : XidImple(com.arjuna.ats.jta.xa.XidImple) Uid(com.arjuna.ats.arjuna.common.Uid) XAOnePhaseResource(com.arjuna.ats.internal.jta.resources.arjunacore.XAOnePhaseResource) SampleOnePhaseResource(com.hp.mwtests.ts.jta.common.SampleOnePhaseResource) Test(org.junit.Test)

Example 8 with XAOnePhaseResource

use of com.arjuna.ats.internal.jta.resources.arjunacore.XAOnePhaseResource in project narayana by jbosstm.

the class OnePhaseUnitTest method testCommitHeuristic.

@Test
public void testCommitHeuristic() {
    SampleOnePhaseResource res = new SampleOnePhaseResource(ErrorType.heurcom);
    XidImple xid = new XidImple(new Uid());
    XAOnePhaseResource xares = new XAOnePhaseResource(res, xid, null);
    assertEquals(xares.commit(), TwoPhaseOutcome.FINISH_OK);
    assertTrue(res.forgetCalled());
}
Also used : XidImple(com.arjuna.ats.jta.xa.XidImple) Uid(com.arjuna.ats.arjuna.common.Uid) XAOnePhaseResource(com.arjuna.ats.internal.jta.resources.arjunacore.XAOnePhaseResource) SampleOnePhaseResource(com.hp.mwtests.ts.jta.common.SampleOnePhaseResource) Test(org.junit.Test)

Example 9 with XAOnePhaseResource

use of com.arjuna.ats.internal.jta.resources.arjunacore.XAOnePhaseResource in project narayana by jbosstm.

the class OnePhaseUnitTest method testRollbackHeuristic.

@Test
public void testRollbackHeuristic() {
    SampleOnePhaseResource res = new SampleOnePhaseResource(ErrorType.heurrb);
    XidImple xid = new XidImple(new Uid());
    XAOnePhaseResource xares = new XAOnePhaseResource(res, xid, null);
    assertEquals(xares.commit(), TwoPhaseOutcome.ONE_PHASE_ERROR);
    assertTrue(res.forgetCalled());
}
Also used : XidImple(com.arjuna.ats.jta.xa.XidImple) Uid(com.arjuna.ats.arjuna.common.Uid) XAOnePhaseResource(com.arjuna.ats.internal.jta.resources.arjunacore.XAOnePhaseResource) SampleOnePhaseResource(com.hp.mwtests.ts.jta.common.SampleOnePhaseResource) Test(org.junit.Test)

Example 10 with XAOnePhaseResource

use of com.arjuna.ats.internal.jta.resources.arjunacore.XAOnePhaseResource in project narayana by jbosstm.

the class OnePhaseUnitTest method testPackUnpack.

@Test
public void testPackUnpack() throws Exception {
    DummyXA res = new DummyXA(false);
    XidImple xid = new XidImple(new Uid());
    XAOnePhaseResource xares = new XAOnePhaseResource(res, xid, null);
    OutputObjectState os = new OutputObjectState();
    xares.pack(os);
    InputObjectState is = new InputObjectState(os);
    xares.unpack(is);
}
Also used : XidImple(com.arjuna.ats.jta.xa.XidImple) Uid(com.arjuna.ats.arjuna.common.Uid) InputObjectState(com.arjuna.ats.arjuna.state.InputObjectState) DummyXA(com.hp.mwtests.ts.jta.common.DummyXA) XAOnePhaseResource(com.arjuna.ats.internal.jta.resources.arjunacore.XAOnePhaseResource) OutputObjectState(com.arjuna.ats.arjuna.state.OutputObjectState) Test(org.junit.Test)

Aggregations

XAOnePhaseResource (com.arjuna.ats.internal.jta.resources.arjunacore.XAOnePhaseResource)10 Test (org.junit.Test)10 Uid (com.arjuna.ats.arjuna.common.Uid)9 XidImple (com.arjuna.ats.jta.xa.XidImple)9 SampleOnePhaseResource (com.hp.mwtests.ts.jta.common.SampleOnePhaseResource)8 OutputObjectState (com.arjuna.ats.arjuna.state.OutputObjectState)3 InputObjectState (com.arjuna.ats.arjuna.state.InputObjectState)2 DummyRecoverableXAConnection (com.hp.mwtests.ts.jta.common.DummyRecoverableXAConnection)1 DummyXA (com.hp.mwtests.ts.jta.common.DummyXA)1 IOException (java.io.IOException)1