Search in sources :

Example 6 with DemoResource

use of com.hp.mwtests.ts.jts.orbspecific.resources.DemoResource in project narayana by jbosstm.

the class JacORBGenericRecoveryCreatorFailureUnitTest method testFail.

@Test
public void testFail() throws Exception {
    JacOrbRCServiceInit init = new JacOrbRCServiceInit();
    JacOrbRecoveryInit rinit = new JacOrbRecoveryInit();
    init.startRCservice();
    RecoveryCreator creator = RecoveryCreator.getCreator();
    GenericRecoveryCreator generic = null;
    if (creator instanceof GenericRecoveryCreator)
        generic = (GenericRecoveryCreator) creator;
    assertTrue(generic != null);
    DemoResource demo = new DemoResource();
    assertTrue(generic.create(demo.getResource(), null) == null);
    JacOrbRCServiceInit.shutdownRCService();
}
Also used : DemoResource(com.hp.mwtests.ts.jts.orbspecific.resources.DemoResource) JacOrbRCServiceInit(com.arjuna.ats.internal.jts.orbspecific.jacorb.recoverycoordinators.JacOrbRCServiceInit) JacOrbRecoveryInit(com.arjuna.ats.internal.jts.orbspecific.jacorb.recoverycoordinators.JacOrbRecoveryInit) RecoveryCreator(com.arjuna.ats.internal.jts.recovery.RecoveryCreator) GenericRecoveryCreator(com.arjuna.ats.internal.jts.recovery.recoverycoordinators.GenericRecoveryCreator) GenericRecoveryCreator(com.arjuna.ats.internal.jts.recovery.recoverycoordinators.GenericRecoveryCreator) Test(org.junit.Test)

Example 7 with DemoResource

use of com.hp.mwtests.ts.jts.orbspecific.resources.DemoResource in project narayana by jbosstm.

the class TopLevelTransactionUnitTest method testRollback.

@Test
public void testRollback() throws Exception {
    AtomicTransaction A = new AtomicTransaction();
    A.begin();
    assertTrue(A.get_txcontext() != null);
    A.registerResource(new DemoResource().getResource());
    TopLevelTransaction B = new TopLevelTransaction();
    DemoResource d = new DemoResource();
    B.begin();
    B.registerResource(d.getResource());
    B.commit(true);
    A.rollback();
    assertEquals(d.getResourceTrace().getTrace(), ResourceTrace.ResourceTraceCommitOnePhase);
}
Also used : DemoResource(com.hp.mwtests.ts.jts.orbspecific.resources.DemoResource) AtomicTransaction(com.arjuna.ats.jts.extensions.AtomicTransaction) TopLevelTransaction(com.arjuna.ats.jts.extensions.TopLevelTransaction) Test(org.junit.Test)

Example 8 with DemoResource

use of com.hp.mwtests.ts.jts.orbspecific.resources.DemoResource in project narayana by jbosstm.

the class TopLevelTransactionUnitTest method testCommit.

@Test
public void testCommit() throws Exception {
    AtomicTransaction A = new AtomicTransaction();
    A.begin();
    assertTrue(A.get_txcontext() != null);
    A.registerResource(new DemoResource().getResource());
    TopLevelTransaction B = new TopLevelTransaction();
    DemoResource d = new DemoResource();
    B.begin();
    B.registerResource(d.getResource());
    B.commit(true);
    A.commit(true);
    assertEquals(d.getResourceTrace().getTrace(), ResourceTrace.ResourceTraceCommitOnePhase);
}
Also used : DemoResource(com.hp.mwtests.ts.jts.orbspecific.resources.DemoResource) AtomicTransaction(com.arjuna.ats.jts.extensions.AtomicTransaction) TopLevelTransaction(com.arjuna.ats.jts.extensions.TopLevelTransaction) Test(org.junit.Test)

Example 9 with DemoResource

use of com.hp.mwtests.ts.jts.orbspecific.resources.DemoResource in project narayana by jbosstm.

