From 0e96a636c825288987e07212aa556197e0fb43f6 Mon Sep 17 00:00:00 2001 From: Keith Wall Date: Wed, 29 Aug 2012 21:53:02 +0000 Subject: QPID-4143 now producing test-summary.csv to make viewing all the 'all participants' test results more convenient. Re-ordered columns so that the important stuff appears first. Applied patch from Philip Harvey git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1378751 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/qpid/disttest/ConfigFileHelper.java | 11 -- .../org/apache/qpid/disttest/ControllerRunner.java | 59 +++------ .../apache/qpid/disttest/ResultsFileWriter.java | 112 ++++++++++++++++ .../disttest/controller/ResultsForAllTests.java | 21 +++ .../disttest/message/ParticipantAttribute.java | 39 +++++- .../disttest/results/aggregation/ITestResult.java | 2 - .../results/aggregation/TestResultAggregator.java | 23 ++++ .../disttest/results/formatting/CSVFormater.java | 89 ------------- .../disttest/results/formatting/CSVFormatter.java | 91 +++++++++++++ .../apache/qpid/disttest/ConfigFileHelperTest.java | 8 -- .../qpid/disttest/ResultsFileWriterTest.java | 86 ++++++++++++ .../aggregation/TestResultAggregatorTest.java | 35 ++++- .../results/formatting/CSVFormaterTest.java | 146 --------------------- .../results/formatting/CSVFormatterTest.java | 145 ++++++++++++++++++++ .../disttest/results/formatting/expectedOutput.csv | 4 +- .../systest/disttest/endtoend/EndToEndTest.java | 8 +- 16 files changed, 574 insertions(+), 305 deletions(-) create mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/ResultsFileWriter.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/formatting/CSVFormater.java create mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/formatting/CSVFormatter.java create mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/ResultsFileWriterTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/formatting/CSVFormaterTest.java create mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/formatting/CSVFormatterTest.java (limited to 'qpid/java') diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/ConfigFileHelper.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/ConfigFileHelper.java index fb4c1b700b..ee374e180d 100644 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/ConfigFileHelper.java +++ b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/ConfigFileHelper.java @@ -60,15 +60,4 @@ public class ConfigFileHelper return testConfigFile; } - - /** - * generateOutputCsvNameFrom("/config/testConfigFile.js", "/output") returns /output/testConfigFile.csv - */ - public String generateOutputCsvNameFrom(String testConfigFile, String outputDir) - { - final String filenameOnlyWithExtension = new File(testConfigFile).getName(); - final String cvsFile = filenameOnlyWithExtension.replaceFirst(".?\\w*$", ".csv"); - - return new File(outputDir, cvsFile).getAbsolutePath(); - } } diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/ControllerRunner.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/ControllerRunner.java index aea0ea301a..a0e949bddc 100644 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/ControllerRunner.java +++ b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/ControllerRunner.java @@ -19,9 +19,9 @@ */ package org.apache.qpid.disttest; +import java.io.File; import java.io.FileNotFoundException; -import java.io.FileWriter; -import java.io.IOException; +import java.util.ArrayList; import java.util.List; import javax.naming.Context; @@ -32,7 +32,6 @@ import org.apache.qpid.disttest.controller.config.Config; import org.apache.qpid.disttest.controller.config.ConfigReader; import org.apache.qpid.disttest.jms.ControllerJmsDelegate; import org.apache.qpid.disttest.results.aggregation.Aggregator; -import org.apache.qpid.disttest.results.formatting.CSVFormater; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -52,6 +51,8 @@ public class ControllerRunner extends AbstractRunner private final ConfigFileHelper _configFileHelper = new ConfigFileHelper(); + private ResultsFileWriter _resuResultsFileWriter; + public ControllerRunner() { getCliOptions().put(TEST_CONFIG_PROP, TEST_CONFIG_DEFAULT); @@ -69,6 +70,7 @@ public class ControllerRunner extends AbstractRunner public void runController() throws Exception { Context context = getContext(); + setUpResultsWriter(); ControllerJmsDelegate jmsDelegate = new ControllerJmsDelegate(context); @@ -82,6 +84,13 @@ public class ControllerRunner extends AbstractRunner } } + void setUpResultsWriter() + { + String outputDirString = getCliOptions().get(ControllerRunner.OUTPUT_DIR_PROP); + File outputDir = new File(outputDirString); + _resuResultsFileWriter = new ResultsFileWriter(outputDir); + } + private void runTests(ControllerJmsDelegate jmsDelegate) { Controller controller = new Controller(jmsDelegate, DistributedTestConstants.REGISTRATION_TIMEOUT, DistributedTestConstants.COMMAND_RESPONSE_TIMEOUT); @@ -92,6 +101,8 @@ public class ControllerRunner extends AbstractRunner try { + List results = new ArrayList(); + for (String testConfigFile : testConfigFiles) { final Config testConfig = buildTestConfigFrom(testConfigFile); @@ -100,8 +111,11 @@ public class ControllerRunner extends AbstractRunner controller.awaitClientRegistrations(); LOGGER.info("Running test : " + testConfigFile); - runTest(controller, testConfigFile); + ResultsForAllTests testResult = runTest(controller, testConfigFile); + results.add(testResult); } + + _resuResultsFileWriter.writeResultsSummary(results); } catch(Exception e) { @@ -113,7 +127,7 @@ public class ControllerRunner extends AbstractRunner } } - private void runTest(Controller controller, String testConfigFile) + private ResultsForAllTests runTest(Controller controller, String testConfigFile) { final Config testConfig = buildTestConfigFrom(testConfigFile); controller.setConfig(testConfig); @@ -121,9 +135,8 @@ public class ControllerRunner extends AbstractRunner ResultsForAllTests rawResultsForAllTests = controller.runAllTests(); ResultsForAllTests resultsForAllTests = _aggregator.aggregateResults(rawResultsForAllTests); - String outputDir = getCliOptions().get(ControllerRunner.OUTPUT_DIR_PROP); - final String outputFile = _configFileHelper.generateOutputCsvNameFrom(testConfigFile, outputDir); - writeResultsToFile(resultsForAllTests, outputFile); + _resuResultsFileWriter.writeResultsToFile(resultsForAllTests, testConfigFile); + return resultsForAllTests; } private void createClientsIfNotDistributed(final List testConfigFiles) @@ -148,36 +161,6 @@ public class ControllerRunner extends AbstractRunner } } - private void writeResultsToFile(ResultsForAllTests resultsForAllTests, String outputFile) - { - FileWriter writer = null; - try - { - final String outputCsv = new CSVFormater().format(resultsForAllTests); - writer = new FileWriter(outputFile); - writer.write(outputCsv); - LOGGER.info("Wrote " + resultsForAllTests.getTestResults().size() + " test result(s) to output file " + outputFile); - } - catch (IOException e) - { - throw new DistributedTestException("Unable to write output file " + outputFile, e); - } - finally - { - if (writer != null) - { - try - { - writer.close(); - } - catch (IOException e) - { - LOGGER.error("Failed to close stream for file " + outputFile, e); - } - } - } - } - private Config buildTestConfigFrom(String testConfigFile) { ConfigReader configReader = new ConfigReader(); diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/ResultsFileWriter.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/ResultsFileWriter.java new file mode 100644 index 0000000000..81b717403d --- /dev/null +++ b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/ResultsFileWriter.java @@ -0,0 +1,112 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.qpid.disttest; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.util.List; + +import org.apache.qpid.disttest.controller.ResultsForAllTests; +import org.apache.qpid.disttest.results.aggregation.TestResultAggregator; +import org.apache.qpid.disttest.results.formatting.CSVFormatter; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class ResultsFileWriter +{ + private static final Logger LOGGER = LoggerFactory.getLogger(ResultsFileWriter.class); + + static final String TEST_SUMMARY_FILE_NAME = "test-summary.csv"; + + private final File _outputDir; + + private CSVFormatter _csvFormater = new CSVFormatter(); + + private TestResultAggregator _testResultAggregator = new TestResultAggregator(); + + public ResultsFileWriter(File outputDir) + { + _outputDir = outputDir; + } + + public void writeResultsToFile(ResultsForAllTests resultsForAllTests, String testConfigFile) + { + final String outputFile = generateOutputCsvNameFrom(testConfigFile); + writeResultsToOutputFile(resultsForAllTests, outputFile); + } + + public void writeResultsSummary(List allResultsList) + { + ResultsForAllTests combinedResults = _testResultAggregator.aggregateTestResults(allResultsList); + writeResultsToOutputFile(combinedResults, new File(_outputDir, TEST_SUMMARY_FILE_NAME).getAbsolutePath()); + } + + /** + * generateOutputCsvNameFrom("/config/testConfigFile.js", "/output") returns /output/testConfigFile.csv + */ + private String generateOutputCsvNameFrom(String testConfigFile) + { + final String filenameOnlyWithExtension = new File(testConfigFile).getName(); + final String cvsFile = filenameOnlyWithExtension.replaceFirst(".?\\w*$", ".csv"); + + return new File(_outputDir, cvsFile).getAbsolutePath(); + } + + private void writeResultsToOutputFile(ResultsForAllTests resultsForAllTests, String outputFile) + { + FileWriter writer = null; + try + { + final String outputCsv = _csvFormater.format(resultsForAllTests); + writer = new FileWriter(outputFile); + writer.write(outputCsv); + LOGGER.info("Wrote " + resultsForAllTests.getTestResults().size() + " test result(s) to output file " + outputFile); + } + catch (IOException e) + { + throw new DistributedTestException("Unable to write output file " + outputFile, e); + } + finally + { + if (writer != null) + { + try + { + writer.close(); + } + catch (IOException e) + { + LOGGER.error("Failed to close stream for file " + outputFile, e); + } + } + } + } + + void setCsvFormater(CSVFormatter csvFormater) + { + _csvFormater = csvFormater; + } + + void setTestResultAggregator(TestResultAggregator testResultAggregator) + { + _testResultAggregator = testResultAggregator; + } + +} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/ResultsForAllTests.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/ResultsForAllTests.java index 6c5ff3450c..d4474e2c12 100644 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/ResultsForAllTests.java +++ b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/ResultsForAllTests.java @@ -21,7 +21,9 @@ package org.apache.qpid.disttest.controller; import java.util.ArrayList; import java.util.List; +import org.apache.qpid.disttest.message.ParticipantResult; import org.apache.qpid.disttest.results.aggregation.ITestResult; +import org.apache.qpid.disttest.results.aggregation.TestResultAggregator; public class ResultsForAllTests { @@ -46,4 +48,23 @@ public class ResultsForAllTests { return _hasErrors; } + + public ResultsForAllTests getAllParticipantsResult() + { + ResultsForAllTests summaryResultsForAllTests = new ResultsForAllTests(); + + for (ITestResult testResult : _results) + { + for(ParticipantResult participantResult : testResult.getParticipantResults()) + { + if(TestResultAggregator.ALL_CONSUMER_PARTICIPANTS_NAME.equals(participantResult.getParticipantName())) + { + TestResult summaryTestResult = new TestResult(testResult.getName()); + summaryTestResult.addParticipantResult(participantResult); + summaryResultsForAllTests.add(summaryTestResult); + } + } + } + return summaryResultsForAllTests; + } } diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ParticipantAttribute.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ParticipantAttribute.java index 0418562a2d..ea1a633f21 100644 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ParticipantAttribute.java +++ b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ParticipantAttribute.java @@ -18,6 +18,8 @@ */ package org.apache.qpid.disttest.message; +import java.text.DecimalFormat; + import org.apache.qpid.disttest.client.Participant; /** @@ -31,6 +33,8 @@ public enum ParticipantAttribute { TEST_NAME("testName"), ITERATION_NUMBER("iterationNumber"), + THROUGHPUT("throughputKbPerS", "#"), + AVERAGE_LATENCY("averageLatency", "#"), CONFIGURED_CLIENT_NAME("clientName"), PARTICIPANT_NAME("participantName"), NUMBER_OF_MESSAGES_PROCESSED("numberOfMessages"), @@ -52,24 +56,55 @@ public enum ParticipantAttribute TOTAL_NUMBER_OF_CONSUMERS("totalNumberOfConsumers"), TOTAL_NUMBER_OF_PRODUCERS("totalNumberOfProducers"), TOTAL_PAYLOAD_PROCESSED("totalPayloadProcessedB"), - THROUGHPUT("throughputKbPerS"), TIME_TAKEN("timeTakenMs"), ERROR_MESSAGE("errorMessage"), MIN_LATENCY("minLatency"), MAX_LATENCY("maxLatency"), - AVERAGE_LATENCY("averageLatency"), LATENCY_STANDARD_DEVIATION("latencyStandardDeviation") ; private String _displayName; + private String _decimalFormat; ParticipantAttribute(String displayName) { _displayName = displayName; } + ParticipantAttribute(String displayName, String decimalFormat) + { + _displayName = displayName; + _decimalFormat = decimalFormat; + } + + public String getDecimalFormat() + { + return _decimalFormat; + } + public String getDisplayName() { return _displayName; } + + public String format(Object attributeValue) + { + if(attributeValue == null) + { + return null; + } + + String attributeAsString = String.valueOf(attributeValue); + + if(_decimalFormat != null) + { + DecimalFormat decimalFormat = new DecimalFormat(_decimalFormat); + double attributeAsDoule = Double.valueOf(attributeAsString); + return decimalFormat.format(attributeAsDoule); + } + else + { + return attributeAsString; + } + } } diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/ITestResult.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/ITestResult.java index 3f9cdff69d..6230067486 100644 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/ITestResult.java +++ b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/ITestResult.java @@ -22,10 +22,8 @@ import java.util.List; import org.apache.qpid.disttest.message.ParticipantResult; -// TODO rename me!! public interface ITestResult { - // TODO should weaken to Collection List getParticipantResults(); diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/TestResultAggregator.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/TestResultAggregator.java index 5934e0e997..954f796d21 100644 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/TestResultAggregator.java +++ b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/TestResultAggregator.java @@ -18,6 +18,9 @@ */ package org.apache.qpid.disttest.results.aggregation; +import java.util.List; + +import org.apache.qpid.disttest.controller.ResultsForAllTests; import org.apache.qpid.disttest.message.ConsumerParticipantResult; import org.apache.qpid.disttest.message.ParticipantResult; import org.apache.qpid.disttest.message.ProducerParticipantResult; @@ -103,4 +106,24 @@ public class TestResultAggregator aggregatedAllResult.setTotalPayloadProcessed(aggregatedConsumerResult.getTotalPayloadProcessed()); aggregatedAllResult.setThroughput(aggregatedConsumerResult.getThroughput()); } + + /** + * Produces a single {@link ResultsForAllTests} from the supplied list, only containing + * the "All participants" results. + */ + public ResultsForAllTests aggregateTestResults(List allResultsList) + { + ResultsForAllTests retVal = new ResultsForAllTests(); + + for (ResultsForAllTests resultsForAllTests : allResultsList) + { + ResultsForAllTests allParticipantsResult = resultsForAllTests.getAllParticipantsResult(); + for (ITestResult testResult : allParticipantsResult.getTestResults()) + { + retVal.add(testResult); + } + } + + return retVal; + } } diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/formatting/CSVFormater.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/formatting/CSVFormater.java deleted file mode 100644 index 52e53ca624..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/formatting/CSVFormater.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.qpid.disttest.results.formatting; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang.StringUtils; -import org.apache.qpid.disttest.controller.ResultsForAllTests; -import org.apache.qpid.disttest.message.ParticipantAttribute; -import org.apache.qpid.disttest.message.ParticipantResult; -import org.apache.qpid.disttest.results.aggregation.ITestResult; - -/** - * produces CSV output using the ordered enums in {@link ParticipantAttribute} - */ -public class CSVFormater -{ - public String format(ResultsForAllTests results) - { - StringBuilder builder = new StringBuilder(); - - builder.append(header()); - - List testResults = results.getTestResults(); - - for (ITestResult testResult : testResults) - { - - List participantResults = new ArrayList(testResult.getParticipantResults()); - Collections.sort(participantResults, new CSVOrderParticipantResultComparator()); - - for (ParticipantResult participantResult : participantResults) - { - Map attributes = participantResult.getAttributes(); - builder.append(row(attributes)); - } - } - - return builder.toString(); - } - - /** - * return a row, including a newline character at the end - */ - private String row(Map attributeValueMap) - { - List attributeValues = new ArrayList(); - for (ParticipantAttribute attribute : ParticipantAttribute.values()) - { - attributeValues.add(attributeValueMap.get(attribute)); - } - - String row = StringUtils.join(attributeValues.toArray(), ","); - return row + "\n"; - } - - /** return the header row, including a newline at the end */ - private String header() - { - List displayNames = new ArrayList(); - for (ParticipantAttribute attribute : ParticipantAttribute.values()) - { - displayNames.add(attribute.getDisplayName()); - } - - String header = StringUtils.join(displayNames.toArray(), ","); - return header + "\n"; - } - -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/formatting/CSVFormatter.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/formatting/CSVFormatter.java new file mode 100644 index 0000000000..ea7a3f78c7 --- /dev/null +++ b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/formatting/CSVFormatter.java @@ -0,0 +1,91 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.qpid.disttest.results.formatting; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang.StringUtils; +import org.apache.qpid.disttest.controller.ResultsForAllTests; +import org.apache.qpid.disttest.message.ParticipantAttribute; +import org.apache.qpid.disttest.message.ParticipantResult; +import org.apache.qpid.disttest.results.aggregation.ITestResult; + +/** + * produces CSV output using the ordered enums in {@link ParticipantAttribute} + */ +public class CSVFormatter +{ + public String format(ResultsForAllTests results) + { + StringBuilder builder = new StringBuilder(); + + builder.append(header()); + + List testResults = results.getTestResults(); + + for (ITestResult testResult : testResults) + { + + List participantResults = new ArrayList(testResult.getParticipantResults()); + Collections.sort(participantResults, new CSVOrderParticipantResultComparator()); + + for (ParticipantResult participantResult : participantResults) + { + Map attributes = participantResult.getAttributes(); + builder.append(row(attributes)); + } + } + + return builder.toString(); + } + + /** + * return a row, including a newline character at the end + */ + private String row(Map attributeValueMap) + { + List attributeValues = new ArrayList(); + for (ParticipantAttribute attribute : ParticipantAttribute.values()) + { + Object attributeValue = attributeValueMap.get(attribute); + String attributeValueFormatted = attribute.format(attributeValue); + attributeValues.add(attributeValueFormatted); + } + + String row = StringUtils.join(attributeValues.toArray(), ","); + return row + "\n"; + } + + /** return the header row, including a newline at the end */ + private String header() + { + List displayNames = new ArrayList(); + for (ParticipantAttribute attribute : ParticipantAttribute.values()) + { + displayNames.add(attribute.getDisplayName()); + } + + String header = StringUtils.join(displayNames.toArray(), ","); + return header + "\n"; + } + +} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/ConfigFileHelperTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/ConfigFileHelperTest.java index a10b3b359e..629442d86c 100644 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/ConfigFileHelperTest.java +++ b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/ConfigFileHelperTest.java @@ -39,14 +39,6 @@ public class ConfigFileHelperTest extends QpidTestCase _testDir = TestFileUtils.createTestDirectory(); } - public void testGenerateOutputCsvNameFrom() - { - String outputDir = "/tmp/outputDir"; - - assertEquals("/tmp/outputDir/my.json.file.csv", _configFileHelper.generateOutputCsvNameFrom("/tmp/my.json.file.json", outputDir)); - assertEquals("/tmp/outputDir/my.js.file.csv", _configFileHelper.generateOutputCsvNameFrom("/tmp/my.js.file.js", outputDir)); - } - public void testGetTestConfigFilesForDirectory() throws Exception { String jsFile = createFile("file1.js"); diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/ResultsFileWriterTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/ResultsFileWriterTest.java new file mode 100644 index 0000000000..abe000f072 --- /dev/null +++ b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/ResultsFileWriterTest.java @@ -0,0 +1,86 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.qpid.disttest; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.io.File; +import java.util.Arrays; + +import junit.framework.TestCase; + +import org.apache.qpid.disttest.controller.ResultsForAllTests; +import org.apache.qpid.disttest.results.aggregation.TestResultAggregator; +import org.apache.qpid.disttest.results.formatting.CSVFormatter; +import org.apache.qpid.test.utils.TestFileUtils; +import org.apache.qpid.util.FileUtils; + +public class ResultsFileWriterTest extends TestCase +{ + private CSVFormatter _csvFormater = mock(CSVFormatter.class); + private TestResultAggregator _testResultAggregator = mock(TestResultAggregator.class); + + private File _outputDir = TestFileUtils.createTestDirectory(); + + private ResultsFileWriter _resultsFileWriter = new ResultsFileWriter(_outputDir); + + @Override + public void setUp() + { + _resultsFileWriter.setCsvFormater(_csvFormater); + _resultsFileWriter.setTestResultAggregator(_testResultAggregator); + } + + public void testWriteResultsToFile() + { + ResultsForAllTests resultsForAllTests = mock(ResultsForAllTests.class); + + String expectedCsvContents = "expected-csv-contents"; + when(_csvFormater.format(resultsForAllTests)).thenReturn(expectedCsvContents); + + _resultsFileWriter.writeResultsToFile(resultsForAllTests, "config.json"); + + File resultsFile = new File(_outputDir, "config.csv"); + + assertEquals(expectedCsvContents, FileUtils.readFileAsString(resultsFile)); + } + + public void testWriteResultsSummary() + { + ResultsForAllTests results1 = mock(ResultsForAllTests.class); + ResultsForAllTests results2 = mock(ResultsForAllTests.class); + ResultsForAllTests summaryResults = mock(ResultsForAllTests.class); + + when(_testResultAggregator.aggregateTestResults(Arrays.asList(results1, results2))) + .thenReturn(summaryResults); + + String expectedSummaryFileContents = "expected-summary-file"; + + when(_csvFormater.format(summaryResults)) + .thenReturn(expectedSummaryFileContents); + + _resultsFileWriter.writeResultsSummary(Arrays.asList(results1, results2)); + + File summaryFile = new File(_outputDir, ResultsFileWriter.TEST_SUMMARY_FILE_NAME); + + assertEquals(expectedSummaryFileContents, FileUtils.readFileAsString(summaryFile)); + } + +} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/aggregation/TestResultAggregatorTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/aggregation/TestResultAggregatorTest.java index 9c00e7cf1c..7cb9ebed5e 100644 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/aggregation/TestResultAggregatorTest.java +++ b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/aggregation/TestResultAggregatorTest.java @@ -18,11 +18,15 @@ */ package org.apache.qpid.disttest.results.aggregation; +import static org.mockito.Mockito.*; + +import java.util.Arrays; import java.util.Date; import java.util.List; import junit.framework.TestCase; +import org.apache.qpid.disttest.controller.ResultsForAllTests; import org.apache.qpid.disttest.controller.TestResult; import org.apache.qpid.disttest.message.ConsumerParticipantResult; import org.apache.qpid.disttest.message.ParticipantResult; @@ -30,17 +34,14 @@ import org.apache.qpid.disttest.message.ProducerParticipantResult; public class TestResultAggregatorTest extends TestCase { - private static final String TEST1_NAME = "TEST1_NAME"; private static final int TEST1_ITERATION_NUMBER = 1; - private static final String CONSUMER_PARTICIPANT_NAME1 = "CONSUMER_PARTICIPANT_NAME1"; private static final String CONSUMER_PARTICIPANT_NAME2 = "CONSUMER_PARTICIPANT_NAME2"; private static final String PRODUCER_PARTICIPANT_NAME = "PRODUCER_PARTICIPANT_NAME"; - private static final long CONSUMER1_STARTDATE = 50; private static final long CONSUMER1_ENDDATE = 20000; @@ -64,6 +65,33 @@ public class TestResultAggregatorTest extends TestCase private TestResultAggregator _aggregator = new TestResultAggregator(); + public void testAggregateTestResults() + { + ResultsForAllTests resultsForAllTests1 = mock(ResultsForAllTests.class); + ResultsForAllTests resultsForAllTests2 = mock(ResultsForAllTests.class); + + ResultsForAllTests summaryResult1 = mock(ResultsForAllTests.class); + ResultsForAllTests summaryResult2 = mock(ResultsForAllTests.class); + + when(resultsForAllTests1.getAllParticipantsResult()).thenReturn(summaryResult1); + when(resultsForAllTests2.getAllParticipantsResult()).thenReturn(summaryResult2); + + ITestResult testResult1 = mock(ITestResult.class); + ITestResult testResult2 = mock(ITestResult.class); + + when(summaryResult1.getTestResults()).thenReturn(Arrays.asList(testResult1)); + when(summaryResult2.getTestResults()).thenReturn(Arrays.asList(testResult2)); + + ResultsForAllTests actualSummaryResults = _aggregator.aggregateTestResults(Arrays.asList( + resultsForAllTests1, + resultsForAllTests2)); + + assertEquals( + "Summary results should contain the all the 'all participants' test results", + Arrays.asList(testResult1, testResult2), + actualSummaryResults.getTestResults()); + } + public void testAggregateResultsForTwoConsumerAndOneProducer() throws Exception { TestResult originalTestResult = createResultsFromTest(); @@ -197,4 +225,5 @@ public class TestResultAggregatorTest extends TestCase participantResult.setEndDate(new Date(end)); participantResult.setBatchSize(batchSize); } + } diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/formatting/CSVFormaterTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/formatting/CSVFormaterTest.java deleted file mode 100644 index 565f59d25b..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/formatting/CSVFormaterTest.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.qpid.disttest.results.formatting; - -import static org.apache.qpid.disttest.message.ParticipantAttribute.BATCH_SIZE; -import static org.apache.qpid.disttest.message.ParticipantAttribute.CONFIGURED_CLIENT_NAME; -import static org.apache.qpid.disttest.message.ParticipantAttribute.*; -import static org.apache.qpid.disttest.message.ParticipantAttribute.ERROR_MESSAGE; -import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_BROWSING_SUBSCRIPTION; -import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_DURABLE_SUBSCRIPTION; -import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_NO_LOCAL; -import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_SELECTOR; -import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_SYNCHRONOUS_CONSUMER; -import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_TOPIC; -import static org.apache.qpid.disttest.message.ParticipantAttribute.ITERATION_NUMBER; -import static org.apache.qpid.disttest.message.ParticipantAttribute.MAXIMUM_DURATION; -import static org.apache.qpid.disttest.message.ParticipantAttribute.NUMBER_OF_MESSAGES_PROCESSED; -import static org.apache.qpid.disttest.message.ParticipantAttribute.PARTICIPANT_NAME; -import static org.apache.qpid.disttest.message.ParticipantAttribute.PAYLOAD_SIZE; -import static org.apache.qpid.disttest.message.ParticipantAttribute.PRIORITY; -import static org.apache.qpid.disttest.message.ParticipantAttribute.PRODUCER_INTERVAL; -import static org.apache.qpid.disttest.message.ParticipantAttribute.PRODUCER_START_DELAY; -import static org.apache.qpid.disttest.message.ParticipantAttribute.TEST_NAME; -import static org.apache.qpid.disttest.message.ParticipantAttribute.THROUGHPUT; -import static org.apache.qpid.disttest.message.ParticipantAttribute.TIME_TAKEN; -import static org.apache.qpid.disttest.message.ParticipantAttribute.TIME_TO_LIVE; -import static org.apache.qpid.disttest.message.ParticipantAttribute.TOTAL_NUMBER_OF_CONSUMERS; -import static org.apache.qpid.disttest.message.ParticipantAttribute.TOTAL_NUMBER_OF_PRODUCERS; -import static org.apache.qpid.disttest.message.ParticipantAttribute.TOTAL_PAYLOAD_PROCESSED; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.io.BufferedReader; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.HashMap; -import java.util.Map; - -import junit.framework.TestCase; - -import org.apache.qpid.disttest.controller.ResultsForAllTests; -import org.apache.qpid.disttest.controller.TestResult; -import org.apache.qpid.disttest.message.ParticipantAttribute; -import org.apache.qpid.disttest.message.ParticipantResult; - -public class CSVFormaterTest extends TestCase -{ - private static final String TEST1 = "TEST1"; - private static final String PARTICIPANT = "PARTICIPANT"; - private static final String CONFIGURED_CLIENT1 = "CONFIGURED_CLIENT1"; - - private CSVFormater _formatter = new CSVFormater(); - - public void testResultsFileWithWithOneRow() throws Exception - { - ParticipantResult participantResult = mock(ParticipantResult.class); - Map participantAttributes = getParticipantAttributes(); - - when(participantResult.getAttributes()).thenReturn(participantAttributes); - when(participantResult.getParticipantName()).thenReturn(PARTICIPANT); - - TestResult testResult = new TestResult(TEST1); - testResult.addParticipantResult(participantResult); - - ResultsForAllTests resultsForAllTests = new ResultsForAllTests(); - resultsForAllTests.add(testResult); - - String output = _formatter.format(resultsForAllTests); - - String expectedOutput = readCsvOutputFileAsString("expectedOutput.csv"); - - assertEquals(expectedOutput, output); - } - - private Map getParticipantAttributes() - { - Map participantAttributes = new HashMap(); - - participantAttributes.put(TEST_NAME, TEST1); - participantAttributes.put(ITERATION_NUMBER, 0); - participantAttributes.put(CONFIGURED_CLIENT_NAME, CONFIGURED_CLIENT1); - participantAttributes.put(PARTICIPANT_NAME, PARTICIPANT); - participantAttributes.put(NUMBER_OF_MESSAGES_PROCESSED, 0); - participantAttributes.put(PAYLOAD_SIZE, 1); - participantAttributes.put(PRIORITY, 2); - participantAttributes.put(TIME_TO_LIVE, 3); - participantAttributes.put(ACKNOWLEDGE_MODE, 4); - participantAttributes.put(DELIVERY_MODE, 5); - participantAttributes.put(BATCH_SIZE, 6); - participantAttributes.put(MAXIMUM_DURATION, 7); - participantAttributes.put(PRODUCER_START_DELAY, 8); - participantAttributes.put(PRODUCER_INTERVAL, 9); - participantAttributes.put(IS_TOPIC, true); - participantAttributes.put(IS_DURABLE_SUBSCRIPTION, false); - participantAttributes.put(IS_BROWSING_SUBSCRIPTION, true); - participantAttributes.put(IS_SELECTOR, false); - participantAttributes.put(IS_NO_LOCAL, true); - participantAttributes.put(IS_SYNCHRONOUS_CONSUMER, false); - participantAttributes.put(TOTAL_NUMBER_OF_CONSUMERS, 1); - participantAttributes.put(TOTAL_NUMBER_OF_PRODUCERS, 2); - participantAttributes.put(TOTAL_PAYLOAD_PROCESSED, 1024); - participantAttributes.put(THROUGHPUT, 2048); - participantAttributes.put(TIME_TAKEN, 1000); - participantAttributes.put(ERROR_MESSAGE, "error"); - participantAttributes.put(MIN_LATENCY, 2l); - participantAttributes.put(MAX_LATENCY, 9l); - participantAttributes.put(AVERAGE_LATENCY, 5.0f); - participantAttributes.put(LATENCY_STANDARD_DEVIATION, 2.0f); - return participantAttributes; - } - - private String readCsvOutputFileAsString(String filename) throws Exception - { - InputStream is = getClass().getResourceAsStream(filename); - assertNotNull(is); - - StringBuilder output = new StringBuilder(); - - BufferedReader br = new BufferedReader(new InputStreamReader(is)); - String line = null; - while((line = br.readLine()) != null) - { - output.append(line); - output.append("\n"); - } - - return output.toString(); - } - -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/formatting/CSVFormatterTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/formatting/CSVFormatterTest.java new file mode 100644 index 0000000000..0d66c7ffb5 --- /dev/null +++ b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/formatting/CSVFormatterTest.java @@ -0,0 +1,145 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.qpid.disttest.results.formatting; + +import static org.apache.qpid.disttest.message.ParticipantAttribute.BATCH_SIZE; +import static org.apache.qpid.disttest.message.ParticipantAttribute.CONFIGURED_CLIENT_NAME; +import static org.apache.qpid.disttest.message.ParticipantAttribute.*; +import static org.apache.qpid.disttest.message.ParticipantAttribute.ERROR_MESSAGE; +import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_BROWSING_SUBSCRIPTION; +import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_DURABLE_SUBSCRIPTION; +import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_NO_LOCAL; +import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_SELECTOR; +import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_SYNCHRONOUS_CONSUMER; +import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_TOPIC; +import static org.apache.qpid.disttest.message.ParticipantAttribute.ITERATION_NUMBER; +import static org.apache.qpid.disttest.message.ParticipantAttribute.MAXIMUM_DURATION; +import static org.apache.qpid.disttest.message.ParticipantAttribute.NUMBER_OF_MESSAGES_PROCESSED; +import static org.apache.qpid.disttest.message.ParticipantAttribute.PARTICIPANT_NAME; +import static org.apache.qpid.disttest.message.ParticipantAttribute.PAYLOAD_SIZE; +import static org.apache.qpid.disttest.message.ParticipantAttribute.PRIORITY; +import static org.apache.qpid.disttest.message.ParticipantAttribute.PRODUCER_INTERVAL; +import static org.apache.qpid.disttest.message.ParticipantAttribute.PRODUCER_START_DELAY; +import static org.apache.qpid.disttest.message.ParticipantAttribute.TEST_NAME; +import static org.apache.qpid.disttest.message.ParticipantAttribute.THROUGHPUT; +import static org.apache.qpid.disttest.message.ParticipantAttribute.TIME_TAKEN; +import static org.apache.qpid.disttest.message.ParticipantAttribute.TIME_TO_LIVE; +import static org.apache.qpid.disttest.message.ParticipantAttribute.TOTAL_NUMBER_OF_CONSUMERS; +import static org.apache.qpid.disttest.message.ParticipantAttribute.TOTAL_NUMBER_OF_PRODUCERS; +import static org.apache.qpid.disttest.message.ParticipantAttribute.TOTAL_PAYLOAD_PROCESSED; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.io.BufferedReader; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.HashMap; +import java.util.Map; + +import junit.framework.TestCase; + +import org.apache.qpid.disttest.controller.ResultsForAllTests; +import org.apache.qpid.disttest.controller.TestResult; +import org.apache.qpid.disttest.message.ParticipantAttribute; +import org.apache.qpid.disttest.message.ParticipantResult; + +public class CSVFormatterTest extends TestCase +{ + private static final String TEST1 = "TEST1"; + private static final String PARTICIPANT = "PARTICIPANT"; + private static final String CONFIGURED_CLIENT1 = "CONFIGURED_CLIENT1"; + + private CSVFormatter _formatter = new CSVFormatter(); + + public void testResultsFileWithWithOneRow() throws Exception + { + ParticipantResult participantResult = mock(ParticipantResult.class); + Map participantAttributes = getParticipantAttributes(); + + when(participantResult.getAttributes()).thenReturn(participantAttributes); + when(participantResult.getParticipantName()).thenReturn(PARTICIPANT); + + TestResult testResult = new TestResult(TEST1); + testResult.addParticipantResult(participantResult); + + ResultsForAllTests resultsForAllTests = new ResultsForAllTests(); + resultsForAllTests.add(testResult); + + String output = _formatter.format(resultsForAllTests); + + String expectedOutput = readCsvOutputFileAsString("expectedOutput.csv"); + + assertEquals(expectedOutput, output); + } + + private Map getParticipantAttributes() + { + Map participantAttributes = new HashMap(); + + participantAttributes.put(TEST_NAME, TEST1); + participantAttributes.put(ITERATION_NUMBER, 0); + participantAttributes.put(CONFIGURED_CLIENT_NAME, CONFIGURED_CLIENT1); + participantAttributes.put(PARTICIPANT_NAME, PARTICIPANT); + participantAttributes.put(NUMBER_OF_MESSAGES_PROCESSED, 0); + participantAttributes.put(PAYLOAD_SIZE, 1); + participantAttributes.put(PRIORITY, 2); + participantAttributes.put(TIME_TO_LIVE, 3); + participantAttributes.put(ACKNOWLEDGE_MODE, 4); + participantAttributes.put(DELIVERY_MODE, 5); + participantAttributes.put(BATCH_SIZE, 6); + participantAttributes.put(MAXIMUM_DURATION, 7); + participantAttributes.put(PRODUCER_START_DELAY, 8); + participantAttributes.put(PRODUCER_INTERVAL, 9); + participantAttributes.put(IS_TOPIC, true); + participantAttributes.put(IS_DURABLE_SUBSCRIPTION, false); + participantAttributes.put(IS_BROWSING_SUBSCRIPTION, true); + participantAttributes.put(IS_SELECTOR, false); + participantAttributes.put(IS_NO_LOCAL, true); + participantAttributes.put(IS_SYNCHRONOUS_CONSUMER, false); + participantAttributes.put(TOTAL_NUMBER_OF_CONSUMERS, 1); + participantAttributes.put(TOTAL_NUMBER_OF_PRODUCERS, 2); + participantAttributes.put(TOTAL_PAYLOAD_PROCESSED, 1024); + participantAttributes.put(THROUGHPUT, 2048.49); + participantAttributes.put(TIME_TAKEN, 1000); + participantAttributes.put(ERROR_MESSAGE, "error"); + participantAttributes.put(MIN_LATENCY, 2l); + participantAttributes.put(MAX_LATENCY, 9l); + participantAttributes.put(AVERAGE_LATENCY, 4.6f); + participantAttributes.put(LATENCY_STANDARD_DEVIATION, 2.0f); + return participantAttributes; + } + + private String readCsvOutputFileAsString(String filename) throws Exception + { + InputStream is = getClass().getResourceAsStream(filename); + assertNotNull(is); + + StringBuilder output = new StringBuilder(); + + BufferedReader br = new BufferedReader(new InputStreamReader(is)); + String line = null; + while((line = br.readLine()) != null) + { + output.append(line); + output.append("\n"); + } + + return output.toString(); + } +} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/formatting/expectedOutput.csv b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/formatting/expectedOutput.csv index ada2303d46..a5881e187a 100644 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/formatting/expectedOutput.csv +++ b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/formatting/expectedOutput.csv @@ -1,2 +1,2 @@ -testName,iterationNumber,clientName,participantName,numberOfMessages,payloadSizeB,priority,timeToLiveMs,acknowledgeMode,deliveryMode,batchSize,maximumDurationMs,producerStartDelayMs,producerIntervalMs,isTopic,isDurableSubscription,isBrowsingSubscription,isSelector,isNoLocal,isSynchronousConsumer,totalNumberOfConsumers,totalNumberOfProducers,totalPayloadProcessedB,throughputKbPerS,timeTakenMs,errorMessage,minLatency,maxLatency,averageLatency,latencyStandardDeviation -TEST1,0,CONFIGURED_CLIENT1,PARTICIPANT,0,1,2,3,4,5,6,7,8,9,true,false,true,false,true,false,1,2,1024,2048,1000,error,2,9,5.0,2.0 +testName,iterationNumber,throughputKbPerS,averageLatency,clientName,participantName,numberOfMessages,payloadSizeB,priority,timeToLiveMs,acknowledgeMode,deliveryMode,batchSize,maximumDurationMs,producerStartDelayMs,producerIntervalMs,isTopic,isDurableSubscription,isBrowsingSubscription,isSelector,isNoLocal,isSynchronousConsumer,totalNumberOfConsumers,totalNumberOfProducers,totalPayloadProcessedB,timeTakenMs,errorMessage,minLatency,maxLatency,latencyStandardDeviation +TEST1,0,2048,5,CONFIGURED_CLIENT1,PARTICIPANT,0,1,2,3,4,5,6,7,8,9,true,false,true,false,true,false,1,2,1024,1000,error,2,9,2.0 diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/systest/disttest/endtoend/EndToEndTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/systest/disttest/endtoend/EndToEndTest.java index 7e58e1b5b1..75242e06cc 100644 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/systest/disttest/endtoend/EndToEndTest.java +++ b/qpid/java/perftests/src/test/java/org/apache/qpid/systest/disttest/endtoend/EndToEndTest.java @@ -76,10 +76,10 @@ public class EndToEndTest extends QpidBrokerTestCase String[] cells = csvLine.split(",", DONT_STRIP_EMPTY_LAST_FIELD_FLAG); // All attributes become cells in the CSV, so this will be true assertEquals("Unexpected number of cells in CSV line " + csvLine, ParticipantAttribute.values().length, cells.length); - assertEquals("Unexpected test name in CSV line " + csvLine, testName, cells[0]); - assertEquals("Unexpected client name in CSV line " + csvLine, clientName, cells[2]); - assertEquals("Unexpected participant name in CSV line " + csvLine, participantName, cells[3]); - assertEquals("Unexpected number of messages processed in CSV line " + csvLine, String.valueOf(expectedNumberOfMessagesProcessed), cells[4]); + assertEquals("Unexpected test name in CSV line " + csvLine, testName, cells[ParticipantAttribute.TEST_NAME.ordinal()]); + assertEquals("Unexpected client name in CSV line " + csvLine, clientName, cells[ParticipantAttribute.CONFIGURED_CLIENT_NAME.ordinal()]); + assertEquals("Unexpected participant name in CSV line " + csvLine, participantName, cells[ParticipantAttribute.PARTICIPANT_NAME.ordinal()]); + assertEquals("Unexpected number of messages processed in CSV line " + csvLine, String.valueOf(expectedNumberOfMessagesProcessed), cells[ParticipantAttribute.NUMBER_OF_MESSAGES_PROCESSED.ordinal()]); } -- cgit v1.2.1