use of org.jpos.iso.channel.BASE24TCPChannel in project jPOS by jpos.
the class BaseChannelTest method testRemoveFilter.
@Test
public void testRemoveFilter() throws Throwable {
BaseChannel bASE24TCPChannel = new BASE24TCPChannel();
bASE24TCPChannel.removeFilter(new StatefulFilter(), 100);
assertEquals("(BASE24TCPChannel) bASE24TCPChannel.incomingFilters.size()", 0, ((BASE24TCPChannel) bASE24TCPChannel).incomingFilters.size());
assertEquals("(BASE24TCPChannel) bASE24TCPChannel.outgoingFilters.size()", 0, ((BASE24TCPChannel) bASE24TCPChannel).outgoingFilters.size());
}
use of org.jpos.iso.channel.BASE24TCPChannel in project jPOS by jpos.
the class DelayFilterTest method testFilter1.
@Test
public void testFilter1() throws Throwable {
LogEvent evt = new LogEvent(new BASE24TCPChannel("testDelayFilterHost", 100, new Base1SubFieldPackager()), "testDelayFilterTag", null);
ISOMsg result = new DelayFilter(1).filter(new PADChannel(), null, evt);
assertEquals("evt.payLoad.size()", 2, evt.getPayLoad().size());
assertEquals("evt.payLoad.get(1)", "<delay-filter delay=\"1\"/>", evt.getPayLoad().get(1));
assertNull("result", result);
}
use of org.jpos.iso.channel.BASE24TCPChannel 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.iso.channel.BASE24TCPChannel 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.iso.channel.BASE24TCPChannel in project jPOS by jpos.
the class StatefulFilterTest method testFilter5.
@Test
public void testFilter5() throws Throwable {
StatefulFilter statefulFilter = new StatefulFilter();
BASE24TCPChannel iSOChannel = mock(BASE24TCPChannel.class);
LogEvent evt = mock(LogEvent.class);
ISOMsg m = mock(ISOMsg.class);
given(m.getString(11)).willReturn(null);
given(m.getString(41)).willReturn(null);
given(m.getDirection()).willReturn(0);
ISOMsg result = statefulFilter.filter(iSOChannel, m, evt);
assertSame("result", m, result);
}
Aggregations