Search in sources :

Example 1 with ISO93BPackager

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

the class BaseChannelTest method testCreateISOMsgThrowsNullPointerException.

@Test
public void testCreateISOMsgThrowsNullPointerException() throws Throwable {
    BaseChannel cSChannel = new CSChannel(new ISO93BPackager());
    cSChannel.setPackager(null);
    try {
        cSChannel.createMsg();
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
        assertNull("(CSChannel) cSChannel.packager", ((CSChannel) cSChannel).packager);
    }
}
Also used : ISO93BPackager(org.jpos.iso.packager.ISO93BPackager) CSChannel(org.jpos.iso.channel.CSChannel) Test(org.junit.Test)

Example 2 with ISO93BPackager

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

the class NCCChannelTest method testSetHeader.

@Test
public void testSetHeader() throws Throwable {
    byte[] TPDU = new byte[1];
    NCCChannel nCCChannel = new NCCChannel("testNCCChannelHost", 100, new ISO93BPackager(), TPDU);
    nCCChannel.setHeader("testNCCChannelHeader");
    assertEquals("nCCChannel.getHeader().length", 10, nCCChannel.getHeader().length);
}
Also used : ISO93BPackager(org.jpos.iso.packager.ISO93BPackager) Test(org.junit.Test)

Example 3 with ISO93BPackager

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

the class PADChannelTest method testConstructor2.

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

Example 4 with ISO93BPackager

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

the class BaseChannelTest method testSetConfiguration.

@Test
public void testSetConfiguration() throws Throwable {
    BaseChannel gZIPChannel = new GZIPChannel(new ISO93BPackager(), null);
    gZIPChannel.setSocketFactory(new SunJSSESocketFactory());
    gZIPChannel.setConfiguration(new SimpleConfiguration());
    assertEquals("(GZIPChannel) gZIPChannel.getTimeout()", 300000, gZIPChannel.getTimeout());
    assertEquals("(GZIPChannel) gZIPChannel.getMaxPacketLength()", 100000, gZIPChannel.getMaxPacketLength());
    assertFalse("(GZIPChannel) gZIPChannel.overrideHeader", ((GZIPChannel) gZIPChannel).overrideHeader);
}
Also used : ISO93BPackager(org.jpos.iso.packager.ISO93BPackager) SimpleConfiguration(org.jpos.core.SimpleConfiguration) GZIPChannel(org.jpos.iso.channel.GZIPChannel) Test(org.junit.Test)

Example 5 with ISO93BPackager

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

the class NACChannelTest method testSetHeaderThrowsNullPointerException.

@Test
public void testSetHeaderThrowsNullPointerException() throws Throwable {
    byte[] TPDU = new byte[0];
    byte[] TPDU2 = new byte[1];
    NACChannel nACChannel = new NACChannel(new ISO93APackager(), TPDU2, new ServerSocket());
    new NACChannel(new ISO93BPackager(), TPDU).addFilter(new DelayFilter(), 100);
    try {
        nACChannel.setHeader((String) null);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
        assertSame("nACChannel.getHeader()", TPDU2, nACChannel.getHeader());
    }
}
Also used : DelayFilter(org.jpos.iso.filter.DelayFilter) ISO93BPackager(org.jpos.iso.packager.ISO93BPackager) ISO93APackager(org.jpos.iso.packager.ISO93APackager) ServerSocket(java.net.ServerSocket) Test(org.junit.Test)

Aggregations

ISO93BPackager (org.jpos.iso.packager.ISO93BPackager)6 Test (org.junit.Test)6 ServerSocket (java.net.ServerSocket)2 ISOPackager (org.jpos.iso.ISOPackager)2 SimpleConfiguration (org.jpos.core.SimpleConfiguration)1 CSChannel (org.jpos.iso.channel.CSChannel)1 GZIPChannel (org.jpos.iso.channel.GZIPChannel)1 DelayFilter (org.jpos.iso.filter.DelayFilter)1 ISO93APackager (org.jpos.iso.packager.ISO93APackager)1