Search in sources :

Example 11 with Logger

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

the class CTCSubElementPackagerTest method testUnpackThrowsISOException.

@Test
public void testUnpackThrowsISOException() throws Throwable {
    CTCSubElementPackager cTCSubElementPackager = new CTCSubElementPackager();
    ISOFieldPackager[] fld = new ISOFieldPackager[2];
    cTCSubElementPackager.setFieldPackager(fld);
    cTCSubElementPackager.setLogger(new Logger(), "testCTCSubElementPackagerRealm");
    cTCSubElementPackager.setFieldPackager(0, new IFE_CHAR());
    byte[] b = new byte[2];
    try {
        cTCSubElementPackager.unpack(new ISOVField(new ISOField(100, "testCTCSubElementPackagerv"), null), b);
        fail("Expected ISOException to be thrown");
    } catch (ISOException ex) {
        assertEquals("ex.getMessage()", "Can't add to Leaf", ex.getMessage());
        assertNull("ex.getNested()", ex.getNested());
    }
}
Also used : ISOField(org.jpos.iso.ISOField) ISOException(org.jpos.iso.ISOException) ISOVField(org.jpos.iso.ISOVField) ISOFieldPackager(org.jpos.iso.ISOFieldPackager) Logger(org.jpos.util.Logger) IFE_CHAR(org.jpos.iso.IFE_CHAR) Test(org.junit.Test)

Example 12 with Logger

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

the class GenericSubFieldPackagerTest method testReturnsZero.

@Test
public void testReturnsZero() throws Throwable {
    byte[] b = new byte[0];
    GenericSubFieldPackager genericSubFieldPackager = new GenericSubFieldPackager();
    genericSubFieldPackager.setLogger(new Logger(), "testGenericSubFieldPackagerRealm");
    int l = genericSubFieldPackager.unpack(new ISOMsg("testGenericSubFieldPackagerMti"), b);
    assertEquals(0L, (long) l);
}
Also used : ISOMsg(org.jpos.iso.ISOMsg) Logger(org.jpos.util.Logger) Test(org.junit.Test)

Example 13 with Logger

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

the class GenericSubFieldPackagerTest method testUnpackReturnsZero1.

@Test
public void testUnpackReturnsZero1() throws Throwable {
    byte[] b = new byte[0];
    ISOFieldPackager[] fld = new ISOFieldPackager[0];
    GenericSubFieldPackager genericSubFieldPackager = new GenericSubFieldPackager();
    genericSubFieldPackager.setFieldPackager(fld);
    genericSubFieldPackager.setLogger(new Logger(), "testGenericSubFieldPackagerRealm");
    int l = genericSubFieldPackager.unpack(new ISOMsg("testGenericSubFieldPackagerMti"), b);
    assertEquals(0L, (long) l);
}
Also used : ISOMsg(org.jpos.iso.ISOMsg) ISOFieldPackager(org.jpos.iso.ISOFieldPackager) Logger(org.jpos.util.Logger) Test(org.junit.Test)

Example 14 with Logger

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

the class PostPackagerTest method testSetLogger.

@Test
public void testSetLogger() throws Throwable {
    PostPackager postPackager = new PostPackager();
    Logger logger = Logger.getLogger("testPostPackagerName");
    postPackager.setLogger(logger, "testPostPackagerRealm");
    assertNotNull("postPackager.p127", postPackager.p127);
    assertSame("postPackager.getLogger()", logger, postPackager.getLogger());
    assertEquals("postPackager.getRealm()", "testPostPackagerRealm", postPackager.getRealm());
}
Also used : Logger(org.jpos.util.Logger) Test(org.junit.Test)

Example 15 with Logger

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

the class BaseSMAdapterTest method testTranslatePINImplThrowsSMException1.

@Test
public void testTranslatePINImplThrowsSMException1() throws Throwable {
    BaseSMAdapter baseSMAdapter = new BaseSMAdapter(new SubConfiguration(new SimpleConfiguration(new Properties(null)), "testBaseSMAdapterPrefix"), new Logger(), "testBaseSMAdapterRealm");
    try {
        baseSMAdapter.translatePINImpl(new EncryptedPIN(), new SecureDESKey((short) 100, "testBaseSMAdapterKeyType", "testBaseSMAdapterKeyHexString1", "testBaseSMAdapterKeyCheckValueHexString1"), new SecureDESKey(), (byte) 0);
        fail("Expected SMException to be thrown");
    } catch (SMException ex) {
        assertEquals("ex.getMessage()", "Operation not supported in: org.jpos.security.BaseSMAdapter", ex.getMessage());
        assertNull("ex.nested", ex.nested);
        assertNull("ex.getNested()", ex.getNested());
    }
}
Also used : SimpleConfiguration(org.jpos.core.SimpleConfiguration) SubConfiguration(org.jpos.core.SubConfiguration) Properties(java.util.Properties) 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