use of org.jpos.iso.packager.CTCSubFieldPackager in project jPOS by jpos.
the class BaseChannelTest method testApplyIncomingFiltersThrowsVetoException.
@Test
public void testApplyIncomingFiltersThrowsVetoException() throws Throwable {
BaseChannel x25Channel = new X25Channel();
x25Channel.addFilter(new MD5Filter());
try {
x25Channel.applyIncomingFilters(new ISOMsg(), new LogEvent(new CTCSubFieldPackager(), "testBaseChannelTag"));
fail("Expected VetoException to be thrown");
} catch (ISOFilter.VetoException ex) {
assertEquals("ex.getMessage()", "MD5Filter not configured", ex.getMessage());
assertNull("ex.nested", ex.nested);
}
}
use of org.jpos.iso.packager.CTCSubFieldPackager in project jPOS by jpos.
the class BaseChannelTest method testApplyOutgoingFilters.
@Test
public void testApplyOutgoingFilters() throws Throwable {
BaseChannel x25Channel = new X25Channel();
LogEvent evt = new LogEvent(new CTCSubFieldPackager(), "testBaseChannelTag");
ISOMsg result = x25Channel.applyOutgoingFilters(m, evt);
assertSame("result", m, result);
}
use of org.jpos.iso.packager.CTCSubFieldPackager in project jPOS by jpos.
the class GZIPChannelTest method testConstructor.
@Test
public void testConstructor() throws Throwable {
ISOPackager p = new CTCSubFieldPackager();
ServerSocket serverSocket = new ServerSocket();
GZIPChannel gZIPChannel = new GZIPChannel(p, serverSocket);
assertEquals("gZIPChannel.getIncomingFilters().size()", 0, gZIPChannel.getIncomingFilters().size());
assertEquals("gZIPChannel.getMaxPacketLength()", 100000, gZIPChannel.getMaxPacketLength());
assertSame("gZIPChannel.getPackager()", p, gZIPChannel.getPackager());
assertEquals("gZIPChannel.getPort()", 0, gZIPChannel.getPort());
assertEquals("gZIPChannel.getName()", "", gZIPChannel.getName());
assertEquals("gZIPChannel.getCounters().length", 3, gZIPChannel.getCounters().length);
assertNull("gZIPChannel.getLogger()", gZIPChannel.getLogger());
assertNull("gZIPChannel.getSocketFactory()", gZIPChannel.getSocketFactory());
assertNull("gZIPChannel.getHeader()", gZIPChannel.getHeader());
assertEquals("gZIPChannel.getOutgoingFilters().size()", 0, gZIPChannel.getOutgoingFilters().size());
assertSame("gZIPChannel.getServerSocket()", serverSocket, gZIPChannel.getServerSocket());
assertEquals("gZIPChannel.getOriginalRealm()", "org.jpos.iso.channel.GZIPChannel", gZIPChannel.getOriginalRealm());
assertNull("gZIPChannel.getRealm()", gZIPChannel.getRealm());
assertNull("gZIPChannel.getHost()", gZIPChannel.getHost());
}
use of org.jpos.iso.packager.CTCSubFieldPackager in project jPOS by jpos.
the class DelayFilterTest method testFilter2.
@Test
public void testFilter2() throws Throwable {
DelayFilter delayFilter = new DelayFilter(-1);
ISOChannel channel = new PADChannel(new CTCSubFieldPackager());
LogEvent evt = new LogEvent("testDelayFilterTag", "");
ISOMsg result = delayFilter.filter(channel, m, evt);
assertEquals("evt.payLoad.size()", 2, evt.getPayLoad().size());
assertEquals("evt.payLoad.get(1)", "<delay-filter delay=\"-1\"/>", evt.getPayLoad().get(1));
assertSame("result", m, result);
}
use of org.jpos.iso.packager.CTCSubFieldPackager 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());
}
Aggregations