Search in sources :

Example 36 with Configuration

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

the class BSHLogListenerTest method testLog.

@Test
public void testLog() throws Throwable {
    BSHLogListener bSHLogListener = new BSHLogListener();
    Configuration cfg = new SimpleConfiguration(new Properties());
    bSHLogListener.setConfiguration(cfg);
    LogEvent ev = new LogEvent("testBSHLogListenerTag");
    ev.setSource(new LogChannel());
    LogEvent result = bSHLogListener.log(ev);
    assertSame("result", ev, result);
    assertSame("bSHLogListener.cfg", cfg, bSHLogListener.cfg);
}
Also used : SimpleConfiguration(org.jpos.core.SimpleConfiguration) Configuration(org.jpos.core.Configuration) LogEvent(org.jpos.util.LogEvent) SimpleConfiguration(org.jpos.core.SimpleConfiguration) LogChannel(org.jpos.iso.channel.LogChannel) Properties(java.util.Properties) Test(org.junit.Test)

Example 37 with Configuration

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

the class BSHRequestListenerTest method testSetConfigurationThrowsNullPointerException.

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

Example 38 with Configuration

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

the class BaseChannelTest method testSetConfigurationThrowsNullPointerException.

@Test
public void testSetConfigurationThrowsNullPointerException() throws Throwable {
    BaseChannel x25Channel = new X25Channel();
    Configuration cfg = new SimpleConfiguration((Properties) null);
    try {
        x25Channel.setConfiguration(cfg);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
        assertEquals("(X25Channel) x25Channel.getMaxPacketLength()", 100000, x25Channel.getMaxPacketLength());
        assertEquals("(X25Channel) x25Channel.getPort()", 0, x25Channel.getPort());
        assertEquals("(X25Channel) x25Channel.getTimeout()", 0, x25Channel.getTimeout());
        assertNull("(X25Channel) x25Channel.getHost()", x25Channel.getHost());
        assertNull("(X25Channel) x25Channel.getSocket()", x25Channel.getSocket());
        assertFalse("(X25Channel) x25Channel.overrideHeader", ((X25Channel) x25Channel).overrideHeader);
    }
}
Also used : Configuration(org.jpos.core.Configuration) SimpleConfiguration(org.jpos.core.SimpleConfiguration) X25Channel(org.jpos.iso.channel.X25Channel) SimpleConfiguration(org.jpos.core.SimpleConfiguration) Test(org.junit.Test)

Example 39 with Configuration

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

the class BaseSMAdapterTest method testSetConfiguration.

@Test
public void testSetConfiguration() throws Throwable {
    BaseSMAdapter baseSMAdapter = new BaseSMAdapter();
    Configuration cfg = new SimpleConfiguration();
    baseSMAdapter.setConfiguration(cfg);
    assertSame("baseSMAdapter.cfg", cfg, baseSMAdapter.cfg);
}
Also used : SubConfiguration(org.jpos.core.SubConfiguration) Configuration(org.jpos.core.Configuration) SimpleConfiguration(org.jpos.core.SimpleConfiguration) SimpleConfiguration(org.jpos.core.SimpleConfiguration) Test(org.junit.Test)

Example 40 with Configuration

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

the class JCESecurityModuleTest method testSetConfigurationThrowsConfigurationException.

@Test
public void testSetConfigurationThrowsConfigurationException() throws Throwable {
    JCESecurityModule jCESecurityModule = new JCESecurityModule();
    Configuration cfg = new SimpleConfiguration();
    try {
        jCESecurityModule.setConfiguration(cfg);
        fail("Expected ConfigurationException to be thrown");
    } catch (ConfigurationException ex) {
    // expected
    }
}
Also used : SimpleConfiguration(org.jpos.core.SimpleConfiguration) Configuration(org.jpos.core.Configuration) SubConfiguration(org.jpos.core.SubConfiguration) ConfigurationException(org.jpos.core.ConfigurationException) SimpleConfiguration(org.jpos.core.SimpleConfiguration) 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