/** * Test method for {@link Monitor#getServiceInfo()}. * * @throws ConnectionException */ @Test public final void testGetServiceInfo1() throws ConnectionException { final Monitor conn = new Monitor(scalarisNode); try { final GetServiceInfoResult serviceInfo = conn.getServiceInfo(); assertTrue(serviceInfo.nodes >= 0); assertTrue(serviceInfo.totalLoad >= 0); } finally { conn.closeConnection(); } }
/** * Test method for {@link Monitor#getNodeInfo()}. * * @throws ConnectionException */ @Test public final void testGetNodeInfo1() throws ConnectionException { final Monitor conn = new Monitor(scalarisNode); try { final GetNodeInfoResult nodeInfo = conn.getNodeInfo(); assertTrue(nodeInfo.dhtNodes >= 0); assertTrue(!nodeInfo.scalarisVersion.isEmpty()); assertTrue(!nodeInfo.erlangVersion.isEmpty()); } finally { conn.closeConnection(); } }
/** * Test method for {@link Monitor#getServicePerformance()}. * * @throws ConnectionException */ @Test public final void testGetServicePerformance1() throws ConnectionException { final Monitor conn = new Monitor(scalarisNode); try { final GetServicePerformanceResult nodePerformance = conn.getServicePerformance(); for (final Entry<Long, Double> latencyAvg : nodePerformance.latencyAvg.entrySet()) { assertTrue(latencyAvg.toString(), latencyAvg.getKey() >= 0); assertTrue(latencyAvg.toString(), latencyAvg.getValue() >= 0); } for (final Entry<Long, Double> latencyStddev : nodePerformance.latencyStddev.entrySet()) { assertTrue(latencyStddev.toString(), latencyStddev.getKey() >= 0); assertTrue(latencyStddev.toString(), latencyStddev.getValue() >= 0); } } finally { conn.closeConnection(); } }
/** * Test method for {@link Monitor#getNodeInfo()} with a closed connection. * * @throws ConnectionException */ @Test(expected = ConnectionException.class) public final void testGetNodeInfo_NotConnected() throws ConnectionException { final Monitor conn = new Monitor(scalarisNode); conn.closeConnection(); conn.getNodeInfo(); }
/** * Test method for {@link Monitor#closeConnection()} trying to close the connection twice. * * @throws ConnectionException */ @Test public void testDoubleClose() throws ConnectionException { final Monitor conn = new Monitor(scalarisNode); conn.closeConnection(); conn.closeConnection(); }
/** * Test method for {@link Monitor#getServicePerformance()} with a closed connection. * * @throws ConnectionException */ @Test(expected = ConnectionException.class) public final void testGetServicePerformance_NotConnected() throws ConnectionException { final Monitor conn = new Monitor(scalarisNode); conn.closeConnection(); conn.getServicePerformance(); }