@Override public void reconcileOspf(int nodeId, Date now) { OspfElement element = m_ospfElementDao.findByNodeId(nodeId); if (element != null && element.getOspfNodeLastPollTime().getTime() < now.getTime()) { m_ospfElementDao.delete(element); m_ospfElementDao.flush(); } m_ospfLinkDao.deleteByNodeIdOlderThen(nodeId, now); m_ospfLinkDao.flush(); }
@Override public List<OspfLinkNode> getOspfLinks(int nodeId) { List<OspfLinkNode> nodelinks = new ArrayList<OspfLinkNode>(); for (OspfLink link : m_ospfLinkDao.findByNodeId(Integer.valueOf(nodeId))) { nodelinks.add(convertFromModel(nodeId, link)); } return nodelinks; }
@Test public void testGetOspfLinkStatusDown() { EasyMock.expect( m_alarmDao.findMatching(EasyMock.anyObject(org.opennms.core.criteria.Criteria.class))) .andReturn(createDownAlarm()); EasyMock.expect( m_ospfLinkDao.findMatching(EasyMock.<org.opennms.core.criteria.Criteria>anyObject())) .andReturn(createOspfLinks()); EasyMock.replay(m_alarmDao, m_ospfLinkDao); List<EdgeRef> edges = createEdges(); Map<EdgeRef, Status> statusMap = m_statusProvider.getStatusForEdges(m_edgeProvider, edges, new Criteria[0]); assertEquals(1, statusMap.size()); assertEquals(edges.get(0), new ArrayList<EdgeRef>(statusMap.keySet()).get(0)); Status status = statusMap.get(edges.get(0)); assertEquals("down", status.computeStatus()); }