use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class JdbcDataCollectionConfigDaoJaxbTest method testAfterPropertiesSetWithBogusFileResource.
public void testAfterPropertiesSetWithBogusFileResource() throws Exception {
Resource resource = new FileSystemResource("/bogus-file");
JdbcDataCollectionConfigDaoJaxb dao = new JdbcDataCollectionConfigDaoJaxb();
dao.setConfigResource(resource);
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new MarshallingResourceFailureException(ThrowableAnticipator.IGNORE_MESSAGE));
try {
dao.afterPropertiesSet();
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
}
use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class JdbcFilterDaoIT method testAfterPropertiesSetNoSchemaFactory.
@Test
public void testAfterPropertiesSetNoSchemaFactory() {
ThrowableAnticipator ta = new ThrowableAnticipator();
JdbcFilterDao dao = new JdbcFilterDao();
dao.setDataSource(m_dataSource);
ta.anticipate(new IllegalStateException("property databaseSchemaConfigFactory cannot be null"));
try {
dao.afterPropertiesSet();
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
}
use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class ResourceAttributeFilteringResourceVisitorTest method testAfterPropertiesSetNoResourceAttributeValueMatch.
public void testAfterPropertiesSetNoResourceAttributeValueMatch() throws Exception {
ResourceAttributeFilteringResourceVisitor filteringVisitor = new ResourceAttributeFilteringResourceVisitor();
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalStateException("property resourceAttributeValueMatch must be set to a non-null value"));
filteringVisitor.setDelegatedVisitor(m_delegatedVisitor);
filteringVisitor.setResourceAttributeKey("ifSpeed");
try {
filteringVisitor.afterPropertiesSet();
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
}
use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class ResourceAttributeFilteringResourceVisitorTest method testAfterPropertiesSetNoResourceTypeMatch.
public void testAfterPropertiesSetNoResourceTypeMatch() throws Exception {
ResourceAttributeFilteringResourceVisitor filteringVisitor = new ResourceAttributeFilteringResourceVisitor();
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalStateException("property resourceAttributeKey must be set to a non-null value"));
filteringVisitor.setDelegatedVisitor(m_delegatedVisitor);
filteringVisitor.setResourceAttributeValueMatch("1000000000");
try {
filteringVisitor.afterPropertiesSet();
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
}
use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class ResourceTreeWalkerTest method testAfterPropertiesSetNoResourceDao.
public void testAfterPropertiesSetNoResourceDao() {
ResourceTreeWalker walker = new ResourceTreeWalker();
walker.setResourceDao(null);
walker.setVisitor(m_visitor);
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalStateException("property resourceDao must be set to a non-null value"));
m_mocks.replayAll();
try {
walker.afterPropertiesSet();
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
m_mocks.verifyAll();
}
Aggregations