Search in sources :

Example 16 with PostPackager

use of org.jpos.iso.packager.PostPackager in project jPOS by jpos.

the class CSChannelTest method testGetHeaderLength.

@Test
public void testGetHeaderLength() throws Throwable {
    CSChannel cSChannel = new CSChannel("testCSChannelHost", 100, new PostPackager());
    int result = cSChannel.getHeaderLength();
    assertEquals(0, result, "result");
}
Also used : PostPackager(org.jpos.iso.packager.PostPackager) Test(org.junit.jupiter.api.Test)

Example 17 with PostPackager

use of org.jpos.iso.packager.PostPackager in project jPOS by jpos.

the class NACChannelTest method testSendMessageHeaderThrowsNullPointerException1.

@Test
public void testSendMessageHeaderThrowsNullPointerException1() throws Throwable {
    byte[] TPDU = new byte[0];
    NACChannel nACChannel = new NACChannel(new PostPackager(), TPDU);
    ISOMsg m = new ISOMsg();
    try {
        nACChannel.sendMessageHeader(m, 100);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        if (isJavaVersionAtMost(JAVA_14)) {
            assertNull(ex.getMessage(), "ex.getMessage()");
        } else {
            assertEquals("Cannot invoke \"java.io.DataOutputStream.write(byte[])\" because \"this.serverOut\" is null", ex.getMessage(), "ex.getMessage()");
        }
    }
}
Also used : ISOMsg(org.jpos.iso.ISOMsg) PostPackager(org.jpos.iso.packager.PostPackager) Test(org.junit.jupiter.api.Test)

Example 18 with PostPackager

use of org.jpos.iso.packager.PostPackager in project jPOS by jpos.

the class X25ChannelTest method testSetHeader.

@Test
public void testSetHeader() throws Throwable {
    X25Channel x25Channel = new X25Channel(new PostPackager());
    x25Channel.setHeader("testX25ChannelHeader");
    assertEquals(10, x25Channel.header.length, "x25Channel.header.length");
}
Also used : PostPackager(org.jpos.iso.packager.PostPackager) Test(org.junit.jupiter.api.Test)

Example 19 with PostPackager

use of org.jpos.iso.packager.PostPackager in project jPOS by jpos.

the class StatefulFilterTest method testFilterThrowsNullPointerException1.

@Test
public void testFilterThrowsNullPointerException1() throws Throwable {
    int[] key = new int[0];
    StatefulFilter statefulFilter = new StatefulFilter();
    statefulFilter.setKey(key);
    statefulFilter.setSpace((Space) null);
    statefulFilter.setMatchDirection(0);
    statefulFilter.setIgnoredFields(null);
    try {
        statefulFilter.filter(new CSChannel("testStatefulFilterHost", 100, new PostPackager()), new ISOMsg("testStatefulFilterMti"), new LogEvent());
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        if (isJavaVersionAtMost(JAVA_14)) {
            assertNull(ex.getMessage(), "ex.getMessage()");
        } else {
            assertEquals("Cannot invoke \"org.jpos.space.Space.out(Object, Object, long)\" because the return value of \"org.jpos.iso.filter.StatefulFilter.getSpace()\" is null", ex.getMessage(), "ex.getMessage()");
        }
    }
}
Also used : ISOMsg(org.jpos.iso.ISOMsg) PostPackager(org.jpos.iso.packager.PostPackager) LogEvent(org.jpos.util.LogEvent) CSChannel(org.jpos.iso.channel.CSChannel) Test(org.junit.jupiter.api.Test)

Example 20 with PostPackager

use of org.jpos.iso.packager.PostPackager in project jPOS by jpos.

the class StatefulFilterTest method testFilterThrowsNullPointerException7.

@Test
public void testFilterThrowsNullPointerException7() throws Throwable {
    StatefulFilter statefulFilter = new StatefulFilter();
    statefulFilter.setKey(null);
    try {
        statefulFilter.filter(new BASE24TCPChannel(new EuroSubFieldPackager()), new ISOMsg(), new LogEvent(new PostPackager(), "testStatefulFilterTag"));
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        if (isJavaVersionAtMost(JAVA_14)) {
            assertNull(ex.getMessage(), "ex.getMessage()");
        } else {
            assertEquals("Cannot read the array length because \"<local8>\" is null", ex.getMessage(), "ex.getMessage()");
        }
    }
}
Also used : BASE24TCPChannel(org.jpos.iso.channel.BASE24TCPChannel) EuroSubFieldPackager(org.jpos.iso.packager.EuroSubFieldPackager) ISOMsg(org.jpos.iso.ISOMsg) LogEvent(org.jpos.util.LogEvent) PostPackager(org.jpos.iso.packager.PostPackager) Test(org.junit.jupiter.api.Test)

Aggregations

PostPackager (org.jpos.iso.packager.PostPackager)21 Test (org.junit.jupiter.api.Test)21 ISOMsg (org.jpos.iso.ISOMsg)8 CSChannel (org.jpos.iso.channel.CSChannel)8 LogEvent (org.jpos.util.LogEvent)7 SimpleConfiguration (org.jpos.core.SimpleConfiguration)3 ISOFilter (org.jpos.iso.ISOFilter)3 ISOPackager (org.jpos.iso.ISOPackager)3 ServerSocket (java.net.ServerSocket)2 BASE24TCPChannel (org.jpos.iso.channel.BASE24TCPChannel)2 XMLChannel (org.jpos.iso.channel.XMLChannel)2 EOFException (java.io.EOFException)1 Collection (java.util.Collection)1 PADChannel (org.jpos.iso.channel.PADChannel)1 PostChannel (org.jpos.iso.channel.PostChannel)1 EuroSubFieldPackager (org.jpos.iso.packager.EuroSubFieldPackager)1