Search in sources :

Example 1 with GenericPackager

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

the class VAPChannelTest method testConstructor2.

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

Example 2 with GenericPackager

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

the class VAPChannelTest method testSetConfigurationThrowsNullPointerException.

@Test
public void testSetConfigurationThrowsNullPointerException() throws Throwable {
    VAPChannel vAPChannel = new VAPChannel(new GenericPackager());
    Configuration cfg = new SubConfiguration();
    try {
        vAPChannel.setConfiguration(cfg);
        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.get(String)\" because \"this.cfg\" is null", ex.getMessage(), "ex.getMessage()");
        }
        assertEquals(100000, vAPChannel.getMaxPacketLength(), "vAPChannel.getMaxPacketLength()");
        assertEquals(0, vAPChannel.getPort(), "vAPChannel.getPort()");
        assertNull(vAPChannel.getSocket(), "vAPChannel.getSocket()");
        assertEquals(0, vAPChannel.getTimeout(), "vAPChannel.getTimeout()");
        assertEquals("000000", vAPChannel.srcid, "vAPChannel.srcid");
        assertFalse(vAPChannel.isOverrideHeader(), "vAPChannel.isOverrideHeader()");
        assertNull(vAPChannel.getHost(), "vAPChannel.getHost()");
        assertEquals("000000", vAPChannel.dstid, "vAPChannel.dstid");
    }
}
Also used : GenericPackager(org.jpos.iso.packager.GenericPackager) SimpleConfiguration(org.jpos.core.SimpleConfiguration) Configuration(org.jpos.core.Configuration) SubConfiguration(org.jpos.core.SubConfiguration) SubConfiguration(org.jpos.core.SubConfiguration) Test(org.junit.jupiter.api.Test)

Example 3 with GenericPackager

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

the class VAPChannelTest method testShouldIgnore2.

@Test
public void testShouldIgnore2() throws Throwable {
    VAPChannel vAPChannel = new VAPChannel(new GenericPackager());
    boolean result = vAPChannel.shouldIgnore(null);
    assertFalse(result, "result");
}
Also used : GenericPackager(org.jpos.iso.packager.GenericPackager) Test(org.junit.jupiter.api.Test)

Example 4 with GenericPackager

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

the class GZIPChannelTest method testConstructor3.

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

Example 5 with GenericPackager

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

the class BaseChannelTest method testGetChannel.

@Test
public void testGetChannel() throws Throwable {
    BaseChannel aSCIIChannel = new ASCIIChannel(new GenericPackager(), new ServerSocket());
    aSCIIChannel.setName("channel.");
    BaseChannel result = (BaseChannel) BaseChannel.getChannel("channel.");
    assertSame(aSCIIChannel, result, "result");
}
Also used : GenericPackager(org.jpos.iso.packager.GenericPackager) ASCIIChannel(org.jpos.iso.channel.ASCIIChannel) Test(org.junit.jupiter.api.Test)

Aggregations

GenericPackager (org.jpos.iso.packager.GenericPackager)21 Test (org.junit.jupiter.api.Test)20 ISOMsg (org.jpos.iso.ISOMsg)8 FileInputStream (java.io.FileInputStream)7 GenericTagSequence (org.jpos.tlv.GenericTagSequence)5 LiteralTagValue (org.jpos.tlv.LiteralTagValue)4 ISOPackager (org.jpos.iso.ISOPackager)3 ISOField (org.jpos.iso.ISOField)2 HEXChannel (org.jpos.iso.channel.HEXChannel)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 IOException (java.io.IOException)1 ObjectOutput (java.io.ObjectOutput)1 ObjectOutputStream (java.io.ObjectOutputStream)1 Configuration (org.jpos.core.Configuration)1 SimpleConfiguration (org.jpos.core.SimpleConfiguration)1 SubConfiguration (org.jpos.core.SubConfiguration)1 ASCIIChannel (org.jpos.iso.channel.ASCIIChannel)1 CSChannel (org.jpos.iso.channel.CSChannel)1 PADChannel (org.jpos.iso.channel.PADChannel)1 ISOMsgRef (org.jpos.tlv.ISOMsgRef)1