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()");
}
}
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));
}
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");
}
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()");
}
}
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()");
}
}
Aggregations