Search in sources :

Example 41 with LogEvent

use of org.jpos.util.LogEvent in project jPOS by jpos.

the class ContextTest method testGetLogEvent.

@Test
public void testGetLogEvent() throws Throwable {
    LogEvent result = new Context().getLogEvent();
    assertNotNull(result);
}
Also used : LogEvent(org.jpos.util.LogEvent) Test(org.junit.Test)

Example 42 with LogEvent

use of org.jpos.util.LogEvent in project jPOS by jpos.

the class TransactionManagerTest method testCommit4.

@Test
public void testCommit4() throws Throwable {
    LogEvent evt = new LogEvent("testTransactionManagerTag");
    transactionManager.commit(1, 100L, new NotActiveException("testTransactionManagerParam1"), members, true, evt, null);
    assertEquals("(ArrayList) members.size()", 0, members.size());
}
Also used : LogEvent(org.jpos.util.LogEvent) NotActiveException(java.io.NotActiveException) Test(org.junit.Test)

Example 43 with LogEvent

use of org.jpos.util.LogEvent in project jPOS by jpos.

the class TransactionManagerTest method testPrepare7.

@Test
public void testPrepare7() throws Throwable {
    transactionManager = new TransactionManager();
    List<TransactionParticipant> members = new ArrayList();
    List<TransactionParticipant> arrayList = new ArrayList();
    BSHTransactionParticipant bSHTransactionParticipant = new BSHTransactionParticipant();
    boolean abort = arrayList.add(bSHTransactionParticipant);
    LogEvent evt = new LogEvent();
    int result = transactionManager.prepare(1, 100L, Boolean.FALSE, members, arrayList.iterator(), abort, evt, null);
    assertEquals("(ArrayList) members.size()", 1, members.size());
    assertSame("(ArrayList) members.get(0)", bSHTransactionParticipant, members.get(0));
    assertEquals("evt.payLoad.size()", 1, evt.getPayLoad().size());
    assertEquals("evt.payLoad.get(0)", "prepareForAbort: org.jpos.transaction.participant.BSHTransactionParticipant", evt.getPayLoad().get(0));
    assertEquals("result", 0, result);
}
Also used : BSHTransactionParticipant(org.jpos.transaction.participant.BSHTransactionParticipant) BSHTransactionParticipant(org.jpos.transaction.participant.BSHTransactionParticipant) LogEvent(org.jpos.util.LogEvent) ArrayList(java.util.ArrayList) CheckPoint(org.jpos.transaction.participant.CheckPoint) Test(org.junit.Test)

Example 44 with LogEvent

use of org.jpos.util.LogEvent in project jPOS by jpos.

the class TransactionManagerTest method testAbortThrowsNullPointerException2.

@Test
public void testAbortThrowsNullPointerException2() throws Throwable {
    LogEvent evt = new LogEvent("testTransactionManagerTag", "");
    try {
        transactionManager.abort(1, 100L, new File("testTransactionManagerParam1"), null, true, evt, null);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
    }
}
Also used : LogEvent(org.jpos.util.LogEvent) File(java.io.File) Test(org.junit.Test)

Example 45 with LogEvent

use of org.jpos.util.LogEvent 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)

Aggregations

LogEvent (org.jpos.util.LogEvent)189 Test (org.junit.Test)78 ConfigurationException (org.jpos.core.ConfigurationException)51 ISOMsg (org.jpos.iso.ISOMsg)41 SimpleMsg (org.jpos.util.SimpleMsg)40 NotFoundException (org.jpos.util.NameRegistrar.NotFoundException)38 ArrayList (java.util.ArrayList)24 IOException (java.io.IOException)18 SimpleConfiguration (org.jpos.core.SimpleConfiguration)14 CSChannel (org.jpos.iso.channel.CSChannel)12 Loggeable (org.jpos.util.Loggeable)11 Map (java.util.Map)9 ISOChannel (org.jpos.iso.ISOChannel)9 PostChannel (org.jpos.iso.channel.PostChannel)9 CTCSubFieldPackager (org.jpos.iso.packager.CTCSubFieldPackager)9 ISOFilter (org.jpos.iso.ISOFilter)8 BASE24TCPChannel (org.jpos.iso.channel.BASE24TCPChannel)8 PADChannel (org.jpos.iso.channel.PADChannel)8 ISOBaseValidatingPackager (org.jpos.iso.packager.ISOBaseValidatingPackager)8 EOFException (java.io.EOFException)7