Search in sources :

Example 6 with BASE24TCPChannel

use of org.jpos.iso.channel.BASE24TCPChannel 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 7 with BASE24TCPChannel

use of org.jpos.iso.channel.BASE24TCPChannel in project jPOS by jpos.

the class FilterLogListenerTest method testLog1.

@Test
public void testLog1() throws Throwable {
    LogEvent ev = new LogEvent(new BASE24TCPChannel(), "testFilterLogListenerTag", "");
    FilterLogListener filterLogListener = new FilterLogListener();
    LogEvent result = filterLogListener.log(ev);
    assertSame("result", ev, result);
    assertNotNull("filterLogListener.p", filterLogListener.p);
}
Also used : BASE24TCPChannel(org.jpos.iso.channel.BASE24TCPChannel) Test(org.junit.Test)

Example 8 with BASE24TCPChannel

use of org.jpos.iso.channel.BASE24TCPChannel in project jPOS by jpos.

the class BaseChannelTest method testRemoveFilter2.

@Test
public void testRemoveFilter2() throws Throwable {
    BaseChannel bASE24TCPChannel = new BASE24TCPChannel();
    bASE24TCPChannel.removeFilter(new DelayFilter(), 0);
    assertEquals("(BASE24TCPChannel) bASE24TCPChannel.incomingFilters.size()", 0, ((BASE24TCPChannel) bASE24TCPChannel).incomingFilters.size());
    assertEquals("(BASE24TCPChannel) bASE24TCPChannel.outgoingFilters.size()", 0, ((BASE24TCPChannel) bASE24TCPChannel).outgoingFilters.size());
}
Also used : BASE24TCPChannel(org.jpos.iso.channel.BASE24TCPChannel) DelayFilter(org.jpos.iso.filter.DelayFilter) Test(org.junit.Test)

Example 9 with BASE24TCPChannel

use of org.jpos.iso.channel.BASE24TCPChannel in project jPOS by jpos.

the class MacroFilterTest method testFilter2.

@Test
public void testFilter2() throws Throwable {
    ISOMsg m = new ISOMsg();
    m.set(100, "testMacroFilterValue");
    ISOMsg result = new MacroFilter().filter(new BASE24TCPChannel(), m, new LogEvent("testMacroFilterTag"));
    assertSame("result", m, result);
}
Also used : BASE24TCPChannel(org.jpos.iso.channel.BASE24TCPChannel) ISOMsg(org.jpos.iso.ISOMsg) LogEvent(org.jpos.util.LogEvent) Test(org.junit.Test)

Example 10 with BASE24TCPChannel

use of org.jpos.iso.channel.BASE24TCPChannel in project jPOS by jpos.

the class StatefulFilterTest method testFilterThrowsNullPointerException7.

@Test
public void testFilterThrowsNullPointerException7() throws Throwable {
    StatefulFilter statefulFilter = new StatefulFilter();
    statefulFilter.setKey(null);
    try {
        statefulFilter.filter(new BASE24TCPChannel(new EuroSubFieldPackager()), new ISOMsg(), new LogEvent(new PostPackager(), "testStatefulFilterTag"));
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
    }
}
Also used : BASE24TCPChannel(org.jpos.iso.channel.BASE24TCPChannel) EuroSubFieldPackager(org.jpos.iso.packager.EuroSubFieldPackager) ISOMsg(org.jpos.iso.ISOMsg) LogEvent(org.jpos.util.LogEvent) PostPackager(org.jpos.iso.packager.PostPackager) Test(org.junit.Test)

Aggregations

BASE24TCPChannel (org.jpos.iso.channel.BASE24TCPChannel)11 Test (org.junit.Test)11 LogEvent (org.jpos.util.LogEvent)8 ISOMsg (org.jpos.iso.ISOMsg)6 SimpleConfiguration (org.jpos.core.SimpleConfiguration)2 ISOFilter (org.jpos.iso.ISOFilter)2 PostPackager (org.jpos.iso.packager.PostPackager)2 PADChannel (org.jpos.iso.channel.PADChannel)1 DelayFilter (org.jpos.iso.filter.DelayFilter)1 StatefulFilter (org.jpos.iso.filter.StatefulFilter)1 Base1SubFieldPackager (org.jpos.iso.packager.Base1SubFieldPackager)1 EuroSubFieldPackager (org.jpos.iso.packager.EuroSubFieldPackager)1 GenericValidatingPackager (org.jpos.iso.packager.GenericValidatingPackager)1