Search in sources :

Example 31 with ISOMsg

use of org.jpos.iso.ISOMsg in project jPOS by jpos.

the class CSChannelTest method testSendMessageHeader.

@Test
public void testSendMessageHeader() throws Throwable {
    CSChannel cSChannel = new CSChannel();
    cSChannel.sendMessageHeader(new ISOMsg(), 100);
    assertEquals("cSChannel.getHeaderLength()", 0, cSChannel.getHeaderLength());
}
Also used : ISOMsg(org.jpos.iso.ISOMsg) Test(org.junit.Test)

Example 32 with ISOMsg

use of org.jpos.iso.ISOMsg 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 33 with ISOMsg

use of org.jpos.iso.ISOMsg in project jPOS by jpos.

the class ChannelPoolTest method testSendThrowsIOException.

@Test
public void testSendThrowsIOException() throws Throwable {
    ChannelPool channelPool = new ChannelPool();
    try {
        channelPool.send(new ISOMsg());
        fail("Expected IOException to be thrown");
    } catch (IOException ex) {
        assertEquals("ex.getClass()", IOException.class, ex.getClass());
        assertEquals("channelPool.pool.size()", 0, channelPool.pool.size());
        assertNull("channelPool.current", channelPool.current);
        assertTrue("channelPool.usable", channelPool.usable);
    }
}
Also used : ISOMsg(org.jpos.iso.ISOMsg) IOException(java.io.IOException) Test(org.junit.Test)

Example 34 with ISOMsg

use of org.jpos.iso.ISOMsg in project jPOS by jpos.

the class NACChannelTest method testSendMessageHeader.

@Test
public void testSendMessageHeader() throws Throwable {
    NACChannel nACChannel = new NACChannel();
    ISOMsg m = new ISOMsg();
    nACChannel.sendMessageHeader(m, 100);
    assertTrue("Execute without Exception", true);
}
Also used : ISOMsg(org.jpos.iso.ISOMsg) Test(org.junit.Test)

Example 35 with ISOMsg

use of org.jpos.iso.ISOMsg in project jPOS by jpos.

the class NCCChannelTest method testSendMessageHeaderThrowsNullPointerException.

@Test
public void testSendMessageHeaderThrowsNullPointerException() throws Throwable {
    byte[] TPDU = new byte[1];
    NCCChannel nCCChannel = new NCCChannel(new ISO87BPackager(), TPDU, new ServerSocket());
    ISOMsg m = new ISOMsg();
    try {
        nCCChannel.sendMessageHeader(m, 100);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
    }
}
Also used : ISO87BPackager(org.jpos.iso.packager.ISO87BPackager) ISOMsg(org.jpos.iso.ISOMsg) ServerSocket(java.net.ServerSocket) Test(org.junit.Test)

Aggregations

ISOMsg (org.jpos.iso.ISOMsg)223 Test (org.junit.Test)191 LogEvent (org.jpos.util.LogEvent)41 ISOBaseValidator (org.jpos.iso.ISOBaseValidator)30 ISOException (org.jpos.iso.ISOException)29 ISOComponent (org.jpos.iso.ISOComponent)25 ISOVMsg (org.jpos.iso.ISOVMsg)22 ISOFieldValidator (org.jpos.iso.ISOFieldValidator)21 Context (org.jpos.transaction.Context)20 ISOValidator (org.jpos.iso.ISOValidator)18 Result (org.jpos.rc.Result)17 SimpleConfiguration (org.jpos.core.SimpleConfiguration)15 ISOFieldPackager (org.jpos.iso.ISOFieldPackager)12 TEST0100 (org.jpos.iso.validator.TEST0100)12 FileInputStream (java.io.FileInputStream)9 Vector (java.util.Vector)9 PostChannel (org.jpos.iso.channel.PostChannel)9 MSGTEST (org.jpos.iso.validator.MSGTEST)9 MSGTEST02 (org.jpos.iso.validator.MSGTEST02)9 ISOFilter (org.jpos.iso.ISOFilter)8