Search in sources :

Example 6 with PostPackager

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

the class BASE24ChannelTest method testConstructor.

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

Example 7 with PostPackager

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

the class BaseChannelTest method testAcceptThrowsNullPointerException.

@Test
public void testAcceptThrowsNullPointerException() throws Throwable {
    BaseChannel xMLChannel = new XMLChannel(new PostPackager());
    try {
        xMLChannel.accept(null);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        if (isJavaVersionAtMost(JAVA_14)) {
            assertNull(ex.getMessage(), "ex.getMessage()");
        } else {
            assertEquals("Cannot invoke \"java.net.ServerSocket.accept()\" because \"s\" is null", ex.getMessage(), "ex.getMessage()");
        }
        assertNull(((XMLChannel) xMLChannel).logger, "(XMLChannel) xMLChannel.logger");
        assertNull(((XMLChannel) xMLChannel).originalRealm, "(XMLChannel) xMLChannel.originalRealm");
        assertNull(((XMLChannel) xMLChannel).serverIn, "(XMLChannel) xMLChannel.serverIn");
        assertNull(((XMLChannel) xMLChannel).serverOut, "(XMLChannel) xMLChannel.serverOut");
        assertNull(xMLChannel.getSocket(), "(XMLChannel) xMLChannel.getSocket()");
        assertEquals(3, ((XMLChannel) xMLChannel).cnt.length, "(XMLChannel) xMLChannel.cnt.length");
        assertNull(((XMLChannel) xMLChannel).realm, "(XMLChannel) xMLChannel.realm");
        assertFalse(((XMLChannel) xMLChannel).usable, "(XMLChannel) xMLChannel.usable");
    }
}
Also used : PostPackager(org.jpos.iso.packager.PostPackager) XMLChannel(org.jpos.iso.channel.XMLChannel) Test(org.junit.jupiter.api.Test)

Example 8 with PostPackager

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

the class BaseChannelTest method testSetTimeout1.

@Test
public void testSetTimeout1() throws Throwable {
    BaseChannel cSChannel = new CSChannel(new PostPackager());
    cSChannel.setTimeout(0);
    assertEquals(0, cSChannel.getTimeout(), "(CSChannel) cSChannel.getTimeout()");
}
Also used : PostPackager(org.jpos.iso.packager.PostPackager) CSChannel(org.jpos.iso.channel.CSChannel) Test(org.junit.jupiter.api.Test)

Example 9 with PostPackager

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

the class BaseChannelTest method testSendMessageTrailer.

@Test
public void testSendMessageTrailer() throws Throwable {
    BaseChannel xMLChannel = new XMLChannel(new PostPackager());
    xMLChannel.sendMessageTrailer(new ISOMsg(), new byte[] { 100 });
    int actual = xMLChannel.getHeaderLength();
    assertEquals(0, actual, "(XMLChannel) xMLChannel.getHeaderLength()");
}
Also used : PostPackager(org.jpos.iso.packager.PostPackager) XMLChannel(org.jpos.iso.channel.XMLChannel) Test(org.junit.jupiter.api.Test)

Example 10 with PostPackager

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

the class BaseChannelTest method testSetHeaderThrowsNullPointerException.

@Test
public void testSetHeaderThrowsNullPointerException() throws Throwable {
    BaseChannel cSChannel = new CSChannel(new PostPackager());
    try {
        cSChannel.setHeader((String) null);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        if (isJavaVersionAtMost(JAVA_14)) {
            assertNull(ex.getMessage(), "ex.getMessage()");
        } else {
            assertEquals("Cannot invoke \"String.getBytes()\" because \"header\" is null", ex.getMessage(), "ex.getMessage()");
        }
        assertNull(((CSChannel) cSChannel).header, "(CSChannel) cSChannel.header");
    }
}
Also used : PostPackager(org.jpos.iso.packager.PostPackager) CSChannel(org.jpos.iso.channel.CSChannel) 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