/** * 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 }; } }
/** * 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 }; } }
public AvailabilityNode(final Node node) { m_nodeId = node.getNodeid(); m_availability = node.getNodevalue(); m_serviceCount = node.getNodesvccount(); m_serviceDownCount = node.getNodesvcdowncount(); }
public AvailabilityNode(final Node node) { m_nodeId = node.getNodeid(); m_availability = node.getNodevalue(); m_serviceCount = node.getNodesvccount(); m_serviceDownCount = node.getNodesvcdowncount(); }
@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());