use of org.jpos.core.SimpleConfiguration 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("MD5Filter not configured", ex.getMessage(), "ex.getMessage()");
assertNull(ex.getNested(), "ex.getNested()");
}
}
use of org.jpos.core.SimpleConfiguration in project jPOS by jpos.
the class MD5FilterTest method testFilterThrowsVetoException3.
@Test
public void testFilterThrowsVetoException3() throws Throwable {
MD5Filter mD5Filter = new MD5Filter();
mD5Filter.setConfiguration(new SimpleConfiguration());
LogEvent evt = new LogEvent("testMD5FilterTag");
int[] fields = new int[1];
mD5Filter.setFields(fields);
ISOMsg m = new ISOMsg("testMD5FilterMti");
try {
mD5Filter.filter(new BASE24TCPChannel("testMD5FilterHost", 100, new PostPackager()), m, evt);
fail("Expected VetoException to be thrown");
} catch (ISOFilter.VetoException ex) {
assertEquals(3, evt.getPayLoad().size(), "evt.payLoad.size()");
assertEquals("org.jpos.iso.ISOFilter$VetoException: invalid MAC", ex.getMessage(), "ex.getMessage()");
assertEquals("invalid MAC", ex.getNested().getMessage(), "ex.getNested().getMessage()");
assertEquals(0, m.getDirection(), "m.getDirection()");
}
}
use of org.jpos.core.SimpleConfiguration in project jPOS by jpos.
the class MD5FilterTest method testFilterThrowsNullPointerException2.
@Test
public void testFilterThrowsNullPointerException2() throws Throwable {
MD5Filter mD5Filter = new MD5Filter();
mD5Filter.setConfiguration(new SimpleConfiguration());
ISOMsg m = new ISOMsg("testMD5FilterMti");
try {
mD5Filter.filter(new ASCIIChannel(new GenericValidatingPackager()), m, null);
fail("Expected NullPointerException to be thrown");
} catch (NullPointerException ex) {
if (isJavaVersionAtMost(JAVA_14)) {
assertNull(ex.getMessage(), "ex.getMessage()");
} else {
assertEquals("Cannot invoke \"org.jpos.util.LogEvent.addMessage(Object)\" because \"evt\" is null", ex.getMessage(), "ex.getMessage()");
}
assertEquals(0, m.getDirection(), "m.getDirection()");
}
}
use of org.jpos.core.SimpleConfiguration in project jPOS by jpos.
the class MD5FilterTest method testFilterThrowsVetoException.
@Test
public void testFilterThrowsVetoException() throws Throwable {
MD5Filter mD5Filter = new MD5Filter();
mD5Filter.setConfiguration(new SimpleConfiguration(new Properties()));
int[] fields = new int[3];
fields[1] = 57;
mD5Filter.setFields(fields);
ISOMsg m = new ISOMsg("testMD5FilterMti");
LogEvent evt = new LogEvent("testMD5FilterTag", new XMLPackager());
try {
mD5Filter.filter(new ASCIIChannel(null), m, evt);
fail("Expected VetoException to be thrown");
} catch (ISOFilter.VetoException ex) {
assertEquals(4, evt.getPayLoad().size(), "evt.payLoad.size()");
assertEquals("org.jpos.iso.ISOFilter$VetoException: invalid MAC", ex.getMessage(), "ex.getMessage()");
assertEquals("invalid MAC", ex.getNested().getMessage(), "ex.getNested().getMessage()");
assertEquals(0, m.getDirection(), "m.getDirection()");
}
}
use of org.jpos.core.SimpleConfiguration in project jPOS by jpos.
the class MacroFilterTest method testSetConfiguration.
@Test
public void testSetConfiguration() throws Throwable {
MacroFilter macroFilter = new MacroFilter();
Configuration cfg = new SimpleConfiguration();
macroFilter.setConfiguration(cfg);
assertNotNull(macroFilter.seq, "macroFilter.seq");
assertSame(cfg, macroFilter.cfg, "macroFilter.cfg");
assertEquals(0, macroFilter.unsetFields.length, "macroFilter.unsetFields.length");
assertEquals(0, macroFilter.validFields.length, "macroFilter.validFields.length");
}
Aggregations