use of org.jpos.iso.ISOMsg in project jPOS by jpos.
the class MD5FilterTest method testFilterThrowsVetoException5.
@Test
public void testFilterThrowsVetoException5() throws Throwable {
ISOMsg m = new ISOMsg("testMD5FilterMti");
LogEvent evt = new LogEvent();
try {
new MD5Filter().filter(new PostChannel(), m, evt);
fail("Expected VetoException to be thrown");
} catch (ISOFilter.VetoException ex) {
assertEquals("ex.getMessage()", "MD5Filter not configured", ex.getMessage());
assertNull("ex.getNested()", ex.getNested());
assertEquals("m.getDirection()", 0, m.getDirection());
}
}
use of org.jpos.iso.ISOMsg 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("m.getMaxField()", 128, m.getMaxField());
assertSame("result", m, result);
}
use of org.jpos.iso.ISOMsg 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) {
assertNull("ex.getMessage()", ex.getMessage());
assertEquals("m.getDirection()", 0, m.getDirection());
}
}
use of org.jpos.iso.ISOMsg in project jPOS by jpos.
the class MD5FilterTest method testFilterThrowsNullPointerException2.
@Test
public void testFilterThrowsNullPointerException2() throws Throwable {
MD5Filter mD5Filter = new MD5Filter();
mD5Filter.setConfiguration(new SimpleConfiguration());
ISOMsg m = new ISOMsg("testMD5FilterMti");
try {
mD5Filter.filter(new ASCIIChannel(new GenericValidatingPackager()), m, null);
fail("Expected NullPointerException to be thrown");
} catch (NullPointerException ex) {
assertNull("ex.getMessage()", ex.getMessage());
assertEquals("m.getDirection()", 0, m.getDirection());
}
}
use of org.jpos.iso.ISOMsg 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("evt.payLoad.size()", 3, evt.getPayLoad().size());
assertEquals("ex.getMessage()", "org.jpos.iso.ISOFilter$VetoException: invalid MAC", ex.getMessage());
assertEquals("ex.getNested().getMessage()", "invalid MAC", ex.getNested().getMessage());
assertEquals("m.getDirection()", 3, m.getDirection());
}
}
Aggregations