Search in sources :

Example 76 with ThrowableAnticipator

use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.

the class EventIpcManagerFactoryTest method testSetIpcManagerNull.

public void testSetIpcManagerNull() {
    ThrowableAnticipator ta = new ThrowableAnticipator();
    ta.anticipate(new IllegalArgumentException("argument ipcManager must not be null"));
    try {
        EventIpcManagerFactory.setIpcManager(null);
    } catch (Throwable t) {
        ta.throwableReceived(t);
    }
    ta.verifyAnticipated();
}
Also used : ThrowableAnticipator(org.opennms.test.ThrowableAnticipator)

Example 77 with ThrowableAnticipator

use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.

the class EventIpcManagerDefaultImplTest method testInitWithNoHandlerPoolSize.

public void testInitWithNoHandlerPoolSize() {
    ThrowableAnticipator ta = new ThrowableAnticipator();
    ta.anticipate(new IllegalStateException("handlerPoolSize not set"));
    EventIpcManagerDefaultImpl manager = new EventIpcManagerDefaultImpl(m_registry);
    manager.setEventHandler(m_eventHandler);
    try {
        manager.afterPropertiesSet();
    } catch (Throwable t) {
        ta.throwableReceived(t);
    }
    ta.verifyAnticipated();
}
Also used : ThrowableAnticipator(org.opennms.test.ThrowableAnticipator)

Example 78 with ThrowableAnticipator

use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.

the class EventIpcManagerDefaultImplTest method testInitWithNoEventHandler.

public void testInitWithNoEventHandler() {
    ThrowableAnticipator ta = new ThrowableAnticipator();
    ta.anticipate(new IllegalStateException("eventHandler not set"));
    EventIpcManagerDefaultImpl manager = new EventIpcManagerDefaultImpl(m_registry);
    manager.setHandlerPoolSize(5);
    try {
        manager.afterPropertiesSet();
    } catch (Throwable t) {
        ta.throwableReceived(t);
    }
    ta.verifyAnticipated();
}
Also used : ThrowableAnticipator(org.opennms.test.ThrowableAnticipator)

Example 79 with ThrowableAnticipator

use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.

the class AbstractJaxbConfigDaoTest method testAfterPropertiesSetWithNoConfigSet.

public void testAfterPropertiesSetWithNoConfigSet() {
    TestJaxbConfigDao dao = new TestJaxbConfigDao();
    ThrowableAnticipator ta = new ThrowableAnticipator();
    ta.anticipate(new IllegalStateException("property configResource must be set and be non-null"));
    try {
        dao.afterPropertiesSet();
    } catch (Throwable t) {
        ta.throwableReceived(t);
    }
    ta.verifyAnticipated();
}
Also used : ThrowableAnticipator(org.opennms.test.ThrowableAnticipator)

Example 80 with ThrowableAnticipator

use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.

the class JdbcFilterDaoIT method testAfterPropertiesSetNoDataSource.

@Test
public void testAfterPropertiesSetNoDataSource() throws Exception {
    ThrowableAnticipator ta = new ThrowableAnticipator();
    JdbcFilterDao dao = new JdbcFilterDao();
    InputStream is = ConfigurationTestUtils.getInputStreamForConfigFile("database-schema.xml");
    dao.setDatabaseSchemaConfigFactory(new DatabaseSchemaConfigFactory(is));
    is.close();
    ta.anticipate(new IllegalStateException("property dataSource cannot be null"));
    try {
        dao.afterPropertiesSet();
    } catch (Throwable t) {
        ta.throwableReceived(t);
    }
    ta.verifyAnticipated();
}
Also used : InputStream(java.io.InputStream) DatabaseSchemaConfigFactory(org.opennms.netmgt.config.DatabaseSchemaConfigFactory) ThrowableAnticipator(org.opennms.test.ThrowableAnticipator) JdbcFilterDao(org.opennms.netmgt.filter.JdbcFilterDao) Test(org.junit.Test)

Aggregations

ThrowableAnticipator (org.opennms.test.ThrowableAnticipator)105 Test (org.junit.Test)44 Ignore (org.junit.Ignore)12 ThresholdEvaluatorStateHighLow (org.opennms.netmgt.threshd.ThresholdEvaluatorHighLow.ThresholdEvaluatorStateHighLow)9 Threshold (org.opennms.netmgt.config.threshd.Threshold)8 BindException (org.springframework.validation.BindException)8 Date (java.util.Date)6 LocationMonitorIdCommand (org.opennms.web.svclayer.model.LocationMonitorIdCommand)6 MarshallingResourceFailureException (org.opennms.core.xml.MarshallingResourceFailureException)4 DistributedStatusDetailsCommand (org.opennms.web.svclayer.model.DistributedStatusDetailsCommand)4 FileSystemResource (org.springframework.core.io.FileSystemResource)4 InputStreamResource (org.springframework.core.io.InputStreamResource)4 Resource (org.springframework.core.io.Resource)4 Errors (org.springframework.validation.Errors)4 File (java.io.File)3 IOException (java.io.IOException)3 SQLException (java.sql.SQLException)3 JdbcFilterDao (org.opennms.netmgt.filter.JdbcFilterDao)2 EventBuilder (org.opennms.netmgt.model.events.EventBuilder)2 RrdException (org.opennms.netmgt.rrd.RrdException)2