Search in sources :

Example 11 with CSChannel

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

the class BaseChannelTest method testApplyIncomingFiltersThrowsNullPointerException.

@Test
public void testApplyIncomingFiltersThrowsNullPointerException() throws Throwable {
    BaseChannel cSChannel = new CSChannel();
    cSChannel.addIncomingFilter(new MacroFilter());
    byte[] header = new byte[2];
    try {
        cSChannel.applyIncomingFilters(null, header, "testString".getBytes(), new LogEvent());
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
    }
}
Also used : LogEvent(org.jpos.util.LogEvent) CSChannel(org.jpos.iso.channel.CSChannel) MacroFilter(org.jpos.iso.filter.MacroFilter) Test(org.junit.Test)

Example 12 with CSChannel

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

the class BaseChannelTest method testGetIncomingFilters.

@Test
public void testGetIncomingFilters() throws Throwable {
    Collection result = (Collection) new CSChannel(new PostPackager()).getIncomingFilters();
    assertEquals("result.size()", 0, result.size());
}
Also used : PostPackager(org.jpos.iso.packager.PostPackager) Collection(java.util.Collection) CSChannel(org.jpos.iso.channel.CSChannel) Test(org.junit.Test)

Example 13 with CSChannel

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

the class DelayFilterTest method testFilter.

@Test
public void testFilter() throws Throwable {
    DelayFilter delayFilter = new DelayFilter(0);
    LogEvent evt = new LogEvent("testDelayFilterTag", "testString");
    ISOChannel channel = new CSChannel(new Base1SubFieldPackager(), new ServerSocket());
    ISOMsg result = delayFilter.filter(channel, m, evt);
    assertEquals("evt.payLoad.size()", 2, evt.getPayLoad().size());
    assertEquals("evt.payLoad.get(1)", "<delay-filter delay=\"0\"/>", evt.getPayLoad().get(1));
    assertSame("result", m, result);
}
Also used : Base1SubFieldPackager(org.jpos.iso.packager.Base1SubFieldPackager) ISOMsg(org.jpos.iso.ISOMsg) LogEvent(org.jpos.util.LogEvent) ServerSocket(java.net.ServerSocket) ISOChannel(org.jpos.iso.ISOChannel) CSChannel(org.jpos.iso.channel.CSChannel) Test(org.junit.Test)

Example 14 with CSChannel

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

the class MacroFilterTest method testFilter4.

@Test
public void testFilter4() throws Throwable {
    ISOMsg m = new ISOMsg(100);
    byte[] value = new byte[2];
    m.set(100, value);
    m.merge(new ISOMsg("testMacroFilterMti"));
    m.set(100, "");
    ISOMsg result = new MacroFilter().filter(new CSChannel(new ISOBaseValidatingPackager()), m, new LogEvent("testMacroFilterTag", ""));
    assertSame("result", m, result);
}
Also used : ISOMsg(org.jpos.iso.ISOMsg) LogEvent(org.jpos.util.LogEvent) ISOBaseValidatingPackager(org.jpos.iso.packager.ISOBaseValidatingPackager) CSChannel(org.jpos.iso.channel.CSChannel) Test(org.junit.Test)

Example 15 with CSChannel

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

the class MacroFilterTest method testFilter1.

@Test
public void testFilter1() throws Throwable {
    ISOMsg m = new ISOMsg(100);
    m.merge(new ISOMsg("testMacroFilterMti"));
    m.set(1, "");
    ISOMsg result = new MacroFilter().filter(new CSChannel(new ISOBaseValidatingPackager()), m, new LogEvent("testMacroFilterTag", ""));
    assertEquals("result.getDirection()", 0, result.getDirection());
}
Also used : ISOMsg(org.jpos.iso.ISOMsg) LogEvent(org.jpos.util.LogEvent) ISOBaseValidatingPackager(org.jpos.iso.packager.ISOBaseValidatingPackager) CSChannel(org.jpos.iso.channel.CSChannel) Test(org.junit.Test)

Aggregations

CSChannel (org.jpos.iso.channel.CSChannel)18 Test (org.junit.Test)18 LogEvent (org.jpos.util.LogEvent)12 ISOMsg (org.jpos.iso.ISOMsg)10 PostPackager (org.jpos.iso.packager.PostPackager)8 ISOBaseValidatingPackager (org.jpos.iso.packager.ISOBaseValidatingPackager)3 ISOChannel (org.jpos.iso.ISOChannel)2 ServerSocket (java.net.ServerSocket)1 Collection (java.util.Collection)1 Configuration (org.jpos.core.Configuration)1 SimpleConfiguration (org.jpos.core.SimpleConfiguration)1 ISOVMsg (org.jpos.iso.ISOVMsg)1 MacroFilter (org.jpos.iso.filter.MacroFilter)1 Base1SubFieldPackager (org.jpos.iso.packager.Base1SubFieldPackager)1 GenericPackager (org.jpos.iso.packager.GenericPackager)1 ISO93BPackager (org.jpos.iso.packager.ISO93BPackager)1