use of org.opennms.features.topology.api.topo.EdgeRef in project opennms by OpenNMS.
the class LinkdEdgeStatusProviderTest method testGetLldpLinkStatusDown.
@Test
public void testGetLldpLinkStatusDown() {
EasyMock.expect(m_alarmDao.findMatching(EasyMock.anyObject(org.opennms.core.criteria.Criteria.class))).andReturn(createLldpDownAlarm()).anyTimes();
List<EdgeRef> edges = getEdgeRefs();
for (EdgeRef ref : edges) EasyMock.expect(m_edgeProvider.getEdge(ref)).andReturn(getEdgeFromRef(ref)).anyTimes();
EasyMock.replay(m_alarmDao, m_edgeProvider);
Map<EdgeRef, Status> statusMap = m_statusProvider.getStatusForEdges(m_edgeProvider, edges, new Criteria[0]);
assertEquals(8, statusMap.size());
assertEquals(edges.get(0), new ArrayList<EdgeRef>(statusMap.keySet()).get(0));
assertEquals(statusMap.get(edges.get(0)).computeStatus(), "up");
assertEquals(statusMap.get(edges.get(1)).computeStatus(), "up");
assertEquals(statusMap.get(edges.get(2)).computeStatus(), "up");
assertEquals(statusMap.get(edges.get(3)).computeStatus(), "up");
assertEquals(statusMap.get(edges.get(5)).computeStatus(), "up");
assertEquals(statusMap.get(edges.get(6)).computeStatus(), "up");
assertEquals(statusMap.get(edges.get(7)).computeStatus(), "up");
assertEquals(statusMap.get(edges.get(4)).computeStatus(), "down");
}
use of org.opennms.features.topology.api.topo.EdgeRef in project opennms by OpenNMS.
the class LinkdEdgeStatusProviderTest method testGetBridgeLinkStatusOneDown.
@Test
public void testGetBridgeLinkStatusOneDown() {
EasyMock.expect(m_alarmDao.findMatching(EasyMock.anyObject(org.opennms.core.criteria.Criteria.class))).andReturn(createBridgeDownAlarm()).anyTimes();
List<EdgeRef> edges = getEdgeRefs();
for (EdgeRef ref : edges) EasyMock.expect(m_edgeProvider.getEdge(ref)).andReturn(getEdgeFromRef(ref)).anyTimes();
EasyMock.replay(m_alarmDao, m_edgeProvider);
Map<EdgeRef, Status> statusMap = m_statusProvider.getStatusForEdges(m_edgeProvider, edges, new Criteria[0]);
assertEquals(8, statusMap.size());
assertEquals(edges.get(0), new ArrayList<EdgeRef>(statusMap.keySet()).get(0));
assertEquals(statusMap.get(edges.get(0)).computeStatus(), "up");
assertEquals(statusMap.get(edges.get(2)).computeStatus(), "up");
assertEquals(statusMap.get(edges.get(3)).computeStatus(), "up");
assertEquals(statusMap.get(edges.get(4)).computeStatus(), "up");
assertEquals(statusMap.get(edges.get(5)).computeStatus(), "up");
assertEquals(statusMap.get(edges.get(6)).computeStatus(), "up");
assertEquals(statusMap.get(edges.get(7)).computeStatus(), "up");
assertEquals(statusMap.get(edges.get(1)).computeStatus(), "down");
}
use of org.opennms.features.topology.api.topo.EdgeRef in project opennms by OpenNMS.
the class LinkdEdgeStatusProviderTest method testGetBridgeLinkStatusDesignatedCloudDown.
@Test
public void testGetBridgeLinkStatusDesignatedCloudDown() {
EasyMock.expect(m_alarmDao.findMatching(EasyMock.anyObject(org.opennms.core.criteria.Criteria.class))).andReturn(createCloudDownAlarm()).anyTimes();
List<EdgeRef> edges = getEdgeRefs();
for (EdgeRef ref : edges) EasyMock.expect(m_edgeProvider.getEdge(ref)).andReturn(getEdgeFromRef(ref)).anyTimes();
EasyMock.replay(m_alarmDao, m_edgeProvider);
Map<EdgeRef, Status> statusMap = m_statusProvider.getStatusForEdges(m_edgeProvider, edges, new Criteria[0]);
assertEquals(8, statusMap.size());
assertEquals(edges.get(0), new ArrayList<EdgeRef>(statusMap.keySet()).get(0));
assertEquals(statusMap.get(edges.get(1)).computeStatus(), "up");
assertEquals(statusMap.get(edges.get(2)).computeStatus(), "up");
assertEquals(statusMap.get(edges.get(3)).computeStatus(), "up");
assertEquals(statusMap.get(edges.get(4)).computeStatus(), "up");
assertEquals(statusMap.get(edges.get(5)).computeStatus(), "up");
assertEquals(statusMap.get(edges.get(6)).computeStatus(), "up");
assertEquals(statusMap.get(edges.get(7)).computeStatus(), "up");
assertEquals(statusMap.get(edges.get(0)).computeStatus(), "down");
}
use of org.opennms.features.topology.api.topo.EdgeRef in project opennms by OpenNMS.
the class LinkdEdgeStatusProviderTest method testSPC944OspfLinkStatus.
@Test
public void testSPC944OspfLinkStatus() {
EasyMock.expect(m_alarmDao.findMatching(EasyMock.anyObject(org.opennms.core.criteria.Criteria.class))).andReturn(createChennaiDownAlarm()).anyTimes();
List<EdgeRef> edges = getEdgeRefs();
for (EdgeRef ref : edges) EasyMock.expect(m_edgeProvider.getEdge(ref)).andReturn(getEdgeFromRef(ref)).anyTimes();
EasyMock.replay(m_alarmDao, m_edgeProvider);
Map<EdgeRef, Status> statusMap = m_statusProvider.getStatusForEdges(m_edgeProvider, edges, new Criteria[0]);
assertEquals(8, statusMap.size());
assertEquals(edges.get(0), new ArrayList<EdgeRef>(statusMap.keySet()).get(0));
assertEquals(statusMap.get(edges.get(0)).computeStatus(), "up");
assertEquals(statusMap.get(edges.get(1)).computeStatus(), "up");
assertEquals(statusMap.get(edges.get(2)).computeStatus(), "up");
assertEquals(statusMap.get(edges.get(3)).computeStatus(), "up");
assertEquals(statusMap.get(edges.get(4)).computeStatus(), "up");
assertEquals(statusMap.get(edges.get(5)).computeStatus(), "up");
assertEquals(statusMap.get(edges.get(6)).computeStatus(), "up");
assertEquals(statusMap.get(edges.get(7)).computeStatus(), "down");
}
use of org.opennms.features.topology.api.topo.EdgeRef in project opennms by OpenNMS.
the class VEProviderGraphContainer method unselectElementsWhichAreNotVisibleAnymore.
// we have to find out if each selected vertex/edge is still displayable, if not we deselect it.
private static void unselectElementsWhichAreNotVisibleAnymore(Graph graph, SelectionManager selectionManager) {
if (selectionManager == null)
return;
List<VertexRef> selectedVertexRefs = new ArrayList<>(selectionManager.getSelectedVertexRefs());
List<VertexRef> newSelectedVertexRefs = new ArrayList<>();
for (VertexRef eachSelectedVertex : selectedVertexRefs) {
for (Vertex eachDisplayableVertex : graph.getDisplayVertices()) {
if (eachDisplayableVertex.getNamespace().equals(eachSelectedVertex.getNamespace()) && eachDisplayableVertex.getId().equals(eachSelectedVertex.getId())) {
newSelectedVertexRefs.add(eachSelectedVertex);
break;
}
}
}
List<EdgeRef> selectedEdgeRefs = new ArrayList<>(selectionManager.getSelectedEdgeRefs());
List<EdgeRef> newSelectedEdgeRefs = new ArrayList<>();
for (EdgeRef eachSelectedEdgeRef : selectedEdgeRefs) {
for (Edge eachDisplayableEdge : graph.getDisplayEdges()) {
if (eachDisplayableEdge.getNamespace().equals(eachSelectedEdgeRef.getNamespace()) && eachDisplayableEdge.getId().equals(eachSelectedEdgeRef.getId())) {
newSelectedEdgeRefs.add(eachSelectedEdgeRef);
break;
}
}
}
// if the selection changed, inform selectionManager
if (!newSelectedVertexRefs.equals(selectedVertexRefs)) {
selectionManager.setSelectedVertexRefs(newSelectedVertexRefs);
}
if (!newSelectedEdgeRefs.equals(selectedEdgeRefs)) {
selectionManager.setSelectedEdgeRefs(newSelectedEdgeRefs);
}
}
Aggregations