/** * Create an instance of {@link Node } * */ public Node createNode() { return new Node(); }
public AvailabilityNode(final Node node) { m_nodeId = node.getNodeid(); m_availability = node.getNodevalue(); m_serviceCount = node.getNodesvccount(); m_serviceDownCount = node.getNodesvcdowncount(); }
/** * Convenience method to count the number of services under a category and * the number of those services that are currently down. * * @param category a {@link org.opennms.netmgt.xml.rtc.Category} object. * @return an array of long. */ protected static long[] getServiceCounts(final org.opennms.netmgt.xml.rtc.Category category) { if (category == null) { throw new IllegalArgumentException("Cannot take null parameters."); } long count = 0; long downCount = 0; for (Node node : category.getNode()) { count += node.getNodesvccount(); downCount += node.getNodesvcdowncount(); } return new long[] { count, downCount }; } }
Node levelNode = new Node(); levelNode.setNodeid(nodeID); levelNode.setNodevalue(m_dataMgr.getValue(nodeID, rtcCat, curTime, rWindow)); levelNode.setNodesvccount(m_dataMgr.getServiceCount(nodeID, rtcCat)); levelNode.setNodesvcdowncount(m_dataMgr.getServiceDownCount(nodeID, rtcCat));
@Test public void categoryIsFullyAvailableWhenNoServicesArePresent() throws Exception { final RTCCategory rtcCat = EasyMock.createNiceMock(RTCCategory.class); EasyMock.expect(rtcCat.getLabel()).andReturn("Routers"); // This nodeid should not exist in the database EasyMock.expect(rtcCat.getNodes()).andReturn(Lists.newArrayList(99999)); EasyMock.replay(rtcCat); final EuiLevel euiLevel = m_availabilityService.getEuiLevel(rtcCat); assertEquals(1, euiLevel.getCategory().size()); final Category category = euiLevel.getCategory().get(0); assertEquals(100.0, category.getCatvalue(), 0.001); assertEquals(1, category.getNode().size()); final Node node = category.getNode().get(0); assertEquals(100.0, node.getNodevalue(), 0.001); assertEquals(0, node.getNodesvccount()); assertEquals(0, node.getNodesvcdowncount()); }
assertEquals(4, category.getNode().get(0).getNodesvccount()); assertEquals(2, category.getNode().get(1).getNodesvccount());
@XmlElementWrapper(name="nodes") @XmlElement(name="node") public List<Long> getNodeIds() { final List<Long> nodeIds = new ArrayList<>(); if (m_rtcCategory != null) { for (final Node node : m_rtcCategory.getNode()) { nodeIds.add(node.getNodeid()); } } return nodeIds; }
.count(); final Node levelNode = new Node(); levelNode.setNodeid(nodeId); levelNode.setNodevalue(RTCUtils.getOutagePercentage(outageTime, rWindow, numServices)); levelNode.setNodesvccount(numServices); levelNode.setNodesvcdowncount(numServicesDown);
/** * Convenience method to count the number of services under a category and * the number of those services that are currently down. * * @param category a {@link org.opennms.netmgt.xml.rtc.Category} object. * @return an array of long. */ protected static long[] getServiceCounts(final org.opennms.netmgt.xml.rtc.Category category) { if (category == null) { throw new IllegalArgumentException("Cannot take null parameters."); } long count = 0; long downCount = 0; for (Node node : category.getNode()) { count += node.getNodesvccount(); downCount += node.getNodesvcdowncount(); } return new long[] { count, downCount }; } }
@XmlElementWrapper(name="nodes") @XmlElement(name="node") public List<Long> getNodeIds() { final List<Long> nodeIds = new ArrayList<>(); if (m_rtcCategory != null) { for (final Node node : m_rtcCategory.getNode()) { nodeIds.add(node.getNodeid()); } } return nodeIds; }
public AvailabilityNode(final Node node) { m_nodeId = node.getNodeid(); m_availability = node.getNodevalue(); m_serviceCount = node.getNodesvccount(); m_serviceDownCount = node.getNodesvcdowncount(); }
public AvailabilityNode getNode(final Long nodeId) { if (m_rtcCategory != null) { for (final Node node : m_rtcCategory.getNode()) { if (node.getNodeid() == nodeId) { return new AvailabilityNode(node); } } } return null; }
public AvailabilityNode getNode(final Long nodeId) { if (m_rtcCategory != null) { for (final Node node : m_rtcCategory.getNode()) { if (node.getNodeid() == nodeId) { return new AvailabilityNode(node); } } } return null; }