@Test public void testConnectVertices() { m_topologyProvider.resetContainer(); Vertex vertexId = m_topologyProvider.addVertex(0, 0); assertEquals(1, m_topologyProvider.getVertices().size()); Vertex vertex0 = m_topologyProvider.getVertices().iterator().next(); assertEquals("v0", vertex0.getId()); Vertex vertex1 = m_topologyProvider.addVertex(0, 0); assertEquals(2, m_topologyProvider.getVertices().size()); Edge edgeId = m_topologyProvider.connectVertices(vertex0, vertex1); assertEquals(1, m_topologyProvider.getEdges().size()); SimpleLeafVertex sourceLeafVert = (SimpleLeafVertex) edgeId.getSource().getVertex(); SimpleLeafVertex targetLeafVert = (SimpleLeafVertex) edgeId.getTarget().getVertex(); assertEquals("v0", sourceLeafVert.getId()); assertEquals("v1", targetLeafVert.getId()); EdgeRef[] edgeIds = m_topologyProvider.getEdgeIdsForVertex(vertexId); assertEquals(1, edgeIds.length); assertEquals(edgeId, edgeIds[0]); }
private AbstractVertex getVertex(OnmsNode onmsnode) { OnmsIpInterface ip = getAddress(onmsnode); AbstractVertex vertex = new SimpleLeafVertex(TOPOLOGY_NAMESPACE_LINKD, onmsnode.getNodeId(), 0, 0); vertex.setIconKey(getIconName(onmsnode)); vertex.setLabel(onmsnode.getLabel()); vertex.setIpAddress(ip == null ? null : ip.getIpAddress().getHostAddress()); vertex.setNodeID(Integer.parseInt(onmsnode.getNodeId())); vertex.setTooltipText(getNodeTooltipText(onmsnode, vertex, ip)); return vertex; }
LinkdTopologyProvider extends AbstractTopologyProvider implements GraphProvider { private AbstractVertex getVertex(OnmsNode onmsnode) { OnmsIpInterface ip = getAddress(onmsnode); AbstractVertex vertex = new SimpleLeafVertex(TOPOLOGY_NAMESPACE_LINKD, onmsnode.getNodeId(), 0, 0); vertex.setIconKey(getIconName(onmsnode)); vertex.setLabel(onmsnode.getLabel()); vertex.setIpAddress(ip == null ? null : ip.getIpAddress().getHostAddress()); vertex.setNodeID(Integer.parseInt(onmsnode.getNodeId())); vertex.setTooltipText(getNodeTooltipText(onmsnode, vertex, ip)); return vertex; } }
LinkdTopologyProvider extends AbstractTopologyProvider implements GraphProvider { private AbstractVertex getVertex(OnmsNode onmsnode) { OnmsIpInterface ip = getAddress(onmsnode); AbstractVertex vertex = new SimpleLeafVertex(TOPOLOGY_NAMESPACE_LINKD, onmsnode.getNodeId(), 0, 0); vertex.setIconKey(getIconName(onmsnode)); vertex.setLabel(onmsnode.getLabel()); vertex.setIpAddress(ip == null ? null : ip.getIpAddress().getHostAddress()); vertex.setNodeID(Integer.parseInt(onmsnode.getNodeId())); vertex.setTooltipText(getNodeTooltipText(onmsnode, vertex, ip)); return vertex; } LinkdTopologyProvider(); }
LinkdTopologyProvider extends AbstractTopologyProvider implements GraphProvider { private AbstractVertex getVertex(OnmsNode onmsnode) { OnmsIpInterface ip = getAddress(onmsnode); AbstractVertex vertex = new SimpleLeafVertex(TOPOLOGY_NAMESPACE_LINKD, onmsnode.getNodeId(), 0, 0); vertex.setIconKey(getIconName(onmsnode)); vertex.setLabel(onmsnode.getLabel()); vertex.setIpAddress(ip == null ? null : ip.getIpAddress().getHostAddress()); vertex.setNodeID(Integer.parseInt(onmsnode.getNodeId())); vertex.setTooltipText(getNodeTooltipText(onmsnode, vertex, ip)); return vertex; } LinkdTopologyProvider(); String getConfigurationFile(); void setConfigurationFile(String configurationFile); SnmpInterfaceDao getSnmpInterfaceDao(); void setSnmpInterfaceDao(SnmpInterfaceDao snmpInterfaceDao); NodeDao getNodeDao(); void setNodeDao(NodeDao nodeDao); boolean isAddNodeWithoutLink(); void setAddNodeWithoutLink(boolean addNodeWithoutLink); DataLinkInterfaceDao getDataLinkInterfaceDao(); void setDataLinkInterfaceDao(DataLinkInterfaceDao dataLinkInterfaceDao); void onInit(); @Override void refresh(); @Override void load(String filename); static String getIconName(OnmsNode node); @Override void save(); IpInterfaceDao getIpInterfaceDao(); void setIpInterfaceDao(IpInterfaceDao ipInterfaceDao); }
LinkdTopologyProvider extends AbstractTopologyProvider implements GraphProvider { private AbstractVertex getVertex(OnmsNode onmsnode) { OnmsIpInterface ip = getAddress(onmsnode); AbstractVertex vertex = new SimpleLeafVertex(TOPOLOGY_NAMESPACE_LINKD, onmsnode.getNodeId(), 0, 0); vertex.setIconKey(getIconName(onmsnode)); vertex.setLabel(onmsnode.getLabel()); vertex.setIpAddress(ip == null ? null : ip.getIpAddress().getHostAddress()); vertex.setNodeID(Integer.parseInt(onmsnode.getNodeId())); vertex.setTooltipText(getNodeTooltipText(onmsnode, vertex, ip)); return vertex; } LinkdTopologyProvider(); String getConfigurationFile(); void setConfigurationFile(String configurationFile); SnmpInterfaceDao getSnmpInterfaceDao(); void setSnmpInterfaceDao(SnmpInterfaceDao snmpInterfaceDao); NodeDao getNodeDao(); void setNodeDao(NodeDao nodeDao); boolean isAddNodeWithoutLink(); void setAddNodeWithoutLink(boolean addNodeWithoutLink); DataLinkInterfaceDao getDataLinkInterfaceDao(); void setDataLinkInterfaceDao(DataLinkInterfaceDao dataLinkInterfaceDao); void onInit(); @Override void refresh(); @Override void load(String filename); static String getIconName(OnmsNode node); @Override void save(); IpInterfaceDao getIpInterfaceDao(); void setIpInterfaceDao(IpInterfaceDao ipInterfaceDao); static final String TOPOLOGY_NAMESPACE_LINKD; static final String GROUP_ICON_KEY; static final String SERVER_ICON_KEY; }