use of org.jpos.iso.channel.CSChannel 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.channel.CSChannel in project jPOS by jpos.
the class BaseChannelTest method testCreateISOMsgThrowsNullPointerException.
@Test
public void testCreateISOMsgThrowsNullPointerException() throws Throwable {
BaseChannel cSChannel = new CSChannel(new ISO93BPackager());
cSChannel.setPackager(null);
try {
cSChannel.createMsg();
fail("Expected NullPointerException to be thrown");
} catch (NullPointerException ex) {
assertNull("ex.getMessage()", ex.getMessage());
assertNull("(CSChannel) cSChannel.packager", ((CSChannel) cSChannel).packager);
}
}
use of org.jpos.iso.channel.CSChannel in project jPOS by jpos.
the class BaseChannelTest method testDisconnect1.
@Test
public void testDisconnect1() throws Throwable {
ServerSocket sock = new ServerSocket();
BaseChannel cSChannel = new CSChannel(new PostPackager());
cSChannel.setServerSocket(sock);
cSChannel.disconnect();
assertSame("(CSChannel) cSChannel.serverSocket", sock, ((CSChannel) cSChannel).serverSocket);
assertNull("(CSChannel) cSChannel.getSocket()", cSChannel.getSocket());
assertFalse("(CSChannel) cSChannel.usable", ((CSChannel) cSChannel).usable);
}
use of org.jpos.iso.channel.CSChannel in project jPOS by jpos.
the class BaseChannelTest method testApplyIncomingFilters.
@Test
public void testApplyIncomingFilters() throws Throwable {
byte[] image = "testString".getBytes();
final BaseChannel cSChannel = new CSChannel();
cSChannel.addIncomingFilter(filter);
final LogEvent evt = new LogEvent();
byte[] header = new byte[2];
when(filter.filter(cSChannel, m, evt)).thenReturn(m);
ISOMsg result = cSChannel.applyIncomingFilters(m, header, image, evt);
assertSame("result", m, result);
}
use of org.jpos.iso.channel.CSChannel in project jPOS by jpos.
the class BaseChannelTest method testSetTimeout1.
@Test
public void testSetTimeout1() throws Throwable {
BaseChannel cSChannel = new CSChannel(new PostPackager());
cSChannel.setTimeout(0);
assertEquals("(CSChannel) cSChannel.getTimeout()", 0, cSChannel.getTimeout());
}
Aggregations