/** * Tests if the receiving faults table is correctly updated when a sending fault with an error code is reported. */ public void testReportSendingFault() { EndpointView endpointView = createMockEndPointView(0); endpointView.reportSendingFault(100); Assert.assertEquals("Sending fault table not updated with new entry", 1, endpointView.getSendingFaultTable().get(100).longValue()); endpointView.reportSendingFault(100); Assert.assertEquals("Receiving fault table not updated", 2, endpointView.getSendingFaultTable().get(100).longValue()); }
/** * Tests if the sending faults table and the sending fault counts are correctly updated when * 'incrementFaultsSending' is called. */ public void testIncrementFaultsSending() { EndpointView endpointView = createMockEndPointView(0); endpointView.incrementFaultsSending(100); Assert.assertEquals("Sending fault count not incremented", 1, endpointView.getFaultsSending()); Assert.assertEquals("Sending fault table not updated", 1, endpointView.getSendingFaultTable().get(100).longValue()); endpointView.incrementFaultsSending(100); Assert.assertEquals("Sending fault count not incremented", 2, endpointView.getFaultsSending()); Assert.assertEquals("Sending fault table not updated", 2, endpointView.getSendingFaultTable().get(100).longValue()); }
/** * A Map of send faults with the error code and count * @return a Map of send faults */ public Map<Integer, Long> getSendingFaultTable() { if (endpoint.getChildren() != null) { Map<Integer, Long> sendingFaultTable = new HashMap<Integer, Long>(); for (Endpoint e : endpoint.getChildren()) { if (e.getMetricsMBean() != null) { addTableMaps(sendingFaultTable, e.getMetricsMBean().getSendingFaultTable()); } } addTableMaps(sendingFaultTable, this.sendingFaultTable); return sendingFaultTable; } else { return sendingFaultTable; } }
/** * A Map of send faults with the error code and count * @return a Map of send faults */ public Map<Integer, Long> getSendingFaultTable() { if (endpoint.getChildren() != null) { Map<Integer, Long> sendingFaultTable = new HashMap<Integer, Long>(); for (Endpoint e : endpoint.getChildren()) { if (e.getMetricsMBean() != null) { addTableMaps(sendingFaultTable, e.getMetricsMBean().getSendingFaultTable()); } } addTableMaps(sendingFaultTable, this.sendingFaultTable); return sendingFaultTable; } else { return sendingFaultTable; } }
/** * Method to assert reset statistics of an endpoint view. * * @param endpointView the endpoint view of which statistics should be asserted */ private void assertResetStatistics(EndpointView endpointView) { Assert.assertEquals("message receive count not reset", 0, endpointView.getMessagesReceived()); Assert.assertEquals("Faults receive count not reset", 0, endpointView.getFaultsReceiving()); Assert.assertEquals("Receive timeout count not reset", 0, endpointView.getTimeoutsReceiving()); Assert.assertEquals("Bytes received not reset", 0, endpointView.getBytesReceived()); Assert.assertEquals("Min message size received not reset", 0, endpointView.getMinSizeReceived()); Assert.assertEquals("Max message size received not reset", 0, endpointView.getMaxSizeReceived()); Assert.assertEquals("Average message size received not reset", 0.0, endpointView.getAvgSizeReceived()); Assert.assertEquals("Receiving fault table not cleared", 0, endpointView.getReceivingFaultTable().size()); Assert.assertEquals("Message sent count not reset", 0, endpointView.getMessagesSent()); Assert.assertEquals("Faults sent count not reset", 0, endpointView.getFaultsSending()); Assert.assertEquals("Sending timeout count not reset", 0, endpointView.getTimeoutsSending()); Assert.assertEquals("Bytes send not reset", 0, endpointView.getBytesSent()); Assert.assertEquals("Min message size sent not reset", 0, endpointView.getMinSizeSent()); Assert.assertEquals("Max message size sent not reset", 0, endpointView.getMaxSizeSent()); Assert.assertEquals("Average message size setn not reset", 0.0, endpointView.getAvgSizeSent()); Assert.assertEquals("Sending failut table not cleared", 0, endpointView.getSendingFaultTable().size()); Assert.assertEquals("Response code table not cleared", 0, endpointView.getResponseCodeTable().size()); }