use of org.jpos.iso.ISOMsg 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.ISOMsg in project jPOS by jpos.
the class VAPChannelTest method testSendMessageHeaderThrowsNullPointerException.
@Test
public void testSendMessageHeaderThrowsNullPointerException() throws Throwable {
VAPChannel vAPChannel = new VAPChannel();
ISOMsg m = new ISOMsg("testVAPChannelMti");
byte[] b = new byte[0];
m.setHeader(b);
try {
vAPChannel.sendMessageHeader(m, 100);
fail("Expected NullPointerException to be thrown");
} catch (NullPointerException ex) {
assertNull("ex.getMessage()", ex.getMessage());
assertEquals("m.getDirection()", 0, m.getDirection());
}
}
use of org.jpos.iso.ISOMsg in project jPOS by jpos.
the class XMLChannelTest method testSendMessageHeader.
@Test
public void testSendMessageHeader() throws Throwable {
XMLChannel xMLChannel = new XMLChannel(null, new ServerSocket());
xMLChannel.sendMessageHeader(new ISOMsg("testXMLChannelMti"), 100);
assertEquals("xMLChannel.getHeaderLength()", 0, xMLChannel.getHeaderLength());
}
use of org.jpos.iso.ISOMsg in project jPOS by jpos.
the class DelayFilterTest method testFilter1.
@Test
public void testFilter1() throws Throwable {
LogEvent evt = new LogEvent(new BASE24TCPChannel("testDelayFilterHost", 100, new Base1SubFieldPackager()), "testDelayFilterTag", null);
ISOMsg result = new DelayFilter(1).filter(new PADChannel(), null, evt);
assertEquals("evt.payLoad.size()", 2, evt.getPayLoad().size());
assertEquals("evt.payLoad.get(1)", "<delay-filter delay=\"1\"/>", evt.getPayLoad().get(1));
assertNull("result", result);
}
use of org.jpos.iso.ISOMsg 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);
}
Aggregations