Search in sources :

Example 1 with PADChannel

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

the class BaseChannelTest method testRemoveFilter3.

@Test
public void testRemoveFilter3() throws Throwable {
    BaseChannel pADChannel = new PADChannel("testBaseChannelHost", 100, null);
    pADChannel.removeFilter(new MD5Filter(), 2);
    assertEquals("(PADChannel) pADChannel.outgoingFilters.size()", 0, ((PADChannel) pADChannel).outgoingFilters.size());
}
Also used : PADChannel(org.jpos.iso.channel.PADChannel) MD5Filter(org.jpos.iso.filter.MD5Filter) Test(org.junit.Test)

Example 2 with PADChannel

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

the class BaseChannelTest method testIsOverrideHeader.

@Test
public void testIsOverrideHeader() throws Throwable {
    boolean result = new PADChannel(new GenericPackager()).isOverrideHeader();
    assertFalse("result", result);
}
Also used : GenericPackager(org.jpos.iso.packager.GenericPackager) PADChannel(org.jpos.iso.channel.PADChannel) Test(org.junit.Test)

Example 3 with PADChannel

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

the class DelayFilterTest method testFilter1.

@Test
public void testFilter1() throws Throwable {
    LogEvent evt = new LogEvent(new BASE24TCPChannel("testDelayFilterHost", 100, new Base1SubFieldPackager()), "testDelayFilterTag", null);
    ISOMsg result = new DelayFilter(1).filter(new PADChannel(), null, evt);
    assertEquals("evt.payLoad.size()", 2, evt.getPayLoad().size());
    assertEquals("evt.payLoad.get(1)", "<delay-filter delay=\"1\"/>", evt.getPayLoad().get(1));
    assertNull("result", result);
}
Also used : BASE24TCPChannel(org.jpos.iso.channel.BASE24TCPChannel) Base1SubFieldPackager(org.jpos.iso.packager.Base1SubFieldPackager) ISOMsg(org.jpos.iso.ISOMsg) LogEvent(org.jpos.util.LogEvent) PADChannel(org.jpos.iso.channel.PADChannel) Test(org.junit.Test)

Example 4 with PADChannel

use of org.jpos.iso.channel.PADChannel 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 PADChannel

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

the class MD5FilterTest method testFilterThrowsVetoException6.

@Test
public void testFilterThrowsVetoException6() throws Throwable {
    MD5Filter mD5Filter = new MD5Filter();
    mD5Filter.setConfiguration(new SimpleConfiguration());
    mD5Filter.setFields(null);
    try {
        mD5Filter.filter(new PADChannel(new PostPackager()), null, null);
        fail("Expected VetoException to be thrown");
    } catch (ISOFilter.VetoException ex) {
        assertEquals("ex.getMessage()", "MD5Filter not configured", ex.getMessage());
        assertNull("ex.getNested()", ex.getNested());
    }
}
Also used : ISOFilter(org.jpos.iso.ISOFilter) PostPackager(org.jpos.iso.packager.PostPackager) PADChannel(org.jpos.iso.channel.PADChannel) SimpleConfiguration(org.jpos.core.SimpleConfiguration) Test(org.junit.Test)

Aggregations

PADChannel (org.jpos.iso.channel.PADChannel)12 Test (org.junit.Test)12 LogEvent (org.jpos.util.LogEvent)8 ISOMsg (org.jpos.iso.ISOMsg)7 ISOChannel (org.jpos.iso.ISOChannel)3 SimpleConfiguration (org.jpos.core.SimpleConfiguration)2 ISOFilter (org.jpos.iso.ISOFilter)2 Base1SubFieldPackager (org.jpos.iso.packager.Base1SubFieldPackager)2 CTCSubFieldPackager (org.jpos.iso.packager.CTCSubFieldPackager)2 XMLPackager (org.jpos.iso.packager.XMLPackager)2 Configuration (org.jpos.core.Configuration)1 BASE24TCPChannel (org.jpos.iso.channel.BASE24TCPChannel)1 MD5Filter (org.jpos.iso.filter.MD5Filter)1 EuroSubFieldPackager (org.jpos.iso.packager.EuroSubFieldPackager)1 GenericPackager (org.jpos.iso.packager.GenericPackager)1 GenericSubFieldPackager (org.jpos.iso.packager.GenericSubFieldPackager)1 PostPackager (org.jpos.iso.packager.PostPackager)1