Search in sources :

Example 66 with SimpleConfiguration

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

the class RemoveNewLinesMapperTest method testValuesChangedByConfiguration.

@Test
void testValuesChangedByConfiguration() throws ConfigurationException {
    RemoveNewLinesMapper mapper = new RemoveNewLinesMapper();
    SimpleConfiguration cfg = new SimpleConfiguration();
    cfg.put("combine-spaces", "true");
    cfg.put("newline-at-end", "false");
    mapper.setConfiguration(cfg);
    assertTrue(mapper.combineSpaces);
    assertFalse(mapper.newLineAtEnd);
}
Also used : SimpleConfiguration(org.jpos.core.SimpleConfiguration) Test(org.junit.jupiter.api.Test)

Example 67 with SimpleConfiguration

use of org.jpos.core.SimpleConfiguration 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(0, protectedLogListener.protectFields.length, "protectedLogListener.protectFields.length");
    assertEquals(0, protectedLogListener.wipeFields.length, "protectedLogListener.wipeFields.length");
    assertSame(cfg, protectedLogListener.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.jupiter.api.Test)

Example 68 with SimpleConfiguration

use of org.jpos.core.SimpleConfiguration 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("For input string: \":0\"", ex.getMessage(), "ex.getMessage()");
        assertSame(cfg, dailyTaskAdaptor.getConfiguration(), "dailyTaskAdaptor.getConfiguration()");
    }
}
Also used : SimpleConfiguration(org.jpos.core.SimpleConfiguration) Configuration(org.jpos.core.Configuration) SimpleConfiguration(org.jpos.core.SimpleConfiguration) Test(org.junit.jupiter.api.Test)

Example 69 with SimpleConfiguration

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

the class CMFTest method testCMFConverterOverride.

@Test
public void testCMFConverterOverride() throws ConfigurationException {
    CMFConverter c = new CMFConverter();
    SimpleConfiguration cfg = new SimpleConfiguration();
    cfg.put("10000", "----,jPOS error message");
    c.setConfiguration(cfg);
    assertEquals(new SimpleRC("0000", "APPROVED"), c.convert(CMF.APPROVED), "Standard RC");
    assertEquals(new SimpleRC("ZZZZ", "General decline"), c.convert(CMF.GENERAL_DECLINE), "ResourceBundle override");
    assertEquals(new SimpleRC("9999", "Internal error"), c.convert(CMF.INTERNAL_ERROR), "ResourceBundle override");
    assertEquals(new SimpleRC("----", "jPOS error message"), c.convert(CMF.JPOS), "Configuration override");
}
Also used : SimpleConfiguration(org.jpos.core.SimpleConfiguration) Test(org.junit.jupiter.api.Test)

Example 70 with SimpleConfiguration

use of org.jpos.core.SimpleConfiguration 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(cfg, baseSMAdapter.cfg, "baseSMAdapter.cfg");
}
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.jupiter.api.Test)

Aggregations

SimpleConfiguration (org.jpos.core.SimpleConfiguration)71 Test (org.junit.jupiter.api.Test)59 Configuration (org.jpos.core.Configuration)25 Properties (java.util.Properties)16 SubConfiguration (org.jpos.core.SubConfiguration)15 ISOMsg (org.jpos.iso.ISOMsg)14 LogEvent (org.jpos.util.LogEvent)14 ConfigurationException (org.jpos.core.ConfigurationException)9 ASCIIChannel (org.jpos.iso.channel.ASCIIChannel)7 Logger (org.jpos.util.Logger)7 ISOFilter (org.jpos.iso.ISOFilter)6 GZIPChannel (org.jpos.iso.channel.GZIPChannel)4 ISOBaseValidatingPackager (org.jpos.iso.packager.ISOBaseValidatingPackager)4 PostChannel (org.jpos.iso.channel.PostChannel)3 PostPackager (org.jpos.iso.packager.PostPackager)3 XMLPackager (org.jpos.iso.packager.XMLPackager)3 Element (org.jdom2.Element)2 BASE24TCPChannel (org.jpos.iso.channel.BASE24TCPChannel)2 LogChannel (org.jpos.iso.channel.LogChannel)2 PADChannel (org.jpos.iso.channel.PADChannel)2