Search in sources :

Example 21 with Configuration

use of org.jpos.core.Configuration 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 22 with Configuration

use of org.jpos.core.Configuration 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 23 with Configuration

use of org.jpos.core.Configuration 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("simpleKeyFile.header", "Key File", simpleKeyFile.header);
        assertEquals("simpleKeyFile.props.size()", 0, 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.Test)

Example 24 with Configuration

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

Example 25 with Configuration

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

the class TransactionManagerTest method testSetConfigurationThrowsNullPointerException.

@Test
public void testSetConfigurationThrowsNullPointerException() throws Throwable {
    Configuration cfg = new SubConfiguration();
    try {
        transactionManager.setConfiguration(cfg);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
        assertFalse("transactionManager.debug", transactionManager.debug);
        assertSame("transactionManager.getConfiguration()", cfg, transactionManager.getConfiguration());
        assertEquals("transactionManager.pauseTimeout", 0L, transactionManager.pauseTimeout);
        assertEquals("transactionManager.retryInterval", 5000L, transactionManager.retryInterval);
    }
}
Also used : SimpleConfiguration(org.jpos.core.SimpleConfiguration) Configuration(org.jpos.core.Configuration) SubConfiguration(org.jpos.core.SubConfiguration) SubConfiguration(org.jpos.core.SubConfiguration) Test(org.junit.Test)

Aggregations

Configuration (org.jpos.core.Configuration)49 Test (org.junit.Test)45 SimpleConfiguration (org.jpos.core.SimpleConfiguration)39 SubConfiguration (org.jpos.core.SubConfiguration)35 ConfigurationException (org.jpos.core.ConfigurationException)8 Properties (java.util.Properties)4 Logger (org.jpos.util.Logger)4 LogEvent (org.jpos.util.LogEvent)3 Configurable (org.jpos.core.Configurable)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 PrintStream (java.io.PrintStream)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 StringTokenizer (java.util.StringTokenizer)1 ISOChannel (org.jpos.iso.ISOChannel)1 ISOMsg (org.jpos.iso.ISOMsg)1 ISOVMsg (org.jpos.iso.ISOVMsg)1 CSChannel (org.jpos.iso.channel.CSChannel)1 LogChannel (org.jpos.iso.channel.LogChannel)1