Search in sources :

Example 36 with Logger

use of org.jpos.util.Logger in project jPOS by jpos.

the class JCESecurityModuleTest method testConstructorThrowsNullPointerException2.

@Test
public void testConstructorThrowsNullPointerException2() throws Throwable {
    Configuration cfg = new SubConfiguration();
    try {
        new JCESecurityModule(cfg, new Logger(), "testJCESecurityModuleRealm");
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
    }
}
Also used : SimpleConfiguration(org.jpos.core.SimpleConfiguration) Configuration(org.jpos.core.Configuration) SubConfiguration(org.jpos.core.SubConfiguration) SubConfiguration(org.jpos.core.SubConfiguration) Logger(org.jpos.util.Logger) Test(org.junit.Test)

Example 37 with Logger

use of org.jpos.util.Logger in project jPOS by jpos.

the class JCESecurityModuleTest method testConstructorThrowsConfigurationException1.

@Test
public void testConstructorThrowsConfigurationException1() throws Throwable {
    Configuration cfg = new SimpleConfiguration();
    try {
        new JCESecurityModule(cfg, new Logger(), "testJCESecurityModuleRealm");
        fail("Expected ConfigurationException to be thrown");
    } catch (ConfigurationException ex) {
    // expected
    }
}
Also used : SimpleConfiguration(org.jpos.core.SimpleConfiguration) Configuration(org.jpos.core.Configuration) SubConfiguration(org.jpos.core.SubConfiguration) ConfigurationException(org.jpos.core.ConfigurationException) SimpleConfiguration(org.jpos.core.SimpleConfiguration) Logger(org.jpos.util.Logger) Test(org.junit.Test)

Example 38 with Logger

use of org.jpos.util.Logger in project jPOS by jpos.

the class Base1SubFieldPackagerTest method testUnpack.

@Test
public void testUnpack() throws Throwable {
    Base1SubFieldPackager base1SubFieldPackager = new Base1SubFieldPackager();
    ISOFieldPackager[] fld = new ISOFieldPackager[3];
    base1SubFieldPackager.setFieldPackager(fld);
    base1SubFieldPackager.setLogger(new Logger(), "testBase1SubFieldPackagerRealm");
    byte[] b = new byte[0];
    int result = base1SubFieldPackager.unpack(new ISOMsg(100), b);
    assertEquals("result", 0, result);
}
Also used : ISOMsg(org.jpos.iso.ISOMsg) ISOFieldPackager(org.jpos.iso.ISOFieldPackager) Logger(org.jpos.util.Logger) Test(org.junit.Test)

Example 39 with Logger

use of org.jpos.util.Logger in project jPOS by jpos.

the class EuroPackagerTest method testSetLogger.

@Test
public void testSetLogger() throws Throwable {
    EuroPackager euroPackager = new EuroPackager();
    Logger logger = Logger.getLogger("testEuroPackagerName");
    euroPackager.setLogger(logger, "testEuroPackagerRealm");
    assertSame("euroPackager.getLogger()", logger, euroPackager.getLogger());
    assertNotNull("euroPackager.f48Packager", euroPackager.f48Packager);
    assertEquals("euroPackager.getRealm()", "testEuroPackagerRealm", euroPackager.getRealm());
}
Also used : Logger(org.jpos.util.Logger) Test(org.junit.Test)

Example 40 with Logger

use of org.jpos.util.Logger in project jPOS by jpos.

the class GenericSubFieldPackagerTest method testUnpackThrowsISOException8.

@Test
public void testUnpackThrowsISOException8() throws Throwable {
    ISOFieldPackager[] fld = new ISOFieldPackager[2];
    fld[1] = new IFA_LLLLCHAR();
    GenericSubFieldPackager genericSubFieldPackager = new GenericSubFieldPackager();
    genericSubFieldPackager.setFieldPackager(fld);
    genericSubFieldPackager.setLogger(new Logger(), "testGenericSubFieldPackagerRealm");
    byte[] b = new byte[5];
    try {
        genericSubFieldPackager.unpack(new ISOMsg(), b);
        fail("Expected ISOException to be thrown");
    } catch (ISOException ex) {
        assertEquals("ex.getMessage()", "org.jpos.iso.IFA_LLLLCHAR: Problem unpacking field -1", ex.getMessage());
        assertNull("ex.getNested().getMessage()", ex.getNested().getMessage());
    }
}
Also used : ISOException(org.jpos.iso.ISOException) ISOMsg(org.jpos.iso.ISOMsg) ISOFieldPackager(org.jpos.iso.ISOFieldPackager) IFA_LLLLCHAR(org.jpos.iso.IFA_LLLLCHAR) Logger(org.jpos.util.Logger) Test(org.junit.Test)

Aggregations

Logger (org.jpos.util.Logger)45 Test (org.junit.Test)36 SimpleConfiguration (org.jpos.core.SimpleConfiguration)7 SubConfiguration (org.jpos.core.SubConfiguration)5 ISOMsg (org.jpos.iso.ISOMsg)5 SimpleLogListener (org.jpos.util.SimpleLogListener)5 Properties (java.util.Properties)4 Configuration (org.jpos.core.Configuration)4 ISOFieldPackager (org.jpos.iso.ISOFieldPackager)4 ISOException (org.jpos.iso.ISOException)3 ConfigurationException (org.jpos.core.ConfigurationException)2 GZIPChannel (org.jpos.iso.channel.GZIPChannel)2 Log (org.jpos.util.Log)2 NameRegistrar (org.jpos.util.NameRegistrar)2 Before (org.junit.Before)2 PrintStream (java.io.PrintStream)1 Iterator (java.util.Iterator)1 Map (java.util.Map)1 IFA_LLLLCHAR (org.jpos.iso.IFA_LLLLCHAR)1 IFE_CHAR (org.jpos.iso.IFE_CHAR)1