Search in sources :

Example 1 with GenericValidatingPackager

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

the class BaseChannelTest method testResetCounters.

@Test
public void testResetCounters() throws Throwable {
    BaseChannel x25Channel = new X25Channel(new GenericValidatingPackager());
    x25Channel.resetCounters();
    assertEquals("(X25Channel) x25Channel.cnt.length", 3, ((X25Channel) x25Channel).cnt.length);
}
Also used : GenericValidatingPackager(org.jpos.iso.packager.GenericValidatingPackager) X25Channel(org.jpos.iso.channel.X25Channel) Test(org.junit.Test)

Example 2 with GenericValidatingPackager

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

the class GZIPChannelTest method testConstructor2.

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

Example 3 with GenericValidatingPackager

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

the class MD5FilterTest method testFilterThrowsNullPointerException2.

@Test
public void testFilterThrowsNullPointerException2() throws Throwable {
    MD5Filter mD5Filter = new MD5Filter();
    mD5Filter.setConfiguration(new SimpleConfiguration());
    ISOMsg m = new ISOMsg("testMD5FilterMti");
    try {
        mD5Filter.filter(new ASCIIChannel(new GenericValidatingPackager()), m, null);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
        assertEquals("m.getDirection()", 0, m.getDirection());
    }
}
Also used : GenericValidatingPackager(org.jpos.iso.packager.GenericValidatingPackager) ISOMsg(org.jpos.iso.ISOMsg) ASCIIChannel(org.jpos.iso.channel.ASCIIChannel) SimpleConfiguration(org.jpos.core.SimpleConfiguration) Test(org.junit.Test)

Example 4 with GenericValidatingPackager

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

the class BaseChannelTest method testGetHeaderLength1.

@Test
public void testGetHeaderLength1() throws Throwable {
    BaseChannel logChannel = new LogChannel("testBaseChannelHost", 100, new GenericValidatingPackager());
    ISOMsg iSOVMsg = new ISOMsg();
    iSOVMsg.setHeader(new BaseHeader());
    int result = logChannel.getHeaderLength((ISOMsg) iSOVMsg.clone());
    assertEquals("result", 0, result);
}
Also used : GenericValidatingPackager(org.jpos.iso.packager.GenericValidatingPackager) LogChannel(org.jpos.iso.channel.LogChannel) BaseHeader(org.jpos.iso.header.BaseHeader) Test(org.junit.Test)

Example 5 with GenericValidatingPackager

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

the class BaseChannelTest method testGetHeaderLengthThrowsNullPointerException.

@Test
public void testGetHeaderLengthThrowsNullPointerException() throws Throwable {
    BaseChannel logChannel = new LogChannel("testBaseChannelHost", 100, new GenericValidatingPackager());
    try {
        logChannel.getHeaderLength((ISOMsg) null);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
    }
}
Also used : GenericValidatingPackager(org.jpos.iso.packager.GenericValidatingPackager) LogChannel(org.jpos.iso.channel.LogChannel) Test(org.junit.Test)

Aggregations

GenericValidatingPackager (org.jpos.iso.packager.GenericValidatingPackager)8 Test (org.junit.Test)8 ISOPackager (org.jpos.iso.ISOPackager)2 LogChannel (org.jpos.iso.channel.LogChannel)2 SimpleConfiguration (org.jpos.core.SimpleConfiguration)1 ISOMsg (org.jpos.iso.ISOMsg)1 ASCIIChannel (org.jpos.iso.channel.ASCIIChannel)1 BASE24TCPChannel (org.jpos.iso.channel.BASE24TCPChannel)1 GZIPChannel (org.jpos.iso.channel.GZIPChannel)1 X25Channel (org.jpos.iso.channel.X25Channel)1 BaseHeader (org.jpos.iso.header.BaseHeader)1 LogEvent (org.jpos.util.LogEvent)1