use of org.jpos.iso.packager.GenericPackager in project jPOS by jpos.
the class BaseChannelTest method testNewSocketThrowsIllegalArgumentException.
@Test
public void testNewSocketThrowsIllegalArgumentException() throws Throwable {
byte[] TPDU = new byte[0];
BaseChannel hEXChannel = new HEXChannel("testBaseChannelHost", -1, new GenericPackager(), TPDU);
try {
hEXChannel.newSocket("test", -1);
fail("Expected IllegalArgumentException to be thrown");
} catch (IllegalArgumentException ex) {
assertEquals("ex.getMessage()", "port out of range:-1", ex.getMessage());
assertNull("(HEXChannel) hEXChannel.socketFactory", ((HEXChannel) hEXChannel).socketFactory);
}
}
use of org.jpos.iso.packager.GenericPackager in project jPOS by jpos.
the class ASCIIChannelTest method testSendMessageLength.
@Test
public void testSendMessageLength() throws Throwable {
ASCIIChannel aSCIIChannel = new ASCIIChannel("testASCIIChannelHost", 100, new GenericPackager());
try {
aSCIIChannel.sendMessageLength(Integer.MIN_VALUE);
fail("IOException expected");
} catch (IOException ex) {
assertEquals("ex.getMessage()", "invalid negative length (" + Integer.MIN_VALUE + ")", ex.getMessage());
}
}
use of org.jpos.iso.packager.GenericPackager in project jPOS by jpos.
the class HEXChannelTest method testConstructor.
@Test
public void testConstructor() throws Throwable {
ISOPackager p = new GenericPackager();
byte[] TPDU = new byte[3];
HEXChannel hEXChannel = new HEXChannel("testHEXChannelHost", 100, p, TPDU);
assertEquals("hEXChannel.getIncomingFilters().size()", 0, hEXChannel.getIncomingFilters().size());
assertEquals("hEXChannel.getMaxPacketLength()", 100000, hEXChannel.getMaxPacketLength());
assertSame("hEXChannel.getPackager()", p, hEXChannel.getPackager());
assertEquals("hEXChannel.getPort()", 100, hEXChannel.getPort());
assertEquals("hEXChannel.getName()", "", hEXChannel.getName());
assertEquals("hEXChannel.getCounters().length", 3, hEXChannel.getCounters().length);
assertNull("hEXChannel.getLogger()", hEXChannel.getLogger());
assertNull("hEXChannel.getSocketFactory()", hEXChannel.getSocketFactory());
assertSame("hEXChannel.getHeader()", TPDU, hEXChannel.getHeader());
assertEquals("hEXChannel.getOutgoingFilters().size()", 0, hEXChannel.getOutgoingFilters().size());
assertNull("hEXChannel.getServerSocket()", hEXChannel.getServerSocket());
assertEquals("hEXChannel.getOriginalRealm()", "org.jpos.iso.channel.HEXChannel", hEXChannel.getOriginalRealm());
assertNull("hEXChannel.getRealm()", hEXChannel.getRealm());
assertEquals("hEXChannel.getHost()", "testHEXChannelHost", hEXChannel.getHost());
}
use of org.jpos.iso.packager.GenericPackager in project jPOS by jpos.
the class LoopbackChannelTest method testSetPackager.
@Test
public void testSetPackager() throws Throwable {
LoopbackChannel loopbackChannel = new LoopbackChannel();
loopbackChannel.setPackager(new GenericPackager());
assertNull("loopbackChannel.getName()", loopbackChannel.getName());
}
use of org.jpos.iso.packager.GenericPackager in project jPOS by jpos.
the class StatefulFilterTest method testFilterThrowsNullPointerException3.
@Test
public void testFilterThrowsNullPointerException3() throws Throwable {
int[] key = new int[0];
StatefulFilter statefulFilter = new StatefulFilter();
statefulFilter.setKey(key);
statefulFilter.setSpace((Space) null);
try {
statefulFilter.filter(new CSChannel("testStatefulFilterHost", 100, new GenericPackager()), new ISOMsg("testStatefulFilterMti"), new LogEvent("testStatefulFilterTag", "testString"));
fail("Expected NullPointerException to be thrown");
} catch (NullPointerException ex) {
assertNull("ex.getMessage()", ex.getMessage());
}
}
Aggregations