use of org.jpos.util.LogEvent in project jPOS by jpos.
the class StatefulFilterTest method testFilterThrowsVetoException.
@Test
public void testFilterThrowsVetoException() throws Throwable {
StatefulFilter statefulFilter = new StatefulFilter();
statefulFilter.setSpace("testStatefulFilterUri");
int[] key = new int[0];
statefulFilter.setVetoUnmatched(true);
statefulFilter.setKey(key);
try {
statefulFilter.filter(new BASE24TCPChannel(), new ISOMsg("testStatefulFilterMti"), new LogEvent());
fail("Expected VetoException to be thrown");
} catch (ISOFilter.VetoException ex) {
assertEquals("ex.getMessage()", "unmatched iso message", ex.getMessage());
assertNull("ex.getNested()", ex.getNested());
}
}
use of org.jpos.util.LogEvent in project jPOS by jpos.
the class StatefulFilterTest method testFilter6.
@Test
public void testFilter6() throws Throwable {
StatefulFilter statefulFilter = new StatefulFilter();
statefulFilter.setMatchDirection(58);
statefulFilter.setSavedFields(null);
statefulFilter.setIgnoredFields(null);
ISOMsg m = new ISOMsg("testStatefulFilterMti");
m.setDirection(58);
ISOMsg result = statefulFilter.filter(new PostChannel("testStatefulFilterHost", 100, new XMLPackager()), m, new LogEvent("testStatefulFilterTag", new CTCSubFieldPackager()));
assertEquals("result.getDirection()", 58, result.getDirection());
}
use of org.jpos.util.LogEvent in project jPOS by jpos.
the class StatefulFilterTest method testFilterThrowsNullPointerException4.
@Test
public void testFilterThrowsNullPointerException4() throws Throwable {
ISOMsg m = new ISOMsg(100);
m.setDirection(100);
StatefulFilter statefulFilter = new StatefulFilter();
statefulFilter.setSpace((Space) null);
statefulFilter.setMatchDirection(100);
statefulFilter.setSavedFields(null);
try {
statefulFilter.filter(new PostChannel("testStatefulFilterHost", 100, new GenericSubFieldPackager()), m, new LogEvent());
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 StatefulFilterTest method testFilter1.
@Test
public void testFilter1() throws Throwable {
ISOMsg m = new ISOMsg("testStatefulFilterMti");
m.setDirection(1);
ISOMsg result = new StatefulFilter().filter(new NACChannel(), m, new LogEvent());
assertSame("result", m, result);
}
use of org.jpos.util.LogEvent 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) {
assertNull("ex.getMessage()", ex.getMessage());
}
}
Aggregations