Search in sources :

Example 26 with Configuration

use of org.jpos.core.Configuration 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("ex.getMessage()", "queue property not specified", ex.getMessage());
        assertNull("ex.getNested()", ex.getNested());
        assertNull("transactionManager.queue", transactionManager.queue);
        assertSame("transactionManager.getConfiguration()", cfg, transactionManager.getConfiguration());
        assertEquals("transactionManager.tail", 0L, transactionManager.tail);
        assertTrue("transactionManager.isModified()", transactionManager.isModified());
        assertNull("transactionManager.sp", transactionManager.sp);
        assertNull("transactionManager.psp", transactionManager.psp);
        assertEquals("transactionManager.head", 0L, 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.Test)

Example 27 with Configuration

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

the class DailyLogListenerTest method testSetConfigurationThrowsNullPointerException.

@Test
public void testSetConfigurationThrowsNullPointerException() throws Throwable {
    DailyLogListener dailyLogListener = new DailyLogListener();
    Configuration cfg = new SubConfiguration();
    try {
        dailyLogListener.setConfiguration(cfg);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
        assertNull("dailyLogListener.rotate", dailyLogListener.rotate);
        assertEquals("dailyLogListener.getCompressionBufferSize()", 131072, dailyLogListener.getCompressionBufferSize());
        assertNotNull("dailyLogListener.p", dailyLogListener.p);
        assertNull("dailyLogListener.getPrefix()", dailyLogListener.getPrefix());
        assertEquals("dailyLogListener.getSuffix()", ".log", dailyLogListener.getSuffix());
        assertNull("dailyLogListener.f", dailyLogListener.f);
        assertEquals("dailyLogListener.getCompressedSuffix()", "", dailyLogListener.getCompressedSuffix());
        assertNull("dailyLogListener.logName", dailyLogListener.logName);
        assertEquals("dailyLogListener.sleepTime", 0L, dailyLogListener.sleepTime);
        assertEquals("dailyLogListener.maxSize", 0L, dailyLogListener.maxSize);
        assertEquals("dailyLogListener.getCompressionFormat()", 0, dailyLogListener.getCompressionFormat());
        assertTrue("dailyLogListener.getDateFmt().isLenient()", dailyLogListener.getDateFmt().isLenient());
    }
}
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 28 with Configuration

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

the class DirPollTest method testSetConfigurationThrowsNullPointerException1.

@Test
public void testSetConfigurationThrowsNullPointerException1() throws Throwable {
    Configuration cfg = new SubConfiguration();
    DirPoll processor = new DirPoll();
    DirPoll dirPoll = new DirPoll();
    processor.setProcessor("");
    dirPoll.setProcessor(processor);
    try {
        dirPoll.setConfiguration(cfg);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
    }
}
Also used : SubConfiguration(org.jpos.core.SubConfiguration) Configuration(org.jpos.core.Configuration) SubConfiguration(org.jpos.core.SubConfiguration) Test(org.junit.Test)

Example 29 with Configuration

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

the class DirPollTest method testSetConfigurationThrowsStackOverflowError.

@Test
public void testSetConfigurationThrowsStackOverflowError() throws Throwable {
    Configuration cfg = new SubConfiguration();
    DirPoll processor = new DirPoll();
    processor.setProcessor(processor);
    try {
        processor.setConfiguration(cfg);
        fail("Expected StackOverflowError to be thrown");
    } catch (StackOverflowError ex) {
        assertEquals("ex.getClass()", StackOverflowError.class, ex.getClass());
    }
}
Also used : SubConfiguration(org.jpos.core.SubConfiguration) Configuration(org.jpos.core.Configuration) SubConfiguration(org.jpos.core.SubConfiguration) Test(org.junit.Test)

Example 30 with Configuration

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

the class DirPollTest method testSetConfigurationThrowsNullPointerException4.

@Test
public void testSetConfigurationThrowsNullPointerException4() throws Throwable {
    Configuration cfg = new SubConfiguration();
    DirPoll dirPoll = new DirPoll();
    try {
        dirPoll.setConfiguration(cfg);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
    }
}
Also used : SubConfiguration(org.jpos.core.SubConfiguration) Configuration(org.jpos.core.Configuration) 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