Search in sources :

Example 6 with DummyRecoverableXAConnection

use of com.hp.mwtests.ts.jta.common.DummyRecoverableXAConnection in project narayana by jbosstm.

the class XAResourceRecordUnitTest method testPackUnpack.

@Test
public void testPackUnpack() throws Exception {
    ThreadActionData.purgeActions();
    OTSImpleManager.current().contextManager().purgeActions();
    XAResourceRecord xares;
    DummyRecoverableXAConnection rc = new DummyRecoverableXAConnection();
    Object[] params = new Object[1];
    params[XAResourceRecord.XACONNECTION] = rc;
    xares = new XAResourceRecord(new TransactionImple(), new DummyXA(false), new XidImple(new Uid()), params);
    OutputObjectState os = new OutputObjectState();
    assertTrue(xares.saveState(os));
    xares = new XAResourceRecord();
    InputObjectState is = new InputObjectState(os);
    assertTrue(xares.restoreState(is));
}
Also used : XidImple(com.arjuna.ats.jta.xa.XidImple) DummyRecoverableXAConnection(com.hp.mwtests.ts.jta.common.DummyRecoverableXAConnection) Uid(com.arjuna.ats.arjuna.common.Uid) InputObjectState(com.arjuna.ats.arjuna.state.InputObjectState) DummyXA(com.hp.mwtests.ts.jta.jts.common.DummyXA) XAResourceRecord(com.arjuna.ats.internal.jta.resources.jts.orbspecific.XAResourceRecord) TransactionImple(com.arjuna.ats.internal.jta.transaction.jts.TransactionImple) OutputObjectState(com.arjuna.ats.arjuna.state.OutputObjectState) Test(org.junit.Test)

Example 7 with DummyRecoverableXAConnection

use of com.hp.mwtests.ts.jta.common.DummyRecoverableXAConnection in project narayana by jbosstm.

the class XAResourceRecordUnitTest method test.

@Test
public void test() throws Exception {
    ThreadActionData.purgeActions();
    OTSImpleManager.current().contextManager().purgeActions();
    XAResourceRecord xares = new XAResourceRecord();
    DummyRecoverableXAConnection rc = new DummyRecoverableXAConnection();
    Object[] params = new Object[1];
    params[XAResourceRecord.XACONNECTION] = rc;
    xares = new XAResourceRecord(new TransactionImple(), new DummyXA(false), new XidImple(new Uid()), params);
    xares.merge(null);
    xares.alter(null);
    assertTrue(xares.type() != null);
    assertTrue(xares.toString() != null);
    assertTrue(xares.get_uid().notEquals(Uid.nullUid()));
}
Also used : XidImple(com.arjuna.ats.jta.xa.XidImple) DummyRecoverableXAConnection(com.hp.mwtests.ts.jta.common.DummyRecoverableXAConnection) Uid(com.arjuna.ats.arjuna.common.Uid) DummyXA(com.hp.mwtests.ts.jta.jts.common.DummyXA) XAResourceRecord(com.arjuna.ats.internal.jta.resources.jts.orbspecific.XAResourceRecord) TransactionImple(com.arjuna.ats.internal.jta.transaction.jts.TransactionImple) Test(org.junit.Test)

Example 8 with DummyRecoverableXAConnection

use of com.hp.mwtests.ts.jta.common.DummyRecoverableXAConnection in project narayana by jbosstm.

the class XAResourceRecordUnitTest method testReadonly.

@Test
public void testReadonly() throws Exception {
    ThreadActionData.purgeActions();
    OTSImpleManager.current().contextManager().purgeActions();
    XAResourceRecord xares;
    DummyRecoverableXAConnection rc = new DummyRecoverableXAConnection();
    Object[] params = new Object[1];
    params[XAResourceRecord.XACONNECTION] = rc;
    xares = new XAResourceRecord(new TransactionImple(), new TestResource(true), new XidImple(new Uid()), params);
    try {
        xares.commit();
        fail();
    } catch (final NotPrepared ex) {
    }
    assertEquals(xares.prepare(), Vote.VoteReadOnly);
}
Also used : XidImple(com.arjuna.ats.jta.xa.XidImple) DummyRecoverableXAConnection(com.hp.mwtests.ts.jta.common.DummyRecoverableXAConnection) Uid(com.arjuna.ats.arjuna.common.Uid) XAResourceRecord(com.arjuna.ats.internal.jta.resources.jts.orbspecific.XAResourceRecord) TransactionImple(com.arjuna.ats.internal.jta.transaction.jts.TransactionImple) TestResource(com.hp.mwtests.ts.jta.common.TestResource) NotPrepared(org.omg.CosTransactions.NotPrepared) Test(org.junit.Test)

Aggregations

Uid (com.arjuna.ats.arjuna.common.Uid)8 XidImple (com.arjuna.ats.jta.xa.XidImple)8 DummyRecoverableXAConnection (com.hp.mwtests.ts.jta.common.DummyRecoverableXAConnection)8 Test (org.junit.Test)8 TransactionImple (com.arjuna.ats.internal.jta.transaction.jts.TransactionImple)4 InputObjectState (com.arjuna.ats.arjuna.state.InputObjectState)3 OutputObjectState (com.arjuna.ats.arjuna.state.OutputObjectState)3 XAResourceRecord (com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord)3 XAResourceRecord (com.arjuna.ats.internal.jta.resources.jts.orbspecific.XAResourceRecord)3 TransactionImple (com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple)3 DummyXA (com.hp.mwtests.ts.jta.jts.common.DummyXA)3 DummyXA (com.hp.mwtests.ts.jta.common.DummyXA)2 TestResource (com.hp.mwtests.ts.jta.common.TestResource)2 XAOnePhaseResource (com.arjuna.ats.internal.jta.resources.arjunacore.XAOnePhaseResource)1 SampleOnePhaseResource (com.hp.mwtests.ts.jta.common.SampleOnePhaseResource)1 NotPrepared (org.omg.CosTransactions.NotPrepared)1