use of com.arjuna.ats.internal.jts.orbspecific.coordinator.ArjunaTransactionImple in project narayana by jbosstm.
the class ExtendedResourceUnitTest method testNestedCommit.
@Test
public void testNestedCommit() 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.nestedCommit(), TwoPhaseOutcome.FINISH_OK);
OTSImpleManager.current().rollback();
OTSImpleManager.current().rollback();
}
use of com.arjuna.ats.internal.jts.orbspecific.coordinator.ArjunaTransactionImple in project narayana by jbosstm.
the class ExtendedResourceUnitTest method testOnePhaseCommit.
@Test
public void testOnePhaseCommit() 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.topLevelOnePhaseCommit(), TwoPhaseOutcome.FINISH_OK);
OTSImpleManager.current().rollback();
}
use of com.arjuna.ats.internal.jts.orbspecific.coordinator.ArjunaTransactionImple in project narayana by jbosstm.
the class ServerNestedRestrictedUnitTest method test.
@Test
public void test() 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());
ServerRestrictedNestedAction act = new ServerRestrictedNestedAction(sc);
assertTrue(act.deepestControl() != null);
assertEquals(act.child(), null);
}
use of com.arjuna.ats.internal.jts.orbspecific.coordinator.ArjunaTransactionImple in project narayana by jbosstm.
the class ServerNestedStrictUnitTest 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());
ServerStrictNestedAction act = new ServerStrictNestedAction(sc, true);
assertFalse(act.interposeResource());
act.commit_subtransaction(null);
}
use of com.arjuna.ats.internal.jts.orbspecific.coordinator.ArjunaTransactionImple in project narayana by jbosstm.
the class ServerTopLevelOSIActionUnitTest 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());
ServerOSITopLevelAction act = new ServerOSITopLevelAction(sc, true);
assertEquals(act.prepare(), Vote.VoteReadOnly);
try {
act.commit();
fail();
} catch (final INVALID_TRANSACTION ex) {
}
assertTrue(act.getReference() != null);
}
Aggregations