use of com.arjuna.ats.internal.jts.orbspecific.ControlImple in project narayana by jbosstm.
the class ServerControlUnitTest 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());
assertTrue(sc.isWrapper());
assertTrue(sc.get_coordinator() != null);
assertTrue(sc.get_terminator() != null);
assertEquals(sc.getParentImple(), null);
assertTrue(sc.forgetHeuristics());
assertTrue(sc.toString() != null);
sc.destroy();
}
use of com.arjuna.ats.internal.jts.orbspecific.ControlImple in project narayana by jbosstm.
the class ServerNestedOSIActionUnitTest 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());
ServerOSINestedAction act = new ServerOSINestedAction(sc, true);
assertFalse(act.interposeResource());
act.commit_subtransaction(null);
}
use of com.arjuna.ats.internal.jts.orbspecific.ControlImple in project narayana by jbosstm.
the class RestrictedInterpositionUnitTest method test.
@Test
public void test() throws Exception {
RestrictedInterposition inter = new RestrictedInterposition();
OTSImpleManager.current().begin();
OTSImpleManager.current().begin();
PropagationContext ctx = OTSImpleManager.current().get_control().get_coordinator().get_txcontext();
ControlImple cont = inter.setupHierarchy(ctx);
RestrictedInterpositionCreator creator = new RestrictedInterpositionCreator();
assertTrue(creator.recreateLocal(ctx) != null);
assertTrue(creator.recreate(ctx) != null);
OTSImpleManager.current().rollback();
OTSImpleManager.current().rollback();
}
use of com.arjuna.ats.internal.jts.orbspecific.ControlImple in project narayana by jbosstm.
the class ServerControlWrapperUnitTest method testNested.
@Test
public void testNested() throws Exception {
TransactionFactoryImple imple = new TransactionFactoryImple("test");
ControlImple tx = imple.createLocal(1000);
ServerControlWrapper wrap = new ServerControlWrapper(tx);
ControlWrapper sub = wrap.create_subtransaction();
assertTrue(sub != null);
assertEquals(sub.cancel(), ActionStatus.ABORTED);
}
use of com.arjuna.ats.internal.jts.orbspecific.ControlImple in project narayana by jbosstm.
the class ExplicitInterposition method registerTransaction.
private final synchronized void registerTransaction(PropagationContext ctx) throws InterpositionFailed, SystemException {
if (jtsLogger.logger.isTraceEnabled()) {
jtsLogger.logger.trace("ExplicitInterposition::registerTransaction ( PropagationContext ctx )");
}
if (_inUse) {
jtsLogger.i18NLogger.warn_excalledagain("ExplicitInterposition.registerTransaction");
throw new InterpositionFailed();
}
if (// invalid
(ctx == null) || (ctx.current.coord == null))
throw new INVALID_TRANSACTION(ExceptionCodes.INVALID_ACTION, CompletionStatus.COMPLETED_NO);
_inUse = true;
TransactionFactoryImple _localFactory = OTSImpleManager.factory();
try {
ControlImple cont = _localFactory.recreateLocal(ctx);
CurrentImple current = OTSImpleManager.current();
if (_remember) {
try {
_oldControl = current.suspendWrapper();
} catch (Exception e) {
throw new InterpositionFailed();
}
}
current.resumeImple(cont);
// current.resume(cont.getControl());
cont = null;
} catch (InterpositionFailed ex) {
throw ex;
} catch (Exception e) {
jtsLogger.i18NLogger.warn_eicaughtexception("ExplicitInterposition.registerTransaction(PropagationContext)", e);
throw new InterpositionFailed();
}
}
Aggregations