use of org.jpos.core.SimpleConfiguration in project jPOS by jpos.
the class MD5FilterTest method testFilterThrowsNullPointerException.
@Test
public void testFilterThrowsNullPointerException() throws Throwable {
MD5Filter mD5Filter = new MD5Filter();
mD5Filter.setConfiguration(new SimpleConfiguration());
int[] fields = new int[1];
mD5Filter.setFields(fields);
ISOMsg m = new ISOMsg("testMD5FilterMti");
try {
mD5Filter.filter(new GZIPChannel(new XMLPackager()), m, null);
fail("Expected NullPointerException to be thrown");
} catch (NullPointerException ex) {
if (isJavaVersionAtMost(JAVA_14)) {
assertNull(ex.getMessage(), "ex.getMessage()");
} else {
assertEquals("Cannot invoke \"org.jpos.util.LogEvent.addMessage(Object)\" because \"evt\" is null", ex.getMessage(), "ex.getMessage()");
}
assertEquals(0, m.getDirection(), "m.getDirection()");
}
}
use of org.jpos.core.SimpleConfiguration in project jPOS by jpos.
the class MD5FilterTest method testFilter.
@Test
public void testFilter() throws Throwable {
MD5Filter mD5Filter = new MD5Filter();
mD5Filter.setConfiguration(new SimpleConfiguration());
ISOMsg m = new ISOMsg("testMD5FilterMti");
m.setDirection(2);
ISOMsg result = mD5Filter.filter(new ASCIIChannel(new EuroSubFieldPackager()), m, new LogEvent());
assertEquals(128, m.getMaxField(), "m.getMaxField()");
assertSame(m, result, "result");
}
use of org.jpos.core.SimpleConfiguration 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.core.SimpleConfiguration 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.core.SimpleConfiguration in project jPOS by jpos.
the class MD5FilterTest method testFilterThrowsNullPointerException4.
@Test
public void testFilterThrowsNullPointerException4() throws Throwable {
MD5Filter mD5Filter = new MD5Filter();
mD5Filter.setConfiguration(new SimpleConfiguration());
LogEvent evt = new LogEvent();
try {
mD5Filter.filter(new BASE24TCPChannel(), null, evt);
fail("Expected NullPointerException to be thrown");
} catch (NullPointerException ex) {
if (isJavaVersionAtMost(JAVA_14)) {
assertNull(ex.getMessage(), "ex.getMessage()");
} else {
assertEquals("Cannot invoke \"org.jpos.iso.ISOMsg.getDirection()\" because \"m\" is null", ex.getMessage(), "ex.getMessage()");
}
}
}
Aggregations