use of com.arjuna.ats.internal.jts.orbspecific.ControlImple in project narayana by jbosstm.
the class FactoryListUnitTest method test.
@SuppressWarnings("static-access")
@Test
public void test() throws Exception {
FactoryList factory = new FactoryList();
factory.removeDefault();
try {
assertNull(factory.recreate(null, FactoryList.DEFAULT_ID));
fail();
} catch (final INVALID_TRANSACTION ex) {
} catch (final Throwable ex) {
fail();
}
FactoryList.remove(Arjuna.restrictedXID());
TransactionFactoryImple imple = new TransactionFactoryImple("test");
ControlImple tx = imple.createLocal(1000);
PropagationContext ctx = tx.get_coordinator().get_txcontext();
Control cont = FactoryList.recreate(ctx, Arjuna.XID());
assertTrue(Utility.getUid(cont).equals(tx.get_uid()));
}
use of com.arjuna.ats.internal.jts.orbspecific.ControlImple in project narayana by jbosstm.
the class ServerControlWrapperUnitTest method testEquality.
@Test
public void testEquality() throws Exception {
TransactionFactoryImple imple = new TransactionFactoryImple("test");
ControlImple tx = imple.createLocal(1000);
ServerControlWrapper wrap1 = new ServerControlWrapper(tx);
ServerControlWrapper wrap2 = new ServerControlWrapper(tx.getControl());
assertTrue(wrap1.get_uid().equals(wrap2.get_uid()));
wrap1 = new ServerControlWrapper(tx.getControl(), tx);
wrap2 = new ServerControlWrapper(tx.getControl(), tx.get_uid());
assertTrue(wrap1.get_uid().equals(wrap2.get_uid()));
}
use of com.arjuna.ats.internal.jts.orbspecific.ControlImple in project narayana by jbosstm.
the class ServerFactoryUnitTest method test.
@Test
public void test() throws Exception {
TransactionFactoryImple factory = new TransactionFactoryImple("test");
ControlImple tx = factory.createLocal(1000);
Uid u = new Uid();
ServerControl server = ServerFactory.create_transaction(u, null, null, tx.get_coordinator(), tx.get_terminator(), 1000);
try {
ServerFactory.getCurrentStatus(new Uid("", false));
Assert.fail();
} catch (final Throwable ex) {
}
Assert.assertEquals(ServerFactory.getStatus(tx.get_uid()), org.omg.CosTransactions.Status.StatusActive);
}
use of com.arjuna.ats.internal.jts.orbspecific.ControlImple in project narayana by jbosstm.
the class TransactionFactoryUnitTest method testBasic.
@Test
public void testBasic() throws Exception {
TransactionFactoryImple factory = new TransactionFactoryImple("test");
arjPropertyManager.getCoordinatorEnvironmentBean().setEnableStatistics(true);
try {
factory.numberOfTransactions(TransactionType.TransactionTypeActive);
// fail();
} catch (final Inactive ex) {
} catch (final NoTransaction ex) {
}
ControlImple tx = factory.createLocal(1000);
assertTrue(tx != null);
org.omg.CosTransactions.otid_t[] txId = null;
try {
txId = factory.numberOfTransactions(TransactionType.TransactionTypeActive);
} catch (final Throwable ex) {
fail();
}
try {
if (factory.getChildTransactions(txId[0]) != null)
fail();
} catch (final Throwable ex) {
fail();
}
org.omg.CosTransactions.Status status = factory.getCurrentStatus(txId[0]);
assertTrue(status == org.omg.CosTransactions.Status.StatusActive);
assertTrue(factory.getStatus(txId[0]) == org.omg.CosTransactions.Status.StatusActive);
Control proxy = factory.createProxy(tx.get_coordinator(), tx.get_terminator());
assertTrue(proxy != null);
Control propagated = factory.createPropagatedControl(tx.get_coordinator());
assertTrue(propagated != null);
assertTrue(Utility.getUid(proxy).equals(Utility.getUid(propagated)));
GlobalTransactionInfo info = factory.getGlobalInfo();
assertTrue(info != null);
assertEquals(info.totalNumberOfTransactions, 1);
assertEquals(info.numberOfHeuristics, 0);
factory.numberOfTransactions(TransactionType.TransactionTypeUnresolved);
try {
tx.getImplHandle().rollback();
} catch (final Throwable ex) {
}
}
use of com.arjuna.ats.internal.jts.orbspecific.ControlImple in project narayana by jbosstm.
the class TransactionFactoryUnitTest method testInfo.
@Test
public void testInfo() throws Exception {
TransactionFactoryImple factory = new TransactionFactoryImple("test");
ControlImple tx = factory.createLocal(1000);
TransactionInfo info = factory.getTransactionInfo(Utility.uidToOtid(tx.get_uid()));
assertEquals(info.currentDepth, 1);
assertEquals(info.timeout, 0);
assertEquals(info.numberOfThreads, 0);
try {
tx.getImplHandle().rollback();
} catch (final Throwable ex) {
}
}
Aggregations