use of org.omg.CosTransactions.Control 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 org.omg.CosTransactions.Control 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 org.omg.CosTransactions.Control in project narayana by jbosstm.
the class OTSThread method terminate.
/*
* Can't use finalize since it may be called by
* some other thread than this one.
*/
public void terminate() {
try {
CurrentImple current = OTSImpleManager.current();
if (current != null) {
Control c = current.suspend();
c = null;
}
} catch (Exception e) {
}
}
use of org.omg.CosTransactions.Control in project narayana by jbosstm.
the class ContextManagerUnitTest method testContextManager.
@Test
public void testContextManager() throws Exception {
ContextManager manager = new ContextManager();
assertEquals(manager.current(Thread.currentThread().getName()), null);
assertEquals(manager.current(), null);
OTSImpleManager.current().begin();
manager.associate();
OTSImpleManager.current().suspend();
OTSImpleManager.current().begin();
Control ct = OTSImpleManager.current().suspend();
manager.addRemoteHierarchy(ct);
manager.popAction();
OTSImpleManager.current().suspend();
OTSImpleManager.current().begin();
ActionControl cont = (ActionControl) OTSImpleManager.current().getControlWrapper().getImple().getControl();
manager.addActionControlHierarchy(cont);
manager.purgeActions();
OTSImpleManager.current().suspend();
OTSImpleManager.current().begin();
manager.addControlImpleHierarchy(OTSImpleManager.current().getControlWrapper().getImple());
manager.purgeActions();
OTSImpleManager.current().suspend();
}
use of org.omg.CosTransactions.Control in project narayana by jbosstm.
the class JtsTransactionImple method getTransactionIOR.
/**
* If the current transaction represents an OTS transaction then return it IOR
*
* @return the IOR or null if the current transaction is not an OTS transaction
* @throws NamingException
* @throws org.omg.CORBA.SystemException
* @throws SystemException
* @throws Unavailable
*/
public static String getTransactionIOR() throws org.omg.CORBA.SystemException, SystemException, Unavailable {
log.debug("getTransactionIOR");
TransactionImpl curr = TransactionImpl.current();
if (curr != null) {
log.debug("have JtsTransactionImple");
return curr.getControlIOR();
} else if (hasTransaction()) {
log.debug("have tx mgr");
Transaction tx = tm.getTransaction();
log.debug("have arjuna tx");
TransactionImple atx = (TransactionImple) tx;
ControlWrapper cw = atx.getControlWrapper();
log.debug("lookup control");
Control c = cw.get_control();
String ior = ORBManager.getORB().orb().object_to_string(c);
log.debug("getTransactionIOR: ior: " + ior);
return ior;
} else {
return null;
}
}
Aggregations