Search in sources :

Example 1 with ISOBaseValidatingPackager

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

the class MD5FilterTest method testFilter2.

@Test
public void testFilter2() throws Throwable {
    MD5Filter mD5Filter = new MD5Filter();
    mD5Filter.setConfiguration(new SimpleConfiguration());
    int[] fields = new int[1];
    mD5Filter.setFields(fields);
    ISOMsg m = new ISOMsg("testMD5FilterMti");
    m.setDirection(2);
    ISOMsg result = mD5Filter.filter(new ASCIIChannel(new ISOBaseValidatingPackager()), m, new LogEvent("testMD5FilterTag"));
    assertEquals(128, m.getMaxField(), "m.getMaxField()");
    assertSame(m, result, "result");
}
Also used : ISOMsg(org.jpos.iso.ISOMsg) ASCIIChannel(org.jpos.iso.channel.ASCIIChannel) LogEvent(org.jpos.util.LogEvent) SimpleConfiguration(org.jpos.core.SimpleConfiguration) ISOBaseValidatingPackager(org.jpos.iso.packager.ISOBaseValidatingPackager) Test(org.junit.jupiter.api.Test)

Example 2 with ISOBaseValidatingPackager

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

the class MacroFilterTest method testFilter6.

@Test
public void testFilter6() throws Throwable {
    ISOMsg m = new ISOMsg(100);
    m.set(100, "");
    ISOMsg result = new MacroFilter().filter(new CSChannel(new ISOBaseValidatingPackager()), m, new LogEvent("testMacroFilterTag", ""));
    assertEquals(0, result.getDirection(), "result.getDirection()");
}
Also used : ISOMsg(org.jpos.iso.ISOMsg) LogEvent(org.jpos.util.LogEvent) ISOBaseValidatingPackager(org.jpos.iso.packager.ISOBaseValidatingPackager) CSChannel(org.jpos.iso.channel.CSChannel) Test(org.junit.jupiter.api.Test)

Example 3 with ISOBaseValidatingPackager

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

the class BASE24ChannelTest method testConstructor2.

@Test
public void testConstructor2() throws Throwable {
    ISOPackager p = new ISOBaseValidatingPackager();
    BASE24Channel bASE24Channel = new BASE24Channel("testBASE24ChannelHost", 100, p);
    assertEquals(0, bASE24Channel.getIncomingFilters().size(), "bASE24Channel.getIncomingFilters().size()");
    assertEquals(100000, bASE24Channel.getMaxPacketLength(), "bASE24Channel.getMaxPacketLength()");
    assertSame(p, bASE24Channel.getPackager(), "bASE24Channel.getPackager()");
    assertEquals(100, 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()");
    assertEquals("testBASE24ChannelHost", bASE24Channel.getHost(), "bASE24Channel.getHost()");
}
Also used : ISOPackager(org.jpos.iso.ISOPackager) ISOBaseValidatingPackager(org.jpos.iso.packager.ISOBaseValidatingPackager) Test(org.junit.jupiter.api.Test)

Example 4 with ISOBaseValidatingPackager

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

the class BaseChannelTest method testApplyIncomingFilters1.

@Test
public void testApplyIncomingFilters1() throws Throwable {
    BaseChannel gZIPChannel = new GZIPChannel("testBaseChannelHost", 100, new ISOBaseValidatingPackager());
    LogEvent evt = new LogEvent();
    byte[] header = new byte[0];
    byte[] image = new byte[2];
    ISOMsg result = gZIPChannel.applyIncomingFilters(m, header, image, evt);
    assertSame(m, result, "result");
}
Also used : LogEvent(org.jpos.util.LogEvent) ISOBaseValidatingPackager(org.jpos.iso.packager.ISOBaseValidatingPackager) GZIPChannel(org.jpos.iso.channel.GZIPChannel) Test(org.junit.jupiter.api.Test)

Example 5 with ISOBaseValidatingPackager

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

the class HEXChannelTest method testSendMessageLengthThrowsNullPointerException.

@Test
public void testSendMessageLengthThrowsNullPointerException() throws Throwable {
    HEXChannel hEXChannel = new HEXChannel(new ISOBaseValidatingPackager(), null, new ServerSocket());
    try {
        hEXChannel.sendMessageLength(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()");
        }
    }
}
Also used : ISOBaseValidatingPackager(org.jpos.iso.packager.ISOBaseValidatingPackager) ServerSocket(java.net.ServerSocket) Test(org.junit.jupiter.api.Test)

Aggregations

ISOBaseValidatingPackager (org.jpos.iso.packager.ISOBaseValidatingPackager)15 Test (org.junit.jupiter.api.Test)15 LogEvent (org.jpos.util.LogEvent)8 ISOMsg (org.jpos.iso.ISOMsg)7 ISOPackager (org.jpos.iso.ISOPackager)5 SimpleConfiguration (org.jpos.core.SimpleConfiguration)4 ASCIIChannel (org.jpos.iso.channel.ASCIIChannel)4 CSChannel (org.jpos.iso.channel.CSChannel)3 ServerSocket (java.net.ServerSocket)2 ISOFilter (org.jpos.iso.ISOFilter)2 GZIPChannel (org.jpos.iso.channel.GZIPChannel)2