Search in sources :

Example 11 with PostPackager

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

the class BaseChannelTest method testDisconnect1.

@Test
public void testDisconnect1() throws Throwable {
    ServerSocket sock = new ServerSocket();
    BaseChannel cSChannel = new CSChannel(new PostPackager());
    cSChannel.setServerSocket(sock);
    cSChannel.disconnect();
    assertSame(sock, ((CSChannel) cSChannel).serverSocket, "(CSChannel) cSChannel.serverSocket");
    assertNull(cSChannel.getSocket(), "(CSChannel) cSChannel.getSocket()");
    assertFalse(((CSChannel) cSChannel).usable, "(CSChannel) cSChannel.usable");
}
Also used : PostPackager(org.jpos.iso.packager.PostPackager) CSChannel(org.jpos.iso.channel.CSChannel) Test(org.junit.jupiter.api.Test)

Example 12 with PostPackager

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

the class BSHFilterTest method testFilterThrowsNullPointerException.

@Test
public void testFilterThrowsNullPointerException() throws Throwable {
    BSHFilter bSHFilter = new BSHFilter();
    LogEvent evt = new LogEvent();
    try {
        bSHFilter.filter(new CSChannel("testBSHFilterHost", 100, new PostPackager()), new ISOMsg("testBSHFilterMti"), evt);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        if (isJavaVersionAtMost(JAVA_14)) {
            assertNull(ex.getMessage(), "ex.getMessage()");
        } else {
            assertEquals("Cannot invoke \"org.jpos.core.Configuration.getAll(String)\" because \"this.cfg\" is null", ex.getMessage(), "ex.getMessage()");
        }
        assertNull(bSHFilter.cfg, "bSHFilter.cfg");
    }
}
Also used : ISOMsg(org.jpos.iso.ISOMsg) LogEvent(org.jpos.util.LogEvent) PostPackager(org.jpos.iso.packager.PostPackager) CSChannel(org.jpos.iso.channel.CSChannel) Test(org.junit.jupiter.api.Test)

Example 13 with PostPackager

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

the class BaseChannelTest method testGetIncomingFilters.

@Test
public void testGetIncomingFilters() throws Throwable {
    Collection result = (Collection) new CSChannel(new PostPackager()).getIncomingFilters();
    assertEquals(0, result.size(), "result.size()");
}
Also used : PostPackager(org.jpos.iso.packager.PostPackager) Collection(java.util.Collection) CSChannel(org.jpos.iso.channel.CSChannel) Test(org.junit.jupiter.api.Test)

Example 14 with PostPackager

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

the class XMLChannelTest method testStreamReceive.

@Test
public void testStreamReceive() throws Throwable {
    XMLChannel xMLChannel = new XMLChannel(new PostPackager(), new ServerSocket());
    try {
        xMLChannel.streamReceive();
    } catch (EOFException e) {
        return;
    }
    fail("EOFException should have been raised");
}
Also used : PostPackager(org.jpos.iso.packager.PostPackager) EOFException(java.io.EOFException) ServerSocket(java.net.ServerSocket) Test(org.junit.jupiter.api.Test)

Example 15 with PostPackager

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

the class NACChannelTest method testConstructor3.

@Test
public void testConstructor3() throws Throwable {
    byte[] TPDU = new byte[0];
    ISOPackager p = new PostPackager();
    NACChannel nACChannel = new NACChannel(p, TPDU);
    assertEquals(0, nACChannel.getIncomingFilters().size(), "nACChannel.getIncomingFilters().size()");
    assertEquals(100000, nACChannel.getMaxPacketLength(), "nACChannel.getMaxPacketLength()");
    assertSame(p, nACChannel.getPackager(), "nACChannel.getPackager()");
    assertEquals(0, nACChannel.getPort(), "nACChannel.getPort()");
    assertEquals("", nACChannel.getName(), "nACChannel.getName()");
    assertEquals(3, nACChannel.getCounters().length, "nACChannel.getCounters().length");
    assertNull(nACChannel.getLogger(), "nACChannel.getLogger()");
    assertNull(nACChannel.getSocketFactory(), "nACChannel.getSocketFactory()");
    assertSame(TPDU, nACChannel.getHeader(), "nACChannel.getHeader()");
    assertEquals(0, nACChannel.getOutgoingFilters().size(), "nACChannel.getOutgoingFilters().size()");
    assertNull(nACChannel.getServerSocket(), "nACChannel.getServerSocket()");
    assertEquals("org.jpos.iso.channel.NACChannel", nACChannel.getOriginalRealm(), "nACChannel.getOriginalRealm()");
    assertNull(nACChannel.getRealm(), "nACChannel.getRealm()");
    assertNull(nACChannel.getHost(), "nACChannel.getHost()");
}
Also used : ISOPackager(org.jpos.iso.ISOPackager) 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