use of org.jpos.iso.channel.ASCIIChannel in project jPOS by jpos.
the class MD5FilterTest method testFilterThrowsVetoException4.
@Test
public void testFilterThrowsVetoException4() throws Throwable {
MD5Filter mD5Filter = new MD5Filter();
mD5Filter.setConfiguration(new SimpleConfiguration());
int[] fields = new int[1];
fields[0] = -100;
mD5Filter.setFields(fields);
ISOMsg m = new ISOMsg("testMD5FilterMti");
m.setDirection(1);
LogEvent evt = new LogEvent("testMD5FilterTag");
try {
mD5Filter.filter(new ASCIIChannel(new ISOBaseValidatingPackager()), 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()", 1, m.getDirection());
}
}
use of org.jpos.iso.channel.ASCIIChannel in project jPOS by jpos.
the class MD5FilterTest method testFilterThrowsVetoException2.
@Test
public void testFilterThrowsVetoException2() throws Throwable {
MD5Filter mD5Filter = new MD5Filter();
mD5Filter.setConfiguration(new SimpleConfiguration());
int[] fields = new int[1];
fields[0] = -100;
mD5Filter.setFields(fields);
ISOMsg m = new ISOMsg("testMD5FilterMti");
m.setDirection(3);
LogEvent evt = new LogEvent("testMD5FilterTag");
try {
mD5Filter.filter(new ASCIIChannel(new ISOBaseValidatingPackager()), 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());
}
}
use of org.jpos.iso.channel.ASCIIChannel in project jPOS by jpos.
the class MD5FilterTest method testFilter1.
@Test
public void testFilter1() throws Throwable {
MD5Filter mD5Filter = new MD5Filter();
mD5Filter.setConfiguration(new SimpleConfiguration());
int[] fields = new int[1];
fields[0] = -100;
mD5Filter.setFields(fields);
ISOMsg m = new ISOMsg("testMD5FilterMti");
m.setDirection(2);
ISOMsg result = mD5Filter.filter(new ASCIIChannel(new ISOBaseValidatingPackager()), m, new LogEvent("testMD5FilterTag"));
assertEquals("m.getMaxField()", 128, m.getMaxField());
assertSame("result", m, result);
}
Aggregations