summaryrefslogtreecommitdiff
path: root/qpid/java/perftests/src/test
diff options
context:
space:
mode:
authorKeith Wall <kwall@apache.org>2014-03-07 17:24:48 +0000
committerKeith Wall <kwall@apache.org>2014-03-07 17:24:48 +0000
commit9bcbad89194862ef37832b9936ba8fc5fa58c47b (patch)
treed25b12bf16782b329eeda01c6a62e81a91842254 /qpid/java/perftests/src/test
parent713dbcd70b5d2da2488c09676f18f1752683654e (diff)
downloadqpid-python-9bcbad89194862ef37832b9936ba8fc5fa58c47b.tar.gz
QPID-5612: JMS benchmarking tool [Part of the existing Java Broker Performance Test suite]
Simple tool that uses the existing performance test suite to give a message throughput statistics (msg/s) and (Kbytes/s) for a use case involving a producer/consumer (on separate connections) with persistent messages on transactional sessions. The test scales the number of connections through 1, 2, 5 and 10 and reports separate statistics for each. The duration of the test and message size can be overridden from the command line via system properties -Dqpid.disttest.duration and -Dqpid.disttest.messageSize respectively. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1575336 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/perftests/src/test')
-rw-r--r--qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/JavaScriptConfigEvaluatorTest.java29
-rw-r--r--qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/ProducerConfigTest.java15
-rw-r--r--qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/ResultsFileWriterTest.java (renamed from qpid/java/perftests/src/test/java/org/apache/qpid/disttest/ResultsFileWriterTest.java)9
3 files changed, 49 insertions, 4 deletions
diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/JavaScriptConfigEvaluatorTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/JavaScriptConfigEvaluatorTest.java
index 55c1d4a7bd..174bd8092c 100644
--- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/JavaScriptConfigEvaluatorTest.java
+++ b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/JavaScriptConfigEvaluatorTest.java
@@ -22,6 +22,7 @@ package org.apache.qpid.disttest.controller.config;
import static org.apache.commons.beanutils.PropertyUtils.getProperty;
+import java.io.FileReader;
import java.util.List;
import java.util.TreeMap;
@@ -59,6 +60,34 @@ public class JavaScriptConfigEvaluatorTest extends QpidTestCase
assertEquals("Unexpected iterating attribute", "1", getProperty(country1, "_regions.[0]._towns.[0]._iteratingAttribute"));
}
+ public void testEvaluateJavaScriptWithReader() throws Exception
+ {
+ String jsFilePath = TestFileUtils.createTempFileFromResource(this, "JavaScriptConfigEvaluatorTest-test-config.js").getAbsolutePath();
+
+ FileReader fileReader = new FileReader(jsFilePath);
+ String rawConfig = new JavaScriptConfigEvaluator().evaluateJavaScript(fileReader);
+
+ Object configAsObject = getObject(rawConfig);
+
+ // Tests are produced by the QPID.iterations js function
+ assertEquals("Unexpected number of countries", 2, getPropertyAsList(configAsObject, "_countries").size());
+
+ Object country0 = getProperty(configAsObject, "_countries.[0]");
+ assertEquals("Unexpected country name", "Country", getProperty(country0, "_name"));
+ assertEquals("Unexpected country iteration number", 0, getPropertyAsInt(country0, "_iterationNumber"));
+
+ assertEquals("Unexpected number of regions", 2, getPropertyAsList(country0, "_regions").size());
+ // Region names are produced by the QPID.times js function
+ assertEquals("Unexpected region name", "repeatingRegion0", getProperty(country0, "_regions.[0]._name"));
+ assertEquals("Unexpected region name", "repeatingRegion1", getProperty(country0, "_regions.[1]._name"));
+ // Iterating attribute are produced by the QPID.iterations js function
+ assertEquals("Unexpected iterating attribute", "0", getProperty(country0, "_regions.[0]._towns.[0]._iteratingAttribute"));
+
+ Object country1 = getProperty(configAsObject, "_countries.[1]");
+ assertEquals("Unexpected country iteration number", 1, getPropertyAsInt(country1, "_iterationNumber"));
+ assertEquals("Unexpected iterating attribute", "1", getProperty(country1, "_regions.[0]._towns.[0]._iteratingAttribute"));
+ }
+
private int getPropertyAsInt(Object configAsObject, String property) throws Exception
{
Number propertyValue = (Number) getProperty(configAsObject, property);
diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/ProducerConfigTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/ProducerConfigTest.java
index 44fca4bb7c..ea9a406b1d 100644
--- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/ProducerConfigTest.java
+++ b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/ProducerConfigTest.java
@@ -41,6 +41,21 @@ public class ProducerConfigTest extends QpidTestCase
assertEquals(Message.DEFAULT_TIME_TO_LIVE, p.getTimeToLive());
}
+ public void testMessageSizeDefault()
+ {
+ CreateProducerCommand producer = new ProducerConfig().createCommand("session1");
+ assertEquals("Unexpected default message size", 1024, producer.getMessageSize());
+ }
+
+ public void testMessageSizeDefaultOverride()
+ {
+ final long overriddenMessageSize = 4096;
+ setTestSystemProperty(ProducerConfig.MESSAGE_SIZE_OVERRIDE_SYSTEM_PROPERTY, String.valueOf(overriddenMessageSize));
+
+ CreateProducerCommand producer2 = new ProducerConfig().createCommand("session1");
+ assertEquals("Unexpected message size", overriddenMessageSize, producer2.getMessageSize());
+ }
+
public void testCreateProducerCommand()
{
String destination = "url:/destination";
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/results/ResultsFileWriterTest.java
index ab55e8003d..db306ea1a4 100644
--- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/ResultsFileWriterTest.java
+++ b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/ResultsFileWriterTest.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.qpid.disttest;
+package org.apache.qpid.disttest.results;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -25,6 +25,7 @@ import java.io.File;
import java.util.Arrays;
import org.apache.qpid.disttest.controller.ResultsForAllTests;
+import org.apache.qpid.disttest.results.ResultsCsvWriter;
import org.apache.qpid.disttest.results.aggregation.TestResultAggregator;
import org.apache.qpid.disttest.results.formatting.CSVFormatter;
import org.apache.qpid.test.utils.QpidTestCase;
@@ -38,7 +39,7 @@ public class ResultsFileWriterTest extends QpidTestCase
private File _outputDir = TestFileUtils.createTestDirectory();
- private ResultsFileWriter _resultsFileWriter = new ResultsFileWriter(_outputDir);
+ private ResultsCsvWriter _resultsFileWriter = new ResultsCsvWriter(_outputDir);
@Override
public void setUp()
@@ -54,7 +55,7 @@ public class ResultsFileWriterTest extends QpidTestCase
String expectedCsvContents = "expected-csv-contents";
when(_csvFormater.format(resultsForAllTests)).thenReturn(expectedCsvContents);
- _resultsFileWriter.writeResultsToFile(resultsForAllTests, "config.json");
+ _resultsFileWriter.writeResults(resultsForAllTests, "config.json");
File resultsFile = new File(_outputDir, "config.csv");
@@ -77,7 +78,7 @@ public class ResultsFileWriterTest extends QpidTestCase
_resultsFileWriter.writeResultsSummary(Arrays.asList(results1, results2));
- File summaryFile = new File(_outputDir, ResultsFileWriter.TEST_SUMMARY_FILE_NAME);
+ File summaryFile = new File(_outputDir, ResultsCsvWriter.TEST_SUMMARY_FILE_NAME);
assertEquals(expectedSummaryFileContents, FileUtils.readFileAsString(summaryFile));
}