Search in sources :

Example 26 with LogEvent

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

the class StatefulFilterTest method testFilterThrowsVetoException.

@Test
public void testFilterThrowsVetoException() throws Throwable {
    StatefulFilter statefulFilter = new StatefulFilter();
    statefulFilter.setSpace("testStatefulFilterUri");
    int[] key = new int[0];
    statefulFilter.setVetoUnmatched(true);
    statefulFilter.setKey(key);
    try {
        statefulFilter.filter(new BASE24TCPChannel(), new ISOMsg("testStatefulFilterMti"), new LogEvent());
        fail("Expected VetoException to be thrown");
    } catch (ISOFilter.VetoException ex) {
        assertEquals("ex.getMessage()", "unmatched iso message", ex.getMessage());
        assertNull("ex.getNested()", ex.getNested());
    }
}
Also used : BASE24TCPChannel(org.jpos.iso.channel.BASE24TCPChannel) ISOFilter(org.jpos.iso.ISOFilter) ISOMsg(org.jpos.iso.ISOMsg) LogEvent(org.jpos.util.LogEvent) Test(org.junit.Test)

Example 27 with LogEvent

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

the class StatefulFilterTest method testFilter6.

@Test
public void testFilter6() throws Throwable {
    StatefulFilter statefulFilter = new StatefulFilter();
    statefulFilter.setMatchDirection(58);
    statefulFilter.setSavedFields(null);
    statefulFilter.setIgnoredFields(null);
    ISOMsg m = new ISOMsg("testStatefulFilterMti");
    m.setDirection(58);
    ISOMsg result = statefulFilter.filter(new PostChannel("testStatefulFilterHost", 100, new XMLPackager()), m, new LogEvent("testStatefulFilterTag", new CTCSubFieldPackager()));
    assertEquals("result.getDirection()", 58, result.getDirection());
}
Also used : XMLPackager(org.jpos.iso.packager.XMLPackager) ISOMsg(org.jpos.iso.ISOMsg) LogEvent(org.jpos.util.LogEvent) PostChannel(org.jpos.iso.channel.PostChannel) CTCSubFieldPackager(org.jpos.iso.packager.CTCSubFieldPackager) Test(org.junit.Test)

Example 28 with LogEvent

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

the class StatefulFilterTest method testFilterThrowsNullPointerException4.

@Test
public void testFilterThrowsNullPointerException4() throws Throwable {
    ISOMsg m = new ISOMsg(100);
    m.setDirection(100);
    StatefulFilter statefulFilter = new StatefulFilter();
    statefulFilter.setSpace((Space) null);
    statefulFilter.setMatchDirection(100);
    statefulFilter.setSavedFields(null);
    try {
        statefulFilter.filter(new PostChannel("testStatefulFilterHost", 100, new GenericSubFieldPackager()), m, new LogEvent());
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
    }
}
Also used : ISOMsg(org.jpos.iso.ISOMsg) LogEvent(org.jpos.util.LogEvent) PostChannel(org.jpos.iso.channel.PostChannel) GenericSubFieldPackager(org.jpos.iso.packager.GenericSubFieldPackager) Test(org.junit.Test)

Example 29 with LogEvent

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

the class StatefulFilterTest method testFilter1.

@Test
public void testFilter1() throws Throwable {
    ISOMsg m = new ISOMsg("testStatefulFilterMti");
    m.setDirection(1);
    ISOMsg result = new StatefulFilter().filter(new NACChannel(), m, new LogEvent());
    assertSame("result", m, result);
}
Also used : NACChannel(org.jpos.iso.channel.NACChannel) ISOMsg(org.jpos.iso.ISOMsg) LogEvent(org.jpos.util.LogEvent) Test(org.junit.Test)

Example 30 with LogEvent

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

the class StatefulFilterTest method testFilterThrowsNullPointerException8.

@Test
public void testFilterThrowsNullPointerException8() throws Throwable {
    int[] key = new int[0];
    StatefulFilter statefulFilter = new StatefulFilter();
    statefulFilter.setKey(key);
    statefulFilter.setSpace((Space) null);
    statefulFilter.setMatchDirection(0);
    statefulFilter.setSavedFields(null);
    statefulFilter.setIgnoredFields(null);
    try {
        statefulFilter.filter(new CSChannel("testStatefulFilterHost", 100, new PostPackager()), new ISOMsg("testStatefulFilterMti"), new LogEvent());
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
    }
}
Also used : ISOMsg(org.jpos.iso.ISOMsg) PostPackager(org.jpos.iso.packager.PostPackager) LogEvent(org.jpos.util.LogEvent) CSChannel(org.jpos.iso.channel.CSChannel) 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