Search in sources :

Example 1 with CTCSubFieldPackager

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

the class BaseChannelTest method testApplyIncomingFiltersThrowsVetoException.

@Test
public void testApplyIncomingFiltersThrowsVetoException() throws Throwable {
    BaseChannel x25Channel = new X25Channel();
    x25Channel.addFilter(new MD5Filter());
    try {
        x25Channel.applyIncomingFilters(new ISOMsg(), new LogEvent(new CTCSubFieldPackager(), "testBaseChannelTag"));
        fail("Expected VetoException to be thrown");
    } catch (ISOFilter.VetoException ex) {
        assertEquals("ex.getMessage()", "MD5Filter not configured", ex.getMessage());
        assertNull("ex.nested", ex.nested);
    }
}
Also used : LogEvent(org.jpos.util.LogEvent) X25Channel(org.jpos.iso.channel.X25Channel) CTCSubFieldPackager(org.jpos.iso.packager.CTCSubFieldPackager) MD5Filter(org.jpos.iso.filter.MD5Filter) Test(org.junit.Test)

Example 2 with CTCSubFieldPackager

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

the class BaseChannelTest method testApplyOutgoingFilters.

@Test
public void testApplyOutgoingFilters() throws Throwable {
    BaseChannel x25Channel = new X25Channel();
    LogEvent evt = new LogEvent(new CTCSubFieldPackager(), "testBaseChannelTag");
    ISOMsg result = x25Channel.applyOutgoingFilters(m, evt);
    assertSame("result", m, result);
}
Also used : LogEvent(org.jpos.util.LogEvent) X25Channel(org.jpos.iso.channel.X25Channel) CTCSubFieldPackager(org.jpos.iso.packager.CTCSubFieldPackager) Test(org.junit.Test)

Example 3 with CTCSubFieldPackager

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

the class GZIPChannelTest method testConstructor.

@Test
public void testConstructor() throws Throwable {
    ISOPackager p = new CTCSubFieldPackager();
    ServerSocket serverSocket = new ServerSocket();
    GZIPChannel gZIPChannel = new GZIPChannel(p, serverSocket);
    assertEquals("gZIPChannel.getIncomingFilters().size()", 0, gZIPChannel.getIncomingFilters().size());
    assertEquals("gZIPChannel.getMaxPacketLength()", 100000, gZIPChannel.getMaxPacketLength());
    assertSame("gZIPChannel.getPackager()", p, gZIPChannel.getPackager());
    assertEquals("gZIPChannel.getPort()", 0, 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());
    assertSame("gZIPChannel.getServerSocket()", serverSocket, gZIPChannel.getServerSocket());
    assertEquals("gZIPChannel.getOriginalRealm()", "org.jpos.iso.channel.GZIPChannel", gZIPChannel.getOriginalRealm());
    assertNull("gZIPChannel.getRealm()", gZIPChannel.getRealm());
    assertNull("gZIPChannel.getHost()", gZIPChannel.getHost());
}
Also used : ISOPackager(org.jpos.iso.ISOPackager) CTCSubFieldPackager(org.jpos.iso.packager.CTCSubFieldPackager) ServerSocket(java.net.ServerSocket) Test(org.junit.Test)

Example 4 with CTCSubFieldPackager

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

the class DelayFilterTest method testFilter2.

@Test
public void testFilter2() throws Throwable {
    DelayFilter delayFilter = new DelayFilter(-1);
    ISOChannel channel = new PADChannel(new CTCSubFieldPackager());
    LogEvent evt = new LogEvent("testDelayFilterTag", "");
    ISOMsg result = delayFilter.filter(channel, m, evt);
    assertEquals("evt.payLoad.size()", 2, evt.getPayLoad().size());
    assertEquals("evt.payLoad.get(1)", "<delay-filter delay=\"-1\"/>", evt.getPayLoad().get(1));
    assertSame("result", m, result);
}
Also used : ISOMsg(org.jpos.iso.ISOMsg) LogEvent(org.jpos.util.LogEvent) PADChannel(org.jpos.iso.channel.PADChannel) CTCSubFieldPackager(org.jpos.iso.packager.CTCSubFieldPackager) ISOChannel(org.jpos.iso.ISOChannel) Test(org.junit.Test)

Example 5 with CTCSubFieldPackager

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

the class StatefulFilterTest method testFilter6.

@Test
public void testFilter6() throws Throwable {
    StatefulFilter statefulFilter = new StatefulFilter();
    statefulFilter.setMatchDirection(58);
    statefulFilter.setSavedFields(null);
    statefulFilter.setIgnoredFields(null);
    ISOMsg m = new ISOMsg("testStatefulFilterMti");
    m.setDirection(58);
    ISOMsg result = statefulFilter.filter(new PostChannel("testStatefulFilterHost", 100, new XMLPackager()), m, new LogEvent("testStatefulFilterTag", new CTCSubFieldPackager()));
    assertEquals("result.getDirection()", 58, result.getDirection());
}
Also used : XMLPackager(org.jpos.iso.packager.XMLPackager) ISOMsg(org.jpos.iso.ISOMsg) LogEvent(org.jpos.util.LogEvent) PostChannel(org.jpos.iso.channel.PostChannel) CTCSubFieldPackager(org.jpos.iso.packager.CTCSubFieldPackager) Test(org.junit.Test)

Aggregations

CTCSubFieldPackager (org.jpos.iso.packager.CTCSubFieldPackager)13 Test (org.junit.Test)13 LogEvent (org.jpos.util.LogEvent)9 ISOMsg (org.jpos.iso.ISOMsg)4 PostChannel (org.jpos.iso.channel.PostChannel)4 ISOPackager (org.jpos.iso.ISOPackager)3 X25Channel (org.jpos.iso.channel.X25Channel)3 ServerSocket (java.net.ServerSocket)2 PADChannel (org.jpos.iso.channel.PADChannel)2 XMLPackager (org.jpos.iso.packager.XMLPackager)2 SimpleConfiguration (org.jpos.core.SimpleConfiguration)1 ISOChannel (org.jpos.iso.ISOChannel)1 ISOFilter (org.jpos.iso.ISOFilter)1 MD5Filter (org.jpos.iso.filter.MD5Filter)1