Search in sources :

Example 6 with PostChannel

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

the class BSHRequestListenerTest method testProcess.

@Test
public void testProcess() throws Throwable {
    BSHRequestListener bSHRequestListener = new BSHRequestListener();
    bSHRequestListener.setConfiguration(new SimpleConfiguration());
    boolean result = bSHRequestListener.process(new PostChannel(), new ISOMsg("testBSHRequestListenerMti"));
    // there is no source to process
    assertFalse("result should be false", result);
    assertEquals("bSHRequestListener.whitelist.size()", 1, bSHRequestListener.whitelist.size());
}
Also used : ISOMsg(org.jpos.iso.ISOMsg) SimpleConfiguration(org.jpos.core.SimpleConfiguration) PostChannel(org.jpos.iso.channel.PostChannel) Test(org.junit.Test)

Example 7 with PostChannel

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

the class MD5FilterTest method testFilterThrowsNullPointerException1.

@Test
public void testFilterThrowsNullPointerException1() throws Throwable {
    int[] fields = new int[1];
    MD5Filter mD5Filter = new MD5Filter();
    mD5Filter.setConfiguration(new SimpleConfiguration());
    mD5Filter.setFields(fields);
    LogEvent evt = new LogEvent("testMD5FilterTag", Integer.valueOf(-12));
    try {
        mD5Filter.filter(new PostChannel(new CTCSubFieldPackager()), null, evt);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
    }
}
Also used : LogEvent(org.jpos.util.LogEvent) SimpleConfiguration(org.jpos.core.SimpleConfiguration) PostChannel(org.jpos.iso.channel.PostChannel) CTCSubFieldPackager(org.jpos.iso.packager.CTCSubFieldPackager) Test(org.junit.Test)

Example 8 with PostChannel

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

the class StatefulFilterTest method testFilterThrowsNullPointerException6.

@Test
public void testFilterThrowsNullPointerException6() throws Throwable {
    StatefulFilter statefulFilter = new StatefulFilter();
    statefulFilter.setKeyPrefix(null);
    try {
        statefulFilter.filter(new PostChannel(new CTCSubFieldPackager()), new ISOMsg("testStatefulFilterMti"), new LogEvent());
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
    }
}
Also used : 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)

Example 9 with PostChannel

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

the class StatefulFilterTest method testFilterThrowsNullPointerException.

@Test
public void testFilterThrowsNullPointerException() throws Throwable {
    ISOMsg m = new ISOMsg(100);
    m.setDirection(100);
    int[] key = new int[0];
    StatefulFilter statefulFilter = new StatefulFilter();
    statefulFilter.setKey(key);
    statefulFilter.setSpace((Space) null);
    statefulFilter.setMatchDirection(100);
    try {
        statefulFilter.filter(new PostChannel("testStatefulFilterHost", 100, new GenericSubFieldPackager()), m, new LogEvent());
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
    }
}
Also used : ISOMsg(org.jpos.iso.ISOMsg) LogEvent(org.jpos.util.LogEvent) PostChannel(org.jpos.iso.channel.PostChannel) GenericSubFieldPackager(org.jpos.iso.packager.GenericSubFieldPackager) Test(org.junit.Test)

Example 10 with PostChannel

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

the class StatefulFilterTest method testFilter3.

@Test
public void testFilter3() throws Throwable {
    int[] key = new int[0];
    StatefulFilter statefulFilter = new StatefulFilter();
    statefulFilter.setKey(key);
    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()));
    assertSame("result", m, result);
}
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

PostChannel (org.jpos.iso.channel.PostChannel)10 Test (org.junit.Test)10 ISOMsg (org.jpos.iso.ISOMsg)9 LogEvent (org.jpos.util.LogEvent)9 CTCSubFieldPackager (org.jpos.iso.packager.CTCSubFieldPackager)4 SimpleConfiguration (org.jpos.core.SimpleConfiguration)3 GenericSubFieldPackager (org.jpos.iso.packager.GenericSubFieldPackager)3 ISOFilter (org.jpos.iso.ISOFilter)2 XMLPackager (org.jpos.iso.packager.XMLPackager)2 PostPackager (org.jpos.iso.packager.PostPackager)1