Search in sources :

Example 6 with ControlImple

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();
}
Also used : Control(org.omg.CosTransactions.Control) ServerControl(com.arjuna.ats.internal.jts.orbspecific.interposition.ServerControl) ServerControl(com.arjuna.ats.internal.jts.orbspecific.interposition.ServerControl) ArjunaTransactionImple(com.arjuna.ats.internal.jts.orbspecific.coordinator.ArjunaTransactionImple) ControlImple(com.arjuna.ats.internal.jts.orbspecific.ControlImple) Test(org.junit.Test)

Example 7 with ControlImple

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);
}
Also used : Control(org.omg.CosTransactions.Control) ServerControl(com.arjuna.ats.internal.jts.orbspecific.interposition.ServerControl) ServerControl(com.arjuna.ats.internal.jts.orbspecific.interposition.ServerControl) ArjunaTransactionImple(com.arjuna.ats.internal.jts.orbspecific.coordinator.ArjunaTransactionImple) ServerOSINestedAction(com.arjuna.ats.internal.jts.orbspecific.interposition.resources.osi.ServerOSINestedAction) ControlImple(com.arjuna.ats.internal.jts.orbspecific.ControlImple) Test(org.junit.Test)

Example 8 with ControlImple

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();
}
Also used : PropagationContext(org.omg.CosTransactions.PropagationContext) RestrictedInterposition(com.arjuna.ats.internal.jts.interposition.resources.restricted.RestrictedInterposition) RestrictedInterpositionCreator(com.arjuna.ats.internal.jts.interposition.resources.restricted.RestrictedInterpositionCreator) ControlImple(com.arjuna.ats.internal.jts.orbspecific.ControlImple) Test(org.junit.Test)

Example 9 with ControlImple

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);
}
Also used : ServerControlWrapper(com.arjuna.ats.internal.jts.interposition.ServerControlWrapper) ServerControlWrapper(com.arjuna.ats.internal.jts.interposition.ServerControlWrapper) ControlWrapper(com.arjuna.ats.internal.jts.ControlWrapper) TransactionFactoryImple(com.arjuna.ats.internal.jts.orbspecific.TransactionFactoryImple) ControlImple(com.arjuna.ats.internal.jts.orbspecific.ControlImple) Test(org.junit.Test)

Example 10 with ControlImple

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();
    }
}
Also used : InterpositionFailed(com.arjuna.ArjunaOTS.InterpositionFailed) INVALID_TRANSACTION(org.omg.CORBA.INVALID_TRANSACTION) TransactionFactoryImple(com.arjuna.ats.internal.jts.orbspecific.TransactionFactoryImple) CurrentImple(com.arjuna.ats.internal.jts.orbspecific.CurrentImple) ControlImple(com.arjuna.ats.internal.jts.orbspecific.ControlImple) SystemException(org.omg.CORBA.SystemException)

Aggregations

ControlImple (com.arjuna.ats.internal.jts.orbspecific.ControlImple)41 Test (org.junit.Test)30 Control (org.omg.CosTransactions.Control)24 ServerControl (com.arjuna.ats.internal.jts.orbspecific.interposition.ServerControl)21 ArjunaTransactionImple (com.arjuna.ats.internal.jts.orbspecific.coordinator.ArjunaTransactionImple)19 TransactionFactoryImple (com.arjuna.ats.internal.jts.orbspecific.TransactionFactoryImple)10 Uid (com.arjuna.ats.arjuna.common.Uid)8 ServerTopLevelAction (com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.ServerTopLevelAction)7 INVALID_TRANSACTION (org.omg.CORBA.INVALID_TRANSACTION)7 PropagationContext (org.omg.CosTransactions.PropagationContext)5 SystemException (org.omg.CORBA.SystemException)4 ControlWrapper (com.arjuna.ats.internal.jts.ControlWrapper)3 ServerNestedAction (com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.ServerNestedAction)3 ServerOSITopLevelAction (com.arjuna.ats.internal.jts.orbspecific.interposition.resources.osi.ServerOSITopLevelAction)3 BAD_PARAM (org.omg.CORBA.BAD_PARAM)3 GlobalTransactionInfo (com.arjuna.ArjunaOTS.GlobalTransactionInfo)2 UidCoordinator (com.arjuna.ArjunaOTS.UidCoordinator)2 ServerControlWrapper (com.arjuna.ats.internal.jts.interposition.ServerControlWrapper)2 CurrentImple (com.arjuna.ats.internal.jts.orbspecific.CurrentImple)2 ServerOSINestedAction (com.arjuna.ats.internal.jts.orbspecific.interposition.resources.osi.ServerOSINestedAction)2