Search in sources :

Example 1 with CSChannel

use of org.jpos.iso.channel.CSChannel in project jPOS by jpos.

the class BSHFilterTest method testFilter1.

@Test
public void testFilter1() throws Throwable {
    BSHFilter bSHFilter = new BSHFilter();
    Configuration cfg = new SimpleConfiguration();
    bSHFilter.setConfiguration(cfg);
    ISOChannel channel = new CSChannel();
    LogEvent evt = new LogEvent();
    ISOVMsg result = (ISOVMsg) bSHFilter.filter(channel, m, evt);
    assertSame("result", m, result);
    assertSame("bSHFilter.cfg", cfg, bSHFilter.cfg);
}
Also used : SimpleConfiguration(org.jpos.core.SimpleConfiguration) Configuration(org.jpos.core.Configuration) LogEvent(org.jpos.util.LogEvent) SimpleConfiguration(org.jpos.core.SimpleConfiguration) ISOVMsg(org.jpos.iso.ISOVMsg) ISOChannel(org.jpos.iso.ISOChannel) CSChannel(org.jpos.iso.channel.CSChannel) Test(org.junit.Test)

Example 2 with CSChannel

use of org.jpos.iso.channel.CSChannel 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 3 with CSChannel

use of org.jpos.iso.channel.CSChannel in project jPOS by jpos.

the class BaseChannelTest method testDisconnect1.

@Test
public void testDisconnect1() throws Throwable {
    ServerSocket sock = new ServerSocket();
    BaseChannel cSChannel = new CSChannel(new PostPackager());
    cSChannel.setServerSocket(sock);
    cSChannel.disconnect();
    assertSame("(CSChannel) cSChannel.serverSocket", sock, ((CSChannel) cSChannel).serverSocket);
    assertNull("(CSChannel) cSChannel.getSocket()", cSChannel.getSocket());
    assertFalse("(CSChannel) cSChannel.usable", ((CSChannel) cSChannel).usable);
}
Also used : PostPackager(org.jpos.iso.packager.PostPackager) CSChannel(org.jpos.iso.channel.CSChannel) Test(org.junit.Test)

Example 4 with CSChannel

use of org.jpos.iso.channel.CSChannel in project jPOS by jpos.

the class BaseChannelTest method testApplyIncomingFilters.

@Test
public void testApplyIncomingFilters() throws Throwable {
    byte[] image = "testString".getBytes();
    final BaseChannel cSChannel = new CSChannel();
    cSChannel.addIncomingFilter(filter);
    final LogEvent evt = new LogEvent();
    byte[] header = new byte[2];
    when(filter.filter(cSChannel, m, evt)).thenReturn(m);
    ISOMsg result = cSChannel.applyIncomingFilters(m, header, image, evt);
    assertSame("result", m, result);
}
Also used : LogEvent(org.jpos.util.LogEvent) CSChannel(org.jpos.iso.channel.CSChannel) Test(org.junit.Test)

Example 5 with CSChannel

use of org.jpos.iso.channel.CSChannel in project jPOS by jpos.

the class BaseChannelTest method testSetTimeout1.

@Test
public void testSetTimeout1() throws Throwable {
    BaseChannel cSChannel = new CSChannel(new PostPackager());
    cSChannel.setTimeout(0);
    assertEquals("(CSChannel) cSChannel.getTimeout()", 0, cSChannel.getTimeout());
}
Also used : PostPackager(org.jpos.iso.packager.PostPackager) CSChannel(org.jpos.iso.channel.CSChannel) Test(org.junit.Test)

Aggregations

CSChannel (org.jpos.iso.channel.CSChannel)18 Test (org.junit.Test)18 LogEvent (org.jpos.util.LogEvent)12 ISOMsg (org.jpos.iso.ISOMsg)10 PostPackager (org.jpos.iso.packager.PostPackager)8 ISOBaseValidatingPackager (org.jpos.iso.packager.ISOBaseValidatingPackager)3 ISOChannel (org.jpos.iso.ISOChannel)2 ServerSocket (java.net.ServerSocket)1 Collection (java.util.Collection)1 Configuration (org.jpos.core.Configuration)1 SimpleConfiguration (org.jpos.core.SimpleConfiguration)1 ISOVMsg (org.jpos.iso.ISOVMsg)1 MacroFilter (org.jpos.iso.filter.MacroFilter)1 Base1SubFieldPackager (org.jpos.iso.packager.Base1SubFieldPackager)1 GenericPackager (org.jpos.iso.packager.GenericPackager)1 ISO93BPackager (org.jpos.iso.packager.ISO93BPackager)1