Search in sources :

Example 31 with Configuration

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

the class FilterLogListenerTest method testSetConfiguration.

@Test
public void testSetConfiguration() throws Throwable {
    FilterLogListener filterLogListener = new FilterLogListener();
    Configuration cfg = new SimpleConfiguration();
    filterLogListener.setConfiguration(cfg);
    assertEquals("filterLogListener.getPriority()", "info", filterLogListener.getPriority());
}
Also used : SubConfiguration(org.jpos.core.SubConfiguration) SimpleConfiguration(org.jpos.core.SimpleConfiguration) Configuration(org.jpos.core.Configuration) SimpleConfiguration(org.jpos.core.SimpleConfiguration) Test(org.junit.Test)

Example 32 with Configuration

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

the class ProtectedLogListenerTest method testSetConfiguration.

@Test
public void testSetConfiguration() throws Throwable {
    ProtectedLogListener protectedLogListener = new ProtectedLogListener();
    Configuration cfg = new SimpleConfiguration();
    protectedLogListener.setConfiguration(cfg);
    assertEquals("protectedLogListener.protectFields.length", 0, protectedLogListener.protectFields.length);
    assertEquals("protectedLogListener.wipeFields.length", 0, protectedLogListener.wipeFields.length);
    assertSame("protectedLogListener.cfg", cfg, protectedLogListener.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 33 with Configuration

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

the class RotateLogListenerTest method testSetConfigurationThrowsNullPointerException.

@Test
public void testSetConfigurationThrowsNullPointerException() throws Throwable {
    RotateLogListener rotateLogListener = new RotateLogListener();
    Configuration cfg = new SubConfiguration();
    try {
        rotateLogListener.setConfiguration(cfg);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
        assertNull("rotateLogListener.logName", rotateLogListener.logName);
        assertEquals("rotateLogListener.sleepTime", 0L, rotateLogListener.sleepTime);
        assertEquals("rotateLogListener.maxSize", 0L, rotateLogListener.maxSize);
        assertEquals("rotateLogListener.maxCopies", 0, rotateLogListener.maxCopies);
        assertNull("rotateLogListener.rotate", rotateLogListener.rotate);
        assertNull("rotateLogListener.f", rotateLogListener.f);
        assertNotNull("rotateLogListener.p", rotateLogListener.p);
    }
}
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 34 with Configuration

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

the class DailyTaskAdaptorTest method testWaitUntilStartTimeThrowsNumberFormatException.

@Test
public void testWaitUntilStartTimeThrowsNumberFormatException() throws Throwable {
    DailyTaskAdaptor dailyTaskAdaptor = new DailyTaskAdaptor();
    Configuration cfg = new SimpleConfiguration();
    dailyTaskAdaptor.setConfiguration(cfg);
    try {
        dailyTaskAdaptor.waitUntilStartTime();
        fail("Expected NumberFormatException to be thrown");
    } catch (NumberFormatException ex) {
        assertEquals("ex.getMessage()", "For input string: \":0\"", ex.getMessage());
        assertSame("dailyTaskAdaptor.getConfiguration()", cfg, dailyTaskAdaptor.getConfiguration());
    }
}
Also used : SimpleConfiguration(org.jpos.core.SimpleConfiguration) Configuration(org.jpos.core.Configuration) SimpleConfiguration(org.jpos.core.SimpleConfiguration) Test(org.junit.Test)

Example 35 with Configuration

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

the class BSHFilterTest method testFilter.

@Test
public void testFilter() throws Throwable {
    Configuration cfg = new SimpleConfiguration();
    BSHFilter bSHFilter = new BSHFilter();
    bSHFilter.setConfiguration(cfg);
    ISOMsg result = bSHFilter.filter(new PADChannel(), null, new LogEvent("testBSHFilterTag", "testString"));
    assertNull("result", result);
    assertSame("bSHFilter.cfg", cfg, bSHFilter.cfg);
}
Also used : SimpleConfiguration(org.jpos.core.SimpleConfiguration) Configuration(org.jpos.core.Configuration) ISOMsg(org.jpos.iso.ISOMsg) LogEvent(org.jpos.util.LogEvent) PADChannel(org.jpos.iso.channel.PADChannel) 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