Search in sources :

Example 11 with SubConfiguration

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

the class FilterLogListenerTest method testSetConfigurationThrowsConfigurationException.

@Test
public void testSetConfigurationThrowsConfigurationException() throws Throwable {
    FilterLogListener filterLogListener = new FilterLogListener(new PrintStream(new ByteArrayOutputStream()));
    Configuration cfg = new SubConfiguration();
    try {
        filterLogListener.setConfiguration(cfg);
        fail("Expected ConfigurationException to be thrown");
    } catch (ConfigurationException ex) {
        assertEquals("ex.getMessage()", "java.lang.NullPointerException", ex.getMessage());
        assertNull("ex.getNested().getMessage()", ex.getNested().getMessage());
        assertEquals("filterLogListener.getPriority()", "info", filterLogListener.getPriority());
    }
}
Also used : PrintStream(java.io.PrintStream) SubConfiguration(org.jpos.core.SubConfiguration) SimpleConfiguration(org.jpos.core.SimpleConfiguration) Configuration(org.jpos.core.Configuration) ConfigurationException(org.jpos.core.ConfigurationException) SubConfiguration(org.jpos.core.SubConfiguration) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Test(org.junit.Test)

Example 12 with SubConfiguration

use of org.jpos.core.SubConfiguration 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)

Example 13 with SubConfiguration

use of org.jpos.core.SubConfiguration 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("baseSMAdapter.cfg", cfg, baseSMAdapter.cfg);
    assertEquals("baseSMAdapter.realm", "testBaseSMAdapterRealm", baseSMAdapter.realm);
    assertSame("baseSMAdapter.logger", logger, baseSMAdapter.logger);
}
Also used : SubConfiguration(org.jpos.core.SubConfiguration) Configuration(org.jpos.core.Configuration) SimpleConfiguration(org.jpos.core.SimpleConfiguration) SimpleConfiguration(org.jpos.core.SimpleConfiguration) SubConfiguration(org.jpos.core.SubConfiguration) Properties(java.util.Properties) Logger(org.jpos.util.Logger) Test(org.junit.Test)

Example 14 with SubConfiguration

use of org.jpos.core.SubConfiguration 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("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)

Example 15 with SubConfiguration

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

the class ProtectedLogListenerTest method testSetConfigurationThrowsNullPointerException.

@Test
public void testSetConfigurationThrowsNullPointerException() throws Throwable {
    ProtectedLogListener protectedLogListener = new ProtectedLogListener();
    Configuration cfg = new SubConfiguration();
    try {
        protectedLogListener.setConfiguration(cfg);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertSame("protectedLogListener.cfg", cfg, protectedLogListener.cfg);
        assertNull("ex.getMessage()", ex.getMessage());
        assertNull("protectedLogListener.wipeFields", protectedLogListener.wipeFields);
        assertNull("protectedLogListener.protectFields", protectedLogListener.protectFields);
    }
}
Also used : SubConfiguration(org.jpos.core.SubConfiguration) Configuration(org.jpos.core.Configuration) SimpleConfiguration(org.jpos.core.SimpleConfiguration) SubConfiguration(org.jpos.core.SubConfiguration) Test(org.junit.Test)

Aggregations

SubConfiguration (org.jpos.core.SubConfiguration)25 Test (org.junit.Test)25 Configuration (org.jpos.core.Configuration)23 SimpleConfiguration (org.jpos.core.SimpleConfiguration)18 Logger (org.jpos.util.Logger)4 Properties (java.util.Properties)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 PrintStream (java.io.PrintStream)1 ConfigurationException (org.jpos.core.ConfigurationException)1 GenericPackager (org.jpos.iso.packager.GenericPackager)1