@Test public void testLoadSimpleGraph() throws Exception { assertEquals(8, m_topologyProvider.getVertices().size()); assertEquals(8, m_topologyProvider.getEdges().size()); Vertex v1 = m_topologyProvider.getVertex("nodes", "1"); Vertex v2 = m_topologyProvider.getVertex("nodes", "2"); Vertex v3 = m_topologyProvider.getVertex("nodes", "3"); Vertex v4 = m_topologyProvider.getVertex("nodes", "4"); Vertex v5 = m_topologyProvider.getVertex("nodes", "5"); Vertex v6 = m_topologyProvider.getVertex("nodes", "6"); assertEquals("node1", v1.getLabel()); assertEquals("192.168.1.1", v1.getIpAddress()); assertEquals(false, v1.isLocked()); assertEquals((Object)new Integer(1), (Object)v1.getNodeID()); assertEquals(false, v1.isSelected()); assertEquals((Object)new Integer(0), (Object)v1.getX()); assertEquals((Object)new Integer(0), (Object)v1.getY()); assertEquals(0, m_topologyProvider.getSemanticZoomLevel(v1)); assertEquals(0, m_topologyProvider.getSemanticZoomLevel(v2)); assertEquals(0, m_topologyProvider.getSemanticZoomLevel(v3)); assertEquals(0, m_topologyProvider.getSemanticZoomLevel(v4)); assertEquals(0, m_topologyProvider.getSemanticZoomLevel(v5)); assertEquals(0, m_topologyProvider.getSemanticZoomLevel(v6)); assertEquals(2, m_topologyProvider.getEdgeIdsForVertex(v1).length); assertEquals(2, m_topologyProvider.getEdgeIdsForVertex(v2).length); assertEquals(2, m_topologyProvider.getEdgeIdsForVertex(v3).length); assertEquals(2, m_topologyProvider.getEdgeIdsForVertex(v4).length); assertEquals(2, m_topologyProvider.getEdgeIdsForVertex(v5).length); assertEquals(2, m_topologyProvider.getEdgeIdsForVertex(v6).length); for (Vertex vertex : m_topologyProvider.getVertices()) { assertEquals("nodes", vertex.getNamespace()); } for (Edge edge : m_topologyProvider.getEdges()) { assertEquals("nodes", edge.getNamespace()); } }
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; }