/** * Create an instance of {@link EuiLevel } * */ public EuiLevel createEuiLevel() { return new EuiLevel(); }
public AvailabilityNode(final Node node) { m_nodeId = node.getNodeid(); m_availability = node.getNodevalue(); m_serviceCount = node.getNodesvccount(); m_serviceDownCount = node.getNodesvcdowncount(); }
/** * Constructor */ public LegacyEuiLevelMapper(DataManager dataMgr) { m_dataMgr = dataMgr; m_header = new Header(); m_header.setVer("1.9a"); m_header.setMstation(""); }
@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()); }
/** * 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 List<Node> getNode() { return m_rtcCategory.getNode(); }
/** * Return the current service level availability for this category. * * @return a double. */ @XmlElement(name="availability") public double getValue() { if (m_rtcCategory == null) { return 0.0; } else { return m_rtcCategory.getCatvalue(); } }
/** * Create an instance of {@link Category } * */ public Category createCategory() { return new Category(); }
/** * Create an instance of {@link Header } * */ public Header createHeader() { return new Header(); }
/** * 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 }; } }
public List<Node> getNode() { return m_rtcCategory.getNode(); }
/** * Return the current service level availability for this category. * * @return a double. */ @XmlElement(name="availability") public double getValue() { if (m_rtcCategory == null) { return 0.0; } else { return m_rtcCategory.getCatvalue(); } }
public NodeList getNodes() { if (m_rtcCategory != null) { return NodeList.forNodes(m_rtcCategory.getNode()); } return new NodeList(); }
public NodeList getNodes() { if (m_rtcCategory != null) { return NodeList.forNodes(m_rtcCategory.getNode()); } return new NodeList(); }