Search in sources :

Example 1 with Forward

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

the class TransactionManagerTest method testPrepareThrowsNullPointerException3.

@Test
public void testPrepareThrowsNullPointerException3() throws Throwable {
    List<TransactionParticipant> members = new ArrayList();
    List<TransactionParticipant> arrayList = new ArrayList();
    arrayList.add(new Forward());
    LogEvent evt = new LogEvent();
    try {
        transactionManager.prepare(1, 100L, Boolean.FALSE, members, arrayList.iterator(), false, evt, null);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertEquals("evt.payLoad.size()", 1, evt.getPayLoad().size());
        assertEquals("evt.payLoad.get(0)", "        prepare: org.jpos.transaction.participant.Forward ABORTED", 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) LogEvent(org.jpos.util.LogEvent) ArrayList(java.util.ArrayList) Forward(org.jpos.transaction.participant.Forward) Test(org.junit.Test)

Example 2 with Forward

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

the class TransactionManagerTest method testAbort3.

@Test
public void testAbort3() throws Throwable {
    LogEvent evt = new LogEvent("testTransactionManagerTag", Integer.valueOf(2));
    transactionManager.abort(1, 100L, Boolean.TRUE, members, members.add(new Forward()), evt, null);
    assertEquals("evt.payLoad.size()", 2, evt.getPayLoad().size());
    assertEquals("evt.payLoad.get(1)", "          abort: org.jpos.transaction.participant.Forward", evt.getPayLoad().get(1));
}
Also used : LogEvent(org.jpos.util.LogEvent) Forward(org.jpos.transaction.participant.Forward) Test(org.junit.Test)

Aggregations

Forward (org.jpos.transaction.participant.Forward)2 LogEvent (org.jpos.util.LogEvent)2 Test (org.junit.Test)2 ArrayList (java.util.ArrayList)1 BSHTransactionParticipant (org.jpos.transaction.participant.BSHTransactionParticipant)1