use of org.opennms.netmgt.model.OnmsServiceType in project opennms by OpenNMS.
the class NotificationManagerIT method setUp.
@Before
public void setUp() throws Exception {
// Initialize Filter DAO
DatabaseSchemaConfigFactory.init();
JdbcFilterDao jdbcFilterDao = new JdbcFilterDao();
jdbcFilterDao.setDataSource(m_dataSource);
jdbcFilterDao.setDatabaseSchemaConfigFactory(DatabaseSchemaConfigFactory.getInstance());
jdbcFilterDao.afterPropertiesSet();
FilterDaoFactory.setInstance(jdbcFilterDao);
m_configManager = new MockNotifdConfigManager(ConfigurationTestUtils.getConfigForResourceWithReplacements(this, "notifd-configuration.xml"));
m_notificationManager = new NotificationManagerImpl(m_configManager, m_dataSource);
OnmsNode node;
OnmsIpInterface ipInterface;
OnmsMonitoredService service;
OnmsServiceType serviceType;
OnmsCategory category1 = new OnmsCategory("CategoryOne");
m_categoryDao.save(category1);
OnmsCategory category2 = new OnmsCategory("CategoryTwo");
m_categoryDao.save(category2);
OnmsCategory category3 = new OnmsCategory("CategoryThree");
m_categoryDao.save(category3);
OnmsCategory category4 = new OnmsCategory("CategoryFour");
m_categoryDao.save(category4);
m_categoryDao.flush();
// node 1
serviceType = new OnmsServiceType("HTTP");
m_serviceTypeDao.save(serviceType);
node = new OnmsNode(m_locationDao.getDefaultLocation(), "node 1");
node.addCategory(category1);
node.addCategory(category2);
node.addCategory(category3);
ipInterface = new OnmsIpInterface(addr("192.168.1.1"), node);
service = new OnmsMonitoredService(ipInterface, serviceType);
m_nodeDao.save(node);
// node 2
node = new OnmsNode(m_locationDao.getDefaultLocation(), "node 2");
node.addCategory(category1);
node.addCategory(category2);
node.addCategory(category4);
m_nodeDao.save(node);
ipInterface = new OnmsIpInterface(addr("192.168.1.1"), node);
m_ipInterfaceDao.save(ipInterface);
service = new OnmsMonitoredService(ipInterface, serviceType);
m_serviceDao.save(service);
ipInterface = new OnmsIpInterface(addr("0.0.0.0"), node);
m_ipInterfaceDao.save(ipInterface);
// node 3
node = new OnmsNode(m_locationDao.getDefaultLocation(), "node 3");
m_nodeDao.save(node);
ipInterface = new OnmsIpInterface(addr("192.168.1.2"), node);
m_ipInterfaceDao.save(ipInterface);
service = new OnmsMonitoredService(ipInterface, serviceType);
m_serviceDao.save(service);
// node 4 has an interface, but no services
node = new OnmsNode(m_locationDao.getDefaultLocation(), "node 4");
m_nodeDao.save(node);
ipInterface = new OnmsIpInterface(addr("192.168.1.3"), node);
m_ipInterfaceDao.save(ipInterface);
// node 5 has no interfaces
node = new OnmsNode(m_locationDao.getDefaultLocation(), "node 5");
m_nodeDao.save(node);
m_nodeDao.flush();
m_ipInterfaceDao.flush();
m_serviceDao.flush();
m_serviceTypeDao.flush();
m_categoryDao.flush();
}
use of org.opennms.netmgt.model.OnmsServiceType in project opennms by OpenNMS.
the class DaoEventdServiceManagerTest method testSync.
@Test
public void testSync() {
m_eventdServiceManager.dataSourceSync();
m_serviceTypeDao.save(new OnmsServiceType("ICMP"));
assertTrue(m_eventdServiceManager.getServiceId("ICMP") > 0);
}
use of org.opennms.netmgt.model.OnmsServiceType in project opennms by OpenNMS.
the class PollerTest method getIPv6MonitoredService.
private OnmsMonitoredService getIPv6MonitoredService() {
OnmsNode node = new OnmsNode();
OnmsMonitoringLocation location = new OnmsMonitoringLocation();
location.setLocationName("MINION");
node.setId(1);
node.setLocation(location);
OnmsIpInterface iface = new OnmsIpInterface("::1", node);
// Make sure that the address is being converted into fully-qualified format
assertEquals("0000:0000:0000:0000:0000:0000:0000:0001", str(iface.getIpAddress()));
OnmsServiceType svcType = new OnmsServiceType("HTTP");
OnmsMonitoredService svc = new OnmsMonitoredService(iface, svcType);
return svc;
}
use of org.opennms.netmgt.model.OnmsServiceType in project opennms by OpenNMS.
the class PollerTest method getMonitoredService.
private OnmsMonitoredService getMonitoredService() {
OnmsNode node = new OnmsNode();
OnmsMonitoringLocation location = new OnmsMonitoringLocation();
location.setLocationName("MINION");
node.setId(1);
node.setLocation(location);
OnmsIpInterface iface = new OnmsIpInterface("192.168.1.1", node);
OnmsServiceType svcType = new OnmsServiceType("HTTP");
OnmsMonitoredService svc = new OnmsMonitoredService(iface, svcType);
return svc;
}
use of org.opennms.netmgt.model.OnmsServiceType in project opennms by OpenNMS.
the class HttpCollectorIT method getServiceType.
private OnmsServiceType getServiceType(String name) {
OnmsServiceType serviceType = m_serviceTypeDao.findByName(name);
if (serviceType == null) {
serviceType = new OnmsServiceType(name);
m_serviceTypeDao.save(serviceType);
m_serviceTypeDao.flush();
}
return serviceType;
}
Aggregations