@Test public void testMultipleConnections() throws Exception { doInit(3); sendRequest(1, 1); // request 1 connection 1 sendRequest(2, 2); // request 1 connection 2 sendRequest(3, 3); // request 1 connection 3 sendRequest(2, 3); // request 2 connection 2 sendRequest(3, 3); // request 2 connection 3 sendRequest(3, 3); // request 3 connection 3 doClose(3); assertEquals(3, _statistics.getConnections()); assertEquals(0, _statistics.getConnectionsOpen()); assertEquals(3, _statistics.getConnectionsOpenMax()); assertTrue(_statistics.getConnectionsOpen() <= _statistics.getConnectionsOpenMax()); assertTrue(_statistics.getConnectionsDurationMean() > 0); assertTrue(_statistics.getConnectionsDurationMax() > 0); assertTrue(_statistics.getConnectionsDurationMean() <= _statistics.getConnectionsDurationMax()); assertEquals(6, _statistics.getMessagesIn()); assertEquals(2.0, _statistics.getConnectionsMessagesInMean(), 0.01); assertEquals(3, _statistics.getConnectionsMessagesInMax()); assertTrue( _statistics.getConnectionsMessagesInMean() <= _statistics.getConnectionsMessagesInMax()); }
@Test public void testMultipleRequests() throws Exception { doInit(1); sendRequest(1, 1); sendRequest(1, 1); doClose(1); assertEquals(1, _statistics.getConnections()); assertEquals(0, _statistics.getConnectionsOpen()); assertEquals(1, _statistics.getConnectionsOpenMax()); assertTrue(_statistics.getConnectionsOpen() <= _statistics.getConnectionsOpenMax()); assertTrue(_statistics.getConnectionsDurationMean() > 0); assertTrue(_statistics.getConnectionsDurationMax() > 0); assertTrue(_statistics.getConnectionsDurationMean() <= _statistics.getConnectionsDurationMax()); assertEquals(2, _statistics.getMessagesIn()); assertEquals(2.0, _statistics.getConnectionsMessagesInMean(), 0.01); assertEquals(2, _statistics.getConnectionsMessagesInMax()); assertTrue( _statistics.getConnectionsMessagesInMean() <= _statistics.getConnectionsMessagesInMax()); }