/** * 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(); } }
/** * 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(); } }
@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(100.0, category.getCatvalue(), 0.001); assertEquals(2, category.getNode().size()); assertEquals(RTCUtils.getOutagePercentage(1800000, 86400000, 6), category.getCatvalue(), 0.0001); assertEquals(2, category.getNode().size());