Search in sources :

Example 6 with PADChannel

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

the class MacroFilterTest method testFilterThrowsNullPointerException.

@Test
public void testFilterThrowsNullPointerException() throws Throwable {
    MacroFilter macroFilter = new MacroFilter();
    LogEvent evt = new LogEvent();
    try {
        macroFilter.filter(new PADChannel("testMacroFilterHost", 100, new XMLPackager()), null, evt);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
        assertNull("macroFilter.cfg", macroFilter.cfg);
        assertNull("macroFilter.seq", macroFilter.seq);
    }
}
Also used : XMLPackager(org.jpos.iso.packager.XMLPackager) LogEvent(org.jpos.util.LogEvent) PADChannel(org.jpos.iso.channel.PADChannel) Test(org.junit.Test)

Example 7 with PADChannel

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

the class QMUXTest method testProcessUnhandled.

@Test
public void testProcessUnhandled() throws Throwable {
    ISOMsg m = new ISOMsg("testQMUXMti");
    m.setSource(new PADChannel(new EuroSubFieldPackager()));
    QMUX qMUX = new QMUX();
    qMUX.processUnhandled(m);
    assertEquals("qMUX.listeners.size()", 0, qMUX.listeners.size());
}
Also used : EuroSubFieldPackager(org.jpos.iso.packager.EuroSubFieldPackager) ISOMsg(org.jpos.iso.ISOMsg) PADChannel(org.jpos.iso.channel.PADChannel) Test(org.junit.Test)

Example 8 with PADChannel

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

the class BSHFilterTest method testFilter.

@Test
public void testFilter() throws Throwable {
    Configuration cfg = new SimpleConfiguration();
    BSHFilter bSHFilter = new BSHFilter();
    bSHFilter.setConfiguration(cfg);
    ISOMsg result = bSHFilter.filter(new PADChannel(), null, new LogEvent("testBSHFilterTag", "testString"));
    assertNull("result", result);
    assertSame("bSHFilter.cfg", cfg, bSHFilter.cfg);
}
Also used : SimpleConfiguration(org.jpos.core.SimpleConfiguration) Configuration(org.jpos.core.Configuration) ISOMsg(org.jpos.iso.ISOMsg) LogEvent(org.jpos.util.LogEvent) PADChannel(org.jpos.iso.channel.PADChannel) SimpleConfiguration(org.jpos.core.SimpleConfiguration) Test(org.junit.Test)

Example 9 with PADChannel

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

the class MacroFilterTest method testFilter3.

@Test
public void testFilter3() throws Throwable {
    MacroFilter macroFilter = new MacroFilter();
    ISOChannel channel = new PADChannel(new GenericSubFieldPackager());
    LogEvent evt = new LogEvent();
    when(m.getMaxField()).thenReturn(0);
    when(m.hasField(0)).thenReturn(false);
    ISOMsg result = macroFilter.filter(channel, m, evt);
    assertSame("result", m, result);
}
Also used : ISOMsg(org.jpos.iso.ISOMsg) LogEvent(org.jpos.util.LogEvent) PADChannel(org.jpos.iso.channel.PADChannel) GenericSubFieldPackager(org.jpos.iso.packager.GenericSubFieldPackager) ISOChannel(org.jpos.iso.ISOChannel) Test(org.junit.Test)

Example 10 with PADChannel

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

the class StatefulFilterTest method testFilter2.

@Test
public void testFilter2() throws Throwable {
    int[] key = new int[0];
    StatefulFilter statefulFilter = new StatefulFilter();
    statefulFilter.setKey(key);
    ISOChannel iSOChannel = new PADChannel();
    LogEvent evt = new LogEvent("testStatefulFilterTag");
    ISOMsg m = mock(ISOMsg.class);
    given(m.getDirection()).willReturn(58);
    ISOMsg result = statefulFilter.filter(iSOChannel, m, evt);
    assertSame("result", m, result);
}
Also used : ISOMsg(org.jpos.iso.ISOMsg) LogEvent(org.jpos.util.LogEvent) PADChannel(org.jpos.iso.channel.PADChannel) ISOChannel(org.jpos.iso.ISOChannel) 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