Search in sources :

Example 41 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 42 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)

Example 43 with SimpleConfiguration

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

the class QMUXTest method testInitServiceWithoutListeners.

@Test
public void testInitServiceWithoutListeners() throws Throwable {
    QMUX mux = new QMUX();
    Configuration cfg = new SimpleConfiguration();
    mux.setConfiguration(cfg);
    Element persist = new Element("testQMUXName");
    persist.addContent(new Element("in").addContent("queue-in"));
    persist.addContent(new Element("out").addContent("queue-out"));
    persist.addContent(new Element("unhandled").addContent("queue-unhandled"));
    persist.addContent(new Element("ready").addContent("test-ready"));
    persist.addContent(new Element("unhandled").addContent("queue-unhandled"));
    mux.setPersist(persist);
    mux.initService();
    assertEquals("queue-unhandled", mux.unhandled);
    assertEquals("queue-out", mux.out);
    assertEquals("queue-in", mux.in);
    assertNull(mux.ignorerc);
    assertNotNull(mux.sp);
    assertFalse(mux.isModified());
    assertArrayEquals(new String[] { "test-ready" }, mux.ready);
    assertArrayEquals(new String[] { "41", "11" }, mux.key);
    assertEquals(0, mux.listeners.size());
}
Also used : SimpleConfiguration(org.jpos.core.SimpleConfiguration) Configuration(org.jpos.core.Configuration) Element(org.jdom2.Element) SimpleConfiguration(org.jpos.core.SimpleConfiguration) Test(org.junit.jupiter.api.Test)

Example 44 with SimpleConfiguration

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

the class TransactionManagerTest method testInitServiceThrowsConfigurationException.

@Test
public void testInitServiceThrowsConfigurationException() throws Throwable {
    Configuration cfg = new SimpleConfiguration();
    transactionManager.setConfiguration(cfg);
    try {
        transactionManager.initService();
        fail("Expected ConfigurationException to be thrown");
    } catch (ConfigurationException ex) {
        assertEquals("queue property not specified", ex.getMessage(), "ex.getMessage()");
        assertNull(ex.getNested(), "ex.getNested()");
        assertNull(transactionManager.queue, "transactionManager.queue");
        assertSame(cfg, transactionManager.getConfiguration(), "transactionManager.getConfiguration()");
        assertEquals(0L, transactionManager.tail, "transactionManager.tail");
        assertTrue(transactionManager.isModified(), "transactionManager.isModified()");
        assertNull(transactionManager.sp, "transactionManager.sp");
        assertNull(transactionManager.psp, "transactionManager.psp");
        assertEquals(0L, transactionManager.head, "transactionManager.head");
        assertNull(transactionManager.groups, "transactionManager.groups");
        assertNull(transactionManager.tailLock, "transactionManager.tailLock");
    }
}
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.jupiter.api.Test)

Example 45 with SimpleConfiguration

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

the class CheckFieldsTest method setUp.

@BeforeEach
public void setUp() {
    cfg = new SimpleConfiguration();
    cf = new CheckFields();
    cf.setConfiguration(cfg);
}
Also used : SimpleConfiguration(org.jpos.core.SimpleConfiguration) BeforeEach(org.junit.jupiter.api.BeforeEach)

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