use of org.opennms.netmgt.filter.JdbcFilterDao in project opennms by OpenNMS.
the class JdbcFilterDaoIT method setUp.
@Before
public void setUp() throws Exception {
m_populator.populateDatabase();
// Initialize Filter DAO
// Give the filter DAO access to the same TemporaryDatabase data source
// as the autowired DAOs
DatabaseSchemaConfigFactory.init();
m_dao = new JdbcFilterDao();
m_dao.setDataSource(m_dataSource);
m_dao.setDatabaseSchemaConfigFactory(DatabaseSchemaConfigFactory.getInstance());
m_dao.afterPropertiesSet();
FilterDaoFactory.setInstance(m_dao);
}
use of org.opennms.netmgt.filter.JdbcFilterDao in project opennms by OpenNMS.
the class JdbcFilterDaoIT method testAfterPropertiesSetValid.
@Test
public void testAfterPropertiesSetValid() throws Exception {
JdbcFilterDao dao = new JdbcFilterDao();
dao.setDataSource(m_dataSource);
InputStream is = ConfigurationTestUtils.getInputStreamForConfigFile("database-schema.xml");
dao.setDatabaseSchemaConfigFactory(new DatabaseSchemaConfigFactory(is));
is.close();
dao.afterPropertiesSet();
}
use of org.opennms.netmgt.filter.JdbcFilterDao 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();
}
Aggregations