Search in sources :

Example 11 with XMLPackager

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

the class SslChannelIntegrationTest method newIsoServer.

private ISOServer newIsoServer() throws IOException, ISOException {
    XMLChannel clientSide = new XMLChannel(new XMLPackager());
    clientSide.setLogger(logger, "server.channel");
    ISOServer isoServer = new ISOServer(PORT, clientSide, new ThreadPool());
    isoServer.setSocketFactory(new GenericSSLSocketFactory());
    isoServer.setConfiguration(serverConfiguration());
    isoServer.setLogger(logger, "server");
    isoServer.addISORequestListener(new TestListener());
    return isoServer;
}
Also used : XMLPackager(org.jpos.iso.packager.XMLPackager) ThreadPool(org.jpos.util.ThreadPool) XMLChannel(org.jpos.iso.channel.XMLChannel)

Example 12 with XMLPackager

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

the class X25ChannelTest method testSetHeaderThrowsNullPointerException.

@Test
public void testSetHeaderThrowsNullPointerException() throws Throwable {
    X25Channel x25Channel = new X25Channel("testX25ChannelHost", 100, new XMLPackager());
    try {
        x25Channel.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(x25Channel.header, "x25Channel.header");
    }
}
Also used : XMLPackager(org.jpos.iso.packager.XMLPackager) Test(org.junit.jupiter.api.Test)

Example 13 with XMLPackager

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

the class StatefulFilterTest method testFilter3.

@Test
public void testFilter3() throws Throwable {
    int[] key = new int[0];
    StatefulFilter statefulFilter = new StatefulFilter();
    statefulFilter.setKey(key);
    statefulFilter.setMatchDirection(58);
    statefulFilter.setSavedFields(null);
    statefulFilter.setIgnoredFields(null);
    ISOMsg m = new ISOMsg("testStatefulFilterMti");
    m.setDirection(58);
    ISOMsg result = statefulFilter.filter(new PostChannel("testStatefulFilterHost", 100, new XMLPackager()), m, new LogEvent("testStatefulFilterTag", new CTCSubFieldPackager()));
    assertSame(m, result, "result");
}
Also used : XMLPackager(org.jpos.iso.packager.XMLPackager) ISOMsg(org.jpos.iso.ISOMsg) LogEvent(org.jpos.util.LogEvent) PostChannel(org.jpos.iso.channel.PostChannel) CTCSubFieldPackager(org.jpos.iso.packager.CTCSubFieldPackager) Test(org.junit.jupiter.api.Test)

Example 14 with XMLPackager

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

the class MD5FilterTest method testFilterThrowsNullPointerException3.

@Test
public void testFilterThrowsNullPointerException3() throws Throwable {
    MD5Filter mD5Filter = new MD5Filter();
    mD5Filter.setConfiguration(new SimpleConfiguration());
    int[] fields = new int[1];
    fields[0] = -100;
    mD5Filter.setFields(fields);
    ISOMsg m = new ISOMsg("testMD5FilterMti");
    try {
        mD5Filter.filter(new GZIPChannel(new XMLPackager()), m, null);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        if (isJavaVersionAtMost(JAVA_14)) {
            assertNull(ex.getMessage(), "ex.getMessage()");
        } else {
            assertEquals("Cannot invoke \"org.jpos.util.LogEvent.addMessage(Object)\" because \"evt\" is null", ex.getMessage(), "ex.getMessage()");
        }
        assertEquals(0, m.getDirection(), "m.getDirection()");
    }
}
Also used : XMLPackager(org.jpos.iso.packager.XMLPackager) ISOMsg(org.jpos.iso.ISOMsg) SimpleConfiguration(org.jpos.core.SimpleConfiguration) GZIPChannel(org.jpos.iso.channel.GZIPChannel) Test(org.junit.jupiter.api.Test)

Example 15 with XMLPackager

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

the class StatefulFilterTest method testFilter7.

@Test
public void testFilter7() throws Throwable {
    int[] key = new int[0];
    StatefulFilter statefulFilter = new StatefulFilter();
    statefulFilter.setKey(key);
    statefulFilter.setMatchDirection(0);
    statefulFilter.setSavedFields(null);
    ISOMsg m = new ISOMsg("testStatefulFilterMti");
    ISOMsg result = statefulFilter.filter(new PADChannel(new XMLPackager()), m, new LogEvent(new Base1SubFieldPackager(), "testStatefulFilterTag"));
    assertSame(m, result, "result");
}
Also used : XMLPackager(org.jpos.iso.packager.XMLPackager) Base1SubFieldPackager(org.jpos.iso.packager.Base1SubFieldPackager) ISOMsg(org.jpos.iso.ISOMsg) LogEvent(org.jpos.util.LogEvent) PADChannel(org.jpos.iso.channel.PADChannel) 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