Search in sources :

Example 1 with Trace

use of org.jpos.transaction.participant.Trace in project jPOS by jpos.

the class TransactionManagerTest method testPrepareForAbort1.

@Test
public void testPrepareForAbort1() throws Throwable {
    int result = transactionManager.prepareForAbort(new Trace(), 100L, new File("testTransactionManagerParam1"));
    assertEquals("result", 64, result);
}
Also used : Trace(org.jpos.transaction.participant.Trace) File(java.io.File) CheckPoint(org.jpos.transaction.participant.CheckPoint) Test(org.junit.Test)

Example 2 with Trace

use of org.jpos.transaction.participant.Trace in project jPOS by jpos.

the class TransactionManagerTest method testPrepareThrowsNullPointerException5.

@Test
public void testPrepareThrowsNullPointerException5() throws Throwable {
    LogEvent evt = new LogEvent("testTransactionManagerTag");
    List<TransactionParticipant> members = new ArrayList();
    List<TransactionParticipant> arrayList = new ArrayList();
    boolean abort = arrayList.add(new Trace());
    try {
        transactionManager.prepare(1, 100L, new NotActiveException(), members, arrayList.iterator(), abort, evt, null);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertEquals("evt.payLoad.size()", 1, evt.getPayLoad().size());
        assertEquals("evt.payLoad.get(0)", "prepareForAbort: org.jpos.transaction.participant.Trace", evt.getPayLoad().get(0));
        assertNull("ex.getMessage()", ex.getMessage());
        assertNull("transactionManager.psp", transactionManager.psp);
        assertNull("transactionManager.groups", transactionManager.groups);
        assertEquals("(ArrayList) members.size()", 0, members.size());
    }
}
Also used : BSHTransactionParticipant(org.jpos.transaction.participant.BSHTransactionParticipant) Trace(org.jpos.transaction.participant.Trace) LogEvent(org.jpos.util.LogEvent) ArrayList(java.util.ArrayList) NotActiveException(java.io.NotActiveException) Test(org.junit.Test)

Example 3 with Trace

use of org.jpos.transaction.participant.Trace in project jPOS by jpos.

the class TransactionManagerTest method testCommit5.

@Test
public void testCommit5() throws Throwable {
    TransactionParticipant p = new Trace();
    transactionManager.commit(p, 100L, Boolean.FALSE);
    assertTrue("Test completed without Exception", true);
}
Also used : BSHTransactionParticipant(org.jpos.transaction.participant.BSHTransactionParticipant) Trace(org.jpos.transaction.participant.Trace) Test(org.junit.Test)

Aggregations

Trace (org.jpos.transaction.participant.Trace)3 Test (org.junit.Test)3 BSHTransactionParticipant (org.jpos.transaction.participant.BSHTransactionParticipant)2 File (java.io.File)1 NotActiveException (java.io.NotActiveException)1 ArrayList (java.util.ArrayList)1 CheckPoint (org.jpos.transaction.participant.CheckPoint)1 LogEvent (org.jpos.util.LogEvent)1