use of org.jpos.iso.packager.PostPackager in project jPOS by jpos.
the class MD5FilterTest method testFilterThrowsVetoException1.
@Test
public void testFilterThrowsVetoException1() throws Throwable {
MD5Filter mD5Filter = new MD5Filter();
mD5Filter.setConfiguration(new SimpleConfiguration());
ISOMsg m = new ISOMsg("testMD5FilterMti");
m.setDirection(3);
LogEvent evt = new LogEvent();
try {
mD5Filter.filter(new PostChannel("testMD5FilterHost", 100, new PostPackager()), m, evt);
fail("Expected VetoException to be thrown");
} catch (ISOFilter.VetoException ex) {
assertEquals(3, evt.getPayLoad().size(), "evt.payLoad.size()");
assertEquals("org.jpos.iso.ISOFilter$VetoException: invalid MAC", ex.getMessage(), "ex.getMessage()");
assertEquals("invalid MAC", ex.getNested().getMessage(), "ex.getNested().getMessage()");
assertEquals(3, m.getDirection(), "m.getDirection()");
}
}
use of org.jpos.iso.packager.PostPackager in project jPOS by jpos.
the class MD5FilterTest method testFilterThrowsVetoException6.
@Test
public void testFilterThrowsVetoException6() throws Throwable {
MD5Filter mD5Filter = new MD5Filter();
mD5Filter.setConfiguration(new SimpleConfiguration());
mD5Filter.setFields(null);
try {
mD5Filter.filter(new PADChannel(new PostPackager()), null, null);
fail("Expected VetoException to be thrown");
} catch (ISOFilter.VetoException ex) {
assertEquals("MD5Filter not configured", ex.getMessage(), "ex.getMessage()");
assertNull(ex.getNested(), "ex.getNested()");
}
}
use of org.jpos.iso.packager.PostPackager in project jPOS by jpos.
the class MD5FilterTest method testFilterThrowsVetoException3.
@Test
public void testFilterThrowsVetoException3() throws Throwable {
MD5Filter mD5Filter = new MD5Filter();
mD5Filter.setConfiguration(new SimpleConfiguration());
LogEvent evt = new LogEvent("testMD5FilterTag");
int[] fields = new int[1];
mD5Filter.setFields(fields);
ISOMsg m = new ISOMsg("testMD5FilterMti");
try {
mD5Filter.filter(new BASE24TCPChannel("testMD5FilterHost", 100, new PostPackager()), m, evt);
fail("Expected VetoException to be thrown");
} catch (ISOFilter.VetoException ex) {
assertEquals(3, evt.getPayLoad().size(), "evt.payLoad.size()");
assertEquals("org.jpos.iso.ISOFilter$VetoException: invalid MAC", ex.getMessage(), "ex.getMessage()");
assertEquals("invalid MAC", ex.getNested().getMessage(), "ex.getNested().getMessage()");
assertEquals(0, m.getDirection(), "m.getDirection()");
}
}
use of org.jpos.iso.packager.PostPackager in project jPOS by jpos.
the class StatefulFilterTest method testFilterThrowsNullPointerException8.
@Test
public void testFilterThrowsNullPointerException8() throws Throwable {
int[] key = new int[0];
StatefulFilter statefulFilter = new StatefulFilter();
statefulFilter.setKey(key);
statefulFilter.setSpace((Space) null);
statefulFilter.setMatchDirection(0);
statefulFilter.setSavedFields(null);
statefulFilter.setIgnoredFields(null);
try {
statefulFilter.filter(new CSChannel("testStatefulFilterHost", 100, new PostPackager()), new ISOMsg("testStatefulFilterMti"), new LogEvent());
fail("Expected NullPointerException to be thrown");
} catch (NullPointerException ex) {
if (isJavaVersionAtMost(JAVA_14)) {
assertNull(ex.getMessage(), "ex.getMessage()");
} else {
assertEquals("Cannot invoke \"org.jpos.space.Space.out(Object, Object, long)\" because the return value of \"org.jpos.iso.filter.StatefulFilter.getSpace()\" is null", ex.getMessage(), "ex.getMessage()");
}
}
}
use of org.jpos.iso.packager.PostPackager in project jPOS by jpos.
the class XMLChannelTest method testConstructor1.
@Test
public void testConstructor1() throws Throwable {
ServerSocket serverSocket = new ServerSocket();
ISOPackager p = new PostPackager();
XMLChannel xMLChannel = new XMLChannel(p, serverSocket);
assertSame(p, xMLChannel.getPackager(), "xMLChannel.getPackager()");
assertNull(xMLChannel.getLogger(), "xMLChannel.getLogger()");
assertEquals(0, xMLChannel.getIncomingFilters().size(), "xMLChannel.getIncomingFilters().size()");
assertEquals(0, xMLChannel.getPort(), "xMLChannel.getPort()");
assertNull(xMLChannel.getHeader(), "xMLChannel.getHeader()");
assertNull(xMLChannel.getSocketFactory(), "xMLChannel.getSocketFactory()");
assertSame(serverSocket, xMLChannel.getServerSocket(), "xMLChannel.getServerSocket()");
assertEquals("org.jpos.iso.channel.XMLChannel", xMLChannel.getOriginalRealm(), "xMLChannel.getOriginalRealm()");
assertNull(xMLChannel.reader, "xMLChannel.reader");
assertNull(xMLChannel.getHost(), "xMLChannel.getHost()");
assertEquals(100000, xMLChannel.getMaxPacketLength(), "xMLChannel.getMaxPacketLength()");
assertEquals("", xMLChannel.getName(), "xMLChannel.getName()");
assertEquals(3, xMLChannel.getCounters().length, "xMLChannel.getCounters().length");
assertEquals(0, xMLChannel.getOutgoingFilters().size(), "xMLChannel.getOutgoingFilters().size()");
assertNull(xMLChannel.getRealm(), "xMLChannel.getRealm()");
}
Aggregations