use of org.jpos.iso.packager.ISO87BPackager in project jPOS by jpos.
the class CSChannelTest method testConstructor3.
@Test
public void testConstructor3() throws Throwable {
ISOPackager p = new ISO87BPackager();
CSChannel cSChannel = new CSChannel(p);
assertEquals("cSChannel.getIncomingFilters().size()", 0, cSChannel.getIncomingFilters().size());
assertEquals("cSChannel.getMaxPacketLength()", 100000, cSChannel.getMaxPacketLength());
assertSame("cSChannel.getPackager()", p, cSChannel.getPackager());
assertEquals("cSChannel.getPort()", 0, cSChannel.getPort());
assertEquals("cSChannel.getName()", "", cSChannel.getName());
assertEquals("cSChannel.getCounters().length", 3, cSChannel.getCounters().length);
assertNull("cSChannel.getLogger()", cSChannel.getLogger());
assertNull("cSChannel.getSocketFactory()", cSChannel.getSocketFactory());
assertNull("cSChannel.getHeader()", cSChannel.getHeader());
assertEquals("cSChannel.getOutgoingFilters().size()", 0, cSChannel.getOutgoingFilters().size());
assertNull("cSChannel.getServerSocket()", cSChannel.getServerSocket());
assertEquals("cSChannel.getOriginalRealm()", "org.jpos.iso.channel.CSChannel", cSChannel.getOriginalRealm());
assertNull("cSChannel.getRealm()", cSChannel.getRealm());
assertNull("cSChannel.getHost()", cSChannel.getHost());
}
use of org.jpos.iso.packager.ISO87BPackager in project jPOS by jpos.
the class NCCChannelTest method testSendMessageHeaderThrowsNullPointerException.
@Test
public void testSendMessageHeaderThrowsNullPointerException() throws Throwable {
byte[] TPDU = new byte[1];
NCCChannel nCCChannel = new NCCChannel(new ISO87BPackager(), TPDU, new ServerSocket());
ISOMsg m = new ISOMsg();
try {
nCCChannel.sendMessageHeader(m, 100);
fail("Expected NullPointerException to be thrown");
} catch (NullPointerException ex) {
assertNull("ex.getMessage()", ex.getMessage());
}
}
use of org.jpos.iso.packager.ISO87BPackager in project jPOS by jpos.
the class NCCChannelTest method testSendMessageHeaderThrowsNullPointerException1.
@Test
public void testSendMessageHeaderThrowsNullPointerException1() throws Throwable {
byte[] TPDU = new byte[1];
NCCChannel nCCChannel = new NCCChannel(new ISO87BPackager(), TPDU, new ServerSocket());
ISOMsg m = new ISOMsg(100);
m.setHeader(new BASE1Header("testNCCChannelSource", "testNCCChannelDestination"));
try {
nCCChannel.sendMessageHeader(m, 100);
fail("Expected NullPointerException to be thrown");
} catch (NullPointerException ex) {
assertNull("ex.getMessage()", ex.getMessage());
}
}
use of org.jpos.iso.packager.ISO87BPackager in project jPOS by jpos.
the class NCCChannelTest method testConstructor.
@Test
public void testConstructor() throws Throwable {
ISOPackager p = new ISO87BPackager();
byte[] TPDU = new byte[1];
ServerSocket serverSocket = new ServerSocket();
NCCChannel nCCChannel = new NCCChannel(p, TPDU, serverSocket);
assertEquals("nCCChannel.getIncomingFilters().size()", 0, nCCChannel.getIncomingFilters().size());
assertEquals("nCCChannel.getMaxPacketLength()", 100000, nCCChannel.getMaxPacketLength());
assertSame("nCCChannel.getPackager()", p, nCCChannel.getPackager());
assertEquals("nCCChannel.getPort()", 0, nCCChannel.getPort());
assertEquals("nCCChannel.getName()", "", nCCChannel.getName());
assertEquals("nCCChannel.getCounters().length", 3, nCCChannel.getCounters().length);
assertNull("nCCChannel.getLogger()", nCCChannel.getLogger());
assertNull("nCCChannel.getSocketFactory()", nCCChannel.getSocketFactory());
assertSame("nCCChannel.getHeader()", TPDU, nCCChannel.getHeader());
assertEquals("nCCChannel.getOutgoingFilters().size()", 0, nCCChannel.getOutgoingFilters().size());
assertSame("nCCChannel.getServerSocket()", serverSocket, nCCChannel.getServerSocket());
assertEquals("nCCChannel.getOriginalRealm()", "org.jpos.iso.channel.NCCChannel", nCCChannel.getOriginalRealm());
assertNull("nCCChannel.getRealm()", nCCChannel.getRealm());
assertNull("nCCChannel.getHost()", nCCChannel.getHost());
}
use of org.jpos.iso.packager.ISO87BPackager in project jPOS by jpos.
the class VAPChannelTest method testSendMessageHeaderThrowsArrayIndexOutOfBoundsException.
@Test
public void testSendMessageHeaderThrowsArrayIndexOutOfBoundsException() throws Throwable {
VAPChannel vAPChannel = new VAPChannel();
final byte[] image = new byte[2];
VAPChannel vAPChannel2 = new VAPChannel(new ISO87BPackager());
final BASE1Header dynamicHeader = (BASE1Header) vAPChannel2.getDynamicHeader(image);
given(m.getHeader()).willReturn(image);
given(m.getISOHeader()).willReturn(dynamicHeader);
try {
vAPChannel.sendMessageHeader(m, 100);
fail("Expected ArrayIndexOutOfBoundsException to be thrown");
} catch (ArrayIndexOutOfBoundsException ex) {
assertEquals("ex.getMessage()", "3", ex.getMessage());
}
}
Aggregations