Search in sources :

Example 16 with OnmsServiceType

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();
}
Also used : MockNotifdConfigManager(org.opennms.netmgt.config.mock.MockNotifdConfigManager) OnmsNode(org.opennms.netmgt.model.OnmsNode) OnmsIpInterface(org.opennms.netmgt.model.OnmsIpInterface) OnmsCategory(org.opennms.netmgt.model.OnmsCategory) OnmsServiceType(org.opennms.netmgt.model.OnmsServiceType) JdbcFilterDao(org.opennms.netmgt.filter.JdbcFilterDao) OnmsMonitoredService(org.opennms.netmgt.model.OnmsMonitoredService) Before(org.junit.Before)

Example 17 with OnmsServiceType

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);
}
Also used : OnmsServiceType(org.opennms.netmgt.model.OnmsServiceType) Test(org.junit.Test)

Example 18 with OnmsServiceType

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;
}
Also used : OnmsNode(org.opennms.netmgt.model.OnmsNode) OnmsIpInterface(org.opennms.netmgt.model.OnmsIpInterface) OnmsServiceType(org.opennms.netmgt.model.OnmsServiceType) OnmsMonitoringLocation(org.opennms.netmgt.model.monitoringLocations.OnmsMonitoringLocation) OnmsMonitoredService(org.opennms.netmgt.model.OnmsMonitoredService)

Example 19 with OnmsServiceType

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;
}
Also used : OnmsNode(org.opennms.netmgt.model.OnmsNode) OnmsIpInterface(org.opennms.netmgt.model.OnmsIpInterface) OnmsServiceType(org.opennms.netmgt.model.OnmsServiceType) OnmsMonitoringLocation(org.opennms.netmgt.model.monitoringLocations.OnmsMonitoringLocation) OnmsMonitoredService(org.opennms.netmgt.model.OnmsMonitoredService)

Example 20 with OnmsServiceType

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;
}
Also used : OnmsServiceType(org.opennms.netmgt.model.OnmsServiceType)

Aggregations

OnmsServiceType (org.opennms.netmgt.model.OnmsServiceType)34 OnmsIpInterface (org.opennms.netmgt.model.OnmsIpInterface)19 OnmsNode (org.opennms.netmgt.model.OnmsNode)17 OnmsMonitoredService (org.opennms.netmgt.model.OnmsMonitoredService)16 Date (java.util.Date)7 Test (org.junit.Test)7 OnmsMonitoringLocation (org.opennms.netmgt.model.monitoringLocations.OnmsMonitoringLocation)6 NetworkBuilder (org.opennms.netmgt.model.NetworkBuilder)4 OnmsOutage (org.opennms.netmgt.model.OnmsOutage)4 OnmsSnmpInterface (org.opennms.netmgt.model.OnmsSnmpInterface)4 Transactional (org.springframework.transaction.annotation.Transactional)4 File (java.io.File)3 ArrayList (java.util.ArrayList)3 Before (org.junit.Before)3 MockEventIpcManager (org.opennms.netmgt.dao.mock.MockEventIpcManager)3 MockPersisterFactory (org.opennms.netmgt.mock.MockPersisterFactory)3 ServiceSelector (org.opennms.netmgt.model.ServiceSelector)3 Properties (java.util.Properties)2 InsufficientInformationException (org.opennms.core.utils.InsufficientInformationException)2 DefaultServiceCollectorRegistry (org.opennms.netmgt.collection.support.DefaultServiceCollectorRegistry)2