Search in sources :

Example 21 with SimpleConfiguration

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

the class SimpleKeyFileTest method testSetConfigurationThrowsConfigurationException.

@Test
public void testSetConfigurationThrowsConfigurationException() throws Throwable {
    SimpleKeyFile simpleKeyFile = new SimpleKeyFile();
    Configuration cfg = new SimpleConfiguration(new Properties());
    try {
        simpleKeyFile.setConfiguration(cfg);
        fail("Expected ConfigurationException to be thrown");
    } catch (ConfigurationException ex) {
        assertEquals("", simpleKeyFile.file.getName(), "simpleKeyFile.file.getName()");
        assertEquals("Key File", simpleKeyFile.header, "simpleKeyFile.header");
        assertEquals(0, simpleKeyFile.props.size(), "simpleKeyFile.props.size()");
    }
}
Also used : Configuration(org.jpos.core.Configuration) SimpleConfiguration(org.jpos.core.SimpleConfiguration) ConfigurationException(org.jpos.core.ConfigurationException) SimpleConfiguration(org.jpos.core.SimpleConfiguration) Properties(java.util.Properties) Test(org.junit.jupiter.api.Test)

Example 22 with SimpleConfiguration

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

the class DUKPTTest method initSM.

private void initSM() throws ConfigurationException {
    sm = new JCESecurityModule();
    sm.setLogger(log.getLogger(), "SSM");
    Properties props = new Properties();
    props.put("lmk", "build/resources/test/org/jpos/security/lmk-test");
    props.put("provider", "com.sun.crypto.provider.SunJCE");
    sm.setConfiguration(new SimpleConfiguration(props));
}
Also used : SimpleConfiguration(org.jpos.core.SimpleConfiguration) Properties(java.util.Properties)

Example 23 with SimpleConfiguration

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

the class BaseSMAdapterTest method testConstructor.

@Test
public void testConstructor() throws Throwable {
    Configuration cfg = new SubConfiguration(new SimpleConfiguration(new Properties(null)), "testBaseSMAdapterPrefix");
    Logger logger = new Logger();
    BaseSMAdapter baseSMAdapter = new BaseSMAdapter(cfg, logger, "testBaseSMAdapterRealm");
    assertSame(cfg, baseSMAdapter.cfg, "baseSMAdapter.cfg");
    assertEquals("testBaseSMAdapterRealm", baseSMAdapter.realm, "baseSMAdapter.realm");
    assertSame(logger, baseSMAdapter.logger, "baseSMAdapter.logger");
}
Also used : SubConfiguration(org.jpos.core.SubConfiguration) SimpleConfiguration(org.jpos.core.SimpleConfiguration) Configuration(org.jpos.core.Configuration) SimpleConfiguration(org.jpos.core.SimpleConfiguration) SubConfiguration(org.jpos.core.SubConfiguration) Properties(java.util.Properties) Logger(org.jpos.util.Logger) Test(org.junit.jupiter.api.Test)

Example 24 with SimpleConfiguration

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

the class BaseSMAdapterTest method testImportPINImplThrowsSMException1.

@Test
public void testImportPINImplThrowsSMException1() throws Throwable {
    BaseSMAdapter baseSMAdapter = new BaseSMAdapter(new SubConfiguration(new SimpleConfiguration(new Properties(null)), "testBaseSMAdapterPrefix"), new Logger(), "testBaseSMAdapterRealm");
    try {
        baseSMAdapter.importPINImpl(new EncryptedPIN("testBaseSMAdapterPinBlockHexString", (byte) 0, "testBaseSMAdapterAccountNumber"), new KeySerialNumber(), new SecureDESKey((short) 100, "testBaseSMAdapterKeyType", "testBaseSMAdapterKeyHexString1", "testBaseSMAdapterKeyCheckValueHexString1"));
        fail("Expected SMException to be thrown");
    } catch (SMException ex) {
        assertEquals("Operation not supported in: org.jpos.security.BaseSMAdapter", ex.getMessage(), "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.jupiter.api.Test)

Example 25 with SimpleConfiguration

use of org.jpos.core.SimpleConfiguration 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("Operation not supported in: org.jpos.security.BaseSMAdapter", ex.getMessage(), "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.jupiter.api.Test)

Aggregations

SimpleConfiguration (org.jpos.core.SimpleConfiguration)71 Test (org.junit.jupiter.api.Test)59 Configuration (org.jpos.core.Configuration)25 Properties (java.util.Properties)16 SubConfiguration (org.jpos.core.SubConfiguration)15 ISOMsg (org.jpos.iso.ISOMsg)14 LogEvent (org.jpos.util.LogEvent)14 ConfigurationException (org.jpos.core.ConfigurationException)9 ASCIIChannel (org.jpos.iso.channel.ASCIIChannel)7 Logger (org.jpos.util.Logger)7 ISOFilter (org.jpos.iso.ISOFilter)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 Element (org.jdom2.Element)2 BASE24TCPChannel (org.jpos.iso.channel.BASE24TCPChannel)2 LogChannel (org.jpos.iso.channel.LogChannel)2 PADChannel (org.jpos.iso.channel.PADChannel)2