コード例 #1
0
  @Test
  @Transactional
  public void testLazy() {
    final List<OnmsMonitoredService> allSvcs = m_monitoredServiceDao.findAll();
    assertTrue(allSvcs.size() > 1);

    final OnmsMonitoredService svc = allSvcs.iterator().next();
    assertEquals(addr("192.168.1.1"), svc.getIpAddress());
    assertEquals(1, svc.getIfIndex().intValue());
    assertEquals(m_databasePopulator.getNode1().getId(), svc.getIpInterface().getNode().getId());
    assertEquals("M", svc.getIpInterface().getIsManaged());
  }
コード例 #2
0
  /** {@inheritDoc} */
  public void poll(OnmsMonitoredService monSvc, int pollResultId) {

    EventBuilder bldr =
        new EventBuilder(EventConstants.DEMAND_POLL_SERVICE_EVENT_UEI, "PollerService");

    bldr.setNodeid(monSvc.getNodeId());
    bldr.setInterface(monSvc.getIpAddress());
    bldr.setIfIndex(monSvc.getIfIndex());
    bldr.setService(monSvc.getServiceType().getName());

    bldr.addParam(EventConstants.PARM_DEMAND_POLL_ID, pollResultId);

    sendEvent(bldr.getEvent());
  }
コード例 #3
0
  @Test
  @Transactional
  public void testGetByCompositeId() {
    final OnmsMonitoredService monSvc =
        m_monitoredServiceDao.get(
            m_databasePopulator.getNode1().getId(), addr("192.168.1.1"), "SNMP");
    assertNotNull(monSvc);

    final OnmsMonitoredService monSvc2 =
        m_monitoredServiceDao.get(
            m_databasePopulator.getNode1().getId(),
            addr("192.168.1.1"),
            monSvc.getIfIndex(),
            monSvc.getServiceId());
    assertNotNull(monSvc2);
  }