use of org.opennms.netmgt.config.CategoryFactory in project opennms by OpenNMS.
the class DataSenderTest method testSendData.
/*
* This doesn't work unless we have a receiver on the other end.... more of an integration test
*/
@Test
@Ignore
public void testSendData() throws IOException, FilterParseException, SAXException, SQLException, RTCException {
InputStream stream = ConfigurationTestUtils.getInputStreamForResource(this, "/org/opennms/netmgt/config/rtc-configuration.xml");
RTCConfigFactory configFactory = new RTCConfigFactory(stream);
stream.close();
Resource categoryResource = ConfigurationTestUtils.getSpringResourceForResource(this, "/org/opennms/netmgt/config/categories.xml");
CategoryFactory.setInstance(new CategoryFactory(categoryResource));
stream = ConfigurationTestUtils.getInputStreamForResource(this, "/org/opennms/netmgt/config/test-database-schema.xml");
DatabaseSchemaConfigFactory.setInstance(new DatabaseSchemaConfigFactory(stream));
stream.close();
DataManager dataManager = new DataManager();
String categoryName = "Database Servers";
String categoryNameUrl = "Database+Servers";
Category category = new Category();
category.setLabel(categoryName);
category.setComment("Some database servers. Exciting, eh?");
category.setNormalThreshold(99.0);
category.setWarningThreshold(97.0);
RTCCategory rtcCategory = new RTCCategory(category, categoryName);
Map<String, RTCCategory> rtcCategories = new HashMap<String, RTCCategory>();
rtcCategories.put(categoryName, rtcCategory);
DataSender sender = new DataSender(dataManager, configFactory);
sender.subscribe("http://localhost:8080/opennms-webapp/rtc/post/" + categoryNameUrl, categoryName, "rtc", "rtc");
sender.sendData();
}
Aggregations