Search in sources :

Example 36 with ISOMsg

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());
    }
}
Also used : ISO87BPackager(org.jpos.iso.packager.ISO87BPackager) ISOMsg(org.jpos.iso.ISOMsg) BASE1Header(org.jpos.iso.header.BASE1Header) ServerSocket(java.net.ServerSocket) Test(org.junit.Test)

Example 37 with ISOMsg

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());
    }
}
Also used : ISOMsg(org.jpos.iso.ISOMsg) Test(org.junit.Test)

Example 38 with ISOMsg

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());
}
Also used : ISOMsg(org.jpos.iso.ISOMsg) ServerSocket(java.net.ServerSocket) Test(org.junit.Test)

Example 39 with ISOMsg

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);
}
Also used : BASE24TCPChannel(org.jpos.iso.channel.BASE24TCPChannel) Base1SubFieldPackager(org.jpos.iso.packager.Base1SubFieldPackager) ISOMsg(org.jpos.iso.ISOMsg) LogEvent(org.jpos.util.LogEvent) PADChannel(org.jpos.iso.channel.PADChannel) Test(org.junit.Test)

Example 40 with ISOMsg

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);
}
Also used : ISOMsg(org.jpos.iso.ISOMsg) LogEvent(org.jpos.util.LogEvent) PADChannel(org.jpos.iso.channel.PADChannel) CTCSubFieldPackager(org.jpos.iso.packager.CTCSubFieldPackager) ISOChannel(org.jpos.iso.ISOChannel) Test(org.junit.Test)

Aggregations

ISOMsg (org.jpos.iso.ISOMsg)223 Test (org.junit.Test)191 LogEvent (org.jpos.util.LogEvent)41 ISOBaseValidator (org.jpos.iso.ISOBaseValidator)30 ISOException (org.jpos.iso.ISOException)29 ISOComponent (org.jpos.iso.ISOComponent)25 ISOVMsg (org.jpos.iso.ISOVMsg)22 ISOFieldValidator (org.jpos.iso.ISOFieldValidator)21 Context (org.jpos.transaction.Context)20 ISOValidator (org.jpos.iso.ISOValidator)18 Result (org.jpos.rc.Result)17 SimpleConfiguration (org.jpos.core.SimpleConfiguration)15 ISOFieldPackager (org.jpos.iso.ISOFieldPackager)12 TEST0100 (org.jpos.iso.validator.TEST0100)12 FileInputStream (java.io.FileInputStream)9 Vector (java.util.Vector)9 PostChannel (org.jpos.iso.channel.PostChannel)9 MSGTEST (org.jpos.iso.validator.MSGTEST)9 MSGTEST02 (org.jpos.iso.validator.MSGTEST02)9 ISOFilter (org.jpos.iso.ISOFilter)8