use of org.jpos.iso.packager.ISOBaseValidatingPackager in project jPOS by jpos.
the class MD5FilterTest method testFilter2.
@Test
public void testFilter2() throws Throwable {
MD5Filter mD5Filter = new MD5Filter();
mD5Filter.setConfiguration(new SimpleConfiguration());
int[] fields = new int[1];
mD5Filter.setFields(fields);
ISOMsg m = new ISOMsg("testMD5FilterMti");
m.setDirection(2);
ISOMsg result = mD5Filter.filter(new ASCIIChannel(new ISOBaseValidatingPackager()), m, new LogEvent("testMD5FilterTag"));
assertEquals(128, m.getMaxField(), "m.getMaxField()");
assertSame(m, result, "result");
}
use of org.jpos.iso.packager.ISOBaseValidatingPackager in project jPOS by jpos.
the class MacroFilterTest method testFilter6.
@Test
public void testFilter6() throws Throwable {
ISOMsg m = new ISOMsg(100);
m.set(100, "");
ISOMsg result = new MacroFilter().filter(new CSChannel(new ISOBaseValidatingPackager()), m, new LogEvent("testMacroFilterTag", ""));
assertEquals(0, result.getDirection(), "result.getDirection()");
}
use of org.jpos.iso.packager.ISOBaseValidatingPackager in project jPOS by jpos.
the class BASE24ChannelTest method testConstructor2.
@Test
public void testConstructor2() throws Throwable {
ISOPackager p = new ISOBaseValidatingPackager();
BASE24Channel bASE24Channel = new BASE24Channel("testBASE24ChannelHost", 100, p);
assertEquals(0, bASE24Channel.getIncomingFilters().size(), "bASE24Channel.getIncomingFilters().size()");
assertEquals(100000, bASE24Channel.getMaxPacketLength(), "bASE24Channel.getMaxPacketLength()");
assertSame(p, bASE24Channel.getPackager(), "bASE24Channel.getPackager()");
assertEquals(100, bASE24Channel.getPort(), "bASE24Channel.getPort()");
assertEquals("", bASE24Channel.getName(), "bASE24Channel.getName()");
assertEquals(3, bASE24Channel.getCounters().length, "bASE24Channel.getCounters().length");
assertNull(bASE24Channel.getLogger(), "bASE24Channel.getLogger()");
assertNull(bASE24Channel.getSocketFactory(), "bASE24Channel.getSocketFactory()");
assertNull(bASE24Channel.getHeader(), "bASE24Channel.getHeader()");
assertEquals(0, bASE24Channel.getOutgoingFilters().size(), "bASE24Channel.getOutgoingFilters().size()");
assertNull(bASE24Channel.getServerSocket(), "bASE24Channel.getServerSocket()");
assertEquals("org.jpos.iso.channel.BASE24Channel", bASE24Channel.getOriginalRealm(), "bASE24Channel.getOriginalRealm()");
assertNull(bASE24Channel.getRealm(), "bASE24Channel.getRealm()");
assertEquals("testBASE24ChannelHost", bASE24Channel.getHost(), "bASE24Channel.getHost()");
}
use of org.jpos.iso.packager.ISOBaseValidatingPackager in project jPOS by jpos.
the class BaseChannelTest method testApplyIncomingFilters1.
@Test
public void testApplyIncomingFilters1() throws Throwable {
BaseChannel gZIPChannel = new GZIPChannel("testBaseChannelHost", 100, new ISOBaseValidatingPackager());
LogEvent evt = new LogEvent();
byte[] header = new byte[0];
byte[] image = new byte[2];
ISOMsg result = gZIPChannel.applyIncomingFilters(m, header, image, evt);
assertSame(m, result, "result");
}
use of org.jpos.iso.packager.ISOBaseValidatingPackager in project jPOS by jpos.
the class HEXChannelTest method testSendMessageLengthThrowsNullPointerException.
@Test
public void testSendMessageLengthThrowsNullPointerException() throws Throwable {
HEXChannel hEXChannel = new HEXChannel(new ISOBaseValidatingPackager(), null, new ServerSocket());
try {
hEXChannel.sendMessageLength(100);
fail("Expected NullPointerException to be thrown");
} catch (NullPointerException ex) {
if (isJavaVersionAtMost(JAVA_14)) {
assertNull(ex.getMessage(), "ex.getMessage()");
} else {
assertEquals("Cannot invoke \"java.io.DataOutputStream.write(byte[])\" because \"this.serverOut\" is null", ex.getMessage(), "ex.getMessage()");
}
}
}
Aggregations