Search in sources :

Example 1 with ISO93APackager

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

the class PostChannelTest method testSendMessageLengthThrowsNullPointerException.

@Test
public void testSendMessageLengthThrowsNullPointerException() throws Throwable {
    PostChannel postChannel = new PostChannel(new ISO93APackager());
    try {
        postChannel.sendMessageLength(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(int)\" because \"this.serverOut\" is null", ex.getMessage(), "ex.getMessage()");
        }
    }
}
Also used : ISO93APackager(org.jpos.iso.packager.ISO93APackager) Test(org.junit.jupiter.api.Test)

Example 2 with ISO93APackager

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

the class BASE24ChannelTest method testStreamReceiveThrowsNullPointerException.

@Test
public void testStreamReceiveThrowsNullPointerException() throws Throwable {
    BASE24Channel bASE24Channel = new BASE24Channel(new ISO93APackager());
    try {
        bASE24Channel.streamReceive();
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        if (isJavaVersionAtMost(JAVA_14)) {
            assertNull(ex.getMessage(), "ex.getMessage()");
        } else {
            assertEquals("Cannot invoke \"java.io.DataInputStream.read()\" because \"this.serverIn\" is null", ex.getMessage(), "ex.getMessage()");
        }
    }
}
Also used : ISO93APackager(org.jpos.iso.packager.ISO93APackager) Test(org.junit.jupiter.api.Test)

Example 3 with ISO93APackager

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

the class HEXChannelTest method testConstructor1.

@Test
public void testConstructor1() throws Throwable {
    byte[] TPDU = new byte[1];
    ISOPackager p = new ISO93APackager();
    HEXChannel hEXChannel = new HEXChannel(p, TPDU);
    assertEquals(0, hEXChannel.getIncomingFilters().size(), "hEXChannel.getIncomingFilters().size()");
    assertEquals(100000, hEXChannel.getMaxPacketLength(), "hEXChannel.getMaxPacketLength()");
    assertSame(p, hEXChannel.getPackager(), "hEXChannel.getPackager()");
    assertEquals(0, hEXChannel.getPort(), "hEXChannel.getPort()");
    assertEquals("", hEXChannel.getName(), "hEXChannel.getName()");
    assertEquals(3, hEXChannel.getCounters().length, "hEXChannel.getCounters().length");
    assertNull(hEXChannel.getLogger(), "hEXChannel.getLogger()");
    assertNull(hEXChannel.getSocketFactory(), "hEXChannel.getSocketFactory()");
    assertSame(TPDU, hEXChannel.getHeader(), "hEXChannel.getHeader()");
    assertEquals(0, hEXChannel.getOutgoingFilters().size(), "hEXChannel.getOutgoingFilters().size()");
    assertNull(hEXChannel.getServerSocket(), "hEXChannel.getServerSocket()");
    assertEquals("org.jpos.iso.channel.HEXChannel", hEXChannel.getOriginalRealm(), "hEXChannel.getOriginalRealm()");
    assertNull(hEXChannel.getRealm(), "hEXChannel.getRealm()");
    assertNull(hEXChannel.getHost(), "hEXChannel.getHost()");
}
Also used : ISOPackager(org.jpos.iso.ISOPackager) ISO93APackager(org.jpos.iso.packager.ISO93APackager) Test(org.junit.jupiter.api.Test)

Example 4 with ISO93APackager

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

the class BASE24TCPChannelTest method testConstructor2.

