Search in sources :

Example 1 with Base1Packager

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

the class VAPChannelTest method testSetConfiguration.

@Test
public void testSetConfiguration() throws Throwable {
    VAPChannel vAPChannel = new VAPChannel(new Base1Packager());
    vAPChannel.setSocketFactory(new SunJSSESocketFactory());
    vAPChannel.setConfiguration(new SimpleConfiguration());
    assertEquals("vAPChannel.srcid", "000000", vAPChannel.srcid);
    assertEquals("vAPChannel.dstid", "000000", vAPChannel.dstid);
    assertEquals("vAPChannel.getMaxPacketLength()", 100000, vAPChannel.getMaxPacketLength());
    assertEquals("vAPChannel.getPort()", 0, vAPChannel.getPort());
    assertNull("vAPChannel.getSocket()", vAPChannel.getSocket());
    assertEquals("vAPChannel.getTimeout()", 300000, vAPChannel.getTimeout());
    assertFalse("vAPChannel.isOverrideHeader()", vAPChannel.isOverrideHeader());
    assertNull("vAPChannel.getHost()", vAPChannel.getHost());
}
Also used : SunJSSESocketFactory(org.jpos.iso.SunJSSESocketFactory) SimpleConfiguration(org.jpos.core.SimpleConfiguration) Base1Packager(org.jpos.iso.packager.Base1Packager) Test(org.junit.Test)

Example 2 with Base1Packager

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

the class ASCIIChannelTest method testGetMessageLengthThrowsNullPointerException.

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

Example 3 with Base1Packager

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

the class CSChannelTest method testConstructor.

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

Example 4 with Base1Packager

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

the class GZIPChannelTest method testSendMessageLengthThrowsNullPointerException.

@Test
public void testSendMessageLengthThrowsNullPointerException() throws Throwable {
    GZIPChannel gZIPChannel = new GZIPChannel("testGZIPChannelHost", 100, new Base1Packager());
    try {
        gZIPChannel.sendMessageLength(100);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
    }
}
Also used : Base1Packager(org.jpos.iso.packager.Base1Packager) Test(org.junit.Test)

Example 5 with Base1Packager

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

the class VAPChannelTest method testSendMessageHeaderThrowsNullPointerException1.

@Test
public void testSendMessageHeaderThrowsNullPointerException1() throws Throwable {
    ISOMsg m = new ISOMsg(100);
    VAPChannel vAPChannel = new VAPChannel(new Base1Packager());
    vAPChannel.setConfiguration(new SimpleConfiguration());
    try {
        vAPChannel.sendMessageHeader(m, 100);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
    }
}
Also used : ISOMsg(org.jpos.iso.ISOMsg) SimpleConfiguration(org.jpos.core.SimpleConfiguration) Base1Packager(org.jpos.iso.packager.Base1Packager) Test(org.junit.Test)

Aggregations

Base1Packager (org.jpos.iso.packager.Base1Packager)7 Test (org.junit.Test)7 ISOPackager (org.jpos.iso.ISOPackager)3 SimpleConfiguration (org.jpos.core.SimpleConfiguration)2 ServerSocket (java.net.ServerSocket)1 ISOMsg (org.jpos.iso.ISOMsg)1 SunJSSESocketFactory (org.jpos.iso.SunJSSESocketFactory)1