Search in sources :

Example 51 with SimpleConfiguration

use of org.jpos.core.SimpleConfiguration in project jPOS by jpos.

the class VAPChannelTest method testSendMessageHeaderThrowsNullPointerException1.

@Test
public void testSendMessageHeaderThrowsNullPointerException1() throws Throwable {
    ISOMsg m = new ISOMsg(100);
    VAPChannel vAPChannel = new VAPChannel(new Base1Packager());
    vAPChannel.setConfiguration(new SimpleConfiguration());
    try {
        vAPChannel.sendMessageHeader(m, 100);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
    }
}
Also used : ISOMsg(org.jpos.iso.ISOMsg) SimpleConfiguration(org.jpos.core.SimpleConfiguration) Base1Packager(org.jpos.iso.packager.Base1Packager) Test(org.junit.Test)

Example 52 with SimpleConfiguration

use of org.jpos.core.SimpleConfiguration in project jPOS by jpos.

the class MD5FilterTest method testFilterThrowsVetoException4.

@Test
public void testFilterThrowsVetoException4() throws Throwable {
    MD5Filter mD5Filter = new MD5Filter();
    mD5Filter.setConfiguration(new SimpleConfiguration());
    int[] fields = new int[1];
    fields[0] = -100;
    mD5Filter.setFields(fields);
    ISOMsg m = new ISOMsg("testMD5FilterMti");
    m.setDirection(1);
    LogEvent evt = new LogEvent("testMD5FilterTag");
    try {
        mD5Filter.filter(new ASCIIChannel(new ISOBaseValidatingPackager()), m, evt);
        fail("Expected VetoException to be thrown");
    } catch (ISOFilter.VetoException ex) {
        assertEquals("evt.payLoad.size()", 3, evt.getPayLoad().size());
        assertEquals("ex.getMessage()", "org.jpos.iso.ISOFilter$VetoException: invalid MAC", ex.getMessage());
        assertEquals("ex.getNested().getMessage()", "invalid MAC", ex.getNested().getMessage());
        assertEquals("m.getDirection()", 1, m.getDirection());
    }
}
Also used : ISOFilter(org.jpos.iso.ISOFilter) ISOMsg(org.jpos.iso.ISOMsg) LogEvent(org.jpos.util.LogEvent) ASCIIChannel(org.jpos.iso.channel.ASCIIChannel) SimpleConfiguration(org.jpos.core.SimpleConfiguration) ISOBaseValidatingPackager(org.jpos.iso.packager.ISOBaseValidatingPackager) Test(org.junit.Test)

Example 53 with SimpleConfiguration

use of org.jpos.core.SimpleConfiguration in project jPOS by jpos.

the class MD5FilterTest method testGetKey.

@Test
public void testGetKey() throws Throwable {
    MD5Filter mD5Filter = new MD5Filter();
    mD5Filter.setConfiguration(new SimpleConfiguration());
    byte[] result = mD5Filter.getKey();
    assertEquals("result.length", 0, result.length);
}
Also used : SimpleConfiguration(org.jpos.core.SimpleConfiguration) Test(org.junit.Test)

Example 54 with SimpleConfiguration

use of org.jpos.core.SimpleConfiguration 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 55 with SimpleConfiguration

use of org.jpos.core.SimpleConfiguration in project jPOS by jpos.

the class MD5FilterTest method testFilterThrowsNullPointerException3.

@Test
public void testFilterThrowsNullPointerException3() throws Throwable {
    MD5Filter mD5Filter = new MD5Filter();
    mD5Filter.setConfiguration(new SimpleConfiguration());
    int[] fields = new int[1];
    fields[0] = -100;
    mD5Filter.setFields(fields);
    ISOMsg m = new ISOMsg("testMD5FilterMti");
    try {
        mD5Filter.filter(new GZIPChannel(new XMLPackager()), m, null);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
        assertEquals("m.getDirection()", 0, m.getDirection());
    }
}
Also used : XMLPackager(org.jpos.iso.packager.XMLPackager) ISOMsg(org.jpos.iso.ISOMsg) SimpleConfiguration(org.jpos.core.SimpleConfiguration) GZIPChannel(org.jpos.iso.channel.GZIPChannel) Test(org.junit.Test)

Aggregations

SimpleConfiguration (org.jpos.core.SimpleConfiguration)65 Test (org.junit.Test)55 Configuration (org.jpos.core.Configuration)24 SubConfiguration (org.jpos.core.SubConfiguration)15 ISOMsg (org.jpos.iso.ISOMsg)15 Properties (java.util.Properties)14 LogEvent (org.jpos.util.LogEvent)14 ConfigurationException (org.jpos.core.ConfigurationException)9 ASCIIChannel (org.jpos.iso.channel.ASCIIChannel)7 ISOFilter (org.jpos.iso.ISOFilter)6 Logger (org.jpos.util.Logger)6 GZIPChannel (org.jpos.iso.channel.GZIPChannel)4 ISOBaseValidatingPackager (org.jpos.iso.packager.ISOBaseValidatingPackager)4 PostChannel (org.jpos.iso.channel.PostChannel)3 PostPackager (org.jpos.iso.packager.PostPackager)3 XMLPackager (org.jpos.iso.packager.XMLPackager)3 BASE24TCPChannel (org.jpos.iso.channel.BASE24TCPChannel)2 LogChannel (org.jpos.iso.channel.LogChannel)2 PADChannel (org.jpos.iso.channel.PADChannel)2 Base1Packager (org.jpos.iso.packager.Base1Packager)2