the class JacORBGenericRecoveryCreatorSuccessUnitTest method testSuccess.

@Test
public void testSuccess() throws Exception {
    JacOrbRCServiceInit init = new JacOrbRCServiceInit();
    JacOrbRecoveryInit rinit = new JacOrbRecoveryInit();
    init.startRCservice();
    RecoveryCreator creator = RecoveryCreator.getCreator();
    GenericRecoveryCreator generic = null;
    if (creator instanceof GenericRecoveryCreator)
        generic = (GenericRecoveryCreator) creator;
    assertTrue(generic != null);
    DemoResource demo = new DemoResource();
    ArjunaTransactionImple tx = new ArjunaTransactionImple(null);
    Object[] params = new Object[1];
    params[0] = tx;
    RecoveryCoordinator rc = generic.create(demo.getResource(), params);
    assertTrue(rc != null);
    generic.destroy(rc);
    generic.destroyAll(params);
    JacOrbRCServiceInit.shutdownRCService();
}
Also used : DemoResource(com.hp.mwtests.ts.jts.orbspecific.resources.DemoResource) JacOrbRCServiceInit(com.arjuna.ats.internal.jts.orbspecific.jacorb.recoverycoordinators.JacOrbRCServiceInit) JacOrbRecoveryInit(com.arjuna.ats.internal.jts.orbspecific.jacorb.recoverycoordinators.JacOrbRecoveryInit) ArjunaTransactionImple(com.arjuna.ats.internal.jts.orbspecific.coordinator.ArjunaTransactionImple) RecoveryCoordinator(org.omg.CosTransactions.RecoveryCoordinator) RecoveryCreator(com.arjuna.ats.internal.jts.recovery.RecoveryCreator) GenericRecoveryCreator(com.arjuna.ats.internal.jts.recovery.recoverycoordinators.GenericRecoveryCreator) GenericRecoveryCreator(com.arjuna.ats.internal.jts.recovery.recoverycoordinators.GenericRecoveryCreator) Test(org.junit.Test)

Aggregations

DemoResource (com.hp.mwtests.ts.jts.orbspecific.resources.DemoResource)9 Test (org.junit.Test)9 AtomicTransaction (com.arjuna.ats.jts.extensions.AtomicTransaction)3 Uid (com.arjuna.ats.arjuna.common.Uid)2 JacOrbRCServiceInit (com.arjuna.ats.internal.jts.orbspecific.jacorb.recoverycoordinators.JacOrbRCServiceInit)2 JacOrbRecoveryInit (com.arjuna.ats.internal.jts.orbspecific.jacorb.recoverycoordinators.JacOrbRecoveryInit)2 RecoveryCreator (com.arjuna.ats.internal.jts.recovery.RecoveryCreator)2 GenericRecoveryCreator (com.arjuna.ats.internal.jts.recovery.recoverycoordinators.GenericRecoveryCreator)2 TopLevelTransaction (com.arjuna.ats.jts.extensions.TopLevelTransaction)2 ORB (com.arjuna.orbportability.ORB)2 RootOA (com.arjuna.orbportability.RootOA)2 DemoSubTranResource (com.hp.mwtests.ts.jts.orbspecific.resources.DemoSubTranResource)2 InputObjectState (com.arjuna.ats.arjuna.state.InputObjectState)1 OutputObjectState (com.arjuna.ats.arjuna.state.OutputObjectState)1 ArjunaTransactionImple (com.arjuna.ats.internal.jts.orbspecific.coordinator.ArjunaTransactionImple)1 RecoveredTransactionReplayer (com.arjuna.ats.internal.jts.recovery.transactions.RecoveredTransactionReplayer)1 ResourceRecord (com.arjuna.ats.internal.jts.resources.ResourceRecord)1 com.hp.mwtests.ts.jts.orbspecific.resources.heuristic (com.hp.mwtests.ts.jts.orbspecific.resources.heuristic)1 ServerORB (com.hp.mwtests.ts.jts.utils.ServerORB)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1