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());
}
}
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());
}
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);
}
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);
}
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());
}
Aggregations