Search in sources :

Example 11 with ISO87APackagerBBitmap

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

the class BaseChannelTest method testSendMessageHeaderThrowsNullPointerException1.

@Test
public void testSendMessageHeaderThrowsNullPointerException1() throws Throwable {
    BaseChannel bASE24Channel = new BASE24Channel("testBaseChannelHost", 100, new ISO87APackagerBBitmap());
    try {
        bASE24Channel.sendMessageHeader(null, 100);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
        assertNull("(BASE24Channel) bASE24Channel.serverOut", ((BASE24Channel) bASE24Channel).serverOut);
    }
}
Also used : BASE24Channel(org.jpos.iso.channel.BASE24Channel) ISO87APackagerBBitmap(org.jpos.iso.packager.ISO87APackagerBBitmap) Test(org.junit.Test)

Example 12 with ISO87APackagerBBitmap

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

the class ASCIIChannelTest method testConstructor1.

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

Example 13 with ISO87APackagerBBitmap

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

the class ASCIIChannelTest method testConstructor3.

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

Example 14 with ISO87APackagerBBitmap

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

the class LogChannelTest method testConnectThrowsSocketException.

@Test
public void testConnectThrowsSocketException() throws Throwable {
    LogChannel logChannel = new LogChannel(new ISO87APackagerBBitmap());
    Socket socket = new Socket();
    socket.close();
    try {
        logChannel.connect(socket);
        fail("Expected SocketException to be thrown");
    } catch (SocketException ex) {
        assertEquals("ex.getClass()", SocketException.class, ex.getClass());
        assertEquals("logChannel.getOriginalRealm()", "org.jpos.iso.channel.LogChannel", logChannel.getOriginalRealm());
        assertEquals("logChannel.getCounters().length", 3, logChannel.getCounters().length);
        assertNull("logChannel.getRealm()", logChannel.getRealm());
        assertSame("logChannel.getSocket()", socket, logChannel.getSocket());
        assertFalse("logChannel.isConnected()", logChannel.isConnected());
        assertNull("logChannel.getLogger()", logChannel.getLogger());
        assertNull("logChannel.reader", logChannel.reader);
        assertNull("socket.getChannel()", socket.getChannel());
    }
}
Also used : SocketException(java.net.SocketException) ISO87APackagerBBitmap(org.jpos.iso.packager.ISO87APackagerBBitmap) Socket(java.net.Socket) ServerSocket(java.net.ServerSocket) Test(org.junit.Test)

Example 15 with ISO87APackagerBBitmap

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

the class X25ChannelTest method testConnectThrowsNullPointerException.

@Test
public void testConnectThrowsNullPointerException() throws Throwable {
    X25Channel x25Channel = new X25Channel("testX25ChannelHost", 100, new ISO87APackagerBBitmap());
    x25Channel.setTimeout(1);
    Socket socket = new Socket(Proxy.NO_PROXY);
    try {
        x25Channel.connect(socket);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
        assertNull("x25Channel.reader", x25Channel.reader);
        assertEquals("x25Channel.getOriginalRealm()", "org.jpos.iso.channel.X25Channel", x25Channel.getOriginalRealm());
        assertEquals("x25Channel.getCounters().length", 3, x25Channel.getCounters().length);
        assertNull("x25Channel.getRealm()", x25Channel.getRealm());
        assertSame("x25Channel.getSocket()", socket, x25Channel.getSocket());
        assertFalse("x25Channel.isConnected()", x25Channel.isConnected());
        assertNull("x25Channel.getLogger()", x25Channel.getLogger());
        assertNull("socket.getChannel()", socket.getChannel());
    }
}
Also used : ISO87APackagerBBitmap(org.jpos.iso.packager.ISO87APackagerBBitmap) Socket(java.net.Socket) Test(org.junit.Test)

Aggregations

ISO87APackagerBBitmap (org.jpos.iso.packager.ISO87APackagerBBitmap)15 Test (org.junit.Test)15 BASE24Channel (org.jpos.iso.channel.BASE24Channel)5 ISOPackager (org.jpos.iso.ISOPackager)3 ServerSocket (java.net.ServerSocket)2 Socket (java.net.Socket)2 RawChannel (org.jpos.iso.channel.RawChannel)2 MD5Filter (org.jpos.iso.filter.MD5Filter)2 SocketException (java.net.SocketException)1 HEXChannel (org.jpos.iso.channel.HEXChannel)1 XSLTFilter (org.jpos.iso.filter.XSLTFilter)1 LogEvent (org.jpos.util.LogEvent)1