use of org.opennms.netmgt.config.DatabaseSchemaConfigFactory 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.config.DatabaseSchemaConfigFactory 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();
}
use of org.opennms.netmgt.config.DatabaseSchemaConfigFactory in project opennms by OpenNMS.
the class CollectorConfigDaoImplIT method initialize.
private void initialize() throws IOException, Exception {
System.setProperty("opennms.home", ConfigurationTestUtils.getDaemonEtcDirectory().getParentFile().getAbsolutePath());
InputStream stream = null;
stream = getInputStreamForFile("/org/opennms/netmgt/config/test-database-schema.xml");
DatabaseSchemaConfigFactory.setInstance(new DatabaseSchemaConfigFactory(stream));
stream.close();
stream = getInputStreamForFile("/org/opennms/netmgt/config/snmp-config.xml");
SnmpPeerFactory.setInstance(new SnmpPeerFactory(new InputStreamResource(stream)));
stream.close();
stream = getInputStreamForFile("/org/opennms/netmgt/config/datacollection-config.xml");
DefaultDataCollectionConfigDao dataCollectionDao = new DefaultDataCollectionConfigDao();
dataCollectionDao.setConfigResource(new InputStreamResource(stream));
dataCollectionDao.afterPropertiesSet();
DataCollectionConfigFactory.setInstance(dataCollectionDao);
stream.close();
stream = getInputStreamForFile("/org/opennms/netmgt/config/collectd-testdata.xml");
try {
new CollectdConfigFactory(stream, "localhost", false);
} finally {
stream.close();
}
}
Aggregations