Search in sources :

Example 1 with Base1SubFieldPackager

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

the class ASCIIChannelTest method testSendMessageLengthThrowsNullPointerException1.

@Test
public void testSendMessageLengthThrowsNullPointerException1() throws Throwable {
    ASCIIChannel aSCIIChannel = new ASCIIChannel(new Base1SubFieldPackager());
    try {
        aSCIIChannel.sendMessageLength(9998);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
    }
}
Also used : Base1SubFieldPackager(org.jpos.iso.packager.Base1SubFieldPackager) Test(org.junit.Test)

Example 2 with Base1SubFieldPackager

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

the class BASE24ChannelTest method testConstructor3.

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

Example 3 with Base1SubFieldPackager

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

the class ChannelPoolTest method testSendThrowsIllegalArgumentException.

@Test
public void testSendThrowsIllegalArgumentException() throws Throwable {
    ChannelPool channelPool = new ChannelPool();
    channelPool.addChannel(new GZIPChannel("testChannelPoolHost", -1, new Base1SubFieldPackager()));
    try {
        channelPool.send((ISOMsg) new ISOMsg().clone());
        fail("Expected IllegalArgumentException to be thrown");
    } catch (IllegalArgumentException ex) {
        assertEquals("ex.getMessage()", "port out of range:-1", ex.getMessage());
        assertEquals("channelPool.pool.size()", 1, channelPool.pool.size());
        assertNull("channelPool.current", channelPool.current);
        assertTrue("channelPool.usable", channelPool.usable);
    }
}
Also used : Base1SubFieldPackager(org.jpos.iso.packager.Base1SubFieldPackager) ISOMsg(org.jpos.iso.ISOMsg) Test(org.junit.Test)

Example 4 with Base1SubFieldPackager

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

the class DelayFilterTest method testFilter1.

@Test
public void testFilter1() throws Throwable {
    LogEvent evt = new LogEvent(new BASE24TCPChannel("testDelayFilterHost", 100, new Base1SubFieldPackager()), "testDelayFilterTag", null);
    ISOMsg result = new DelayFilter(1).filter(new PADChannel(), null, evt);
    assertEquals("evt.payLoad.size()", 2, evt.getPayLoad().size());
    assertEquals("evt.payLoad.get(1)", "<delay-filter delay=\"1\"/>", evt.getPayLoad().get(1));
    assertNull("result", result);
}
Also used : BASE24TCPChannel(org.jpos.iso.channel.BASE24TCPChannel) 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.Test)

Example 5 with Base1SubFieldPackager

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

the class ChannelPoolTest method testSetPackager.

@Test
public void testSetPackager() throws Throwable {
    ChannelPool channelPool = new ChannelPool();
    channelPool.setPackager(new Base1SubFieldPackager());
    assertEquals("channelPool.getName()", "", channelPool.getName());
}
Also used : Base1SubFieldPackager(org.jpos.iso.packager.Base1SubFieldPackager) Test(org.junit.Test)

Aggregations

Base1SubFieldPackager (org.jpos.iso.packager.Base1SubFieldPackager)8 Test (org.junit.Test)8 ISOMsg (org.jpos.iso.ISOMsg)4 LogEvent (org.jpos.util.LogEvent)3 ServerSocket (java.net.ServerSocket)2 PADChannel (org.jpos.iso.channel.PADChannel)2 SimpleConfiguration (org.jpos.core.SimpleConfiguration)1 ISOChannel (org.jpos.iso.ISOChannel)1 ISOPackager (org.jpos.iso.ISOPackager)1 BASE24TCPChannel (org.jpos.iso.channel.BASE24TCPChannel)1 CSChannel (org.jpos.iso.channel.CSChannel)1 XMLPackager (org.jpos.iso.packager.XMLPackager)1