use of org.jpos.iso.packager.PostPackager in project jPOS by jpos.
the class BASE24ChannelTest method testConstructor.
@Test
public void testConstructor() throws Throwable {
ISOPackager p = new PostPackager();
BASE24Channel bASE24Channel = new BASE24Channel(p);
assertEquals(0, bASE24Channel.getIncomingFilters().size(), "bASE24Channel.getIncomingFilters().size()");
assertEquals(100000, bASE24Channel.getMaxPacketLength(), "bASE24Channel.getMaxPacketLength()");
assertSame(p, bASE24Channel.getPackager(), "bASE24Channel.getPackager()");
assertEquals(0, bASE24Channel.getPort(), "bASE24Channel.getPort()");
assertEquals("", bASE24Channel.getName(), "bASE24Channel.getName()");
assertEquals(3, bASE24Channel.getCounters().length, "bASE24Channel.getCounters().length");
assertNull(bASE24Channel.getLogger(), "bASE24Channel.getLogger()");
assertNull(bASE24Channel.getSocketFactory(), "bASE24Channel.getSocketFactory()");
assertNull(bASE24Channel.getHeader(), "bASE24Channel.getHeader()");
assertEquals(0, bASE24Channel.getOutgoingFilters().size(), "bASE24Channel.getOutgoingFilters().size()");
assertNull(bASE24Channel.getServerSocket(), "bASE24Channel.getServerSocket()");
assertEquals("org.jpos.iso.channel.BASE24Channel", bASE24Channel.getOriginalRealm(), "bASE24Channel.getOriginalRealm()");
assertNull(bASE24Channel.getRealm(), "bASE24Channel.getRealm()");
assertNull(bASE24Channel.getHost(), "bASE24Channel.getHost()");
}
use of org.jpos.iso.packager.PostPackager in project jPOS by jpos.
the class BaseChannelTest method testAcceptThrowsNullPointerException.
@Test
public void testAcceptThrowsNullPointerException() throws Throwable {
BaseChannel xMLChannel = new XMLChannel(new PostPackager());
try {
xMLChannel.accept(null);
fail("Expected NullPointerException to be thrown");
} catch (NullPointerException ex) {
if (isJavaVersionAtMost(JAVA_14)) {
assertNull(ex.getMessage(), "ex.getMessage()");
} else {
assertEquals("Cannot invoke \"java.net.ServerSocket.accept()\" because \"s\" is null", ex.getMessage(), "ex.getMessage()");
}
assertNull(((XMLChannel) xMLChannel).logger, "(XMLChannel) xMLChannel.logger");
assertNull(((XMLChannel) xMLChannel).originalRealm, "(XMLChannel) xMLChannel.originalRealm");
assertNull(((XMLChannel) xMLChannel).serverIn, "(XMLChannel) xMLChannel.serverIn");
assertNull(((XMLChannel) xMLChannel).serverOut, "(XMLChannel) xMLChannel.serverOut");
assertNull(xMLChannel.getSocket(), "(XMLChannel) xMLChannel.getSocket()");
assertEquals(3, ((XMLChannel) xMLChannel).cnt.length, "(XMLChannel) xMLChannel.cnt.length");
assertNull(((XMLChannel) xMLChannel).realm, "(XMLChannel) xMLChannel.realm");
assertFalse(((XMLChannel) xMLChannel).usable, "(XMLChannel) xMLChannel.usable");
}
}
use of org.jpos.iso.packager.PostPackager 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(0, cSChannel.getTimeout(), "(CSChannel) cSChannel.getTimeout()");
}
use of org.jpos.iso.packager.PostPackager in project jPOS by jpos.
the class BaseChannelTest method testSendMessageTrailer.
@Test
public void testSendMessageTrailer() throws Throwable {
BaseChannel xMLChannel = new XMLChannel(new PostPackager());
xMLChannel.sendMessageTrailer(new ISOMsg(), new byte[] { 100 });
int actual = xMLChannel.getHeaderLength();
assertEquals(0, actual, "(XMLChannel) xMLChannel.getHeaderLength()");
}
use of org.jpos.iso.packager.PostPackager in project jPOS by jpos.
the class BaseChannelTest method testSetHeaderThrowsNullPointerException.
@Test
public void testSetHeaderThrowsNullPointerException() throws Throwable {
BaseChannel cSChannel = new CSChannel(new PostPackager());
try {
cSChannel.setHeader((String) null);
fail("Expected NullPointerException to be thrown");
} catch (NullPointerException ex) {
if (isJavaVersionAtMost(JAVA_14)) {
assertNull(ex.getMessage(), "ex.getMessage()");
} else {
assertEquals("Cannot invoke \"String.getBytes()\" because \"header\" is null", ex.getMessage(), "ex.getMessage()");
}
assertNull(((CSChannel) cSChannel).header, "(CSChannel) cSChannel.header");
}
}
Aggregations