use of org.jpos.util.LogEvent 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("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()", 0, m.getDirection());
}
}
use of org.jpos.util.LogEvent 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("m.getMaxField()", 128, m.getMaxField());
assertSame("result", m, result);
}
use of org.jpos.util.LogEvent in project jPOS by jpos.
the class MD5FilterTest method testFilterThrowsVetoException.
@Test
public void testFilterThrowsVetoException() throws Throwable {
MD5Filter mD5Filter = new MD5Filter();
mD5Filter.setConfiguration(new SimpleConfiguration(new Properties()));
int[] fields = new int[3];
fields[1] = 57;
mD5Filter.setFields(fields);
ISOMsg m = new ISOMsg("testMD5FilterMti");
LogEvent evt = new LogEvent("testMD5FilterTag", new XMLPackager());
try {
mD5Filter.filter(new ASCIIChannel(null), m, evt);
fail("Expected VetoException to be thrown");
} catch (ISOFilter.VetoException ex) {
assertEquals("evt.payLoad.size()", 4, 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()", 0, m.getDirection());
}
}
use of org.jpos.util.LogEvent 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) {
assertNull("ex.getMessage()", ex.getMessage());
}
}
use of org.jpos.util.LogEvent in project jPOS by jpos.
the class MacroFilterTest method testFilter5.
@Test
public void testFilter5() throws Throwable {
MacroFilter macroFilter = new MacroFilter();
LogEvent evt = new LogEvent();
ISOChannel channel = new NACChannel();
when(m.getMaxField()).thenReturn(0);
when(m.hasField(0)).thenReturn(true);
when(m.getValue(0)).thenReturn("N/A in Composite");
ISOMsg result = macroFilter.filter(channel, m, evt);
assertSame("result", m, result);
}
Aggregations