Search in sources :

Example 6 with XMLPackager

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

the class LogChannelTest method testConstructor3.

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

Example 7 with XMLPackager

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

the class RawChannelTest method testConstructor3.

@Test
public void testConstructor3() throws Throwable {
    byte[] header = new byte[0];
    ISOPackager p = new XMLPackager();
    ServerSocket serverSocket = new ServerSocket();
    RawChannel rawChannel = new RawChannel(p, header, serverSocket);
    assertEquals(0, rawChannel.getIncomingFilters().size(), "rawChannel.getIncomingFilters().size()");
    assertEquals(100000, rawChannel.getMaxPacketLength(), "rawChannel.getMaxPacketLength()");
    assertSame(p, rawChannel.getPackager(), "rawChannel.getPackager()");
    assertEquals(0, rawChannel.getPort(), "rawChannel.getPort()");
    assertEquals("", rawChannel.getName(), "rawChannel.getName()");
    assertEquals(3, rawChannel.getCounters().length, "rawChannel.getCounters().length");
    assertNull(rawChannel.getLogger(), "rawChannel.getLogger()");
    assertNull(rawChannel.getSocketFactory(), "rawChannel.getSocketFactory()");
    assertSame(header, rawChannel.getHeader(), "rawChannel.getHeader()");
    assertEquals(0, rawChannel.getOutgoingFilters().size(), "rawChannel.getOutgoingFilters().size()");
    assertSame(serverSocket, rawChannel.getServerSocket(), "rawChannel.getServerSocket()");
    assertEquals("org.jpos.iso.channel.RawChannel", rawChannel.getOriginalRealm(), "rawChannel.getOriginalRealm()");
    assertNull(rawChannel.getRealm(), "rawChannel.getRealm()");
    assertNull(rawChannel.getHost(), "rawChannel.getHost()");
}
Also used : ISOPackager(org.jpos.iso.ISOPackager) XMLPackager(org.jpos.iso.packager.XMLPackager) ServerSocket(java.net.ServerSocket) Test(org.junit.jupiter.api.Test)

Example 8 with XMLPackager

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

the class BaseChannelTest method testSendKeepAliveThrowsNullPointerException.

@Test
public void testSendKeepAliveThrowsNullPointerException() throws Throwable {
    try {
        new X25Channel("testBaseChannelHost", 100, new XMLPackager()).sendKeepAlive();
        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.flush()\" because \"this.serverOut\" is null", ex.getMessage(), "ex.getMessage()");
        }
    }
}
Also used : XMLPackager(org.jpos.iso.packager.XMLPackager) X25Channel(org.jpos.iso.channel.X25Channel) Test(org.junit.jupiter.api.Test)

Example 9 with XMLPackager

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

the class SslChannelIntegrationTest method newClientChannel.

private XMLChannel newClientChannel() throws IOException, ISOException {
    XMLChannel clientChannel = new XMLChannel(new XMLPackager());
    clientChannel.setSocketFactory(new GenericSSLSocketFactory());
    clientChannel.setConfiguration(clientConfiguration());
    clientChannel.setLogger(logger, "client.channel");
    clientChannel.setHost("localhost", PORT);
    return clientChannel;
}
Also used : XMLPackager(org.jpos.iso.packager.XMLPackager) XMLChannel(org.jpos.iso.channel.XMLChannel)

Example 10 with XMLPackager

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

the class VAPChannelTest method testSendMessageHeaderThrowsNullPointerException2.

@Test
public void testSendMessageHeaderThrowsNullPointerException2() throws Throwable {
    VAPChannel vAPChannel = new VAPChannel("testVAPChannelHost", 100, new XMLPackager());
    ISOMsg m = new ISOMsg("testVAPChannelMti");
    m.setHeader(new BaseHeader());
    try {
        vAPChannel.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()");
        }
        assertEquals(0, m.getDirection(), "m.getDirection()");
    }
}
Also used : XMLPackager(org.jpos.iso.packager.XMLPackager) BaseHeader(org.jpos.iso.header.BaseHeader) Test(org.junit.jupiter.api.Test)

Aggregations

XMLPackager (org.jpos.iso.packager.XMLPackager)15 Test (org.junit.jupiter.api.Test)13 ISOMsg (org.jpos.iso.ISOMsg)6 LogEvent (org.jpos.util.LogEvent)5 SimpleConfiguration (org.jpos.core.SimpleConfiguration)3 ISOPackager (org.jpos.iso.ISOPackager)3 ServerSocket (java.net.ServerSocket)2 GZIPChannel (org.jpos.iso.channel.GZIPChannel)2 PADChannel (org.jpos.iso.channel.PADChannel)2 PostChannel (org.jpos.iso.channel.PostChannel)2 XMLChannel (org.jpos.iso.channel.XMLChannel)2 CTCSubFieldPackager (org.jpos.iso.packager.CTCSubFieldPackager)2 Properties (java.util.Properties)1 ISOFilter (org.jpos.iso.ISOFilter)1 ASCIIChannel (org.jpos.iso.channel.ASCIIChannel)1 X25Channel (org.jpos.iso.channel.X25Channel)1 BaseHeader (org.jpos.iso.header.BaseHeader)1 Base1SubFieldPackager (org.jpos.iso.packager.Base1SubFieldPackager)1 ThreadPool (org.jpos.util.ThreadPool)1