@Test
public void testConstructor2() throws Throwable {
    ISOPackager p = new ISO93APackager();
    BASE24TCPChannel bASE24TCPChannel = new BASE24TCPChannel("testBASE24TCPChannelHost", 100, p);
    assertEquals(0, bASE24TCPChannel.getIncomingFilters().size(), "bASE24TCPChannel.getIncomingFilters().size()");
    assertEquals(100000, bASE24TCPChannel.getMaxPacketLength(), "bASE24TCPChannel.getMaxPacketLength()");
    assertSame(p, bASE24TCPChannel.getPackager(), "bASE24TCPChannel.getPackager()");
    assertEquals(100, bASE24TCPChannel.getPort(), "bASE24TCPChannel.getPort()");
    assertEquals("", bASE24TCPChannel.getName(), "bASE24TCPChannel.getName()");
    assertEquals(3, bASE24TCPChannel.getCounters().length, "bASE24TCPChannel.getCounters().length");
    assertNull(bASE24TCPChannel.getLogger(), "bASE24TCPChannel.getLogger()");
    assertNull(bASE24TCPChannel.getSocketFactory(), "bASE24TCPChannel.getSocketFactory()");
    assertNull(bASE24TCPChannel.getHeader(), "bASE24TCPChannel.getHeader()");
    assertEquals(0, bASE24TCPChannel.getOutgoingFilters().size(), "bASE24TCPChannel.getOutgoingFilters().size()");
    assertNull(bASE24TCPChannel.getServerSocket(), "bASE24TCPChannel.getServerSocket()");
    assertEquals("org.jpos.iso.channel.BASE24TCPChannel", bASE24TCPChannel.getOriginalRealm(), "bASE24TCPChannel.getOriginalRealm()");
    assertNull(bASE24TCPChannel.getRealm(), "bASE24TCPChannel.getRealm()");
    assertEquals("testBASE24TCPChannelHost", bASE24TCPChannel.getHost(), "bASE24TCPChannel.getHost()");
}
Also used : ISOPackager(org.jpos.iso.ISOPackager) ISO93APackager(org.jpos.iso.packager.ISO93APackager) Test(org.junit.jupiter.api.Test)

Example 5 with ISO93APackager

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

the class PostChannelTest method testConstructor1.

@Test
public void testConstructor1() throws Throwable {
    ISOPackager p = new ISO93APackager();
    PostChannel postChannel = new PostChannel("testPostChannelHost", 100, p);
    assertEquals(0, postChannel.getIncomingFilters().size(), "postChannel.getIncomingFilters().size()");
    assertEquals(100000, postChannel.getMaxPacketLength(), "postChannel.getMaxPacketLength()");
    assertSame(p, postChannel.getPackager(), "postChannel.getPackager()");
    assertEquals(100, postChannel.getPort(), "postChannel.getPort()");
    assertEquals("", postChannel.getName(), "postChannel.getName()");
    assertEquals(3, postChannel.getCounters().length, "postChannel.getCounters().length");
    assertNull(postChannel.getLogger(), "postChannel.getLogger()");
    assertNull(postChannel.getSocketFactory(), "postChannel.getSocketFactory()");
    assertNull(postChannel.getHeader(), "postChannel.getHeader()");
    assertEquals(0, postChannel.getOutgoingFilters().size(), "postChannel.getOutgoingFilters().size()");
    assertNull(postChannel.getServerSocket(), "postChannel.getServerSocket()");
    assertEquals("org.jpos.iso.channel.PostChannel", postChannel.getOriginalRealm(), "postChannel.getOriginalRealm()");
    assertNull(postChannel.getRealm(), "postChannel.getRealm()");
    assertEquals("testPostChannelHost", postChannel.getHost(), "postChannel.getHost()");
}
Also used : ISOPackager(org.jpos.iso.ISOPackager) ISO93APackager(org.jpos.iso.packager.ISO93APackager) Test(org.junit.jupiter.api.Test)

Aggregations

ISO93APackager (org.jpos.iso.packager.ISO93APackager)10 Test (org.junit.jupiter.api.Test)10 ISOPackager (org.jpos.iso.ISOPackager)4 ServerSocket (java.net.ServerSocket)2 ISOMsg (org.jpos.iso.ISOMsg)1 DelayFilter (org.jpos.iso.filter.DelayFilter)1 ISO93BPackager (org.jpos.iso.packager.ISO93BPackager)1