use of org.jpos.iso.ISOChannel in project jPOS by jpos.
the class BSHFilterTest method testFilter1.
@Test
public void testFilter1() throws Throwable {
BSHFilter bSHFilter = new BSHFilter();
Configuration cfg = new SimpleConfiguration();
bSHFilter.setConfiguration(cfg);
ISOChannel channel = new CSChannel();
LogEvent evt = new LogEvent();
ISOVMsg result = (ISOVMsg) bSHFilter.filter(channel, m, evt);
assertSame("result", m, result);
assertSame("bSHFilter.cfg", cfg, bSHFilter.cfg);
}
use of org.jpos.iso.ISOChannel in project jPOS by jpos.
the class ChannelAdaptorTest method stopCanWaitForWorkersEvenWhenOutgoingChannelNeverConnects.
@Test
public void stopCanWaitForWorkersEvenWhenOutgoingChannelNeverConnects() throws Exception {
ISOChannel channel = mock(ISOChannel.class);
when(channel.isConnected()).thenReturn(false);
when(channel.receive()).thenThrow(new ISOException("unconnected ISOChannel"));
// repeat test to ensure clean up occurs after stop
for (int i = 0; i < 10; i++) {
channelAdaptor = configureAndStart(new ChannelAdaptorWithoutQ2(channel));
waitForSenderAndReceiverToStart();
assertCallToStopCompletes(i);
}
}
use of org.jpos.iso.ISOChannel in project jPOS by jpos.
the class ChannelPoolTest method testAddChannel1.
@Test
public void testAddChannel1() throws Throwable {
ChannelPool channelPool = new ChannelPool();
ISOChannel channel = new ASCIIChannel();
channelPool.addChannel(channel);
assertEquals("channelPool.pool.size()", 1, channelPool.pool.size());
assertSame("channelPool.pool.get(0)", channel, channelPool.pool.get(0));
}
use of org.jpos.iso.ISOChannel in project jPOS by jpos.
the class DelayFilterTest method testFilter2.
@Test
public void testFilter2() throws Throwable {
DelayFilter delayFilter = new DelayFilter(-1);
ISOChannel channel = new PADChannel(new CTCSubFieldPackager());
LogEvent evt = new LogEvent("testDelayFilterTag", "");
ISOMsg result = delayFilter.filter(channel, m, evt);
assertEquals("evt.payLoad.size()", 2, evt.getPayLoad().size());
assertEquals("evt.payLoad.get(1)", "<delay-filter delay=\"-1\"/>", evt.getPayLoad().get(1));
assertSame("result", m, result);
}
use of org.jpos.iso.ISOChannel 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