From 0a0baee45ebcff44635907d457c4ff6810b09c87 Mon Sep 17 00:00:00 2001 From: Alex Rudyy Date: Wed, 15 Apr 2015 09:47:28 +0000 Subject: QPID-6481: Move java source tree to top level git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1673693 13f79535-47bb-0310-9956-ffa450edef68 --- .../1001-MessageSize-Transient-ByteSec.chartdef | 37 - .../1002-MessageSize-Persistent-ByteSec.chartdef | 37 - .../1003-MessageSize-Transient-MsgSec.chartdef | 37 - .../1004-MessageSize-Persistent-MsgSec.chartdef | 37 - ...-VaryingNumberOfProducers-SessionTrans.chartdef | 57 - ...-VaryingNumberOfConsumers-SessionTrans.chartdef | 57 - .../1021-AcknowledgementModes-Persistent.chartdef | 38 - .../1022-AcknowledgementModes-Transient.chartdef | 36 - .../etc/chartdefs/1030-BatchSize-Equal.chartdef | 37 - .../etc/chartdefs/1031-BatchSize-Unequal.chartdef | 53 - .../etc/chartdefs/1040-QueueTypes.chartdef | 36 - ...mberOfProducerSessionsSingleConnection.chartdef | 49 - .../etc/chartdefs/1060-SSLConnections.chartdef | 49 - ...sWithNonOverlappingSelectors-Transient.chartdef | 37 - ...WithNonOverlappingSelectors-Persistent.chartdef | 43 - ...mersWithOverlappingSelectors-Transient.chartdef | 36 - ...ersWithOverlappingSelectors-Persistent.chartdef | 42 - .../1500-Topic-NumberOfConsumers.chartdef | 37 - .../chartdefs/1501-Topic-NumberOfTopics.chartdef | 37 - .../etc/chartdefs/1502-Topic-Persistence.chartdef | 37 - .../etc/chartdefs/1503-Topic-AckModes.chartdef | 37 - .../2001-Latency-MessageSize-Transient.chartdef | 41 - .../2002-Latency-MessageSize-Persistent.chartdef | 41 - ...31-Latency-VaryingNumberOfParticipants.chartdef | 51 - .../1001-Large-Messages-Transient.chartdef | 29 - .../1002-Large-Messages-Persistent.chartdef | 29 - ...ltipleProducersAndConsumers-Persistent.chartdef | 30 - .../timeseries/1030-Batch-Size-Small.chartdef | 30 - .../timeseries/1031-Batch-Size-Large.chartdef | 30 - .../chartdefs/timeseries/1040-SortedQueue.chartdef | 30 - .../ha/chardefs/1001-ScalingParticipants.chartdef | 48 - qpid/java/perftests/etc/ha/readme.txt | 33 - .../etc/ha/testdefs/ScalingParticipants.js | 92 - qpid/java/perftests/etc/json_config_tool.py | 74 - qpid/java/perftests/etc/log4j.properties | 28 - qpid/java/perftests/etc/perftests-jndi.properties | 27 - qpid/java/perftests/etc/run-perftests.sh | 37 - .../etc/testdefs/AcknowledgementModes.json | 138 - qpid/java/perftests/etc/testdefs/BatchSize.js | 102 - .../etc/testdefs/BatchSizeConsumerVaries.js | 102 - .../etc/testdefs/BatchSizeProducerVaries.js | 102 - .../etc/testdefs/Latency-MessageSize.json | 180 - .../Latency-VaryingNumberOfParticipants.json | 706 - qpid/java/perftests/etc/testdefs/MessageSize.json | 196 - .../QueueConsumersWithNonOverlappingSelectors.js | 120 - .../QueueConsumersWithOverlappingSelectors.js | 132 - qpid/java/perftests/etc/testdefs/QueueTypes.json | 16198 ------------------- qpid/java/perftests/etc/testdefs/Topic-AckModes.js | 88 - .../etc/testdefs/Topic-NumberOfConsumers.js | 90 - .../perftests/etc/testdefs/Topic-NumberOfTopics.js | 95 - .../perftests/etc/testdefs/Topic-Persistence.js | 94 - .../etc/testdefs/VaryingNumberOfParticipants.js | 104 - .../etc/testdefs/VaryingNumberOfParticipantsSSL.js | 104 - ...yingNumberOfProducerSessionsSingleConnection.js | 95 - qpid/java/perftests/example/PQBT-AA-Qpid-01.json | 795 - qpid/java/perftests/example/TQBT-TX-Qpid-01.json | 843 - qpid/java/perftests/example/brokerconfig/log4j.xml | 125 - qpid/java/perftests/example/brokerconfig/passwd | 23 - qpid/java/perftests/example/config-one-test.json | 55 - .../config-stress-testing-manyp-c1-with-psfc.json | 161 - .../perftests/example/config-stress-testing.json | 84 - qpid/java/perftests/example/config-two-tests.json | 117 - .../java/perftests/example/log4j-client.properties | 29 - qpid/java/perftests/example/log4j.properties | 35 - .../perftests/example/perftests-jndi.properties | 29 - qpid/java/perftests/example/perftests.js | 125 - qpid/java/perftests/example/run-client.sh | 21 - qpid/java/perftests/example/run.sh | 22 - qpid/java/perftests/pom.xml | 207 - qpid/java/perftests/src/main/assembly/LICENSE | 233 - qpid/java/perftests/src/main/assembly/NOTICE | 48 - .../dependency-verification/DEPENDENCIES_REFERENCE | 60 - .../src/main/assembly/qpid-perftests-bin.xml | 70 - qpid/java/perftests/src/main/java/json2.js | 487 - .../org/apache/qpid/disttest/AbstractRunner.java | 74 - .../org/apache/qpid/disttest/ArgumentParser.java | 54 - .../java/org/apache/qpid/disttest/Benchmark.java | 290 - .../org/apache/qpid/disttest/ClientRunner.java | 98 - .../org/apache/qpid/disttest/ConfigFileHelper.java | 63 - .../org/apache/qpid/disttest/ControllerRunner.java | 212 - .../qpid/disttest/DistributedTestConstants.java | 35 - .../qpid/disttest/DistributedTestException.java | 66 - .../java/org/apache/qpid/disttest/Visitor.java | 76 - .../org/apache/qpid/disttest/client/Client.java | 228 - .../qpid/disttest/client/ClientCommandVisitor.java | 99 - .../apache/qpid/disttest/client/ClientState.java | 25 - .../disttest/client/ConnectionLostListener.java | 26 - .../qpid/disttest/client/ConsumerParticipant.java | 283 - .../qpid/disttest/client/MessageProvider.java | 218 - .../apache/qpid/disttest/client/Participant.java | 31 - .../qpid/disttest/client/ParticipantExecutor.java | 145 - .../client/ParticipantExecutorRegistry.java | 45 - .../disttest/client/ParticipantResultFactory.java | 118 - .../qpid/disttest/client/ProducerParticipant.java | 234 - .../client/property/GeneratedPropertySupport.java | 68 - .../client/property/GeneratedPropertyValue.java | 27 - .../client/property/ListPropertyValue.java | 122 - .../property/NumericGeneratedPropertySupport.java | 179 - .../disttest/client/property/PropertyValue.java | 27 - .../client/property/PropertyValueFactory.java | 46 - .../client/property/RandomPropertyValue.java | 47 - .../client/property/RangePropertyValue.java | 129 - .../client/property/SimplePropertyValue.java | 79 - .../disttest/client/utils/ExecutorWithLimits.java | 35 - .../client/utils/ExecutorWithLimitsFactory.java | 49 - .../client/utils/ExecutorWithNoLimits.java | 42 - .../client/utils/ExecutorWithTimeLimit.java | 65 - .../qpid/disttest/controller/ClientRegistry.java | 127 - .../qpid/disttest/controller/CommandForClient.java | 46 - .../qpid/disttest/controller/CommandListener.java | 31 - .../qpid/disttest/controller/Controller.java | 231 - .../disttest/controller/ParticipatingClients.java | 94 - .../disttest/controller/ResultsForAllTests.java | 70 - .../qpid/disttest/controller/TestResult.java | 70 - .../qpid/disttest/controller/TestRunner.java | 348 - .../disttest/controller/TestRunnerFactory.java | 31 - .../disttest/controller/config/ClientConfig.java | 113 - .../qpid/disttest/controller/config/Config.java | 86 - .../disttest/controller/config/ConfigReader.java | 91 - .../controller/config/ConnectionConfig.java | 91 - .../disttest/controller/config/ConsumerConfig.java | 83 - .../disttest/controller/config/IterationValue.java | 86 - .../config/JavaScriptConfigEvaluator.java | 83 - .../controller/config/MessageProviderConfig.java | 60 - .../controller/config/ParticipantConfig.java | 105 - .../disttest/controller/config/ProducerConfig.java | 121 - .../disttest/controller/config/QueueConfig.java | 66 - .../disttest/controller/config/SessionConfig.java | 114 - .../disttest/controller/config/TestConfig.java | 117 - .../disttest/controller/config/TestInstance.java | 102 - .../apache/qpid/disttest/db/ResultsDbWriter.java | 440 - .../qpid/disttest/jms/ClientJmsDelegate.java | 715 - .../qpid/disttest/jms/ControllerJmsDelegate.java | 274 - .../qpid/disttest/jms/ExistingQueueDrainer.java | 134 - .../qpid/disttest/jms/JmsMessageAdaptor.java | 124 - .../apache/qpid/disttest/jms/NoOpQueueCreator.java | 38 - .../apache/qpid/disttest/jms/QpidQueueCreator.java | 175 - .../org/apache/qpid/disttest/jms/QueueCreator.java | 34 - .../org/apache/qpid/disttest/json/JsonHandler.java | 43 - .../qpid/disttest/json/PropertyValueAdapter.java | 147 - .../org/apache/qpid/disttest/message/Command.java | 56 - .../apache/qpid/disttest/message/CommandType.java | 39 - .../message/ConsumerParticipantResult.java | 185 - .../disttest/message/CreateConnectionCommand.java | 58 - .../disttest/message/CreateConsumerCommand.java | 107 - .../message/CreateMessageProviderCommand.java | 54 - .../disttest/message/CreateParticpantCommand.java | 114 - .../disttest/message/CreateProducerCommand.java | 106 - .../disttest/message/CreateResponderCommand.java | 28 - .../disttest/message/CreateSessionCommand.java | 62 - .../apache/qpid/disttest/message/NoOpCommand.java | 30 - .../qpid/disttest/message/OutputAttribute.java | 35 - .../disttest/message/ParticipantAttribute.java | 111 - .../message/ParticipantAttributeExtractor.java | 89 - .../qpid/disttest/message/ParticipantResult.java | 322 - .../message/ProducerParticipantResult.java | 102 - .../disttest/message/RegisterClientCommand.java | 43 - .../org/apache/qpid/disttest/message/Response.java | 80 - .../qpid/disttest/message/StartTestCommand.java | 29 - .../qpid/disttest/message/StopClientCommand.java | 28 - .../qpid/disttest/message/TearDownTestCommand.java | 29 - .../disttest/results/BenchmarkResultWriter.java | 68 - .../qpid/disttest/results/ResultsCsvWriter.java | 115 - .../qpid/disttest/results/ResultsWriter.java | 34 - .../results/aggregation/AggregatedTestResult.java | 97 - .../disttest/results/aggregation/Aggregator.java | 49 - .../disttest/results/aggregation/ITestResult.java | 34 - .../aggregation/ParticipantResultAggregator.java | 211 - .../results/aggregation/SeriesStatistics.java | 111 - .../results/aggregation/TestResultAggregator.java | 130 - .../disttest/results/formatting/CSVFormatter.java | 91 - .../CSVOrderParticipantResultComparator.java | 55 - qpid/java/perftests/src/main/java/test-utils.js | 105 - .../java/perftests/src/main/resources/Benchmark.js | 96 - .../src/main/resources/perftests.properties | 20 - .../apache/qpid/disttest/ArgumentParserTest.java | 96 - .../apache/qpid/disttest/ConfigFileHelperTest.java | 71 - .../apache/qpid/disttest/ConfigFileTestHelper.java | 48 - .../apache/qpid/disttest/PerfTestConstants.java | 28 - .../java/org/apache/qpid/disttest/VisitorTest.java | 91 - .../disttest/client/ClientCommandVisitorTest.java | 108 - .../apache/qpid/disttest/client/ClientTest.java | 158 - .../disttest/client/ConsumerParticipantTest.java | 202 - .../qpid/disttest/client/MessageProviderTest.java | 107 - .../disttest/client/ParticipantExecutorTest.java | 198 - .../disttest/client/ParticipantRegistryTest.java | 56 - .../client/ParticipantResultFactoryTest.java | 182 - .../disttest/client/ParticipantTestHelper.java | 83 - .../disttest/client/ProducerParticipantTest.java | 235 - .../client/property/ListPropertyValueTest.java | 85 - .../client/property/PropertyValueFactoryTest.java | 74 - .../client/property/RandomPropertyValueTest.java | 75 - .../client/property/RangePropertyValueTest.java | 152 - .../client/property/SimplePropertyValueTest.java | 30 - .../client/utils/ExecutorWithNoLimitsTest.java | 61 - .../client/utils/ExecutorWithTimeLimitTest.java | 131 - .../disttest/controller/ClientRegistryTest.java | 135 - .../qpid/disttest/controller/ControllerTest.java | 196 - .../controller/ParticipatingClientsTest.java | 144 - .../qpid/disttest/controller/TestRunnerTest.java | 252 - .../controller/config/ClientConfigTest.java | 110 - .../config/ConfigReaderTest-test-config.js | 54 - .../controller/config/ConfigReaderTest.java | 146 - .../disttest/controller/config/ConfigTest.java | 56 - .../controller/config/ConfigTestUtils.java | 56 - .../controller/config/ConnectionConfigTest.java | 93 - .../controller/config/ConsumerConfigTest.java | 78 - .../controller/config/IterationValueTest.java | 81 - .../JavaScriptConfigEvaluatorTest-test-config.js | 43 - .../config/JavaScriptConfigEvaluatorTest.java | 111 - .../config/MessageProviderConfigTest.java | 50 - .../controller/config/ParticipantConfigTest.java | 43 - .../controller/config/ProducerConfigTest.java | 103 - .../controller/config/SessionConfigTest.java | 92 - .../disttest/controller/config/TestConfigTest.java | 112 - .../controller/config/TestInstanceTest.java | 101 - .../disttest/controller/config/sampleConfig.json | 72 - .../qpid/disttest/db/ResultsDbWriterTest.java | 158 - .../qpid/disttest/jms/JmsMessageAdaptorTest.java | 39 - .../qpid/disttest/message/JsonHandlerTest.java | 182 - .../disttest/message/ParticipantResultTest.java | 165 - .../disttest/results/ResultsFileWriterTest.java | 86 - .../qpid/disttest/results/ResultsTestFixture.java | 138 - .../results/aggregation/AggregatorTest.java | 60 - .../ParticipantResultAggregatorTest.java | 294 - .../results/aggregation/SeriesStatisticsTest.java | 43 - .../aggregation/TestResultAggregatorTest.java | 233 - .../results/formatting/CSVFormatterTest.java | 62 - .../CSVOrderParticipantResultComparatorTest.java | 87 - .../disttest/results/formatting/expectedOutput.csv | 2 - qpid/java/perftests/visualisation-jfc/pom.xml | 204 - .../qpid-perftests-visualisation-jfc-bin.xml | 50 - .../apache/qpid/disttest/charting/ChartType.java | 25 - .../qpid/disttest/charting/ChartingException.java | 46 - .../qpid/disttest/charting/ChartingUtil.java | 160 - .../charting/chartbuilder/BarChart3DBuilder.java | 56 - .../charting/chartbuilder/BarChartBuilder.java | 54 - .../charting/chartbuilder/BaseChartBuilder.java | 112 - .../CategoryDataSetBasedChartBuilder.java | 96 - .../CategoryStrokeAndPaintApplier.java | 41 - .../charting/chartbuilder/ChartBuilder.java | 34 - .../charting/chartbuilder/ChartBuilderFactory.java | 51 - .../charting/chartbuilder/ColorFactory.java | 66 - .../charting/chartbuilder/LineChart3DBuilder.java | 52 - .../charting/chartbuilder/LineChartBuilder.java | 53 - .../charting/chartbuilder/SeriesPainter.java | 63 - .../chartbuilder/SeriesStrokeAndPaintApplier.java | 35 - .../chartbuilder/StatisticalBarChartBuilder.java | 114 - .../charting/chartbuilder/TimeSeriesHolder.java | 70 - .../chartbuilder/TimeSeriesLineChartBuilder.java | 59 - .../chartbuilder/XYDataSetBasedChartBuilder.java | 119 - .../charting/chartbuilder/XYLineChartBuilder.java | 51 - .../charting/definition/ChartingDefinition.java | 104 - .../definition/ChartingDefinitionCreator.java | 143 - .../charting/definition/SeriesDefinition.java | 75 - .../definition/SeriesDefinitionCreator.java | 65 - .../charting/seriesbuilder/DatasetHolder.java | 37 - .../charting/seriesbuilder/JdbcSeriesBuilder.java | 157 - .../charting/seriesbuilder/JdbcUrlGenerator.java | 81 - .../charting/seriesbuilder/SeriesBuilder.java | 41 - .../disttest/charting/seriesbuilder/SeriesRow.java | 98 - .../qpid/disttest/charting/writer/ChartWriter.java | 158 - .../chartbuilder/BaseChartBuilderTest.java | 125 - .../chartbuilder/ChartBuilderFactoryTest.java | 67 - .../charting/chartbuilder/ChartProductionTest.java | 238 - .../charting/chartbuilder/ColorFactoryTest.java | 42 - .../TimeSeriesBuilderCallbackTest.java | 91 - .../definition/ChartingDefinitionCreatorTest.java | 159 - .../definition/SeriesDefinitionCreatorTest.java | 130 - .../seriesbuilder/JdbcSeriesBuilderTest.java | 103 - .../seriesbuilder/JdbcUrlGeneratorTest.java | 85 - .../charting/seriesbuilder/SeriesRowTest.java | 64 - .../disttest/charting/writer/ChartWriterTest.java | 134 - .../charting/writer/expected-chart-summary.html | 21 - 274 files changed, 44256 deletions(-) delete mode 100644 qpid/java/perftests/etc/chartdefs/1001-MessageSize-Transient-ByteSec.chartdef delete mode 100644 qpid/java/perftests/etc/chartdefs/1002-MessageSize-Persistent-ByteSec.chartdef delete mode 100644 qpid/java/perftests/etc/chartdefs/1003-MessageSize-Transient-MsgSec.chartdef delete mode 100644 qpid/java/perftests/etc/chartdefs/1004-MessageSize-Persistent-MsgSec.chartdef delete mode 100644 qpid/java/perftests/etc/chartdefs/1015-VaryingNumberOfProducers-SessionTrans.chartdef delete mode 100644 qpid/java/perftests/etc/chartdefs/1016-VaryingNumberOfConsumers-SessionTrans.chartdef delete mode 100644 qpid/java/perftests/etc/chartdefs/1021-AcknowledgementModes-Persistent.chartdef delete mode 100644 qpid/java/perftests/etc/chartdefs/1022-AcknowledgementModes-Transient.chartdef delete mode 100644 qpid/java/perftests/etc/chartdefs/1030-BatchSize-Equal.chartdef delete mode 100644 qpid/java/perftests/etc/chartdefs/1031-BatchSize-Unequal.chartdef delete mode 100644 qpid/java/perftests/etc/chartdefs/1040-QueueTypes.chartdef delete mode 100644 qpid/java/perftests/etc/chartdefs/1050-VaryingNumberOfProducerSessionsSingleConnection.chartdef delete mode 100644 qpid/java/perftests/etc/chartdefs/1060-SSLConnections.chartdef delete mode 100644 qpid/java/perftests/etc/chartdefs/1300-QueueConsumersWithNonOverlappingSelectors-Transient.chartdef delete mode 100644 qpid/java/perftests/etc/chartdefs/1301-QueueConsumersWithNonOverlappingSelectors-Persistent.chartdef delete mode 100644 qpid/java/perftests/etc/chartdefs/1302-QueueConsumersWithOverlappingSelectors-Transient.chartdef delete mode 100644 qpid/java/perftests/etc/chartdefs/1303-QueueConsumersWithOverlappingSelectors-Persistent.chartdef delete mode 100644 qpid/java/perftests/etc/chartdefs/1500-Topic-NumberOfConsumers.chartdef delete mode 100644 qpid/java/perftests/etc/chartdefs/1501-Topic-NumberOfTopics.chartdef delete mode 100644 qpid/java/perftests/etc/chartdefs/1502-Topic-Persistence.chartdef delete mode 100644 qpid/java/perftests/etc/chartdefs/1503-Topic-AckModes.chartdef delete mode 100644 qpid/java/perftests/etc/chartdefs/2001-Latency-MessageSize-Transient.chartdef delete mode 100644 qpid/java/perftests/etc/chartdefs/2002-Latency-MessageSize-Persistent.chartdef delete mode 100644 qpid/java/perftests/etc/chartdefs/2031-Latency-VaryingNumberOfParticipants.chartdef delete mode 100644 qpid/java/perftests/etc/chartdefs/timeseries/1001-Large-Messages-Transient.chartdef delete mode 100644 qpid/java/perftests/etc/chartdefs/timeseries/1002-Large-Messages-Persistent.chartdef delete mode 100644 qpid/java/perftests/etc/chartdefs/timeseries/1011-MultipleProducersAndConsumers-Persistent.chartdef delete mode 100644 qpid/java/perftests/etc/chartdefs/timeseries/1030-Batch-Size-Small.chartdef delete mode 100644 qpid/java/perftests/etc/chartdefs/timeseries/1031-Batch-Size-Large.chartdef delete mode 100644 qpid/java/perftests/etc/chartdefs/timeseries/1040-SortedQueue.chartdef delete mode 100644 qpid/java/perftests/etc/ha/chardefs/1001-ScalingParticipants.chartdef delete mode 100644 qpid/java/perftests/etc/ha/readme.txt delete mode 100644 qpid/java/perftests/etc/ha/testdefs/ScalingParticipants.js delete mode 100755 qpid/java/perftests/etc/json_config_tool.py delete mode 100644 qpid/java/perftests/etc/log4j.properties delete mode 100644 qpid/java/perftests/etc/perftests-jndi.properties delete mode 100755 qpid/java/perftests/etc/run-perftests.sh delete mode 100644 qpid/java/perftests/etc/testdefs/AcknowledgementModes.json delete mode 100644 qpid/java/perftests/etc/testdefs/BatchSize.js delete mode 100644 qpid/java/perftests/etc/testdefs/BatchSizeConsumerVaries.js delete mode 100644 qpid/java/perftests/etc/testdefs/BatchSizeProducerVaries.js delete mode 100644 qpid/java/perftests/etc/testdefs/Latency-MessageSize.json delete mode 100644 qpid/java/perftests/etc/testdefs/Latency-VaryingNumberOfParticipants.json delete mode 100644 qpid/java/perftests/etc/testdefs/MessageSize.json delete mode 100644 qpid/java/perftests/etc/testdefs/QueueConsumersWithNonOverlappingSelectors.js delete mode 100644 qpid/java/perftests/etc/testdefs/QueueConsumersWithOverlappingSelectors.js delete mode 100644 qpid/java/perftests/etc/testdefs/QueueTypes.json delete mode 100644 qpid/java/perftests/etc/testdefs/Topic-AckModes.js delete mode 100644 qpid/java/perftests/etc/testdefs/Topic-NumberOfConsumers.js delete mode 100644 qpid/java/perftests/etc/testdefs/Topic-NumberOfTopics.js delete mode 100644 qpid/java/perftests/etc/testdefs/Topic-Persistence.js delete mode 100644 qpid/java/perftests/etc/testdefs/VaryingNumberOfParticipants.js delete mode 100644 qpid/java/perftests/etc/testdefs/VaryingNumberOfParticipantsSSL.js delete mode 100644 qpid/java/perftests/etc/testdefs/VaryingNumberOfProducerSessionsSingleConnection.js delete mode 100644 qpid/java/perftests/example/PQBT-AA-Qpid-01.json delete mode 100644 qpid/java/perftests/example/TQBT-TX-Qpid-01.json delete mode 100644 qpid/java/perftests/example/brokerconfig/log4j.xml delete mode 100644 qpid/java/perftests/example/brokerconfig/passwd delete mode 100644 qpid/java/perftests/example/config-one-test.json delete mode 100644 qpid/java/perftests/example/config-stress-testing-manyp-c1-with-psfc.json delete mode 100644 qpid/java/perftests/example/config-stress-testing.json delete mode 100644 qpid/java/perftests/example/config-two-tests.json delete mode 100644 qpid/java/perftests/example/log4j-client.properties delete mode 100644 qpid/java/perftests/example/log4j.properties delete mode 100644 qpid/java/perftests/example/perftests-jndi.properties delete mode 100644 qpid/java/perftests/example/perftests.js delete mode 100755 qpid/java/perftests/example/run-client.sh delete mode 100755 qpid/java/perftests/example/run.sh delete mode 100644 qpid/java/perftests/pom.xml delete mode 100644 qpid/java/perftests/src/main/assembly/LICENSE delete mode 100644 qpid/java/perftests/src/main/assembly/NOTICE delete mode 100644 qpid/java/perftests/src/main/assembly/dependency-verification/DEPENDENCIES_REFERENCE delete mode 100644 qpid/java/perftests/src/main/assembly/qpid-perftests-bin.xml delete mode 100644 qpid/java/perftests/src/main/java/json2.js delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/AbstractRunner.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/ArgumentParser.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/Benchmark.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/ClientRunner.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/ConfigFileHelper.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/ControllerRunner.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/DistributedTestConstants.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/DistributedTestException.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/Visitor.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/Client.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ClientCommandVisitor.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ClientState.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ConnectionLostListener.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ConsumerParticipant.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/MessageProvider.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/Participant.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ParticipantExecutor.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ParticipantExecutorRegistry.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ParticipantResultFactory.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ProducerParticipant.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/property/GeneratedPropertySupport.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/property/GeneratedPropertyValue.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/property/ListPropertyValue.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/property/NumericGeneratedPropertySupport.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/property/PropertyValue.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/property/PropertyValueFactory.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/property/RandomPropertyValue.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/property/RangePropertyValue.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/property/SimplePropertyValue.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/utils/ExecutorWithLimits.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/utils/ExecutorWithLimitsFactory.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/utils/ExecutorWithNoLimits.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/utils/ExecutorWithTimeLimit.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/ClientRegistry.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/CommandForClient.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/CommandListener.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/Controller.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/ParticipatingClients.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/ResultsForAllTests.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/TestResult.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/TestRunner.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/TestRunnerFactory.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/ClientConfig.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/Config.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/ConfigReader.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/ConnectionConfig.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/ConsumerConfig.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/IterationValue.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/JavaScriptConfigEvaluator.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/MessageProviderConfig.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/ParticipantConfig.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/ProducerConfig.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/QueueConfig.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/SessionConfig.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/TestConfig.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/TestInstance.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/db/ResultsDbWriter.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/ClientJmsDelegate.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/ControllerJmsDelegate.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/ExistingQueueDrainer.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/JmsMessageAdaptor.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/NoOpQueueCreator.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/QpidQueueCreator.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/QueueCreator.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/json/JsonHandler.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/json/PropertyValueAdapter.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/Command.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CommandType.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ConsumerParticipantResult.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateConnectionCommand.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateConsumerCommand.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateMessageProviderCommand.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateParticpantCommand.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateProducerCommand.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateResponderCommand.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateSessionCommand.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/NoOpCommand.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/OutputAttribute.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ParticipantAttribute.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ParticipantAttributeExtractor.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ParticipantResult.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ProducerParticipantResult.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/RegisterClientCommand.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/Response.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/StartTestCommand.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/StopClientCommand.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/TearDownTestCommand.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/BenchmarkResultWriter.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/ResultsCsvWriter.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/ResultsWriter.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/AggregatedTestResult.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/Aggregator.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/ITestResult.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/ParticipantResultAggregator.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/SeriesStatistics.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/TestResultAggregator.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/formatting/CSVFormatter.java delete mode 100644 qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/formatting/CSVOrderParticipantResultComparator.java delete mode 100644 qpid/java/perftests/src/main/java/test-utils.js delete mode 100644 qpid/java/perftests/src/main/resources/Benchmark.js delete mode 100644 qpid/java/perftests/src/main/resources/perftests.properties delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/ArgumentParserTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/ConfigFileHelperTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/ConfigFileTestHelper.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/PerfTestConstants.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/VisitorTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ClientCommandVisitorTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ClientTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ConsumerParticipantTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/MessageProviderTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ParticipantExecutorTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ParticipantRegistryTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ParticipantResultFactoryTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ParticipantTestHelper.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ProducerParticipantTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/property/ListPropertyValueTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/property/PropertyValueFactoryTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/property/RandomPropertyValueTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/property/RangePropertyValueTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/property/SimplePropertyValueTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/utils/ExecutorWithNoLimitsTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/utils/ExecutorWithTimeLimitTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/ClientRegistryTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/ControllerTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/ParticipatingClientsTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/TestRunnerTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/ClientConfigTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/ConfigReaderTest-test-config.js delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/ConfigReaderTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/ConfigTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/ConfigTestUtils.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/ConnectionConfigTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/ConsumerConfigTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/IterationValueTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/JavaScriptConfigEvaluatorTest-test-config.js delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/JavaScriptConfigEvaluatorTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/MessageProviderConfigTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/ParticipantConfigTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/ProducerConfigTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/SessionConfigTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/TestConfigTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/TestInstanceTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/sampleConfig.json delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/db/ResultsDbWriterTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/jms/JmsMessageAdaptorTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/message/JsonHandlerTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/message/ParticipantResultTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/ResultsFileWriterTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/ResultsTestFixture.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/aggregation/AggregatorTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/aggregation/ParticipantResultAggregatorTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/aggregation/SeriesStatisticsTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/aggregation/TestResultAggregatorTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/formatting/CSVFormatterTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/formatting/CSVOrderParticipantResultComparatorTest.java delete mode 100644 qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/formatting/expectedOutput.csv delete mode 100644 qpid/java/perftests/visualisation-jfc/pom.xml delete mode 100644 qpid/java/perftests/visualisation-jfc/src/main/assembly/qpid-perftests-visualisation-jfc-bin.xml delete mode 100644 qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/ChartType.java delete mode 100644 qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/ChartingException.java delete mode 100644 qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/ChartingUtil.java delete mode 100644 qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/BarChart3DBuilder.java delete mode 100644 qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/BarChartBuilder.java delete mode 100644 qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/BaseChartBuilder.java delete mode 100644 qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/CategoryDataSetBasedChartBuilder.java delete mode 100644 qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/CategoryStrokeAndPaintApplier.java delete mode 100644 qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/ChartBuilder.java delete mode 100644 qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/ChartBuilderFactory.java delete mode 100644 qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/ColorFactory.java delete mode 100644 qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/LineChart3DBuilder.java delete mode 100644 qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/LineChartBuilder.java delete mode 100644 qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/SeriesPainter.java delete mode 100644 qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/SeriesStrokeAndPaintApplier.java delete mode 100644 qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/StatisticalBarChartBuilder.java delete mode 100644 qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/TimeSeriesHolder.java delete mode 100644 qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/TimeSeriesLineChartBuilder.java delete mode 100644 qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/XYDataSetBasedChartBuilder.java delete mode 100644 qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/XYLineChartBuilder.java delete mode 100644 qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/definition/ChartingDefinition.java delete mode 100644 qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/definition/ChartingDefinitionCreator.java delete mode 100644 qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/definition/SeriesDefinition.java delete mode 100644 qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/definition/SeriesDefinitionCreator.java delete mode 100644 qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/seriesbuilder/DatasetHolder.java delete mode 100644 qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/seriesbuilder/JdbcSeriesBuilder.java delete mode 100644 qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/seriesbuilder/JdbcUrlGenerator.java delete mode 100644 qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/seriesbuilder/SeriesBuilder.java delete mode 100644 qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/seriesbuilder/SeriesRow.java delete mode 100644 qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/writer/ChartWriter.java delete mode 100644 qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/chartbuilder/BaseChartBuilderTest.java delete mode 100644 qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/chartbuilder/ChartBuilderFactoryTest.java delete mode 100644 qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/chartbuilder/ChartProductionTest.java delete mode 100644 qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/chartbuilder/ColorFactoryTest.java delete mode 100644 qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/chartbuilder/TimeSeriesBuilderCallbackTest.java delete mode 100644 qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/definition/ChartingDefinitionCreatorTest.java delete mode 100644 qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/definition/SeriesDefinitionCreatorTest.java delete mode 100644 qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/seriesbuilder/JdbcSeriesBuilderTest.java delete mode 100644 qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/seriesbuilder/JdbcUrlGeneratorTest.java delete mode 100644 qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/seriesbuilder/SeriesRowTest.java delete mode 100644 qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/writer/ChartWriterTest.java delete mode 100755 qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/writer/expected-chart-summary.html (limited to 'qpid/java/perftests') diff --git a/qpid/java/perftests/etc/chartdefs/1001-MessageSize-Transient-ByteSec.chartdef b/qpid/java/perftests/etc/chartdefs/1001-MessageSize-Transient-ByteSec.chartdef deleted file mode 100644 index dd8d0f9918..0000000000 --- a/qpid/java/perftests/etc/chartdefs/1001-MessageSize-Transient-ByteSec.chartdef +++ /dev/null @@ -1,37 +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. -# - -chartType=XYLINE -chartTitle=Impact of Message Size Bytes/S -chartSubtitle=Transient messages -chartDescription=1P 1C, single queue, transient, auto-ack, with message payload between 256-262144 bytes ${baselineName}. - -xAxisTitle=Message Size (B) -yAxisTitle=Throughput (KB/s) - -series.1.statement=SELECT payloadSizeB, throughputKbPerS FROM MessageSize WHERE testName like '%TRANSIENT' AND participantName = 'All' -series.1.legend=Current -series.1.dir=${csvCurrentDir} -series.1.colourName=red - -series.2.statement=SELECT payloadSizeB, throughputKbPerS FROM MessageSize WHERE testName like '%TRANSIENT' AND participantName = 'All' -series.2.legend=Baseline ${baselineName} -series.2.dir=${csvBaselineDir} -series.2.colourName=dark_red -series.2.strokeWidth=-1 diff --git a/qpid/java/perftests/etc/chartdefs/1002-MessageSize-Persistent-ByteSec.chartdef b/qpid/java/perftests/etc/chartdefs/1002-MessageSize-Persistent-ByteSec.chartdef deleted file mode 100644 index 42b91bacf8..0000000000 --- a/qpid/java/perftests/etc/chartdefs/1002-MessageSize-Persistent-ByteSec.chartdef +++ /dev/null @@ -1,37 +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. -# - -chartType=XYLINE -chartTitle=Impact of Message Size Bytes/S -chartSubtitle=Persistent messages -chartDescription=1P 1C, single queue, persistent, session-transacted, with message payload between 256-262144 bytes. - -xAxisTitle=Message Size (B) -yAxisTitle=Throughput (KB/s) - -series.1.statement=SELECT payloadSizeB, throughputKbPerS FROM MessageSize WHERE testName like '% PERSISTENT' AND participantName = 'All' -series.1.legend=Current -series.1.dir=${csvCurrentDir} -series.1.colourName=red - -series.2.statement=SELECT payloadSizeB, throughputKbPerS FROM MessageSize WHERE testName like '% PERSISTENT' AND participantName = 'All' -series.2.legend=Baseline ${baselineName} -series.2.dir=${csvBaselineDir} -series.2.colourName=dark_red -series.2.strokeWidth=-1 diff --git a/qpid/java/perftests/etc/chartdefs/1003-MessageSize-Transient-MsgSec.chartdef b/qpid/java/perftests/etc/chartdefs/1003-MessageSize-Transient-MsgSec.chartdef deleted file mode 100644 index bea3be0521..0000000000 --- a/qpid/java/perftests/etc/chartdefs/1003-MessageSize-Transient-MsgSec.chartdef +++ /dev/null @@ -1,37 +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. -# - -chartType=XYLINE -chartTitle=Impact of Message Size -chartSubtitle=Transient messages -chartDescription=1P 1C, single queue, transient, auto-ack, with message payload between 256-262144 bytes. - -xAxisTitle=Message Size (B) -yAxisTitle=Throughput (messages/s) - -series.1.statement=SELECT payloadSizeB, throughputMessagesPerS FROM MessageSize WHERE testName like '%TRANSIENT' AND participantName = 'All' -series.1.legend=Current -series.1.dir=${csvCurrentDir} -series.1.colourName=red - -series.2.statement=SELECT payloadSizeB, throughputMessagesPerS FROM MessageSize WHERE testName like '%TRANSIENT' AND participantName = 'All' -series.2.legend=Baseline ${baselineName} -series.2.dir=${csvBaselineDir} -series.2.colourName=dark_red -series.2.strokeWidth=-1 diff --git a/qpid/java/perftests/etc/chartdefs/1004-MessageSize-Persistent-MsgSec.chartdef b/qpid/java/perftests/etc/chartdefs/1004-MessageSize-Persistent-MsgSec.chartdef deleted file mode 100644 index 993d54c9ca..0000000000 --- a/qpid/java/perftests/etc/chartdefs/1004-MessageSize-Persistent-MsgSec.chartdef +++ /dev/null @@ -1,37 +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. -# - -chartType=XYLINE -chartTitle=Impact of Message Size -chartSubtitle=Persistent messages -chartDescription=1P 1C, single queue, persistent, session-transacted, with message payload between 256-262144 bytes. - -xAxisTitle=Message Size (B) -yAxisTitle=Throughput (messages/s) - -series.1.statement=SELECT payloadSizeB, throughputMessagesPerS FROM MessageSize WHERE testName like '% PERSISTENT' AND participantName = 'All' -series.1.legend=Current -series.1.dir=${csvCurrentDir} -series.2.colourName=red - -series.2.statement=SELECT payloadSizeB, throughputMessagesPerS FROM MessageSize WHERE testName like '% PERSISTENT' AND participantName = 'All' -series.2.legend=Baseline ${baselineName} -series.2.dir=${csvBaselineDir} -series.2.colourName=dark_red -series.2.strokeWidth=-1 diff --git a/qpid/java/perftests/etc/chartdefs/1015-VaryingNumberOfProducers-SessionTrans.chartdef b/qpid/java/perftests/etc/chartdefs/1015-VaryingNumberOfProducers-SessionTrans.chartdef deleted file mode 100644 index 0d11f7014b..0000000000 --- a/qpid/java/perftests/etc/chartdefs/1015-VaryingNumberOfProducers-SessionTrans.chartdef +++ /dev/null @@ -1,57 +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. -# - -chartType=XYLINE -chartTitle=Varying number of producers - transacted -chartSubtitle=Persistent 1KB messages -chartDescription=1,2,5,10,20,40 P/Cs, single queue, persistent, transacted, with message payload 1KB. - -xAxisTitle=Producers -yAxisTitle=Throughput (messages/s) - -series.1.statement=SELECT totalNumberOfProducers, throughputMessagesPerS FROM VaryingNumberOfParticipants WHERE participantName = 'All' and totalNumberOfConsumers = '1' and acknowledgeMode = '0' -series.1.legend=1 Consumer -series.1.dir=${csvCurrentDir} -series.1.colourName=red - -series.2.statement=SELECT totalNumberOfProducers, throughputMessagesPerS FROM VaryingNumberOfParticipants WHERE participantName = 'All' and totalNumberOfConsumers = '5' and acknowledgeMode = '0' -series.2.legend=5 Consumer -series.2.dir=${csvCurrentDir} -series.2.colourName=blue - -series.3.statement=SELECT totalNumberOfProducers, throughputMessagesPerS FROM VaryingNumberOfParticipants WHERE participantName = 'All' and totalNumberOfConsumers = '10' and acknowledgeMode = '0' -series.3.legend=10 Consumer -series.3.dir=${csvCurrentDir} -series.3.colourName=green - -series.4.statement=SELECT totalNumberOfProducers, throughputMessagesPerS FROM VaryingNumberOfParticipants WHERE participantName = 'All' and totalNumberOfConsumers = '20' and acknowledgeMode = '0' -series.4.legend=20 Consumer -series.4.dir=${csvCurrentDir} -series.4.colourName=magenta - -series.5.statement=SELECT totalNumberOfProducers, throughputMessagesPerS FROM VaryingNumberOfParticipants WHERE participantName = 'All' and totalNumberOfConsumers = '40' and acknowledgeMode = '0' -series.5.legend=40 Consumer -series.5.dir=${csvCurrentDir} -series.5.colourName=orange - -series.6.statement=SELECT totalNumberOfProducers, throughputMessagesPerS FROM VaryingNumberOfParticipants WHERE participantName = 'All' and totalNumberOfConsumers = '1' and acknowledgeMode = '0' -series.6.legend=1 Consumer (baseline ${baselineName}) -series.6.dir=${csvBaselineDir} -series.6.colourName=dark_red -series.6.strokeWidth=-1 diff --git a/qpid/java/perftests/etc/chartdefs/1016-VaryingNumberOfConsumers-SessionTrans.chartdef b/qpid/java/perftests/etc/chartdefs/1016-VaryingNumberOfConsumers-SessionTrans.chartdef deleted file mode 100644 index bd3f6a457a..0000000000 --- a/qpid/java/perftests/etc/chartdefs/1016-VaryingNumberOfConsumers-SessionTrans.chartdef +++ /dev/null @@ -1,57 +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. -# - -chartType=XYLINE -chartTitle=Varying number of consumers - transacted -chartSubtitle=Persistent 1KB messages -chartDescription=1,2,5,10,20,40 P/Cs, single queue, persistent, transacted, with message payload 1KB. - -xAxisTitle=Consumers -yAxisTitle=Throughput (messages/s) - -series.1.statement=SELECT totalNumberOfConsumers, throughputMessagesPerS FROM VaryingNumberOfParticipants WHERE participantName = 'All' and totalNumberOfProducers = '1' and acknowledgeMode = '0' -series.1.legend=1 Producer -series.1.dir=${csvCurrentDir} -series.1.colourName=blue - -series.2.statement=SELECT totalNumberOfConsumers, throughputMessagesPerS FROM VaryingNumberOfParticipants WHERE participantName = 'All' and totalNumberOfProducers = '5' and acknowledgeMode = '0' -series.2.legend=5 Producers -series.2.dir=${csvCurrentDir} -series.2.colourName=green - -series.3.statement=SELECT totalNumberOfConsumers, throughputMessagesPerS FROM VaryingNumberOfParticipants WHERE participantName = 'All' and totalNumberOfProducers = '10' and acknowledgeMode = '0' -series.3.legend=10 Producers -series.3.dir=${csvCurrentDir} -series.3.colourName=red - -series.4.statement=SELECT totalNumberOfConsumers, throughputMessagesPerS FROM VaryingNumberOfParticipants WHERE participantName = 'All' and totalNumberOfProducers = '20' and acknowledgeMode = '0' -series.4.legend=20 Producers -series.4.dir=${csvCurrentDir} -series.4.colourName=magenta - -series.5.statement=SELECT totalNumberOfConsumers, throughputMessagesPerS FROM VaryingNumberOfParticipants WHERE participantName = 'All' and totalNumberOfProducers = '40' and acknowledgeMode = '0' -series.5.legend=40 Producers -series.5.dir=${csvCurrentDir} -series.5.colourName=yellow - -series.6.statement=SELECT totalNumberOfConsumers, throughputMessagesPerS FROM VaryingNumberOfParticipants WHERE participantName = 'All' and totalNumberOfProducers = '10' and acknowledgeMode = '0' -series.6.legend=10 Producers (baseline ${baselineName}) -series.6.dir=${csvBaselineDir} -series.6.colourName=dark_red -series.6.strokeWidth=-1 diff --git a/qpid/java/perftests/etc/chartdefs/1021-AcknowledgementModes-Persistent.chartdef b/qpid/java/perftests/etc/chartdefs/1021-AcknowledgementModes-Persistent.chartdef deleted file mode 100644 index 5028ce17fc..0000000000 --- a/qpid/java/perftests/etc/chartdefs/1021-AcknowledgementModes-Persistent.chartdef +++ /dev/null @@ -1,38 +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. -# - -chartType=BAR -chartTitle=Performance of acknowledgement modes -chartSubtitle=Persistent messages (1KB) -chartDescription=1P 1C, single queue, persistent, with message payload 1KB. - -xAxisTitle=Acknowledge mode (0=session transacted; 1=auto-acknowledge) -yAxisTitle=Throughput (messages/s) - -series.1.statement=SELECT acknowledgeMode, throughputMessagesPerS FROM AcknowledgementModes WHERE testName like 'Persistent%' AND participantName = 'All' ORDER BY acknowledgeMode -series.1.legend=Current -series.1.dir=${csvCurrentDir} -series.1.colourName=blue - - -series.2.statement=SELECT acknowledgeMode, throughputMessagesPerS FROM AcknowledgementModes WHERE testName like 'Persistent%' AND participantName = 'All' ORDER BY acknowledgeMode -series.2.legend=Baseline ${baselineName} -series.2.dir=${csvBaselineDir} -series.2.colourName=dark_red - diff --git a/qpid/java/perftests/etc/chartdefs/1022-AcknowledgementModes-Transient.chartdef b/qpid/java/perftests/etc/chartdefs/1022-AcknowledgementModes-Transient.chartdef deleted file mode 100644 index 88d5cd9137..0000000000 --- a/qpid/java/perftests/etc/chartdefs/1022-AcknowledgementModes-Transient.chartdef +++ /dev/null @@ -1,36 +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. -# - -chartType=BAR -chartTitle=Performance of acknowledgement modes -chartSubtitle=Transient messages (1024b) -chartDescription=1P 1C, single queue, transient, with message payload 1KB. - -xAxisTitle=Acknowledge mode (0=session transacted; 1=auto-acknowledge) -yAxisTitle=Throughput (messages/s) - -series.1.statement=SELECT acknowledgeMode, throughputMessagesPerS FROM AcknowledgementModes WHERE testName like 'Transient%' AND participantName = 'All' ORDER BY acknowledgeMode -series.1.legend=Current -series.1.dir=${csvCurrentDir} -series.1.colourName=blue - -series.2.statement=SELECT acknowledgeMode, throughputMessagesPerS FROM AcknowledgementModes WHERE testName like 'Transient%' AND participantName = 'All' ORDER BY acknowledgeMode -series.2.legend=Baseline ${baselineName} -series.2.dir=${csvBaselineDir} -series.2.colourName=dark_red diff --git a/qpid/java/perftests/etc/chartdefs/1030-BatchSize-Equal.chartdef b/qpid/java/perftests/etc/chartdefs/1030-BatchSize-Equal.chartdef deleted file mode 100644 index cfc5efb71c..0000000000 --- a/qpid/java/perftests/etc/chartdefs/1030-BatchSize-Equal.chartdef +++ /dev/null @@ -1,37 +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. -# - -chartType=XYLINE -chartTitle=Transaction Batch Sizes Equal -chartSubtitle=Persistent 1KB messages -chartDescription=1P 1C, single queue, persistent, transacted with message payload 1KB with producer/consumer batch size varying between 1-400 messages for both P and C. - -xAxisTitle=Batch Size -yAxisTitle=Throughput (messages/s) - -series.1.statement=SELECT batchSize, throughputMessagesPerS FROM BatchSize WHERE participantName = 'All' -series.1.legend=Equal Producer/Consumer -series.1.dir=${csvCurrentDir} -series.1.colourName=red - -series.2.statement=SELECT batchSize, throughputMessagesPerS FROM BatchSize WHERE participantName = 'All' -series.2.legend=Equal Producer/Consumer (Baseline ${baselineName}) -series.2.dir=${csvBaselineDir} -series.2.colourName=dark_red -series.2.strokeWidth=-1 diff --git a/qpid/java/perftests/etc/chartdefs/1031-BatchSize-Unequal.chartdef b/qpid/java/perftests/etc/chartdefs/1031-BatchSize-Unequal.chartdef deleted file mode 100644 index ac8de3d290..0000000000 --- a/qpid/java/perftests/etc/chartdefs/1031-BatchSize-Unequal.chartdef +++ /dev/null @@ -1,53 +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. -# - -chartType=XYLINE -chartTitle=Transaction Batch Size Unequal -chartSubtitle=Persistent 1KB messages -chartDescription=1P 1C, single queue, persistent, transacted with message payload 1KB with fixed batch size 1 for one party whilst other varies between 1-400 messages. - -xAxisTitle=Batch Size -yAxisTitle=Throughput (messages/s) - -# -# If csvjdbc could do sub-selects (allowing us to extract the consumer/producer batch size from the All Consumers/All Producers rows), -# we would not need the workaround where we have testdef place the consumer/producer batch size into testName field -# - -series.1.statement=SELECT testName, throughputMessagesPerS FROM BatchSizeProducerVaries WHERE participantName = 'All' -series.1.legend=Variable Producer, Fixed Consumer -series.1.dir=${csvCurrentDir} -series.1.colourName=red - -series.2.statement=SELECT testName, throughputMessagesPerS FROM BatchSizeProducerVaries WHERE participantName = 'All' -series.2.legend=Variable Producer, Fixed Consumer (Baseline ${baselineName}) -series.2.dir=${csvBaselineDir} -series.2.colourName=dark_red -series.2.strokeWidth=-1 - -series.3.statement=SELECT testName, throughputMessagesPerS FROM BatchSizeConsumerVaries WHERE participantName = 'All' -series.3.legend=Fixed Producer, Variable Consumer -series.3.dir=${csvCurrentDir} -series.3.colourName=blue - -series.4.statement=SELECT testName, throughputMessagesPerS FROM BatchSizeConsumerVaries WHERE participantName = 'All' -series.4.legend=Fixed Producer, Variable Consumer (Baseline ${baselineName}) -series.4.dir=${csvBaselineDir} -series.4.colourName=dark_blue -series.4.strokeWidth=-1 diff --git a/qpid/java/perftests/etc/chartdefs/1040-QueueTypes.chartdef b/qpid/java/perftests/etc/chartdefs/1040-QueueTypes.chartdef deleted file mode 100644 index 64fbda8953..0000000000 --- a/qpid/java/perftests/etc/chartdefs/1040-QueueTypes.chartdef +++ /dev/null @@ -1,36 +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. -# - -chartType=BAR -chartTitle=Queue Types -chartSubtitle=Persistent 1KB messages -chartDescription=1P 1C, single queue, persistent, session-transacted with message payload 1KB. Sorted queue - 160,000 random keys, Priority - iteriates priority 0..9. - -xAxisTitle=Queue Types -yAxisTitle=Throughput (messages/s) - -series.1.statement=SELECT testName, throughputMessagesPerS FROM QueueTypes WHERE participantName = 'All' -series.1.legend=Current -series.1.dir=${csvCurrentDir} -series.1.colourName=blue - -series.2.statement=SELECT testName, throughputMessagesPerS FROM QueueTypes WHERE participantName = 'All' -series.2.legend=Baseline ${baselineName} -series.2.dir=${csvBaselineDir} -series.2.colourName=dark_red diff --git a/qpid/java/perftests/etc/chartdefs/1050-VaryingNumberOfProducerSessionsSingleConnection.chartdef b/qpid/java/perftests/etc/chartdefs/1050-VaryingNumberOfProducerSessionsSingleConnection.chartdef deleted file mode 100644 index 7aeeb37508..0000000000 --- a/qpid/java/perftests/etc/chartdefs/1050-VaryingNumberOfProducerSessionsSingleConnection.chartdef +++ /dev/null @@ -1,49 +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. -# - -chartType=XYLINE -chartTitle=Varying number of producer sessions on single connection -chartSubtitle=Persistent messages (1024b) -chartDescription=1-80P single queue, transacted on single connection, 20C transacted on separate connections, persistent, message payload 1KB. - -xAxisTitle=Number of producer sessions -yAxisTitle=Throughput (KB/s) - -# testName contains the number of sessions -series.1.statement=SELECT testName, throughputKbPerS FROM VaryingNumberOfProducerSessionsSingleConnection WHERE participantName = 'All' -series.1.legend=Current - End-to-end throughput -series.1.dir=${csvCurrentDir} -series.1.colourName=red - -series.2.statement=SELECT testName, throughputKbPerS FROM VaryingNumberOfProducerSessionsSingleConnection WHERE participantName = 'All Producers' -series.2.legend=Current - Producer only throughput -series.2.dir=${csvCurrentDir} -series.2.colourName=blue - -series.3.statement=SELECT testName, throughputKbPerS FROM VaryingNumberOfProducerSessionsSingleConnection WHERE participantName = 'All' -series.3.legend=Baseline ${baselineName} - End-to-end throughput -series.3.dir=${csvBaselineDir} -series.3.colourName=dark_red -series.3.strokeWidth=-1 - -series.4.statement=SELECT testName, throughputKbPerS FROM VaryingNumberOfProducerSessionsSingleConnection WHERE participantName = 'All Producers' -series.4.legend=Baseline ${baselineName} - Producer only throughput -series.4.dir=${csvBaselineDir} -series.4.colourName=dark_blue -series.4.strokeWidth=-1 diff --git a/qpid/java/perftests/etc/chartdefs/1060-SSLConnections.chartdef b/qpid/java/perftests/etc/chartdefs/1060-SSLConnections.chartdef deleted file mode 100644 index 90cb06d5c7..0000000000 --- a/qpid/java/perftests/etc/chartdefs/1060-SSLConnections.chartdef +++ /dev/null @@ -1,49 +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. -# - -chartType=LINE -chartTitle=Effect of SSL - transacted -chartSubtitle=Persistent 1KB messages -chartDescription=Matching number of P/Cs, single queue, persistent, transacted, with message payload 1KB. - -xAxisTitle=Number of producers and consumers on separate connections -yAxisTitle=Throughput (messages/s) - -series.1.statement=SELECT totalNumberOfProducers, throughputMessagesPerS FROM VaryingNumberOfParticipants WHERE participantName = 'All' and totalNumberOfConsumers = totalNumberOfProducers and acknowledgeMode = '0' -series.1.legend=Plain -series.1.dir=${csvCurrentDir} -series.1.colourName=red - -series.2.statement=SELECT totalNumberOfProducers, throughputMessagesPerS FROM VaryingNumberOfParticipants WHERE participantName = 'All' and totalNumberOfConsumers = totalNumberOfProducers and acknowledgeMode = '0' -series.2.legend=Plain (baseline ${baselineName}) -series.2.dir=${csvBaselineDir} -series.2.colourName=dark_red -series.2.strokeWidth=-1 - -series.3.statement=SELECT totalNumberOfProducers, throughputMessagesPerS FROM VaryingNumberOfParticipantsSSL WHERE participantName = 'All' and totalNumberOfConsumers = totalNumberOfProducers and acknowledgeMode = '0' -series.3.legend=SSL -series.3.dir=${csvCurrentDir} -series.3.colourName=blue - -series.4.statement=SELECT totalNumberOfProducers, throughputMessagesPerS FROM VaryingNumberOfParticipantsSSL WHERE participantName = 'All' and totalNumberOfConsumers = totalNumberOfProducers and acknowledgeMode = '0' -series.4.legend=SSL (baseline ${baselineName}) -series.4.dir=${csvBaselineDir} -series.4.colourName=dark_blue -series.4.strokeWidth=-1 - diff --git a/qpid/java/perftests/etc/chartdefs/1300-QueueConsumersWithNonOverlappingSelectors-Transient.chartdef b/qpid/java/perftests/etc/chartdefs/1300-QueueConsumersWithNonOverlappingSelectors-Transient.chartdef deleted file mode 100644 index d806acda4b..0000000000 --- a/qpid/java/perftests/etc/chartdefs/1300-QueueConsumersWithNonOverlappingSelectors-Transient.chartdef +++ /dev/null @@ -1,37 +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. -# - -chartType=XYLINE -chartTitle=Impact of non-overlapping selectors on queue consumers with transient messages -chartSubtitle=Transient 1KB messages -xAxisTitle=Consumers -yAxisTitle=Throughput (messages/s) -chartDescription=Impact of non-overlapping selectors on queue consumers with single queue, transient messages, auto-ack, message payload of 1024 bytes, 1 producer, varying number of consumers from 1 to 32. - -series.1.statement=SELECT totalNumberOfConsumers, throughputMessagesPerS FROM QueueConsumersWithNonOverlappingSelectors WHERE participantName = 'All' and testName like '%non overlapping - NON_PERSISTENT%' -series.1.legend=Current -series.1.dir=${csvCurrentDir} -series.1.colourName=blue - -series.2.statement=SELECT totalNumberOfConsumers, throughputMessagesPerS FROM QueueConsumersWithNonOverlappingSelectors WHERE participantName = 'All' and testName like '%non overlapping - NON_PERSISTENT%' -series.2.legend=Baseline ${baselineName} -series.2.dir=${csvBaselineDir} -series.2.colourName=dark_red -series.2.stokeWidth=-1 - diff --git a/qpid/java/perftests/etc/chartdefs/1301-QueueConsumersWithNonOverlappingSelectors-Persistent.chartdef b/qpid/java/perftests/etc/chartdefs/1301-QueueConsumersWithNonOverlappingSelectors-Persistent.chartdef deleted file mode 100644 index 94b354a3c4..0000000000 --- a/qpid/java/perftests/etc/chartdefs/1301-QueueConsumersWithNonOverlappingSelectors-Persistent.chartdef +++ /dev/null @@ -1,43 +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. -# - -chartType=XYLINE -chartTitle=Impact of non-overlapping selectors on queue consumers with persistent messages -chartSubtitle=Persistent 1KB messages -xAxisTitle=Consumers -yAxisTitle=Throughput (messages/s) -chartDescription=Impact of non-overlapping selectors on queue consumers with single queue, persistent messages, session-transacted, message payload of 1024 bytes, 1 producer, varying number of consumers from 1 to 32. - - -series.1.statement=SELECT totalNumberOfConsumers, throughputMessagesPerS FROM QueueConsumersWithNonOverlappingSelectors WHERE participantName = 'All' and testName like '%non overlapping - PERSISTENT' -series.1.legend=Current -series.1.dir=${csvCurrentDir} -series.1.colourName=blue - -series.2.statement=SELECT totalNumberOfConsumers, throughputMessagesPerS FROM QueueConsumersWithNonOverlappingSelectors WHERE participantName = 'All' and testName like '%non overlapping - PERSISTENT' -series.2.legend=Baseline ${baselineName} -series.2.dir=${csvBaselineDir} -series.2.colourName=dark_red -series.2.stokeWidth=-1 - -series.3.statement=SELECT totalNumberOfConsumers, throughputMessagesPerS FROM VaryingNumberOfParticipants WHERE participantName = 'All' and totalNumberOfProducers = '1' and acknowledgeMode = '1' -series.3.legend=Current: no selectors -series.3.dir=${csvCurrentDir} -series.3.colourName=green - diff --git a/qpid/java/perftests/etc/chartdefs/1302-QueueConsumersWithOverlappingSelectors-Transient.chartdef b/qpid/java/perftests/etc/chartdefs/1302-QueueConsumersWithOverlappingSelectors-Transient.chartdef deleted file mode 100644 index 319485ffba..0000000000 --- a/qpid/java/perftests/etc/chartdefs/1302-QueueConsumersWithOverlappingSelectors-Transient.chartdef +++ /dev/null @@ -1,36 +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. -# - -chartType=XYLINE -chartTitle=Impact of 50%-overlapping selectors in queue consumers with transient messages -chartSubtitle=Transient 1KB messages -xAxisTitle=Consumers -yAxisTitle=Throughput (messages/s) -chartDescription=Impact of 50%-overlapping selectors in queue consumers with single queue, transient messages, auto-ack, message payload 1KB, 1 producer, varying number of consumers from 2 to 32. - -series.1.statement=SELECT totalNumberOfConsumers,throughputMessagesPerS FROM QueueConsumersWithOverlappingSelectors WHERE participantName = 'All' and testName like '%50_ overlapping - NON_PERSISTENT%' -series.1.legend=Current -series.1.dir=${csvCurrentDir} -series.1.colourName=blue - -series.2.statement=SELECT totalNumberOfConsumers, throughputMessagesPerS FROM QueueConsumersWithOverlappingSelectors WHERE participantName = 'All' and testName like '%50_ overlapping - NON_PERSISTENT%' -series.2.legend=Baseline ${baselineName} -series.2.dir=${csvBaselineDir} -series.2.colourName=dark_red -series.2.stokeWidth=-1 diff --git a/qpid/java/perftests/etc/chartdefs/1303-QueueConsumersWithOverlappingSelectors-Persistent.chartdef b/qpid/java/perftests/etc/chartdefs/1303-QueueConsumersWithOverlappingSelectors-Persistent.chartdef deleted file mode 100644 index 17cfee2e62..0000000000 --- a/qpid/java/perftests/etc/chartdefs/1303-QueueConsumersWithOverlappingSelectors-Persistent.chartdef +++ /dev/null @@ -1,42 +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. -# - -chartType=XYLINE -chartTitle=Impact of 50%-overlapping selectors in queue consumers with persistent messages -chartDescription=Impact of 50%-overlapping selectors in queue consumers with single queue, persistent messages, session-transacted, message payload of 1KB, 1 producer, varying number of consumers from 2 to 32. -chartSubtitle=Persistent 1KB messages -xAxisTitle=Consumers -yAxisTitle=Throughput (messages/s) - -series.1.statement=SELECT totalNumberOfConsumers, throughputMessagesPerS FROM QueueConsumersWithOverlappingSelectors WHERE participantName = 'All' and testName like '%50_ overlapping - PERSISTENT%' -series.1.legend=Current -series.1.dir=${csvCurrentDir} -series.1.colourName=blue - -series.2.statement=SELECT totalNumberOfConsumers, throughputMessagesPerS FROM QueueConsumersWithOverlappingSelectors WHERE participantName = 'All' and testName like '%50_ overlapping - PERSISTENT%' -series.2.legend=Baseline ${baselineName} -series.2.dir=${csvBaselineDir} -series.2.colourName=dark_red -series.2.stokeWidth=-1 - -series.3.statement=SELECT totalNumberOfConsumers, throughputMessagesPerS FROM VaryingNumberOfParticipants WHERE participantName = 'All' and totalNumberOfProducers = '1' and acknowledgeMode = '1' -series.3.legend=Current: no selectors -series.3.dir=${csvCurrentDir} -series.3.colourName=green - diff --git a/qpid/java/perftests/etc/chartdefs/1500-Topic-NumberOfConsumers.chartdef b/qpid/java/perftests/etc/chartdefs/1500-Topic-NumberOfConsumers.chartdef deleted file mode 100644 index 22b6f4c9ca..0000000000 --- a/qpid/java/perftests/etc/chartdefs/1500-Topic-NumberOfConsumers.chartdef +++ /dev/null @@ -1,37 +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. -# - -chartType=XYLINE -chartTitle=Number of topic consumers -chartSubtitle=Transient 1KB messages -chartDescription=1P 1-100C single topic, transient, transacted, with message payload 1KB. - -xAxisTitle=Numer of consumers -yAxisTitle=Throughput (messages/s) - -series.1.statement=SELECT totalNumberOfConsumers, throughputMessagesPerS FROM Topic-NumberOfConsumers WHERE participantName = 'All' -series.1.legend=Current -series.1.dir=${csvCurrentDir} -series.1.colourName=red - -series.2.statement=SELECT totalNumberOfConsumers, throughputMessagesPerS FROM Topic-NumberOfConsumers WHERE participantName = 'All' -series.2.legend=Baseline ${baselineName} -series.2.dir=${csvBaselineDir} -series.2.colourName=dark_red -series.2.strokeWidth=-1 diff --git a/qpid/java/perftests/etc/chartdefs/1501-Topic-NumberOfTopics.chartdef b/qpid/java/perftests/etc/chartdefs/1501-Topic-NumberOfTopics.chartdef deleted file mode 100644 index c0a67243dc..0000000000 --- a/qpid/java/perftests/etc/chartdefs/1501-Topic-NumberOfTopics.chartdef +++ /dev/null @@ -1,37 +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. -# - -chartType=XYLINE -chartTitle=Number of topics -chartSubtitle=Transient 1KB messages -chartDescription=1,10,50,100 PC, single topic, transient, transacted, with each PC pair having own topic, message payload 1KB. - -xAxisTitle=Numer of topics -yAxisTitle=Throughput (messages/s) - -series.1.statement=SELECT totalNumberOfProducers, throughputMessagesPerS FROM Topic-NumberOfTopics WHERE participantName = 'All' -series.1.legend=Current -series.1.dir=${csvCurrentDir} -series.1.colourName=red - -series.2.statement=SELECT totalNumberOfProducers, throughputMessagesPerS FROM Topic-NumberOfTopics WHERE participantName = 'All' -series.2.legend=Baseline ${baselineName} -series.2.dir=${csvBaselineDir} -series.2.colourName=dark_red -series.2.strokeWidth=-1 diff --git a/qpid/java/perftests/etc/chartdefs/1502-Topic-Persistence.chartdef b/qpid/java/perftests/etc/chartdefs/1502-Topic-Persistence.chartdef deleted file mode 100644 index 1a60ced1cf..0000000000 --- a/qpid/java/perftests/etc/chartdefs/1502-Topic-Persistence.chartdef +++ /dev/null @@ -1,37 +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. -# - -chartType=BAR -chartTitle=Topic transient/durable subscriptions -chartSubtitle=1KB messages -chartDescription=1P 10C, single topic, transacted, message payload 1KB, transient messages on non-durable sub, persistent messages on durable sub. - -xAxisTitle=Subscription type (true durable, false non durable) -yAxisTitle=Throughput (messages/s) - -series.1.statement=SELECT isDurableSubscription, throughputMessagesPerS FROM Topic-Persistence WHERE participantName = 'All Consumers' -series.1.legend=Current -series.1.dir=${csvCurrentDir} -series.1.colourName=blue - -series.2.statement=SELECT isDurableSubscription, throughputMessagesPerS FROM Topic-Persistence WHERE participantName = 'All Consumers' -series.2.legend=Baseline ${baselineName} -series.2.dir=${csvBaselineDir} -series.2.colourName=dark_red -series.2.stokeWidth=2 diff --git a/qpid/java/perftests/etc/chartdefs/1503-Topic-AckModes.chartdef b/qpid/java/perftests/etc/chartdefs/1503-Topic-AckModes.chartdef deleted file mode 100644 index c6decf0c4c..0000000000 --- a/qpid/java/perftests/etc/chartdefs/1503-Topic-AckModes.chartdef +++ /dev/null @@ -1,37 +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. -# - -chartType=BAR -chartTitle=Topic acknowledge modes -chartSubtitle=Transient 1KB messages -chartDescription=1P 10C, single topic, transient, non-durable subscription, message payload 1KB. - -xAxisTitle=Ack Mode (0=transaction 1=auto-ack) -yAxisTitle=Throughput (messages/s) - -series.1.statement=SELECT acknowledgeMode, throughputMessagesPerS FROM Topic-AckModes WHERE participantName = 'All' -series.1.legend=Current -series.1.dir=${csvCurrentDir} -series.1.colourName=blue - -series.2.statement=SELECT acknowledgeMode, throughputMessagesPerS FROM Topic-AckModes WHERE participantName = 'All' -series.2.legend=Baseline ${baselineName} -series.2.dir=${csvBaselineDir} -series.2.colourName=dark_red -series.2.stokeWidth=2 diff --git a/qpid/java/perftests/etc/chartdefs/2001-Latency-MessageSize-Transient.chartdef b/qpid/java/perftests/etc/chartdefs/2001-Latency-MessageSize-Transient.chartdef deleted file mode 100644 index 7d0738fd7b..0000000000 --- a/qpid/java/perftests/etc/chartdefs/2001-Latency-MessageSize-Transient.chartdef +++ /dev/null @@ -1,41 +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. -# - -chartType=STATISTICAL_BAR -chartTitle=Impact of message size on latency -chartSubtitle=Transient messages -chartDescription=1P 1C, single queue, transient, auto-ack, with message payload between 256-262144 bytes. - -xAxisTitle=Message Size (B) -yAxisTitle=Latency (millis) - -series.1.statement=SELECT payloadSizeB, averageLatency,latencyStandardDeviation FROM Latency-MessageSize WHERE testName like '%TRANSIENT' AND participantName = 'All Consumers' -series.1.legend=Average latency -series.1.dir=${csvCurrentDir} -series.1.colourName=red - -series.2.statement=SELECT payloadSizeB, averageLatency,latencyStandardDeviation FROM Latency-MessageSize WHERE testName like '%TRANSIENT' AND participantName = 'All Consumers' -series.2.legend=Average latency (baseline ${baselineName}) -series.2.dir=${csvBaselineDir} -series.2.colourName=dark_red - -series.3.statement=SELECT payloadSizeB, minLatency, 0 FROM Latency-MessageSize WHERE testName like '%TRANSIENT' AND participantName = 'All Consumers' -series.3.legend=Minimum latency -series.3.dir=${csvCurrentDir} -series.3.colourName=green diff --git a/qpid/java/perftests/etc/chartdefs/2002-Latency-MessageSize-Persistent.chartdef b/qpid/java/perftests/etc/chartdefs/2002-Latency-MessageSize-Persistent.chartdef deleted file mode 100644 index 5fd5a3c414..0000000000 --- a/qpid/java/perftests/etc/chartdefs/2002-Latency-MessageSize-Persistent.chartdef +++ /dev/null @@ -1,41 +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. -# - -chartType=STATISTICAL_BAR -chartTitle=Impact of message size on latency -chartSubtitle=Persistent messages -chartDescription=1P 1C, single queue, persistent, session-transacted, with message payload between 256-262144 bytes. - -xAxisTitle=Message Size (B) -yAxisTitle=Latency (millis) - -series.1.statement=SELECT payloadSizeB, averageLatency, latencyStandardDeviation FROM Latency-MessageSize WHERE testName like '%PERSISTENT' AND participantName = 'All Consumers' -series.1.legend=Average latency -series.1.dir=${csvCurrentDir} -series.1.colourName=red - -series.2.statement=SELECT payloadSizeB, averageLatency, latencyStandardDeviation FROM Latency-MessageSize WHERE testName like '%PERSISTENT' AND participantName = 'All Consumers' -series.2.legend=Average latency (baseline ${baselineName}) -series.2.dir=${csvBaselineDir} -series.2.colourName=dark_red - -series.3.statement=SELECT payloadSizeB, minLatency, 0 FROM Latency-MessageSize WHERE testName like '%PERSISTENT' AND participantName = 'All Consumers' -series.3.legend=Minimum latency -series.3.dir=${csvCurrentDir} -series.3.colourName=green diff --git a/qpid/java/perftests/etc/chartdefs/2031-Latency-VaryingNumberOfParticipants.chartdef b/qpid/java/perftests/etc/chartdefs/2031-Latency-VaryingNumberOfParticipants.chartdef deleted file mode 100644 index 91d3cbe0f7..0000000000 --- a/qpid/java/perftests/etc/chartdefs/2031-Latency-VaryingNumberOfParticipants.chartdef +++ /dev/null @@ -1,51 +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. -# - -chartType=STATISTICAL_BAR -chartTitle=Latency, varying number of participants -chartSubtitle=Persistent 1KB messages -chartDescription=1,2,5,10 P/Cs, single queue, persistent, session-transacted, with message payload 1KB. - -xAxisTitle=Consumers -yAxisTitle=Latency (millis) - -series.1.statement=SELECT totalNumberOfConsumers, averageLatency,latencyStandardDeviation FROM Latency-VaryingNumberOfParticipants WHERE participantName = 'All Consumers' and testName like '% - 1 producer - PERSISTENT' -series.1.legend=1 producer -series.1.dir=${csvCurrentDir} -series.1.colourName=blue - -series.2.statement=SELECT totalNumberOfConsumers, averageLatency,latencyStandardDeviation FROM Latency-VaryingNumberOfParticipants WHERE participantName = 'All Consumers' and testName like '% - 2 producers - PERSISTENT' -series.2.legend=2 producers -series.2.dir=${csvCurrentDir} -series.2.colourName=green - -series.3.statement=SELECT totalNumberOfConsumers, averageLatency,latencyStandardDeviation FROM Latency-VaryingNumberOfParticipants WHERE participantName = 'All Consumers' and testName like '% - 5 producers - PERSISTENT' -series.3.legend=5 producers -series.3.dir=${csvCurrentDir} -series.3.colourName=magenta - -series.4.statement=SELECT totalNumberOfConsumers, averageLatency,latencyStandardDeviation FROM Latency-VaryingNumberOfParticipants WHERE participantName = 'All Consumers' and testName like '% - 10 producers - PERSISTENT' -series.4.legend=10 producers -series.4.dir=${csvCurrentDir} -series.4.colourName=red - -series.5.statement=SELECT totalNumberOfConsumers, averageLatency,latencyStandardDeviation FROM Latency-VaryingNumberOfParticipants WHERE participantName = 'All Consumers' and testName like '% - 10 producers - PERSISTENT' -series.5.legend=10 producers (baseline ${baselineName}) -series.5.dir=${csvBaselineDir} -series.5.colourName=dark_red diff --git a/qpid/java/perftests/etc/chartdefs/timeseries/1001-Large-Messages-Transient.chartdef b/qpid/java/perftests/etc/chartdefs/timeseries/1001-Large-Messages-Transient.chartdef deleted file mode 100644 index e77f7b4eff..0000000000 --- a/qpid/java/perftests/etc/chartdefs/timeseries/1001-Large-Messages-Transient.chartdef +++ /dev/null @@ -1,29 +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. -# - -chartType=TIMELINE -chartTitle=Large transient messages -chartDescription=1P 1C, transient, auto-ack, with message payload 65536 bytes. - -xAxisTitle=Date -yAxisTitle=Throughput (KB/s) - -series.1.statement=SELECT insertedTimestamp, throughputKbPerS FROM RESULTS WHERE participantName = 'All' AND testName = 'Message Size - 1P-1C - TRANSIENT' and payloadSizeB = 65536 -series.1.colourName=red -series.1.legend=Throughput diff --git a/qpid/java/perftests/etc/chartdefs/timeseries/1002-Large-Messages-Persistent.chartdef b/qpid/java/perftests/etc/chartdefs/timeseries/1002-Large-Messages-Persistent.chartdef deleted file mode 100644 index ffcf8c26b8..0000000000 --- a/qpid/java/perftests/etc/chartdefs/timeseries/1002-Large-Messages-Persistent.chartdef +++ /dev/null @@ -1,29 +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. -# - -chartType=TIMELINE -chartTitle=Large persistent messages -chartDescription=1P 1C, persistent, auto-ack, with message payload 65536 bytes. - -xAxisTitle=Date -yAxisTitle=Throughput (KB/s) - -series.1.statement=SELECT insertedTimestamp, throughputKbPerS FROM RESULTS WHERE participantName = 'All' AND testName = 'Message Size - 1P-1C - PERSISTENT' and payloadSizeB = 65536 -series.1.colourName=red -series.1.legend=Throughput diff --git a/qpid/java/perftests/etc/chartdefs/timeseries/1011-MultipleProducersAndConsumers-Persistent.chartdef b/qpid/java/perftests/etc/chartdefs/timeseries/1011-MultipleProducersAndConsumers-Persistent.chartdef deleted file mode 100644 index 8f9b4cec9c..0000000000 --- a/qpid/java/perftests/etc/chartdefs/timeseries/1011-MultipleProducersAndConsumers-Persistent.chartdef +++ /dev/null @@ -1,30 +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. -# - -chartType=TIMELINE -chartTitle=Multiple producers and consumers - auto ack -chartSubtitle=Persistent 1KB messages -chartDescription=10 P/Cs, persistent, auto-ack, with message payload 1KB. - -xAxisTitle=Date -yAxisTitle=Throughput (KB/s) - -series.1.statement=SELECT insertedTimestamp, throughputKbPerS FROM RESULTS WHERE participantName = 'All' AND testName = 'Varying number of participants: 10 consumers - 10 producers - PERSISTENT' and acknowledgemode=1 -series.1.colourName=red -series.1.legend=Throughput \ No newline at end of file diff --git a/qpid/java/perftests/etc/chartdefs/timeseries/1030-Batch-Size-Small.chartdef b/qpid/java/perftests/etc/chartdefs/timeseries/1030-Batch-Size-Small.chartdef deleted file mode 100644 index f755bf4a5b..0000000000 --- a/qpid/java/perftests/etc/chartdefs/timeseries/1030-Batch-Size-Small.chartdef +++ /dev/null @@ -1,30 +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. -# - -chartType=TIMELINE -chartTitle=Transactions -chartSubtitle=Persistent 1KB messages -chartDescription=1P 1C, persistent, transacted with message payload 1KB with batch size 1 for both P and C - -xAxisTitle=Date -yAxisTitle=Throughput (KB/s) - -series.1.statement=SELECT insertedTimestamp, throughputKbPerS FROM RESULTS WHERE participantName = 'All' AND testName = 'Batch Size 1-1 - PERSISTENT' -series.1.colourName=red -series.1.legend=Throughput \ No newline at end of file diff --git a/qpid/java/perftests/etc/chartdefs/timeseries/1031-Batch-Size-Large.chartdef b/qpid/java/perftests/etc/chartdefs/timeseries/1031-Batch-Size-Large.chartdef deleted file mode 100644 index ca390f8226..0000000000 --- a/qpid/java/perftests/etc/chartdefs/timeseries/1031-Batch-Size-Large.chartdef +++ /dev/null @@ -1,30 +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. -# - -chartType=TIMELINE -chartTitle=Transactions with large batches -chartSubtitle=Persistent 1KB messages -chartDescription=1P 1C, persistent, transacted with message payload 1KB with batch size 100 for both P and C - -xAxisTitle=Date -yAxisTitle=Throughput (KB/s) - -series.1.statement=SELECT insertedTimestamp, throughputKbPerS FROM RESULTS WHERE participantName = 'All' AND testName = 'Batch Size 100-100 - PERSISTENT' -series.1.colourName=red -series.1.legend=Throughput diff --git a/qpid/java/perftests/etc/chartdefs/timeseries/1040-SortedQueue.chartdef b/qpid/java/perftests/etc/chartdefs/timeseries/1040-SortedQueue.chartdef deleted file mode 100644 index 6dce3a1a77..0000000000 --- a/qpid/java/perftests/etc/chartdefs/timeseries/1040-SortedQueue.chartdef +++ /dev/null @@ -1,30 +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. -# - -chartType=TIMELINE -chartTitle=Sorted queue -chartSubtitle=Persistent 1KB messages -chartDescription=1P 1C, persistent, auto-ack with message payload 1KB. Sorted queue with 160,000 random keys - -xAxisTitle=Date -yAxisTitle=Throughput (KB/s) - -series.1.statement=SELECT insertedTimestamp, throughputKbPerS FROM RESULTS WHERE participantName = 'All' AND testName = 'queue-type:sorted-queue' -series.1.colourName=red -series.1.legend=Throughput \ No newline at end of file diff --git a/qpid/java/perftests/etc/ha/chardefs/1001-ScalingParticipants.chartdef b/qpid/java/perftests/etc/ha/chardefs/1001-ScalingParticipants.chartdef deleted file mode 100644 index c1450714a0..0000000000 --- a/qpid/java/perftests/etc/ha/chardefs/1001-ScalingParticipants.chartdef +++ /dev/null @@ -1,48 +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. -# - -chartType=XYLINE -chartTitle=Scaling participants in non-HA and HA scenarios -chartSubtitle=Persistent 1KB messages, transacted -chartDescription=1,2,5,10 producers/consumers, single queue, persistent, transacted, with message payload 1KB. - -xAxisTitle=Participants -yAxisTitle=Throughput (messages/s) - -series.1.statement=SELECT totalNumberOfConsumers, throughputMessagesPerS FROM ScalingParticipants WHERE participantName = 'All' -series.1.legend=Non HA -series.1.dir=${csvCurrentDir} -series.1.colourName=blue - -#series.1.statement=SELECT totalNumberOfConsumers, throughputMessagesPerS FROM ScalingParticipants-non-ha WHERE participantName = 'All' -#series.1.legend=Non HA -#series.1.dir=${csvCurrentDir} -#series.1.colourName=blue - -#series.2.statement=SELECT totalNumberOfConsumers, throughputMessagesPerS FROM ScalingParticipants-3-node-cluster WHERE participantName = 'All' -#series.2.legend=3 Nodes Cluster -#series.2.dir=${csvCurrentDir} -#series.2.colourName=dark_green - -#series.3.statement=SELECT totalNumberOfConsumers, throughputMessagesPerS FROM ScalingParticipants-3-node-cluster-1-node-down WHERE participantName = 'All' -#series.3.legend=3 Nodes Cluster with one node down -#series.3.dir=${csvCurrentDir} -#series.3.colourName=red - - diff --git a/qpid/java/perftests/etc/ha/readme.txt b/qpid/java/perftests/etc/ha/readme.txt deleted file mode 100644 index f23793b26c..0000000000 --- a/qpid/java/perftests/etc/ha/readme.txt +++ /dev/null @@ -1,33 +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. -# - -This folder contains test definitions and chart definitions for the tests measuring throughput on scaling participants. -They could be useful for testing performance in HA scenarios. - -The tests can be executed with: - -perfetsts> java -cp './target/*:./target/dependency/*:./etc/' -Dqpid.amqp.version=0-91 -Dqpid.disttest.duration=50000 \ - -Dqpid.dest_syntax=BURL org.apache.qpid.disttest.ControllerRunner jndi-config=./etc/perftests-jndi.properties \ - test-config=./etc/ha/testdefs/ScalingParticipants.js distributed=false writeToDb=false - -Graphs can be built with: - -perfetsts> java -cp './visualisation-jfc/target/dependency/*:./visualisation-jfc/target/*' -Djava.awt.headless=true \ - -Dlog4j.configuration=file://./etc/log4j.properties -DcsvCurrentDir=. -DcsvBaselineDir=. -DbaselineName=na \ - org.apache.qpid.disttest.charting.ChartingUtil chart-defs=./etc/ha/1001-ScalingParticipants.chartdef diff --git a/qpid/java/perftests/etc/ha/testdefs/ScalingParticipants.js b/qpid/java/perftests/etc/ha/testdefs/ScalingParticipants.js deleted file mode 100644 index eb092b6fa2..0000000000 --- a/qpid/java/perftests/etc/ha/testdefs/ScalingParticipants.js +++ /dev/null @@ -1,92 +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. - * - */ -var jsonObject = { _tests:[] }; - -var duration = 30000; -var queueName = "direct://amq.direct//scaling-participants?durable='true'"; - -var numbersOfParticipants = [1, 2, 5, 10]; - -for(participantIndex=0; participantIndex < numbersOfParticipants.length; participantIndex++) -{ - var participantNumber = numbersOfParticipants[participantIndex]; - var test = { - "_name": "Varying number of participants: " + participantNumber + " consumers - " + participantNumber + " producers - PERSISTENT", - "_queues":[ - { - "_name": queueName, - "_durable": true - } - ], - "_clients": - QPID.times(participantNumber, - { - "_name": "producingClient__PRODUCING_CLIENT_INDEX", - "_connections":[ - { - "_name": "connection1", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session1", - "_acknowledgeMode": 0, - "_producers": [ - { - "_name": "Producer__PRODUCING_CLIENT_INDEX", - "_destinationName": queueName, - "_maximumDuration": duration, - "_deliveryMode": 2, - "_messageSize": 1024 - } - ] - } - ] - } - ] - }, - "__PRODUCING_CLIENT_INDEX") - .concat(QPID.times(participantNumber, - { - "_name": "consumingClient__CONSUMING_CLIENT_INDEX", - "_connections":[ - { - "_name": "connection1", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session1", - "_acknowledgeMode": 0, - "_consumers": [ - { - "_name": "Consumer__CONSUMING_CLIENT_INDEX", - "_destinationName": queueName, - "_maximumDuration": duration - } - ] - } - ] - } - ] - }, - "__CONSUMING_CLIENT_INDEX")) - }; - jsonObject._tests= jsonObject._tests.concat(test); -} diff --git a/qpid/java/perftests/etc/json_config_tool.py b/qpid/java/perftests/etc/json_config_tool.py deleted file mode 100755 index 38a994f81b..0000000000 --- a/qpid/java/perftests/etc/json_config_tool.py +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - -from StringIO import StringIO -import json -import sys -import re - -objname = None -attrname = None -attrvalue = None - -try: - import argparse - - parser = argparse.ArgumentParser(description='Adds (or updates) a attribute name/value pair of an existing object within a Java Broker config.json') - parser.add_argument("objectname", help='Name of the object e.g. httpManagement') - parser.add_argument("attrname", help='Name of the attribute to add or update e.g. httpBasicAuthenticationEnabled') - parser.add_argument("attrvalue", help='Value of the attribute e.g. true') - args = parser.parse_args() - - objname = args.objectname - attrname = args.attrname - attrvalue = args.attrvalue -except ImportError: - objname = sys.argv[1] - attrname = sys.argv[2] - attrvalue = sys.argv[3] - pass - - -def transform(data): - if isinstance(data, tuple): - (k, v) = data; - return k, transform(v) - elif isinstance(data, list): - return [transform(i) for i in data] - elif isinstance(data, dict): - if "name" in data and data["name"] == objname: - data[attrname] = attrvalue - return data - else: - return data - -# Expects a config.json to be provided on stdin, write the resulting json to stdout. - -lines = [] -for line in sys.stdin: - lines.append(line.rstrip()) - -# naive strip C style comments - this deals with the Apache licence comment present on the default config -input = re.sub("/\*.*?\*/", " ", "".join(lines), re.S) - -data = json.load(StringIO(input)) -data = dict([transform((k, v)) for k,v in data.items()]) - -json.dump(data, sys.stdout, sort_keys=True, indent=2) diff --git a/qpid/java/perftests/etc/log4j.properties b/qpid/java/perftests/etc/log4j.properties deleted file mode 100644 index ec00e022ac..0000000000 --- a/qpid/java/perftests/etc/log4j.properties +++ /dev/null @@ -1,28 +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. -# -log4j.rootLogger=ERROR,console - -log4j.logger.org.apache.qpid=WARN -log4j.logger.org.apache.qpid.disttest=INFO - -log4j.appender.console=org.apache.log4j.ConsoleAppender -log4j.appender.console.Threshold=all -log4j.appender.console.layout=org.apache.log4j.PatternLayout - -log4j.appender.console.layout.ConversionPattern=%d %p [%t] [%c{1}] %m%n diff --git a/qpid/java/perftests/etc/perftests-jndi.properties b/qpid/java/perftests/etc/perftests-jndi.properties deleted file mode 100644 index deb0a8d57b..0000000000 --- a/qpid/java/perftests/etc/perftests-jndi.properties +++ /dev/null @@ -1,27 +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. - -java.naming.factory.initial = org.apache.qpid.jndi.PropertiesFileInitialContextFactory - -connectionfactory.connectionfactory = amqp://guest:guest@clientid/?brokerlist='tcp://localhost:5672' -connectionfactory.sslconnectionfactory = amqp://guest:guest@clientid/?ssl='true'&brokerlist='tcp://localhost:5671' - -destination.controllerqueue = direct://amq.direct//controllerqueue?autodelete='true' - -jdbcDriverClass=org.apache.derby.jdbc.EmbeddedDriver -# writes to a results database in ./perftestResultsDb by default. -jdbcUrl=jdbc:derby:perftestResultsDb;create=true diff --git a/qpid/java/perftests/etc/run-perftests.sh b/qpid/java/perftests/etc/run-perftests.sh deleted file mode 100755 index de435ecfca..0000000000 --- a/qpid/java/perftests/etc/run-perftests.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env bash -# -# 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. -# - -# Runs the perftests using a typical configuration. - -BASE_DIR=`dirname $0` -DURATION=${1:-5000} -AMQP_VERSION=${2:-0-91} - -echo Will run perftests using a maximum duration of ${DURATION}ms and AMQP protocol version ${AMQP_VERSION}. -echo - -java -cp "${BASE_DIR}:${BASE_DIR}/../../build/lib/*" \ - -Dqpid.amqp.version=${AMQP_VERSION} -Dqpid.dest_syntax=BURL \ - -Dqpid.disttest.duration=$DURATION \ - org.apache.qpid.disttest.ControllerRunner \ - jndi-config=${BASE_DIR}/perftests-jndi.properties \ - test-config=${BASE_DIR}/testdefs/VaryingNumberOfParticipants.js \ - distributed=false \ - writeToDb=true diff --git a/qpid/java/perftests/etc/testdefs/AcknowledgementModes.json b/qpid/java/perftests/etc/testdefs/AcknowledgementModes.json deleted file mode 100644 index 071edf3f0e..0000000000 --- a/qpid/java/perftests/etc/testdefs/AcknowledgementModes.json +++ /dev/null @@ -1,138 +0,0 @@ -{ - "_tests":[ - { - "_name": "Transient Ack Modes"; - "_iterations":[ - { - "_messageSize": 1024, - "_acknowledgeMode": 1, - "_deliveryMode": 1 - }, - { - "_messageSize": 1024, - "_acknowledgeMode": 0, - "_deliveryMode": 1 - } - ], - "_queues":[ - { - "_name": "direct://amq.direct//testQueue", - "_attributes": - { - "x-qpid-capacity": 10485760, - "x-qpid-flow-resume-capacity": 8388608 - } - } - ], - "_clients":[ - { - "_name": "producingClient", - "_connections":[ - { - "_name": "connection1", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session1", - "_producers": [ - { - "_name": "Producer1", - "_destinationName": "direct://amq.direct//testQueue", - "_maximumDuration": 30000 - } - ] - } - ] - } - ] - }, - { - "_name": "consumingClient", - "_connections":[ - { - "_name": "connection1", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session1", - "_consumers": [ - { - "_name": "Consumer1", - "_destinationName": "direct://amq.direct//testQueue", - "_maximumDuration": 30000 - } - ] - } - ] - } - ] - } - ] - }, - { - "_name": "Persistent Ack Modes"; - "_iterations":[ - { - "_messageSize": 1024, - "_acknowledgeMode": 1, - "_deliveryMode": 2 - }, - { - "_messageSize": 1024, - "_acknowledgeMode": 0, - "_deliveryMode": 2 - } - ], - "_queues":[ - { - "_name": "direct://amq.direct//testQueue?durable='true'", - "_durable" : "true" - } - ], - "_clients":[ - { - "_name": "producingClient", - "_connections":[ - { - "_name": "connection1", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session1", - "_producers": [ - { - "_name": "Producer1", - "_destinationName": "direct://amq.direct//testQueue?durable='true'", - "_maximumDuration": 30000 - } - ] - } - ] - } - ] - }, - { - "_name": "consumingClient", - "_connections":[ - { - "_name": "connection1", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session1", - "_consumers": [ - { - "_name": "Consumer1", - "_destinationName": "direct://amq.direct//testQueue?durable='true'", - "_maximumDuration": 30000 - } - ] - } - ] - } - ] - } - ] - } - ] -} diff --git a/qpid/java/perftests/etc/testdefs/BatchSize.js b/qpid/java/perftests/etc/testdefs/BatchSize.js deleted file mode 100644 index f17751b7b5..0000000000 --- a/qpid/java/perftests/etc/testdefs/BatchSize.js +++ /dev/null @@ -1,102 +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. - * - */ - -var jsonObject = { - _tests:[] -}; - -var duration = 30000; - -var txBatchSizes = [[1,1], [2,2], [5,5], [10,10], [20,20], [50,50], [100,100], [200,200], [400,400]]; - -var acknowledgeMode = 0; -var deliveryMode = 2; -var messageSize = 1024; - -for(i=0; i < txBatchSizes.length ; i++) -{ - var producerBatchSize = txBatchSizes[i][0]; - var consumerBatchSize = txBatchSizes[i][1]; - var queueName = "txBatchSize" + producerBatchSize + "_" + consumerBatchSize; - var destination = "direct://amq.direct//" + queueName + "?durable='true'"; - - var test = { - "_name": "Batch Size " + producerBatchSize + "-" + consumerBatchSize + " - PERSISTENT", - "_queues":[ - { - "_name": queueName, - "_durable": true - } - ], - "_clients":[ - { - "_name": "producingClient", - "_connections":[ - { - "_name": "connection1", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session1", - "_acknowledgeMode": acknowledgeMode, - "_producers": [ - { - "_name": "Producer1", - "_destinationName": destination, - "_messageSize": messageSize, - "_deliveryMode": deliveryMode, - "_batchSize": producerBatchSize, - "_maximumDuration": duration - } - ] - } - ] - } - ] - }, - { - "_name": "consumingClient", - "_connections":[ - { - "_name": "connection1", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session1", - "_acknowledgeMode": acknowledgeMode, - "_consumers": [ - { - "_name": "Consumer1", - "_destinationName": destination, - "_batchSize": consumerBatchSize, - "_maximumDuration": duration - } - ] - } - ] - } - ] - } - ] - }; - - jsonObject._tests= jsonObject._tests.concat(test); -} diff --git a/qpid/java/perftests/etc/testdefs/BatchSizeConsumerVaries.js b/qpid/java/perftests/etc/testdefs/BatchSizeConsumerVaries.js deleted file mode 100644 index b491f431c9..0000000000 --- a/qpid/java/perftests/etc/testdefs/BatchSizeConsumerVaries.js +++ /dev/null @@ -1,102 +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. - * - */ - -var jsonObject = { - _tests:[] -}; - -var duration = 30000; - -var txBatchSizes = [[1,1], [1,2], [1,5], [1,10], [1,20], [1,50], [1,100], [1,200], [1,400]]; - -var acknowledgeMode = 0; -var deliveryMode = 2; -var messageSize = 1024; - -for(i=0; i < txBatchSizes.length ; i++) -{ - var producerBatchSize = txBatchSizes[i][0]; - var consumerBatchSize = txBatchSizes[i][1]; - var queueName = "txBatchSize" + producerBatchSize + "_" + consumerBatchSize; - var destination = "direct://amq.direct//" + queueName + "?durable='true'"; - - var test = { - "_name": consumerBatchSize,// hack - use test name to expose the consumer batch size on the All result rows - "_queues":[ - { - "_name": queueName, - "_durable": true - } - ], - "_clients":[ - { - "_name": "producingClient", - "_connections":[ - { - "_name": "connection1", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session1", - "_acknowledgeMode": acknowledgeMode, - "_producers": [ - { - "_name": "Producer1", - "_destinationName": destination, - "_messageSize": messageSize, - "_deliveryMode": deliveryMode, - "_batchSize": producerBatchSize, - "_maximumDuration": duration - } - ] - } - ] - } - ] - }, - { - "_name": "consumingClient", - "_connections":[ - { - "_name": "connection1", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session1", - "_acknowledgeMode": acknowledgeMode, - "_consumers": [ - { - "_name": "Consumer1", - "_destinationName": destination, - "_batchSize": consumerBatchSize, - "_maximumDuration": duration - } - ] - } - ] - } - ] - } - ] - }; - - jsonObject._tests= jsonObject._tests.concat(test); -} diff --git a/qpid/java/perftests/etc/testdefs/BatchSizeProducerVaries.js b/qpid/java/perftests/etc/testdefs/BatchSizeProducerVaries.js deleted file mode 100644 index ac23c52c9e..0000000000 --- a/qpid/java/perftests/etc/testdefs/BatchSizeProducerVaries.js +++ /dev/null @@ -1,102 +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. - * - */ - -var jsonObject = { - _tests:[] -}; - -var duration = 30000; - -var txBatchSizes = [[1,1], [2,1], [5,1], [10,1], [20,1], [50,1], [100,1], [200,1], [400,1]]; - -var acknowledgeMode = 0; -var deliveryMode = 2; -var messageSize = 1024; - -for(i=0; i < txBatchSizes.length ; i++) -{ - var producerBatchSize = txBatchSizes[i][0]; - var consumerBatchSize = txBatchSizes[i][1]; - var queueName = "txBatchSize" + producerBatchSize + "_" + consumerBatchSize; - var destination = "direct://amq.direct//" + queueName + "?durable='true'"; - - var test = { - "_name": producerBatchSize,// hack - use test name to expose the producer batch size on the All result rows - "_queues":[ - { - "_name": queueName, - "_durable": true - } - ], - "_clients":[ - { - "_name": "producingClient", - "_connections":[ - { - "_name": "connection1", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session1", - "_acknowledgeMode": acknowledgeMode, - "_producers": [ - { - "_name": "Producer1", - "_destinationName": destination, - "_messageSize": messageSize, - "_deliveryMode": deliveryMode, - "_batchSize": producerBatchSize, - "_maximumDuration": duration - } - ] - } - ] - } - ] - }, - { - "_name": "consumingClient", - "_connections":[ - { - "_name": "connection1", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session1", - "_acknowledgeMode": acknowledgeMode, - "_consumers": [ - { - "_name": "Consumer1", - "_destinationName": destination, - "_batchSize": consumerBatchSize, - "_maximumDuration": duration - } - ] - } - ] - } - ] - } - ] - }; - - jsonObject._tests= jsonObject._tests.concat(test); -} diff --git a/qpid/java/perftests/etc/testdefs/Latency-MessageSize.json b/qpid/java/perftests/etc/testdefs/Latency-MessageSize.json deleted file mode 100644 index f93d1ecaab..0000000000 --- a/qpid/java/perftests/etc/testdefs/Latency-MessageSize.json +++ /dev/null @@ -1,180 +0,0 @@ -{ - "_tests":[ - { - "_name": "Latency - Message Size - TRANSIENT"; - "_iterations":[ - { - "_messageSize": 256 - }, - { - "_messageSize": 1024 - }, - { - "_messageSize": 4096 - }, - { - "_messageSize": 16384 - }, - { - "_messageSize": 32768 - }, - { - "_messageSize": 65536 - }, - { - "_messageSize": 131072 - }, - { - "_messageSize": 262144 - } - ], - "_queues":[ - { - "_name": "direct://amq.direct//latency-message-size-transient" - } - ], - "_clients":[ - { - "_name": "producingClient", - "_connections":[ - { - "_name": "connection1", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session1", - "_acknowledgeMode": 1, - "_producers": [ - { - "_name": "Producer1", - "_destinationName": "direct://amq.direct//latency-message-size-transient", - "_deliveryMode": 1, - "_maximumDuration": 60000, - "_interval": 1000 - } - ] - } - ] - } - ] - }, - { - "_name": "consumingClient", - "_connections":[ - { - "_name": "connection1", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session1", - "_acknowledgeMode": 1, - "_consumers": [ - { - "_name": "Consumer1", - "_destinationName": "direct://amq.direct//latency-message-size-transient", - "_maximumDuration": 60000, - "_evaluateLatency": true - } - ] - } - ] - } - ] - } - ] - }, - { - "_name": "Latency - Message Size - PERSISTENT"; - "_iterations":[ - { - "_messageSize": 256 - }, - { - "_messageSize": 512 - }, - { - "_messageSize": 1024 - }, - { - "_messageSize": 2048 - }, - { - "_messageSize": 4096 - }, - { - "_messageSize": 8192 - }, - { - "_messageSize": 16384 - }, - { - "_messageSize": 32768 - }, - { - "_messageSize": 65536 - }, - { - "_messageSize": 131072 - }, - { - "_messageSize": 262144 - } - ], - "_queues":[ - { - "_name": "direct://amq.direct//latency-message-size-persistent?durable='true'", - "_durable": true - } - ], - "_clients":[ - { - "_name": "producingClient", - "_connections":[ - { - "_name": "connection1", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session1", - "_acknowledgeMode": 0, - "_producers": [ - { - "_name": "Producer1", - "_destinationName": "direct://amq.direct//latency-message-size-persistent?durable='true'", - "_deliveryMode": 2, - "_maximumDuration": 60000, - "_interval": 1000 - } - ] - } - ] - } - ] - }, - { - "_name": "consumingClient", - "_connections":[ - { - "_name": "connection1", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session1", - "_acknowledgeMode": 0, - "_consumers": [ - { - "_name": "Consumer1", - "_destinationName": "direct://amq.direct//latency-message-size-persistent?durable='true'", - "_maximumDuration": 60000, - "_evaluateLatency": true - } - ] - } - ] - } - ] - } - ] - } - ] -} diff --git a/qpid/java/perftests/etc/testdefs/Latency-VaryingNumberOfParticipants.json b/qpid/java/perftests/etc/testdefs/Latency-VaryingNumberOfParticipants.json deleted file mode 100644 index 50f00a8c45..0000000000 --- a/qpid/java/perftests/etc/testdefs/Latency-VaryingNumberOfParticipants.json +++ /dev/null @@ -1,706 +0,0 @@ -{ - "_tests":[ - { - "_name": "Latency of varying number of participants: 1 consumer - 1 producer - PERSISTENT", - "_queues":[ - { - "_name": "direct://amq.direct//latency-varying-consumers?durable='true'", - "_durable": true - } - ], - "_clients":[ - { - "_name": "producingClient", - "_connections":[ - { - "_name": "connection1", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session1", - "_acknowledgeMode": 0, - "_producers": [ - { - "_name": "Producer1", - "_destinationName": "direct://amq.direct//latency-varying-consumers?durable='true'", - "_deliveryMode": 2, - "_messageSize": 1024, - "_maximumDuration": 60000, - "_interval": 1000 - } - ] - } - ] - } - ] - }, - { - "_name": "consumingClient", - "_connections":[ - { - "_name": "connection1", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session1", - "_acknowledgeMode": 0, - "_consumers": [ - { - "_name": "Consumer1", - "_destinationName": "direct://amq.direct//latency-varying-consumers?durable='true'", - "_maximumDuration": 60000, - "_evaluateLatency": true - } - ] - } - ] - } - ] - } - ] - }, - - - { - "_name": "Latency of varying number of participants: 1 consumer - 10 producers - PERSISTENT", - "_queues":[ - { - "_name": "direct://amq.direct//latency-varying-consumers?durable='true'", - "_durable": true - } - ], - "_clients":[ - { - "_name": "producingClient", - "_connections":[ - { - "_name": "connection1", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session1", - "_acknowledgeMode": 0, - "_producers": [ - { - "_name": "Producer1", - "_destinationName": "direct://amq.direct//latency-varying-consumers?durable='true'", - "_maximumDuration": 60000, - "_interval": 3000, - "_deliveryMode": 2, - "_messageSize": 1024 - } - ] - } - ] - }, - { - "_name": "connection2", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session2", - "_acknowledgeMode": 0, - "_producers": [ - { - "_name": "Producer2", - "_destinationName": "direct://amq.direct//latency-varying-consumers?durable='true'", - "_maximumDuration": 60000, - "_interval": 3000, - "_deliveryMode": 2, - "_messageSize": 1024 - } - ] - } - ] - }, - { - "_name": "connection3", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session3", - "_acknowledgeMode": 0, - "_producers": [ - { - "_name": "Producer3", - "_destinationName": "direct://amq.direct//latency-varying-consumers?durable='true'", - "_maximumDuration": 60000, - "_interval": 3000, - "_deliveryMode": 2, - "_messageSize": 1024 - } - ] - } - ] - }, - { - "_name": "connection4", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session4", - "_acknowledgeMode": 0, - "_producers": [ - { - "_name": "Producer4", - "_destinationName": "direct://amq.direct//latency-varying-consumers?durable='true'", - "_maximumDuration": 60000, - "_interval": 3000, - "_deliveryMode": 2, - "_messageSize": 1024 - } - ] - } - ] - }, - { - "_name": "connection5", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session5", - "_acknowledgeMode": 0, - "_producers": [ - { - "_name": "Producer5", - "_destinationName": "direct://amq.direct//latency-varying-consumers?durable='true'", - "_maximumDuration": 60000, - "_interval": 3000, - "_deliveryMode": 2, - "_messageSize": 1024 - } - ] - } - ] - }, - { - "_name": "connection6", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session6", - "_acknowledgeMode": 0, - "_producers": [ - { - "_name": "Producer6", - "_destinationName": "direct://amq.direct//latency-varying-consumers?durable='true'", - "_maximumDuration": 60000, - "_interval": 3000, - "_deliveryMode": 2, - "_messageSize": 1024 - } - ] - } - ] - }, - { - "_name": "connection7", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session7", - "_acknowledgeMode": 0, - "_producers": [ - { - "_name": "Producer7", - "_destinationName": "direct://amq.direct//latency-varying-consumers?durable='true'", - "_maximumDuration": 60000, - "_interval": 3000, - "_deliveryMode": 2, - "_messageSize": 1024 - } - ] - } - ] - }, - { - "_name": "connection8", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session8", - "_acknowledgeMode": 0, - "_producers": [ - { - "_name": "Producer8", - "_destinationName": "direct://amq.direct//latency-varying-consumers?durable='true'", - "_maximumDuration": 60000, - "_interval": 3000, - "_deliveryMode": 2, - "_messageSize": 1024 - } - ] - } - ] - }, - { - "_name": "connection9", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session9", - "_acknowledgeMode": 0, - "_producers": [ - { - "_name": "Producer9", - "_destinationName": "direct://amq.direct//latency-varying-consumers?durable='true'", - "_maximumDuration": 60000, - "_interval": 3000, - "_deliveryMode": 2, - "_messageSize": 1024 - } - ] - } - ] - }, - { - "_name": "connection10", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session10", - "_acknowledgeMode": 0, - "_producers": [ - { - "_name": "Producer10", - "_destinationName": "direct://amq.direct//latency-varying-consumers?durable='true'", - "_maximumDuration": 60000, - "_interval": 3000, - "_deliveryMode": 2, - "_messageSize": 1024 - } - ] - } - ] - } - ] - }, - { - "_name": "consumingClient", - "_connections":[ - { - "_name": "connection1", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session1", - "_acknowledgeMode": 0, - "_consumers": [ - { - "_name": "Consumer1", - "_destinationName": "direct://amq.direct//latency-varying-consumers?durable='true'", - "_maximumDuration": 60000, - "_evaluateLatency": true - } - ] - } - ] - } - ] - } - ] - }, - - { - "_name": "Latency of varying number of participants: 10 consumers - 10 producers - PERSISTENT", - "_queues":[ - { - "_name": "direct://amq.direct//latency-varying-consumers?durable='true'", - "_durable": true - } - ], - "_clients":[ - { - "_name": "producingClient", - "_connections":[ - { - "_name": "connection1", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session1", - "_acknowledgeMode": 0, - "_producers": [ - { - "_name": "Producer1", - "_destinationName": "direct://amq.direct//latency-varying-consumers?durable='true'", - "_maximumDuration": 60000, - "_interval": 3000, - "_deliveryMode": 2, - "_messageSize": 1024 - } - ] - } - ] - }, - { - "_name": "connection2", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session2", - "_acknowledgeMode": 0, - "_producers": [ - { - "_name": "Producer2", - "_destinationName": "direct://amq.direct//latency-varying-consumers?durable='true'", - "_maximumDuration": 60000, - "_interval": 3000, - "_deliveryMode": 2, - "_messageSize": 1024 - } - ] - } - ] - }, - { - "_name": "connection3", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session3", - "_acknowledgeMode": 0, - "_producers": [ - { - "_name": "Producer3", - "_destinationName": "direct://amq.direct//latency-varying-consumers?durable='true'", - "_maximumDuration": 60000, - "_interval": 3000, - "_deliveryMode": 2, - "_messageSize": 1024 - } - ] - } - ] - }, - { - "_name": "connection4", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session4", - "_acknowledgeMode": 0, - "_producers": [ - { - "_name": "Producer4", - "_destinationName": "direct://amq.direct//latency-varying-consumers?durable='true'", - "_maximumDuration": 60000, - "_interval": 3000, - "_deliveryMode": 2, - "_messageSize": 1024 - } - ] - } - ] - }, - { - "_name": "connection5", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session5", - "_acknowledgeMode": 0, - "_producers": [ - { - "_name": "Producer5", - "_destinationName": "direct://amq.direct//latency-varying-consumers?durable='true'", - "_maximumDuration": 60000, - "_interval": 3000, - "_deliveryMode": 2, - "_messageSize": 1024 - } - ] - } - ] - }, - { - "_name": "connection6", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session6", - "_acknowledgeMode": 0, - "_producers": [ - { - "_name": "Producer6", - "_destinationName": "direct://amq.direct//latency-varying-consumers?durable='true'", - "_maximumDuration": 60000, - "_interval": 3000, - "_deliveryMode": 2, - "_messageSize": 1024 - } - ] - } - ] - }, - { - "_name": "connection7", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session7", - "_acknowledgeMode": 0, - "_producers": [ - { - "_name": "Producer7", - "_destinationName": "direct://amq.direct//latency-varying-consumers?durable='true'", - "_maximumDuration": 60000, - "_interval": 3000, - "_deliveryMode": 2, - "_messageSize": 1024 - } - ] - } - ] - }, - { - "_name": "connection8", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session8", - "_acknowledgeMode": 0, - "_producers": [ - { - "_name": "Producer8", - "_destinationName": "direct://amq.direct//latency-varying-consumers?durable='true'", - "_maximumDuration": 60000, - "_interval": 3000, - "_deliveryMode": 2, - "_messageSize": 1024 - } - ] - } - ] - }, - { - "_name": "connection9", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session9", - "_acknowledgeMode": 0, - "_producers": [ - { - "_name": "Producer9", - "_destinationName": "direct://amq.direct//latency-varying-consumers?durable='true'", - "_maximumDuration": 60000, - "_interval": 3000, - "_deliveryMode": 2, - "_messageSize": 1024 - } - ] - } - ] - }, - { - "_name": "connection10", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session10", - "_acknowledgeMode": 0, - "_producers": [ - { - "_name": "Producer10", - "_destinationName": "direct://amq.direct//latency-varying-consumers?durable='true'", - "_maximumDuration": 60000, - "_interval": 3000, - "_deliveryMode": 2, - "_messageSize": 1024 - } - ] - } - ] - } - ] - }, - { - "_name": "consumingClient", - "_connections":[ - { - "_name": "connection1", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session1", - "_acknowledgeMode": 0, - "_consumers": [ - { - "_name": "Consumer1", - "_destinationName": "direct://amq.direct//latency-varying-consumers?durable='true'", - "_maximumDuration": 60000, - "_evaluateLatency": true - } - ] - } - ] - }, - { - "_name": "connection2", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session2", - "_acknowledgeMode": 0, - "_consumers": [ - { - "_name": "Consumer2", - "_destinationName": "direct://amq.direct//latency-varying-consumers?durable='true'", - "_maximumDuration": 60000, - "_evaluateLatency": true - } - ] - } - ] - }, - { - "_name": "connection3", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session3", - "_acknowledgeMode": 0, - "_consumers": [ - { - "_name": "Consumer3", - "_destinationName": "direct://amq.direct//latency-varying-consumers?durable='true'", - "_maximumDuration": 60000, - "_evaluateLatency": true - } - ] - } - ] - }, - { - "_name": "connection4", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session4", - "_acknowledgeMode": 0, - "_consumers": [ - { - "_name": "Consumer4", - "_destinationName": "direct://amq.direct//latency-varying-consumers?durable='true'", - "_maximumDuration": 60000, - "_evaluateLatency": true - } - ] - } - ] - }, - { - "_name": "connection5", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session5", - "_acknowledgeMode": 0, - "_consumers": [ - { - "_name": "Consumer5", - "_destinationName": "direct://amq.direct//latency-varying-consumers?durable='true'", - "_maximumDuration": 60000, - "_evaluateLatency": true - } - ] - } - ] - }, - { - "_name": "connection6", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session6", - "_acknowledgeMode": 0, - "_consumers": [ - { - "_name": "Consumer6", - "_destinationName": "direct://amq.direct//latency-varying-consumers?durable='true'", - "_maximumDuration": 60000, - "_evaluateLatency": true - } - ] - } - ] - }, - { - "_name": "connection7", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session7", - "_acknowledgeMode": 0, - "_consumers": [ - { - "_name": "Consumer7", - "_destinationName": "direct://amq.direct//latency-varying-consumers?durable='true'", - "_maximumDuration": 60000, - "_evaluateLatency": true - } - ] - } - ] - }, - { - "_name": "connection8", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session8", - "_acknowledgeMode": 0, - "_consumers": [ - { - "_name": "Consumer8", - "_destinationName": "direct://amq.direct//latency-varying-consumers?durable='true'", - "_maximumDuration": 60000, - "_evaluateLatency": true - } - ] - } - ] - }, - { - "_name": "connection9", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session9", - "_acknowledgeMode": 0, - "_consumers": [ - { - "_name": "Consumer9", - "_destinationName": "direct://amq.direct//latency-varying-consumers?durable='true'", - "_maximumDuration": 60000, - "_evaluateLatency": true - } - ] - } - ] - }, - { - "_name": "connection10", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session10", - "_acknowledgeMode": 0, - "_consumers": [ - { - "_name": "Consumer10", - "_destinationName": "direct://amq.direct//latency-varying-consumers?durable='true'", - "_maximumDuration": 60000, - "_evaluateLatency": true - } - ] - } - ] - } - ] - } - ] - } - ] -} diff --git a/qpid/java/perftests/etc/testdefs/MessageSize.json b/qpid/java/perftests/etc/testdefs/MessageSize.json deleted file mode 100644 index c97815507b..0000000000 --- a/qpid/java/perftests/etc/testdefs/MessageSize.json +++ /dev/null @@ -1,196 +0,0 @@ -{ - "_tests":[ - { - "_name": "Message Size - 1P-1C - TRANSIENT"; - "_iterations":[ - { - "_messageSize": 256 - }, - { - "_messageSize": 512 - }, - { - "_messageSize": 1024 - }, - { - "_messageSize": 2048 - }, - { - "_messageSize": 4096 - }, - { - "_messageSize": 8192 - }, - { - "_messageSize": 16384 - }, - { - "_messageSize": 32768 - }, - { - "_messageSize": 65536 - }, - { - "_messageSize": 131072 - }, - { - "_messageSize": 262144 - } - ], - "_queues":[ - { - "_name": "direct://amq.direct//messageSize", - "_attributes": - { - "x-qpid-capacity": 10485760, - "x-qpid-flow-resume-capacity": 8388608 - } - } - ], - "_clients":[ - { - "_name": "producingClient", - "_connections":[ - { - "_name": "connection1", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session1", - "_acknowledgeMode": 1, - "_producers": [ - { - "_name": "Producer1", - "_destinationName": "direct://amq.direct//messageSize", - "_deliveryMode": 1, - "_maximumDuration": 30000 - } - ] - } - ] - } - ] - }, - { - "_name": "consumingClient", - "_connections":[ - { - "_name": "connection1", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session1", - "_acknowledgeMode": 1, - "_consumers": [ - { - "_name": "Consumer1", - "_destinationName": "direct://amq.direct//messageSize", - "_maximumDuration": 30000 - } - ] - } - ] - } - ] - } - ] - }, - { - "_name": "Message Size - 1P-1C - PERSISTENT"; - "_iterations":[ - { - "_messageSize": 256 - }, - { - "_messageSize": 512 - }, - { - "_messageSize": 1024 - }, - { - "_messageSize": 2048 - }, - { - "_messageSize": 4096 - }, - { - "_messageSize": 8192 - }, - { - "_messageSize": 16384 - }, - { - "_messageSize": 32768 - }, - { - "_messageSize": 65536 - }, - { - "_messageSize": 131072 - }, - { - "_messageSize": 262144 - } - ], - "_queues":[ - { - "_name": "direct://amq.direct//messageSize?durable='true'", - "_durable": true, - "_attributes": - { - "x-qpid-capacity": 10485760, - "x-qpid-flow-resume-capacity": 8388608 - } - } - ], - "_clients":[ - { - "_name": "producingClient", - "_connections":[ - { - "_name": "connection1", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session1", - "_acknowledgeMode": 0, - "_producers": [ - { - "_name": "Producer1", - "_destinationName": "direct://amq.direct//messageSize?durable='true'", - "_deliveryMode": 2, - "_maximumDuration": 30000 - - } - ] - } - ] - } - ] - }, - { - "_name": "consumingClient", - "_connections":[ - { - "_name": "connection1", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session1", - "_acknowledgeMode": 0, - "_consumers": [ - { - "_name": "Consumer1", - "_destinationName": "direct://amq.direct//messageSize?durable='true'", - "_maximumDuration": 30000 - } - ] - } - ] - } - ] - } - ] - } - ] -} diff --git a/qpid/java/perftests/etc/testdefs/QueueConsumersWithNonOverlappingSelectors.js b/qpid/java/perftests/etc/testdefs/QueueConsumersWithNonOverlappingSelectors.js deleted file mode 100644 index 72b77e0e93..0000000000 --- a/qpid/java/perftests/etc/testdefs/QueueConsumersWithNonOverlappingSelectors.js +++ /dev/null @@ -1,120 +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. - * - */ -var jsonObject = { - _tests:[] -}; - -for (var i=0; i<2; i++) -{ - var deliveryMode = i+1; - var acknowledgeMode = ((i==0) ? 1 : 0); - var durable = (deliveryMode == 2); - var suffix = durable ? "PERSISTENT" : "NON-PERSISTENT"; - var queueName = "direct://amq.direct//queue-selectors-" + suffix + "?durable='" + durable + "'"; - var consumerNumbers = [1, 2, 4, 8, 16, 32]; - for (var j=0; j - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/qpid/java/perftests/example/brokerconfig/passwd b/qpid/java/perftests/example/brokerconfig/passwd deleted file mode 100644 index 99f0f05c6a..0000000000 --- a/qpid/java/perftests/example/brokerconfig/passwd +++ /dev/null @@ -1,23 +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. -# -guest:guest -client:guest -server:guest -admin:admin - diff --git a/qpid/java/perftests/example/config-one-test.json b/qpid/java/perftests/example/config-one-test.json deleted file mode 100644 index 8f4e577d49..0000000000 --- a/qpid/java/perftests/example/config-one-test.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "_tests":[ - { - "_name": "One producer to one consumer"; - "_queues":[ - { - "_name": "direct://amq.direct//testQueue" - } - ]; - "_clients":[ - { - "_name": "producingClient", - "_connections":[ - { - "_name": "connection1", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session1", - "_producers": [ - { - "_name": "Producer1", - "_destinationName": "direct://amq.direct//testQueue", - "_numberOfMessages": 5000 - } - ] - } - ] - } - ] - }, - { - "_name": "consumingClient", - "_connections":[ - { - "_name": "connection1", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session1", - "_consumers": [ - { - "_name": "Consumer1", - "_destinationName": "direct://amq.direct//testQueue", - "_numberOfMessages": 5000 - } - ] - } - ] - } - ] - } - ] - }] -} diff --git a/qpid/java/perftests/example/config-stress-testing-manyp-c1-with-psfc.json b/qpid/java/perftests/example/config-stress-testing-manyp-c1-with-psfc.json deleted file mode 100644 index 548dacf268..0000000000 --- a/qpid/java/perftests/example/config-stress-testing-manyp-c1-with-psfc.json +++ /dev/null @@ -1,161 +0,0 @@ -{ - "_tests":[ - { - "_name": "Many producers to one consumer w/producer flow-control"; - "_queues":[ - { - "_name": "direct://amq.direct//testQueue", - "_attributes": - { - "x-qpid-capacity": 10485760, - "x-qpid-flow-resume-capacity": 8388608 - } - } - ]; - "_clients":[ - { - "_name": "producingClient1", - "_connections":[ - { - "_name": "connection1", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session1", - "_acknowledgeMode": 1, - "_producers": [ - { - "_name": "Producer1", - "_destinationName": "direct://amq.direct//testQueue", - "_numberOfMessages": 1000000, - "_deliveryMode": 1, - "_messageSize": 10000 - } - ] - } - ] - } - ] - }, - { - "_name": "producingClient2", - "_connections":[ - { - "_name": "connection2", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session2", - "_acknowledgeMode": 1, - "_producers": [ - { - "_name": "Producer2", - "_destinationName": "direct://amq.direct//testQueue", - "_numberOfMessages": 1000000, - "_deliveryMode": 1, - "_messageSize": 10000 - } - ] - } - ] - } - ] - }, - { - "_name": "producingClient3", - "_connections":[ - { - "_name": "connection3", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session3", - "_acknowledgeMode": 1, - "_producers": [ - { - "_name": "Producer3", - "_destinationName": "direct://amq.direct//testQueue", - "_numberOfMessages": 1000000, - "_deliveryMode": 1, - "_messageSize": 10000 - } - ] - } - ] - } - ] - }, - { - "_name": "producingClient4", - "_connections":[ - { - "_name": "connection4", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session4", - "_acknowledgeMode": 1, - "_producers": [ - { - "_name": "Producer4", - "_destinationName": "direct://amq.direct//testQueue", - "_numberOfMessages": 1000000, - "_deliveryMode": 1, - "_messageSize": 10000 - } - ] - } - ] - } - ] - }, - { - "_name": "producingClient5", - "_connections":[ - { - "_name": "connection5", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session5", - "_acknowledgeMode": "1", - "_producers": [ - { - "_name": "Producer5", - "_destinationName": "direct://amq.direct//testQueue", - "_numberOfMessages": 1000000, - "_deliveryMode": 1, - "_messageSize": 10000 - } - ] - } - ] - } - ] - }, - { - "_name": "consumingClient", - "_connections":[ - { - "_name": "connection5", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session5", - "_acknowledgeMode": 1, - "_consumers": [ - { - "_name": "Consumer1", - "_destinationName": "direct://amq.direct//testQueue", - "_numberOfMessages": 5000000 - } - ] - } - ] - } - ] - } - ] - } - ] -} diff --git a/qpid/java/perftests/example/config-stress-testing.json b/qpid/java/perftests/example/config-stress-testing.json deleted file mode 100644 index f6029b848d..0000000000 --- a/qpid/java/perftests/example/config-stress-testing.json +++ /dev/null @@ -1,84 +0,0 @@ -{ - "_tests":[ - { - "_name": "One producer to one consumer"; - "_iterations":[ - { - "_messageSize": 10000 - }, - { - "_messageSize": 10000 - }, - { - "_messageSize": 10000 - }, - { - "_messageSize": 10000 - }, - { - "_messageSize": 10000 - }, - { - "_messageSize": 10000 - }, - { - "_messageSize": 10000 - }, - { - "_messageSize": 10000 - } - ], - "_queues":[ - { - "_name": "direct://amq.direct//testQueue" - } - ], - "_clients":[ - { - "_name": "producingClient", - "_connections":[ - { - "_name": "connection1", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session1", - "_acknowledgeMode": 1, - "_producers": [ - { - "_name": "Producer1", - "_destinationName": "direct://amq.direct//testQueue", - "_numberOfMessages": 1000000, - "_deliveryMode": 1 - } - ] - } - ] - } - ] - }, - { - "_name": "consumingClient", - "_connections":[ - { - "_name": "connection1", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session1", - "_acknowledgeMode": 1, - "_consumers": [ - { - "_name": "Consumer1", - "_destinationName": "direct://amq.direct//testQueue", - "_numberOfMessages": 1000000 - } - ] - } - ] - } - ] - } - ] - }] -} diff --git a/qpid/java/perftests/example/config-two-tests.json b/qpid/java/perftests/example/config-two-tests.json deleted file mode 100644 index 79d305b100..0000000000 --- a/qpid/java/perftests/example/config-two-tests.json +++ /dev/null @@ -1,117 +0,0 @@ -{ - "_tests":[ - { - "_name": "One producer to one consumer"; - "_queues":[ - { - "_name": "direct://amq.direct//testQueue" - } - ]; - "_clients":[ - { - "_name": "producingClient", - "_connections":[ - { - "_name": "connection1", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session1", - "_producers": [ - { - "_name": "Producer1", - "_destinationName": "direct://amq.direct//testQueue", - "_numberOfMessages": 5000 - } - ] - } - ] - } - ] - }, - { - "_name": "consumingClient", - "_connections":[ - { - "_name": "connection1", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session1", - "_consumers": [ - { - "_name": "Consumer1", - "_destinationName": "direct://amq.direct//testQueue", - "_numberOfMessages": 5000 - } - ] - } - ] - } - ] - } - ] - }, - { - "_name": "One producer to two consumers"; - "_queues":[ - { - "_name": "direct://amq.direct//testQueue" - } - ]; - "_clients":[ - { - "_name": "producingClient", - "_connections":[ - { - "_name": "connection1", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session1", - "_producers": [ - { - "_name": "Producer", - "_destinationName": "direct://amq.direct//testQueue", - "_numberOfMessages": 5000 - } - ] - } - ] - } - ] - }, - { - "_name": "consumingClient", - "_connections":[ - { - "_name": "connection1", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session1", - "_consumers": [ - { - "_name": "Consumer1", - "_destinationName": "direct://amq.direct//testQueue", - "_numberOfMessages": 2500 - } - ] - }, - { - "_sessionName": "session2", - "_consumers": [ - { - "_name": "Consumer2", - "_destinationName": "direct://amq.direct//testQueue", - "_numberOfMessages": 2500 - } - ] - } - ] - } - ] - } - ] - }] -} diff --git a/qpid/java/perftests/example/log4j-client.properties b/qpid/java/perftests/example/log4j-client.properties deleted file mode 100644 index b724cbf5f2..0000000000 --- a/qpid/java/perftests/example/log4j-client.properties +++ /dev/null @@ -1,29 +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. -# -log4j.rootLogger=ERROR,console - -log4j.logger.org.apache.qpid=WARN -log4j.logger.org.apache.qpid.disttest=INFO - -log4j.appender.console=org.apache.log4j.ConsoleAppender -log4j.appender.console.Threshold=all -log4j.appender.console.layout=org.apache.log4j.PatternLayout - -log4j.appender.console.layout.ConversionPattern=%d %p [%c{1}] %m%n - diff --git a/qpid/java/perftests/example/log4j.properties b/qpid/java/perftests/example/log4j.properties deleted file mode 100644 index cabb774156..0000000000 --- a/qpid/java/perftests/example/log4j.properties +++ /dev/null @@ -1,35 +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. -# -log4j.rootLogger=ERROR,console,fileApp - -log4j.logger.org.apache.qpid=WARN -log4j.logger.org.apache.qpid.disttest=INFO - -log4j.appender.console=org.apache.log4j.ConsoleAppender -log4j.appender.console.Threshold=all -log4j.appender.console.layout=org.apache.log4j.PatternLayout - -log4j.appender.console.layout.ConversionPattern=%d %p [%t] [%c{1}] %m%n - -log4j.appender.fileApp=org.apache.log4j.FileAppender -log4j.appender.fileApp.file=perftests.log -log4j.appender.fileApp.Threshold=info -log4j.appender.fileApp.append=false -log4j.appender.fileApp.layout=org.apache.log4j.PatternLayout -log4j.appender.fileApp.layout.ConversionPattern=%d %p [%t] [%c{1}] %m%n diff --git a/qpid/java/perftests/example/perftests-jndi.properties b/qpid/java/perftests/example/perftests-jndi.properties deleted file mode 100644 index 1c0fd57663..0000000000 --- a/qpid/java/perftests/example/perftests-jndi.properties +++ /dev/null @@ -1,29 +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. - -# this file is used for running system tests of the performance test framework, -# (i.e. not for running the performance tests themselves!) - -java.naming.factory.initial = org.apache.qpid.jndi.PropertiesFileInitialContextFactory - -# use QpidBrokerTestCase's default port -connectionfactory.connectionfactory = amqp://guest:guest@clientid/test?brokerlist='tcp://localhost:5672' - -destination.controllerqueue = direct://amq.direct//controllerqueue?autodelete='true' - -driverName=org.apache.derby.jdbc.EmbeddedDriver -jdbcUrl=jdbc:derby:/tmp/perftestResultsDb;create=true diff --git a/qpid/java/perftests/example/perftests.js b/qpid/java/perftests/example/perftests.js deleted file mode 100644 index be7d5e0be4..0000000000 --- a/qpid/java/perftests/example/perftests.js +++ /dev/null @@ -1,125 +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. - * - */ -var jsonObject = { - _tests:[] -}; - -jsonObject._tests= jsonObject._tests.concat( - QPID.transform( - { - "_name": "Multiple clients: 1 consumer - 1 producer - PERSISTENT - message size=1024", - "_queues":[ - { - "_name": "direct://amq.direct//varying-consumers?durable='true'", - "_durable": true, - "_attributes": - { - "x-qpid-capacity": 10485760, - "x-qpid-flow-resume-capacity": 8388608 - } - } - ], - "_clients":[ - { - "_name": "producingClient", - "_connections":[ - { - "_name": "connection__INDEX_", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session__INDEX_", - "_acknowledgeMode": 1, - "_producers": [ - { - "_name": "Producer__INDEX_", - "_destinationName": "direct://amq.direct//varying-consumers?durable='true'", - "_maximumDuration": 60000, - "_deliveryMode": 2, - "_messageSize": 1024 - } - ] - } - ] - } - ] - }, - { - "_name": "consumingClient", - "_connections":[ - { - "_name": "connection__INDEX_", - "_factory": "connectionfactory", - "_sessions": [ - { - "_sessionName": "session__INDEX_", - "_acknowledgeMode": 1, - "_consumers": [ - { - "_name": "Consumer__INDEX_", - "_destinationName": "direct://amq.direct//varying-consumers?durable='true'", - "_maximumDuration": 60000 - } - ] - } - ] - } - ] - } - ] - }, - function(json) - { - var producerNumbers = [1, 2, 5, 10]; - var consumerNumbers = [1, 2, 5, 10]; - var results = []; - for( var i =0; i < producerNumbers.length; i++) - { - for( var j = 0; j < consumerNumbers.length; j++) - { - var test = QPID.cloneJSON(json); - test._name = "Multiple clients: " + consumerNumbers[j] + " consumer - " + producerNumbers[i] + " producer"; - results.push(test); - test._clients[0]._connections = QPID.times(producerNumbers[i], test._clients[0]._connections[0], "__INDEX_") - test._clients[1]._connections = QPID.times(consumerNumbers[j], test._clients[1]._connections[0], "__INDEX_") - for (var k =0; k< consumerNumbers[j]; k++) - { - test._clients[1]._connections[k]._sessions[0]._consumers[0]._name = "consumer_" + k; - test._clients[1]._connections[k]._sessions[0]._sessionName = "session_" + k; - test._clients[1]._connections[k]._name = "connection_" + k; - test._clients[1]._connections[k]._sessions[0]._consumers[0]._maximumDuration = 30000; - } - for (var k =0; k< producerNumbers[i]; k++) - { - test._clients[0]._connections[k]._sessions[0]._producers[0]._name = "producer_" + k; - test._clients[0]._connections[k]._sessions[0]._sessionName = "session_" + k; - test._clients[0]._connections[k]._name = "connection_" + k; - test._clients[0]._connections[k]._sessions[0]._producers[0]._maximumDuration= 30000; - test._queues[0]._attributes["x-qpid-capacity"] = Math.round(10485760/producerNumbers[i]); - test._queues[0]._attributes["x-qpid-flow-resume-capacity"] = Math.round(8388608/producerNumbers[i]); - } - } - } - return results; - } - ) -); - diff --git a/qpid/java/perftests/example/run-client.sh b/qpid/java/perftests/example/run-client.sh deleted file mode 100755 index 18679a5d08..0000000000 --- a/qpid/java/perftests/example/run-client.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash -# -# 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. -# - -java -cp ".:${QPID_HOME}/lib/*" -Dlog4j.configuration=log4j-client.properties -Dqpid.dest_syntax=BURL org.apache.qpid.disttest.ClientRunner jndi-config=perftests-jndi.properties diff --git a/qpid/java/perftests/example/run.sh b/qpid/java/perftests/example/run.sh deleted file mode 100755 index 0f15f570bb..0000000000 --- a/qpid/java/perftests/example/run.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash -# -# 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. -# - -java -cp ".:${QPID_HOME}/lib/*" -Dqpid.dest_syntax=BURL org.apache.qpid.disttest.ControllerRunner jndi-config=perftests-jndi.properties test-config=$1 distributed=false writeToDb=true - diff --git a/qpid/java/perftests/pom.xml b/qpid/java/perftests/pom.xml deleted file mode 100644 index 39daa6a4bd..0000000000 --- a/qpid/java/perftests/pom.xml +++ /dev/null @@ -1,207 +0,0 @@ - - - - 4.0.0 - - - org.apache.qpid - qpid-java-build - 0.32-SNAPSHOT - - - qpid-perftests - Qpid Performance Tests - Performance testing configuration, code and tests - - - true - - - - - - org.apache.qpid - qpid-client - ${project.version} - - - - org.apache.geronimo.specs - geronimo-jms_1.1_spec - ${geronimo-jms-1-1-version} - provided - - - - - log4j - log4j - ${log4j-version} - - - - org.slf4j - slf4j-log4j12 - ${slf4j-version} - runtime - - - - commons-lang - commons-lang - ${commons-lang-version} - - - - commons-collections - commons-collections - ${commons-collections-version} - - - - commons-beanutils - commons-beanutils-core - ${commons-beanutils-version} - - - - com.google.code.gson - gson - ${gson-version} - - - - org.apache.derby - derby - ${derby-version} - runtime - - - - - org.apache.qpid - qpid-test-utils - ${project.version} - test - - - - - - - - src/main/resources - - - src/main/java - - **/*.java/ - - - - - - - src/test/java - - **/*.java - - - - src/test/resources - - - - - - org.apache.maven.plugins - maven-assembly-plugin - - - - src/main/assembly/qpid-perftests-bin.xml - - - - - make-assembly - package - - single - - - - - - - org.apache.maven.plugins - maven-deploy-plugin - - - true - - - - - org.codehaus.mojo - exec-maven-plugin - 1.3.2 - - - - java - - - - - org.apache.qpid.disttest.ControllerRunner - true - - jndi-config=${basedir}/etc/perftests-jndi.properties - test-config=${basedir}/etc/testdefs - distributed=false - writeToDb=false - - - - log4j.configurationfile:log4j.properties - - - qpid.amqp.version0-91 - - - qpid.dest_syntaxBURL - - - qpid.disttest.duration5000 - - - - - - org.apache.geronimo.specs - geronimo-jms_1.1_spec - ${geronimo-jms-1-1-version} - - - - - - - - diff --git a/qpid/java/perftests/src/main/assembly/LICENSE b/qpid/java/perftests/src/main/assembly/LICENSE deleted file mode 100644 index 3754e75507..0000000000 --- a/qpid/java/perftests/src/main/assembly/LICENSE +++ /dev/null @@ -1,233 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. - - - -############################################### -# Third Party Dependency Licensing Information: -############################################### - -This product bundles the slf4j-api and slf4j-log4j jars which are under -the MIT licence: - -Copyright (c) 2004-2013 QOS.ch - All rights reserved. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/qpid/java/perftests/src/main/assembly/NOTICE b/qpid/java/perftests/src/main/assembly/NOTICE deleted file mode 100644 index 5166f1de8d..0000000000 --- a/qpid/java/perftests/src/main/assembly/NOTICE +++ /dev/null @@ -1,48 +0,0 @@ -Qpid Java Perftests -Copyright 2006-2014 The Apache Software Foundation - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). - -############################################### - -Apache Derby -Copyright 2004-2011 The Apache Software Foundation - -Portions of Derby were originally developed by -International Business Machines Corporation and are -licensed to the Apache Software Foundation under the -"Software Grant and Corporate Contribution License Agreement", -informally known as the "Derby CLA". -The following copyright notice(s) were affixed to portions of the code -with which this file is now or was at one time distributed -and are placed here unaltered. - -(C) Copyright 1997,2004 International Business Machines Corporation. All rights reserved. - -(C) Copyright IBM Corp. 2003. - -############################################### - -Commons Logging -Copyright 2001-2007 The Apache Software Foundation - -############################################### - -Apache Commons BeanUtils -Copyright 2000-2010 The Apache Software Foundation - -############################################### - -Apache Commons Collections -Copyright 2001-2008 The Apache Software Foundation - -############################################### - -Apache Commons Lang -Copyright 2001-2011 The Apache Software Foundation - -############################################### - -Apache log4j -Copyright 2007 The Apache Software Foundation diff --git a/qpid/java/perftests/src/main/assembly/dependency-verification/DEPENDENCIES_REFERENCE b/qpid/java/perftests/src/main/assembly/dependency-verification/DEPENDENCIES_REFERENCE deleted file mode 100644 index 2fd03b4e3b..0000000000 --- a/qpid/java/perftests/src/main/assembly/dependency-verification/DEPENDENCIES_REFERENCE +++ /dev/null @@ -1,60 +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. -# - -#// ------------------------------------------------------------------ -# TRIMMED 3RD PARTY DEPENDENCY INFORMATION FOR MODIFICATION CHECKS -#// ------------------------------------------------------------------ - - - -From: 'Apache Software Foundation' (http://db.apache.org/) - - Apache Derby Database Engine and Embedded JDBC Driver (http://db.apache.org/derby/derby/) org.apache.derby:derby:jar:10.8.2.2 - License: Apache 2 (http://www.apache.org/licenses/LICENSE-2.0.txt) - -From: 'Apache Software Foundation' (http://www.apache.org) - - Apache Log4j (http://logging.apache.org/log4j/1.2/) log4j:log4j:bundle:1.2.16 - License: The Apache Software License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt) - -From: 'Google, Inc.' (http://www.google.com) - - Gson (http://code.google.com/p/google-gson/) com.google.code.gson:gson:jar:2.0 - License: The Apache Software License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt) - -From: 'QOS.ch' (http://www.qos.ch) - - SLF4J API Module (http://www.slf4j.org) org.slf4j:slf4j-api:jar:1.6.4 - License: MIT License (http://www.opensource.org/licenses/mit-license.php) - - SLF4J LOG4J-12 Binding (http://www.slf4j.org) org.slf4j:slf4j-log4j12:jar:1.6.4 - License: MIT License (http://www.opensource.org/licenses/mit-license.php) - -From: 'The Apache Software Foundation' (http://www.apache.org/) - - Commons BeanUtils Core (http://commons.apache.org/beanutils/) commons-beanutils:commons-beanutils-core:jar:1.8.3 - License: The Apache Software License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt) - - Commons Collections (http://commons.apache.org/collections/) commons-collections:commons-collections:jar:3.2.1 - License: The Apache Software License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt) - - Commons Lang (http://commons.apache.org/lang/) commons-lang:commons-lang:jar:2.6 - License: The Apache Software License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt) - - Commons Logging (http://commons.apache.org/logging) commons-logging:commons-logging:jar:1.1.1 - License: The Apache Software License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt) - - Qpid AMQP 0-x JMS Client (http://qpid.apache.org/qpid-java-build/qpid-client) org.apache.qpid:qpid-client:jar - License: The Apache Software License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt) - - Qpid Common (http://qpid.apache.org/qpid-java-build/management/qpid-common) org.apache.qpid:qpid-common:jar - License: The Apache Software License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt) - - - - diff --git a/qpid/java/perftests/src/main/assembly/qpid-perftests-bin.xml b/qpid/java/perftests/src/main/assembly/qpid-perftests-bin.xml deleted file mode 100644 index 7b4e5a44d9..0000000000 --- a/qpid/java/perftests/src/main/assembly/qpid-perftests-bin.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - bin - - tar.gz - - qpid-perftests/${project.version} - - - ${project.basedir} - / - - etc/ - - - - ${basedir}/src/main/assembly/ - / - - README.txt - NOTICE - LICENSE - - 0644 - 0755 - - - - - /lib - true - - - org.apache.qpid:qpid-client - org.apache.qpid:qpid-common - - - - /lib - false - provided - - org.apache.geronimo.specs:geronimo-jms_1.1_spec - - - - - diff --git a/qpid/java/perftests/src/main/java/json2.js b/qpid/java/perftests/src/main/java/json2.js deleted file mode 100644 index 2dbf60d398..0000000000 --- a/qpid/java/perftests/src/main/java/json2.js +++ /dev/null @@ -1,487 +0,0 @@ -/* - http://www.JSON.org/json2.js - 2011-10-19 - - Public Domain. - - NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. - - See http://www.JSON.org/js.html - - - This code should be minified before deployment. - See http://javascript.crockford.com/jsmin.html - - USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO - NOT CONTROL. - - - This file creates a global JSON object containing two methods: stringify - and parse. - - JSON.stringify(value, replacer, space) - value any JavaScript value, usually an object or array. - - replacer an optional parameter that determines how object - values are stringified for objects. It can be a - function or an array of strings. - - space an optional parameter that specifies the indentation - of nested structures. If it is omitted, the text will - be packed without extra whitespace. If it is a number, - it will specify the number of spaces to indent at each - level. If it is a string (such as '\t' or ' '), - it contains the characters used to indent at each level. - - This method produces a JSON text from a JavaScript value. - - When an object value is found, if the object contains a toJSON - method, its toJSON method will be called and the result will be - stringified. A toJSON method does not serialize: it returns the - value represented by the name/value pair that should be serialized, - or undefined if nothing should be serialized. The toJSON method - will be passed the key associated with the value, and this will be - bound to the value - - For example, this would serialize Dates as ISO strings. - - Date.prototype.toJSON = function (key) { - function f(n) { - // Format integers to have at least two digits. - return n < 10 ? '0' + n : n; - } - - return this.getUTCFullYear() + '-' + - f(this.getUTCMonth() + 1) + '-' + - f(this.getUTCDate()) + 'T' + - f(this.getUTCHours()) + ':' + - f(this.getUTCMinutes()) + ':' + - f(this.getUTCSeconds()) + 'Z'; - }; - - You can provide an optional replacer method. It will be passed the - key and value of each member, with this bound to the containing - object. The value that is returned from your method will be - serialized. If your method returns undefined, then the member will - be excluded from the serialization. - - If the replacer parameter is an array of strings, then it will be - used to select the members to be serialized. It filters the results - such that only members with keys listed in the replacer array are - stringified. - - Values that do not have JSON representations, such as undefined or - functions, will not be serialized. Such values in objects will be - dropped; in arrays they will be replaced with null. You can use - a replacer function to replace those with JSON values. - JSON.stringify(undefined) returns undefined. - - The optional space parameter produces a stringification of the - value that is filled with line breaks and indentation to make it - easier to read. - - If the space parameter is a non-empty string, then that string will - be used for indentation. If the space parameter is a number, then - the indentation will be that many spaces. - - Example: - - text = JSON.stringify(['e', {pluribus: 'unum'}]); - // text is '["e",{"pluribus":"unum"}]' - - - text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t'); - // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]' - - text = JSON.stringify([new Date()], function (key, value) { - return this[key] instanceof Date ? - 'Date(' + this[key] + ')' : value; - }); - // text is '["Date(---current time---)"]' - - - JSON.parse(text, reviver) - This method parses a JSON text to produce an object or array. - It can throw a SyntaxError exception. - - The optional reviver parameter is a function that can filter and - transform the results. It receives each of the keys and values, - and its return value is used instead of the original value. - If it returns what it received, then the structure is not modified. - If it returns undefined then the member is deleted. - - Example: - - // Parse the text. Values that look like ISO date strings will - // be converted to Date objects. - - myData = JSON.parse(text, function (key, value) { - var a; - if (typeof value === 'string') { - a = -/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value); - if (a) { - return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4], - +a[5], +a[6])); - } - } - return value; - }); - - myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) { - var d; - if (typeof value === 'string' && - value.slice(0, 5) === 'Date(' && - value.slice(-1) === ')') { - d = new Date(value.slice(5, -1)); - if (d) { - return d; - } - } - return value; - }); - - - This is a reference implementation. You are free to copy, modify, or - redistribute. -*/ - -/*jslint evil: true, regexp: true */ - -/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply, - call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours, - getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join, - lastIndex, length, parse, prototype, push, replace, slice, stringify, - test, toJSON, toString, valueOf -*/ - - -// Create a JSON object only if one does not already exist. We create the -// methods in a closure to avoid creating global variables. - -var JSON; -if (!JSON) { - JSON = {}; -} - -(function () { - 'use strict'; - - function f(n) { - // Format integers to have at least two digits. - return n < 10 ? '0' + n : n; - } - - if (typeof Date.prototype.toJSON !== 'function') { - - Date.prototype.toJSON = function (key) { - - return isFinite(this.valueOf()) - ? this.getUTCFullYear() + '-' + - f(this.getUTCMonth() + 1) + '-' + - f(this.getUTCDate()) + 'T' + - f(this.getUTCHours()) + ':' + - f(this.getUTCMinutes()) + ':' + - f(this.getUTCSeconds()) + 'Z' - : null; - }; - - String.prototype.toJSON = - Number.prototype.toJSON = - Boolean.prototype.toJSON = function (key) { - return this.valueOf(); - }; - } - - var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, - escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, - gap, - indent, - meta = { // table of character substitutions - '\b': '\\b', - '\t': '\\t', - '\n': '\\n', - '\f': '\\f', - '\r': '\\r', - '"' : '\\"', - '\\': '\\\\' - }, - rep; - - - function quote(string) { - -// If the string contains no control characters, no quote characters, and no -// backslash characters, then we can safely slap some quotes around it. -// Otherwise we must also replace the offending characters with safe escape -// sequences. - - escapable.lastIndex = 0; - return escapable.test(string) ? '"' + string.replace(escapable, function (a) { - var c = meta[a]; - return typeof c === 'string' - ? c - : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); - }) + '"' : '"' + string + '"'; - } - - - function str(key, holder) { - -// Produce a string from holder[key]. - - var i, // The loop counter. - k, // The member key. - v, // The member value. - length, - mind = gap, - partial, - value = holder[key]; - -// If the value has a toJSON method, call it to obtain a replacement value. - - if (value && typeof value === 'object' && - typeof value.toJSON === 'function') { - value = value.toJSON(key); - } - -// If we were called with a replacer function, then call the replacer to -// obtain a replacement value. - - if (typeof rep === 'function') { - value = rep.call(holder, key, value); - } - -// What happens next depends on the value's type. - - switch (typeof value) { - case 'string': - return quote(value); - - case 'number': - -// JSON numbers must be finite. Encode non-finite numbers as null. - - return isFinite(value) ? String(value) : 'null'; - - case 'boolean': - case 'null': - -// If the value is a boolean or null, convert it to a string. Note: -// typeof null does not produce 'null'. The case is included here in -// the remote chance that this gets fixed someday. - - return String(value); - -// If the type is 'object', we might be dealing with an object or an array or -// null. - - case 'object': - -// Due to a specification blunder in ECMAScript, typeof null is 'object', -// so watch out for that case. - - if (!value) { - return 'null'; - } - -// Make an array to hold the partial results of stringifying this object value. - - gap += indent; - partial = []; - -// Is the value an array? - - if (Object.prototype.toString.apply(value) === '[object Array]') { - -// The value is an array. Stringify every element. Use null as a placeholder -// for non-JSON values. - - length = value.length; - for (i = 0; i < length; i += 1) { - partial[i] = str(i, value) || 'null'; - } - -// Join all of the elements together, separated with commas, and wrap them in -// brackets. - - v = partial.length === 0 - ? '[]' - : gap - ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' - : '[' + partial.join(',') + ']'; - gap = mind; - return v; - } - -// If the replacer is an array, use it to select the members to be stringified. - - if (rep && typeof rep === 'object') { - length = rep.length; - for (i = 0; i < length; i += 1) { - if (typeof rep[i] === 'string') { - k = rep[i]; - v = str(k, value); - if (v) { - partial.push(quote(k) + (gap ? ': ' : ':') + v); - } - } - } - } else { - -// Otherwise, iterate through all of the keys in the object. - - for (k in value) { - if (Object.prototype.hasOwnProperty.call(value, k)) { - v = str(k, value); - if (v) { - partial.push(quote(k) + (gap ? ': ' : ':') + v); - } - } - } - } - -// Join all of the member texts together, separated with commas, -// and wrap them in braces. - - v = partial.length === 0 - ? '{}' - : gap - ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' - : '{' + partial.join(',') + '}'; - gap = mind; - return v; - } - } - -// If the JSON object does not yet have a stringify method, give it one. - - if (typeof JSON.stringify !== 'function') { - JSON.stringify = function (value, replacer, space) { - -// The stringify method takes a value and an optional replacer, and an optional -// space parameter, and returns a JSON text. The replacer can be a function -// that can replace values, or an array of strings that will select the keys. -// A default replacer method can be provided. Use of the space parameter can -// produce text that is more easily readable. - - var i; - gap = ''; - indent = ''; - -// If the space parameter is a number, make an indent string containing that -// many spaces. - - if (typeof space === 'number') { - for (i = 0; i < space; i += 1) { - indent += ' '; - } - -// If the space parameter is a string, it will be used as the indent string. - - } else if (typeof space === 'string') { - indent = space; - } - -// If there is a replacer, it must be a function or an array. -// Otherwise, throw an error. - - rep = replacer; - if (replacer && typeof replacer !== 'function' && - (typeof replacer !== 'object' || - typeof replacer.length !== 'number')) { - throw new Error('JSON.stringify'); - } - -// Make a fake root object containing our value under the key of ''. -// Return the result of stringifying the value. - - return str('', {'': value}); - }; - } - - -// If the JSON object does not yet have a parse method, give it one. - - if (typeof JSON.parse !== 'function') { - JSON.parse = function (text, reviver) { - -// The parse method takes a text and an optional reviver function, and returns -// a JavaScript value if the text is a valid JSON text. - - var j; - - function walk(holder, key) { - -// The walk method is used to recursively walk the resulting structure so -// that modifications can be made. - - var k, v, value = holder[key]; - if (value && typeof value === 'object') { - for (k in value) { - if (Object.prototype.hasOwnProperty.call(value, k)) { - v = walk(value, k); - if (v !== undefined) { - value[k] = v; - } else { - delete value[k]; - } - } - } - } - return reviver.call(holder, key, value); - } - - -// Parsing happens in four stages. In the first stage, we replace certain -// Unicode characters with escape sequences. JavaScript handles many characters -// incorrectly, either silently deleting them, or treating them as line endings. - - text = String(text); - cx.lastIndex = 0; - if (cx.test(text)) { - text = text.replace(cx, function (a) { - return '\\u' + - ('0000' + a.charCodeAt(0).toString(16)).slice(-4); - }); - } - -// In the second stage, we run the text against regular expressions that look -// for non-JSON patterns. We are especially concerned with '()' and 'new' -// because they can cause invocation, and '=' because it can cause mutation. -// But just to be safe, we want to reject all unexpected forms. - -// We split the second stage into 4 regexp operations in order to work around -// crippling inefficiencies in IE's and Safari's regexp engines. First we -// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we -// replace all simple value tokens with ']' characters. Third, we delete all -// open brackets that follow a colon or comma or that begin the text. Finally, -// we look to see that the remaining characters are only whitespace or ']' or -// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval. - - if (/^[\],:{}\s]*$/ - .test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@') - .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']') - .replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { - -// In the third stage we use the eval function to compile the text into a -// JavaScript structure. The '{' operator is subject to a syntactic ambiguity -// in JavaScript: it can begin a block or an object literal. We wrap the text -// in parens to eliminate the ambiguity. - - j = eval('(' + text + ')'); - -// In the optional fourth stage, we recursively walk the new structure, passing -// each name/value pair to a reviver function for possible transformation. - - return typeof reviver === 'function' - ? walk({'': j}, '') - : j; - } - -// If the text is not JSON parseable, then a SyntaxError is thrown. - - throw new SyntaxError('JSON.parse'); - }; - } -}()); diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/AbstractRunner.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/AbstractRunner.java deleted file mode 100644 index 1192a2729a..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/AbstractRunner.java +++ /dev/null @@ -1,74 +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; - -import java.io.FileInputStream; -import java.util.HashMap; -import java.util.Map; -import java.util.Properties; - -import javax.naming.Context; -import javax.naming.InitialContext; - -public class AbstractRunner -{ - public static final String JNDI_CONFIG_PROP = "jndi-config"; - public static final String JNDI_CONFIG_DEFAULT = "perftests-jndi.properties"; - - private Map _cliOptions = new HashMap(); - { - getCliOptions().put(JNDI_CONFIG_PROP, JNDI_CONFIG_DEFAULT); - } - - protected Context getContext() - { - Context context = null; - - try(FileInputStream inStream = new FileInputStream(getJndiConfig())) - { - final Properties properties = new Properties(); - properties.load(inStream); - context = new InitialContext(properties); - } - catch (Exception e) - { - throw new DistributedTestException("Exception while loading JNDI properties", e); - } - - return context; - } - - public void parseArgumentsIntoConfig(String[] args) - { - ArgumentParser argumentParser = new ArgumentParser(); - argumentParser.parseArgumentsIntoConfig(getCliOptions(), args); - } - - protected String getJndiConfig() - { - return getCliOptions().get(AbstractRunner.JNDI_CONFIG_PROP); - } - - protected Map getCliOptions() - { - return _cliOptions; - } -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/ArgumentParser.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/ArgumentParser.java deleted file mode 100644 index e7421fb9b3..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/ArgumentParser.java +++ /dev/null @@ -1,54 +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; - -import java.util.Map; - -public class ArgumentParser -{ - public void parseArgumentsIntoConfig(Map initialValues, String[] args) - { - for(String arg: args) - { - String[] splitArg = arg.split("="); - if (splitArg.length == 1 && splitArg[0].equals("-h")) - { - initialValues.put("-h", null); - continue; - } - - if(splitArg.length != 2) - { - throw new IllegalArgumentException("arguments must have format =: " + arg); - } - - - String argumentKey = splitArg[0]; - String argumentValue = splitArg[1]; - if(!initialValues.containsKey(argumentKey)) - { - throw new IllegalArgumentException("not a valid configuration property: " + arg); - } - initialValues.put(argumentKey, argumentValue); - } - - } -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/Benchmark.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/Benchmark.java deleted file mode 100644 index 01aefb0977..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/Benchmark.java +++ /dev/null @@ -1,290 +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; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Properties; - -import javax.naming.Context; -import javax.naming.InitialContext; - -import org.apache.qpid.disttest.controller.Controller; -import org.apache.qpid.disttest.controller.ResultsForAllTests; -import org.apache.qpid.disttest.controller.config.Config; -import org.apache.qpid.disttest.controller.config.ConfigReader; -import org.apache.qpid.disttest.controller.config.TestConfig; -import org.apache.qpid.disttest.jms.ControllerJmsDelegate; -import org.apache.qpid.disttest.results.BenchmarkResultWriter; -import org.apache.qpid.disttest.results.ResultsWriter; -import org.apache.qpid.disttest.results.aggregation.Aggregator; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Performs a performance benchmark using the performance test suite. The performance test - * script (Benchmark.js) is normally found on the classpath. - * - * Typical command line usage: - * - * java -cp ".:./lib/*" -Dqpid.disttest.duration=1000 -Dqpid.disttest.messageSize=2048 -Dqpid.dest_syntax=BURL - * org.apache.qpid.disttest.Benchmark - * report-message-totals=false jndi-config=etc/perftests-jndi.properties - * - * The classpath must contain the JMS client and the performance test JAR. - * - */ -public class Benchmark -{ - private static final Logger LOGGER = LoggerFactory.getLogger(Benchmark.class); - - private static final String REPORT_MESSAGE_TOTALS = "report-message-totals"; - private static final String JNDI_CONFIG_PROP = "jndi-config"; - private static final String JNDI_CONFIG_DEFAULT = "jndi.properties"; - private static final String TEST_CONFIG_PROP = "test-config"; - - @SuppressWarnings("serial") - private Map _cliOptions = new HashMap() - {{ - put(JNDI_CONFIG_PROP, JNDI_CONFIG_DEFAULT); - put(TEST_CONFIG_PROP, "/Benchmark.js"); - put(REPORT_MESSAGE_TOTALS, "false"); - }}; - - private final Aggregator _aggregator = new Aggregator(); - - public static void main(String[] args) throws Exception - { - Benchmark benchmark = new Benchmark(); - benchmark.parseArgumentsIntoConfig(args); - benchmark.doBenchMark(); - } - - private void parseArgumentsIntoConfig(String[] args) - { - ArgumentParser argumentParser = new ArgumentParser(); - argumentParser.parseArgumentsIntoConfig(getCliOptions(), args); - if (_cliOptions.containsKey("-h")) - { - printHelp(null); - } - } - - private void printHelp(String message) - { - if (message != null) - { - System.out.println(message); - System.out.println(); - } - System.out.println("Usage:"); - System.out.println("java -cp \"\" -Dqpid.disttest.duration= -Dqpid.disttest.messageSize= org.apache.qpid.disttest.Benchmark [-h] [report-message-totals=] [jndi-config=] [test-config=]"); - System.out.println(" -h prints this help"); - System.out.println(" report-message-totals optional flag to report total payload. Default is false"); - System.out.println(" jndi-config path to jndi properties. Default is jndi.properties"); - System.out.println(" test-config path to test configuration. If not set, defaults to a built in bench mark test script. Alternative testscript(s) can be run by setting this option to a directory or file. If the former, all testscripts within the directory are executed."); - System.out.println(); - System.out.println("Supported JVM settings:"); - System.out.println(" qpid.disttest.duration overridden test duration in milliseconds"); - System.out.println(" qpid.disttest.messageSize overridden message size in bytes"); - System.exit(0); - } - - private Context getContext() - { - String jndiConfig = getJndiConfig(); - if (jndiConfig == null) - { - printHelp("JNDI configuration is not provided"); - } - - try - { - final Properties properties = loadProperties(jndiConfig); - return new InitialContext(properties); - } - catch (Exception e) - { - throw new DistributedTestException("Exception while loading JNDI properties from '" + jndiConfig + "'", e); - } - } - - private Properties loadProperties(String jndiConfig) throws IOException, FileNotFoundException - { - final Properties properties = new Properties(); - InputStream inStream = getClass().getResourceAsStream(jndiConfig); - if (inStream == null) - { - if (!new File(jndiConfig).exists()) - { - printHelp("Cannot find " + jndiConfig); - } - inStream = new FileInputStream(jndiConfig); - } - - try - { - properties.load(inStream); - } - finally - { - if (inStream != null) - { - inStream.close(); - } - } - return properties; - } - - private void doBenchMark() throws Exception - { - Context context = getContext(); - ControllerJmsDelegate jmsDelegate = new ControllerJmsDelegate(context); - - try - { - runTests(jmsDelegate, context); - } - finally - { - jmsDelegate.closeConnections(); - } - } - - private String getJndiConfig() - { - return getCliOptions().get(JNDI_CONFIG_PROP); - } - - private boolean getReportMessageTotals() - { - return Boolean.parseBoolean(getCliOptions().get(REPORT_MESSAGE_TOTALS)); - } - - private Map getCliOptions() - { - return _cliOptions; - } - private void runTests(ControllerJmsDelegate jmsDelegate, Context context) - { - Controller controller = new Controller(jmsDelegate, DistributedTestConstants.REGISTRATION_TIMEOUT, DistributedTestConstants.COMMAND_RESPONSE_TIMEOUT); - - String testConfigPath = getCliOptions().get(TEST_CONFIG_PROP); - Config testConfig = buildTestConfigFrom(testConfigPath); - createClients(testConfig, context); - controller.setConfig(testConfig); - try - { - List results = new ArrayList(); - - controller.awaitClientRegistrations(); - - ResultsForAllTests testResult = runTest(controller, testConfig, testConfigPath); - results.add(testResult); - } - catch(Exception e) - { - LOGGER.error("Problem running test", e); - } - finally - { - controller.stopAllRegisteredClients(); - } - } - - private ResultsForAllTests runTest(Controller controller, Config testConfig, String testConfigFile) - { - ResultsWriter _resultsWriter = new BenchmarkResultWriter(getReportMessageTotals()); - ResultsForAllTests rawResultsForAllTests = controller.runAllTests(); - ResultsForAllTests resultsForAllTests = _aggregator.aggregateResults(rawResultsForAllTests); - - _resultsWriter.writeResults(resultsForAllTests, testConfigFile); - - return resultsForAllTests; - } - - private void createClients(Config testConfig, Context context) - { - int maxNumberOfClients = testConfig.getTotalNumberOfClients(); - - //we must create the required test clients, running in single-jvm mode - for (int i = 1; i <= maxNumberOfClients; i++) - { - ClientRunner clientRunner = new ClientRunner(); - clientRunner.runClients(context); - } - } - - private Config buildTestConfigFrom(String testConfigFile) - { - ConfigReader configReader = new ConfigReader(); - Config testConfig; - InputStream configStream = null; - try - { - configStream = getClass().getResourceAsStream(testConfigFile); - if (configStream != null) - { - testConfig = configReader.readConfig(new InputStreamReader(configStream), testConfigFile.endsWith(".js")); - } - else - { - ConfigFileHelper configFileHelper = new ConfigFileHelper(); - List files = configFileHelper.getTestConfigFiles(testConfigFile); - List tests = new ArrayList(); - for (String file : files) - { - Config config = configReader.getConfigFromFile(file); - tests.addAll(config.getTestConfigs()); - } - testConfig = new Config(tests); - } - } - catch (IOException e) - { - throw new DistributedTestException("Exception while loading test config from '" - + testConfigFile + "'. Tried both classpath and filesystem", e); - } - finally - { - if (configStream != null) - { - try - { - configStream.close(); - } - catch (IOException e) - { - } - } - } - - return testConfig; - } -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/ClientRunner.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/ClientRunner.java deleted file mode 100644 index 7450610597..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/ClientRunner.java +++ /dev/null @@ -1,98 +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; - -import javax.naming.Context; -import javax.naming.NamingException; - -import org.apache.qpid.disttest.client.Client; -import org.apache.qpid.disttest.jms.ClientJmsDelegate; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class ClientRunner extends AbstractRunner -{ - private static final Logger LOGGER = LoggerFactory.getLogger(ClientRunner.class); - - public static final String NUM_OF_CLIENTS_PROP = "number-of-clients"; - - public static final String NUM_OF_CLIENTS_DEFAULT = "1"; - - public ClientRunner() - { - getCliOptions().put(NUM_OF_CLIENTS_PROP, NUM_OF_CLIENTS_DEFAULT); - } - - public static void main(String[] args) - { - ClientRunner runner = new ClientRunner(); - runner.parseArgumentsIntoConfig(args); - runner.runClients(); - } - - public void setJndiPropertiesFileLocation(String jndiConfigFileLocation) - { - getCliOptions().put(JNDI_CONFIG_PROP, jndiConfigFileLocation); - } - - /** - * Run the clients in the background - */ - public void runClients() - { - Context context = getContext(); - runClients(context); - } - - public void runClients(Context context) - { - int numClients = Integer.parseInt(getCliOptions().get(NUM_OF_CLIENTS_PROP)); - - for(int i = 1; i <= numClients; i++) - { - createBackgroundClient(context); - } - } - - private void createBackgroundClient(Context context) - { - try - { - final Client client = new Client(new ClientJmsDelegate(context)); - - final Thread clientThread = new Thread(new Runnable() - { - @Override - public void run() - { - LOGGER.info("Starting client " + client.getClientName()); - client.start(); - client.waitUntilStopped(); - LOGGER.info("Stopped client " + client.getClientName()); - } - }); - clientThread.start(); - } - catch (NamingException e) - { - throw new DistributedTestException("Exception while creating client instance", e); - } - } -} 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 deleted file mode 100644 index a465813159..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/ConfigFileHelper.java +++ /dev/null @@ -1,63 +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; - -import java.io.File; -import java.io.FilenameFilter; -import java.util.ArrayList; -import java.util.List; - -public class ConfigFileHelper -{ - /** - * Returns absolute paths to the config file(s). - *

- * If testConfigPath is a directory, its .js and .json files are returned. - * Otherwise, the returned list just contains testConfigPath. - */ - public List getTestConfigFiles(String testConfigPath) - { - final List testConfigFile = new ArrayList(); - final File configFileOrDirectory = new File(testConfigPath); - - if (configFileOrDirectory.isDirectory()) - { - final String[] configFiles = configFileOrDirectory.list(new FilenameFilter() - { - @Override - public boolean accept(File dir, String name) - { - boolean suffixOk = name.endsWith(".json") || name.endsWith(".js"); - return new File(dir, name).isFile() && suffixOk; - } - }); - - for (String configFile : configFiles) - { - testConfigFile.add(new File(configFileOrDirectory, configFile).getAbsolutePath()); - } - } - else - { - testConfigFile.add(configFileOrDirectory.getAbsolutePath()); - } - - return testConfigFile; - } -} 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 deleted file mode 100644 index a790011663..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/ControllerRunner.java +++ /dev/null @@ -1,212 +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; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import javax.naming.Context; - -import org.apache.qpid.disttest.controller.Controller; -import org.apache.qpid.disttest.controller.ResultsForAllTests; -import org.apache.qpid.disttest.controller.config.Config; -import org.apache.qpid.disttest.controller.config.ConfigReader; -import org.apache.qpid.disttest.db.ResultsDbWriter; -import org.apache.qpid.disttest.jms.ControllerJmsDelegate; -import org.apache.qpid.disttest.results.ResultsCsvWriter; -import org.apache.qpid.disttest.results.ResultsWriter; -import org.apache.qpid.disttest.results.aggregation.Aggregator; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class ControllerRunner extends AbstractRunner -{ - private static final Logger LOGGER = LoggerFactory.getLogger(ControllerRunner.class); - - public static final String TEST_CONFIG_PROP = "test-config"; - public static final String DISTRIBUTED_PROP = "distributed"; - public static final String OUTPUT_DIR_PROP = "outputdir"; - public static final String WRITE_TO_DB = "writeToDb"; - public static final String RUN_ID = "runId"; - - private static final String TEST_CONFIG_DEFAULT = "perftests-config.json"; - private static final String DISTRIBUTED_DEFAULT = "false"; - private static final String OUTPUT_DIR_DEFAULT = "."; - public static final String WRITE_TO_DB_DEFAULT = "false"; - - private final Aggregator _aggregator = new Aggregator(); - - private final ConfigFileHelper _configFileHelper = new ConfigFileHelper(); - - private ResultsWriter _resultsFileWriter; - - private ResultsDbWriter _resultsDbWriter; - - public ControllerRunner() - { - getCliOptions().put(TEST_CONFIG_PROP, TEST_CONFIG_DEFAULT); - getCliOptions().put(DISTRIBUTED_PROP, DISTRIBUTED_DEFAULT); - getCliOptions().put(OUTPUT_DIR_PROP, OUTPUT_DIR_DEFAULT); - getCliOptions().put(WRITE_TO_DB, WRITE_TO_DB_DEFAULT); - getCliOptions().put(RUN_ID, null); - } - - public static void main(String[] args) throws Exception - { - ControllerRunner runner = new ControllerRunner(); - runner.parseArgumentsIntoConfig(args); - runner.runController(); - } - - public void runController() throws Exception - { - Context context = getContext(); - setUpResultFilesWriter(); - setUpResultsDbWriter(); - - ControllerJmsDelegate jmsDelegate = new ControllerJmsDelegate(context); - - try - { - runTests(jmsDelegate); - } - finally - { - jmsDelegate.closeConnections(); - } - } - - private void setUpResultsDbWriter() - { - String writeToDbStr = getCliOptions().get(WRITE_TO_DB); - if(Boolean.valueOf(writeToDbStr)) - { - String runId = getCliOptions().get(RUN_ID); - _resultsDbWriter = new ResultsDbWriter(getContext(), runId); - _resultsDbWriter.createResultsTableIfNecessary(); - } - } - - void setUpResultFilesWriter() - { - String outputDirString = getCliOptions().get(ControllerRunner.OUTPUT_DIR_PROP); - File outputDir = new File(outputDirString); - _resultsFileWriter = new ResultsCsvWriter(outputDir); - } - - private void runTests(ControllerJmsDelegate jmsDelegate) - { - Controller controller = new Controller(jmsDelegate, DistributedTestConstants.REGISTRATION_TIMEOUT, DistributedTestConstants.COMMAND_RESPONSE_TIMEOUT); - - String testConfigPath = getCliOptions().get(ControllerRunner.TEST_CONFIG_PROP); - List testConfigFiles = _configFileHelper.getTestConfigFiles(testConfigPath); - createClientsIfNotDistributed(testConfigFiles); - - try - { - List results = new ArrayList(); - - for (String testConfigFile : testConfigFiles) - { - final Config testConfig = buildTestConfigFrom(testConfigFile); - controller.setConfig(testConfig); - - controller.awaitClientRegistrations(); - - LOGGER.info("Running test : " + testConfigFile); - ResultsForAllTests testResult = runTest(controller, testConfigFile); - results.add(testResult); - } - - _resultsFileWriter.writeResultsSummary(results); - } - catch(Exception e) - { - LOGGER.error("Problem running test", e); - } - finally - { - controller.stopAllRegisteredClients(); - } - } - - private ResultsForAllTests runTest(Controller controller, String testConfigFile) - { - final Config testConfig = buildTestConfigFrom(testConfigFile); - controller.setConfig(testConfig); - - ResultsForAllTests rawResultsForAllTests = controller.runAllTests(); - ResultsForAllTests resultsForAllTests = _aggregator.aggregateResults(rawResultsForAllTests); - - _resultsFileWriter.writeResults(resultsForAllTests, testConfigFile); - if(_resultsDbWriter != null) - { - _resultsDbWriter.writeResults(resultsForAllTests); - } - - return resultsForAllTests; - } - - private void createClientsIfNotDistributed(final List testConfigFiles) - { - if(!isDistributed()) - { - int maxNumberOfClients = 0; - for (String testConfigFile : testConfigFiles) - { - final Config testConfig = buildTestConfigFrom(testConfigFile); - final int numClients = testConfig.getTotalNumberOfClients(); - maxNumberOfClients = Math.max(numClients, maxNumberOfClients); - } - - //we must create the required test clients, running in single-jvm mode - for (int i = 1; i <= maxNumberOfClients; i++) - { - ClientRunner clientRunner = new ClientRunner(); - clientRunner.setJndiPropertiesFileLocation(getJndiConfig()); - clientRunner.runClients(); - } - } - } - - private Config buildTestConfigFrom(String testConfigFile) - { - ConfigReader configReader = new ConfigReader(); - Config testConfig; - try - { - testConfig = configReader.getConfigFromFile(testConfigFile); - } - catch (IOException e) - { - throw new DistributedTestException("Exception while loading test config from '" + testConfigFile + "'", e); - } - return testConfig; - } - - private boolean isDistributed() - { - return Boolean.valueOf(getCliOptions().get(ControllerRunner.DISTRIBUTED_PROP)); - } - - -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/DistributedTestConstants.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/DistributedTestConstants.java deleted file mode 100644 index a6f872e841..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/DistributedTestConstants.java +++ /dev/null @@ -1,35 +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; - -public abstract class DistributedTestConstants -{ - public static final String PERF_TEST_PROPERTIES_FILE = "perftests.properties"; - - public static final String MSG_COMMAND_PROPERTY = "COMMAND"; - public static final String MSG_JSON_PROPERTY = "JSON"; - - public static final long REGISTRATION_TIMEOUT = 60 * 1000; - - /** set to a long time out because stopping clients can take a long time */ - public static final long COMMAND_RESPONSE_TIMEOUT = 120 * 1000; - - public static final String CONTROLLER_QUEUE_JNDI_NAME = "controllerqueue"; -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/DistributedTestException.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/DistributedTestException.java deleted file mode 100644 index d1d24dcfff..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/DistributedTestException.java +++ /dev/null @@ -1,66 +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; - -import org.apache.qpid.disttest.message.Command; - -public class DistributedTestException extends RuntimeException -{ - private static final long serialVersionUID = 1L; - private final Command causeCommand; - - public DistributedTestException(final String message) - { - this(message, (Command) null); - } - - public DistributedTestException(final Throwable cause) - { - this(cause, null); - } - - public DistributedTestException(final String message, final Throwable cause) - { - this(message, cause, null); - } - - public DistributedTestException(final String message, final Command commandCause) - { - super(message); - causeCommand = commandCause; - } - - public DistributedTestException(final Throwable cause, final Command commandCause) - { - super(cause); - causeCommand = commandCause; - } - - public DistributedTestException(final String message, final Throwable cause, final Command commandCause) - { - super(message, cause); - causeCommand = commandCause; - } - - public Command getCauseCommand() - { - return causeCommand; - } -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/Visitor.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/Visitor.java deleted file mode 100644 index 52dad9aa4d..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/Visitor.java +++ /dev/null @@ -1,76 +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; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -/** - * A variation of the visitor pattern that uses reflection to call the correct - * visit method. By convention, subclasses should provide public - *

visit(SpecificClass)
methods. - */ -public abstract class Visitor -{ - - private static final String VISITOR_METHOD_NAME = "visit"; - - public void visit(Object targetObject) - { - Class targetObjectClass = targetObject.getClass(); - final Method method = findVisitMethodForTargetObjectClass(targetObjectClass); - invokeVisitMethod(targetObject, method); - } - - private Method findVisitMethodForTargetObjectClass( - Class targetObjectClass) - { - final Method method; - try - { - method = getClass().getDeclaredMethod(VISITOR_METHOD_NAME, targetObjectClass); - } - catch (Exception e) - { - throw new DistributedTestException("Failed to find method " + VISITOR_METHOD_NAME + " on object of class " + targetObjectClass, e); - } - return method; - } - - private void invokeVisitMethod(Object targetObject, final Method method) - { - try - { - method.invoke(this, targetObject); - } - catch (IllegalArgumentException e) - { - throw new DistributedTestException(e); - } - catch (IllegalAccessException e) - { - throw new DistributedTestException(e); - } - catch (InvocationTargetException e) - { - throw new DistributedTestException(e.getCause()); - } - } -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/Client.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/Client.java deleted file mode 100644 index cf9820979f..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/Client.java +++ /dev/null @@ -1,228 +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.client; - -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicReference; - -import javax.naming.NamingException; - -import org.apache.commons.lang.builder.ToStringBuilder; -import org.apache.commons.lang.builder.ToStringStyle; -import org.apache.qpid.disttest.DistributedTestException; -import org.apache.qpid.disttest.Visitor; -import org.apache.qpid.disttest.jms.ClientJmsDelegate; -import org.apache.qpid.disttest.message.Command; -import org.apache.qpid.disttest.message.CommandType; -import org.apache.qpid.disttest.message.ParticipantResult; -import org.apache.qpid.disttest.message.Response; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class Client -{ - private static final Logger LOGGER = LoggerFactory.getLogger(Client.class); - - private final ClientJmsDelegate _clientJmsDelegate; - - private final CountDownLatch _latch = new CountDownLatch(1); - private Visitor _visitor; - private final AtomicReference _state; - private ParticipantExecutorRegistry _participantRegistry = new ParticipantExecutorRegistry(); - - public Client(final ClientJmsDelegate delegate) throws NamingException - { - _clientJmsDelegate = delegate; - _state = new AtomicReference(ClientState.CREATED); - _visitor = new ClientCommandVisitor(this, _clientJmsDelegate); - } - - /** - * Register with the controller - */ - public void start() - { - _clientJmsDelegate.setConnectionLostListener(new ConnectionLostListener() - { - @Override - public void connectionLost() - { - LOGGER.warn("Client unexpectedly lost the JMS connection. Shutting down."); - transitToStopped(); - } - }); - _clientJmsDelegate.setInstructionListener(this); - _clientJmsDelegate.sendRegistrationMessage(); - _state.set(ClientState.READY); - } - - public void stop() - { - _clientJmsDelegate.setConnectionLostListener(null); - _clientJmsDelegate.sendResponseMessage(new Response(_clientJmsDelegate.getClientName(), CommandType.STOP_CLIENT, null)); - transitToStopped(); - } - - private void transitToStopped() - { - _state.set(ClientState.STOPPED); - _latch.countDown(); - } - - public void addParticipantExecutor(final ParticipantExecutor participant) - { - _participantRegistry.add(participant); - } - - public void waitUntilStopped() - { - waitUntilStopped(0); - } - - public void waitUntilStopped(final long timeout) - { - try - { - if (timeout == 0) - { - _latch.await(); - } - else - { - _latch.await(timeout, TimeUnit.MILLISECONDS); - } - } - catch (final InterruptedException ie) - { - Thread.currentThread().interrupt(); - } - - _clientJmsDelegate.destroy(); - } - - public void processInstruction(final Command command) - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("Client " + getClientName() + " received command: " + command); - } - String responseMessage = null; - try - { - command.accept(_visitor); - } - catch (final Exception e) - { - LOGGER.error("Error processing instruction", e); - responseMessage = e.getMessage(); - } - finally - { - if (_state.get() != ClientState.STOPPED) - { - _clientJmsDelegate.sendResponseMessage(new Response(_clientJmsDelegate.getClientName(), command.getType(), responseMessage)); - } - } - } - - public ClientState getState() - { - return _state.get(); - } - - public String getClientName() - { - return _clientJmsDelegate.getClientName(); - } - - public void setClientCommandVisitor(final ClientCommandVisitor visitor) - { - _visitor = visitor; - } - - public void startTest() - { - if (_state.compareAndSet(ClientState.READY, ClientState.RUNNING_TEST)) - { - try - { - _clientJmsDelegate.startConnections(); - for (final ParticipantExecutor executor : _participantRegistry.executors()) - { - executor.start(this); - } - } - catch (final Exception e) - { - try - { - tearDownTest(); - } - catch (final Exception e2) - { - // ignore - } - throw new DistributedTestException("Error starting test: " + _clientJmsDelegate.getClientName(), e); - } - } - else - { - throw new DistributedTestException("Client '" + _clientJmsDelegate.getClientName() - + "' is not in READY state:" + _state.get()); - } - } - - public void tearDownTest() - { - if (_state.compareAndSet(ClientState.RUNNING_TEST, ClientState.READY)) - { - LOGGER.debug("Tearing down test on client: " + _clientJmsDelegate.getClientName()); - - _clientJmsDelegate.tearDownTest(); - } - else - { - throw new DistributedTestException("Client '" + _clientJmsDelegate.getClientName() + "' is not in RUNNING_TEST state! Ignoring tearDownTest"); - } - - - _participantRegistry.clear(); - } - - public void sendResults(ParticipantResult testResult) - { - _clientJmsDelegate.sendResponseMessage(testResult); - LOGGER.debug("Sent test results " + testResult); - } - - @Override - public String toString() - { - return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) - .append("clientJmsDelegate", _clientJmsDelegate).toString(); - } - - void setParticipantRegistry(ParticipantExecutorRegistry participantRegistry) - { - _participantRegistry = participantRegistry; - } - -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ClientCommandVisitor.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ClientCommandVisitor.java deleted file mode 100644 index 6b81c12c22..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ClientCommandVisitor.java +++ /dev/null @@ -1,99 +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.client; - -import org.apache.qpid.disttest.Visitor; -import org.apache.qpid.disttest.jms.ClientJmsDelegate; -import org.apache.qpid.disttest.message.CreateConnectionCommand; -import org.apache.qpid.disttest.message.CreateConsumerCommand; -import org.apache.qpid.disttest.message.CreateMessageProviderCommand; -import org.apache.qpid.disttest.message.CreateProducerCommand; -import org.apache.qpid.disttest.message.CreateSessionCommand; -import org.apache.qpid.disttest.message.NoOpCommand; -import org.apache.qpid.disttest.message.StartTestCommand; -import org.apache.qpid.disttest.message.StopClientCommand; -import org.apache.qpid.disttest.message.TearDownTestCommand; - -public class ClientCommandVisitor extends Visitor -{ - private final Client _client; - private final ClientJmsDelegate _clientJmsDelegate; - - public ClientCommandVisitor(final Client client, final ClientJmsDelegate clientJmsDelegate) - { - super(); - _client = client; - _clientJmsDelegate = clientJmsDelegate; - } - - public void visit(final StopClientCommand command) - { - - _client.stop(); - } - - public void visit(final NoOpCommand command) - { - // no-op - } - - public void visit(final CreateConnectionCommand command) - { - _clientJmsDelegate.createConnection(command); - } - - public void visit(final CreateSessionCommand command) - { - _clientJmsDelegate.createSession(command); - } - - public void visit(final CreateProducerCommand command) - { - - final ProducerParticipant participant = new ProducerParticipant(_clientJmsDelegate, command); - _clientJmsDelegate.createProducer(command); - final ParticipantExecutor executor = new ParticipantExecutor(participant); - _client.addParticipantExecutor(executor); - } - - public void visit(final CreateConsumerCommand command) - { - final ConsumerParticipant participant = new ConsumerParticipant(_clientJmsDelegate, command); - _clientJmsDelegate.createConsumer(command); - final ParticipantExecutor executor = new ParticipantExecutor(participant); - _client.addParticipantExecutor(executor); - } - - public void visit(final StartTestCommand command) - { - _client.startTest(); - } - - public void visit(final TearDownTestCommand command) - { - _client.tearDownTest(); - } - - public void visit(final CreateMessageProviderCommand command) - { - _clientJmsDelegate.createMessageProvider(command); - } - -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ClientState.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ClientState.java deleted file mode 100644 index c88c0a6c86..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ClientState.java +++ /dev/null @@ -1,25 +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.client; - -public enum ClientState -{ - CREATED, READY, STOPPED, RUNNING_TEST; -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ConnectionLostListener.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ConnectionLostListener.java deleted file mode 100644 index 9acf80fb4d..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ConnectionLostListener.java +++ /dev/null @@ -1,26 +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.client; - - -public interface ConnectionLostListener -{ - void connectionLost(); -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ConsumerParticipant.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ConsumerParticipant.java deleted file mode 100644 index d3a5e30191..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ConsumerParticipant.java +++ /dev/null @@ -1,283 +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.client; - - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.NavigableSet; -import java.util.concurrent.ConcurrentSkipListSet; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.atomic.AtomicLong; - -import javax.jms.JMSException; -import javax.jms.Message; -import javax.jms.MessageListener; - -import org.apache.qpid.disttest.DistributedTestException; -import org.apache.qpid.disttest.jms.ClientJmsDelegate; -import org.apache.qpid.disttest.message.CreateConsumerCommand; -import org.apache.qpid.disttest.message.ParticipantResult; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class ConsumerParticipant implements Participant -{ - private static final Logger LOGGER = LoggerFactory.getLogger(ConsumerParticipant.class); - - private final AtomicInteger _totalNumberOfMessagesReceived = new AtomicInteger(0); - private final NavigableSet _allConsumedPayloadSizes = new ConcurrentSkipListSet(); - private final AtomicLong _totalPayloadSizeOfAllMessagesReceived = new AtomicLong(0); - private final CountDownLatch _asyncRunHasFinished = new CountDownLatch(1); - private final ClientJmsDelegate _jmsDelegate; - private final CreateConsumerCommand _command; - private final ParticipantResultFactory _resultFactory; - - private long _startTime; - - private volatile Exception _asyncMessageListenerException; - private List _messageLatencies; - - public ConsumerParticipant(final ClientJmsDelegate delegate, final CreateConsumerCommand command) - { - _jmsDelegate = delegate; - _command = command; - _resultFactory = new ParticipantResultFactory(); - if (command.isEvaluateLatency()) - { - _messageLatencies = new ArrayList(); - } - } - - @Override - public ParticipantResult doIt(String registeredClientName) throws Exception - { - final Date start = new Date(); - final int acknowledgeMode = _jmsDelegate.getAcknowledgeMode(_command.getSessionName()); - - if (_command.getMaximumDuration() == 0 && _command.getNumberOfMessages() == 0) - { - throw new DistributedTestException("number of messages and duration cannot both be zero"); - } - - if (_command.isSynchronous()) - { - synchronousRun(); - } - else - { - LOGGER.info("Consumer {} registering listener", getName()); - - _jmsDelegate.registerListener(_command.getParticipantName(), new MessageListener(){ - - @Override - public void onMessage(Message message) - { - processAsynchMessage(message); - } - - }); - - waitUntilMsgListenerHasFinished(); - rethrowAnyAsyncMessageListenerException(); - } - - Date end = new Date(); - int numberOfMessagesReceived = _totalNumberOfMessagesReceived.get(); - long totalPayloadSize = _totalPayloadSizeOfAllMessagesReceived.get(); - int payloadSize = getPayloadSizeForResultIfConstantOrZeroOtherwise(_allConsumedPayloadSizes); - - if (LOGGER.isInfoEnabled()) - { - LOGGER.info("Consumer {} finished consuming. Number of messages consumed: {}", - getName(), numberOfMessagesReceived); - } - - ParticipantResult result = _resultFactory.createForConsumer( - getName(), - registeredClientName, - _command, - acknowledgeMode, - numberOfMessagesReceived, - payloadSize, - totalPayloadSize, - start, end, _messageLatencies); - - return result; - } - - private void synchronousRun() - { - LOGGER.info("Consumer {} about to consume messages", getName()); - - _startTime = System.currentTimeMillis(); - - Message message = null; - - do - { - message = _jmsDelegate.consumeMessage(_command.getParticipantName(), - _command.getReceiveTimeout()); - } while (processMessage(message)); - } - - /** - * @return whether to continue running (ie returns false if the message quota has been reached) - */ - private boolean processMessage(Message message) - { - int messageCount = message == null? _totalNumberOfMessagesReceived.get() : _totalNumberOfMessagesReceived.incrementAndGet() ; - boolean batchEnabled = _command.getBatchSize() > 0; - boolean batchComplete = batchEnabled && messageCount % _command.getBatchSize() == 0; - if (message != null) - { - if (LOGGER.isTraceEnabled()) - { - LOGGER.trace("message " + messageCount + " received by " + this); - } - int messagePayloadSize = _jmsDelegate.calculatePayloadSizeFrom(message); - _allConsumedPayloadSizes.add(messagePayloadSize); - _totalPayloadSizeOfAllMessagesReceived.addAndGet(messagePayloadSize); - - if (_command.isEvaluateLatency()) - { - long mesageTimestamp; - try - { - mesageTimestamp = message.getJMSTimestamp(); - } - catch (JMSException e) - { - throw new DistributedTestException("Cannot get message timestamp!", e); - } - long latency = System.currentTimeMillis() - mesageTimestamp; - _messageLatencies.add(latency); - } - - if (!batchEnabled || batchComplete) - { - if (LOGGER.isTraceEnabled() && batchEnabled) - { - LOGGER.trace("Committing: batch size " + _command.getBatchSize() ); - } - _jmsDelegate.commitOrAcknowledgeMessageIfNecessary(_command.getSessionName(), message); - } - } - - boolean reachedExpectedNumberOfMessages = _command.getNumberOfMessages() > 0 && messageCount >= _command.getNumberOfMessages(); - boolean reachedMaximumDuration = _command.getMaximumDuration() > 0 && System.currentTimeMillis() - _startTime >= _command.getMaximumDuration(); - boolean finishedConsuming = reachedExpectedNumberOfMessages || reachedMaximumDuration; - - if (finishedConsuming) - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("message " + messageCount - + " reachedExpectedNumberOfMessages " + reachedExpectedNumberOfMessages - + " reachedMaximumDuration " + reachedMaximumDuration); - } - - if (batchEnabled && !batchComplete) - { - if (LOGGER.isTraceEnabled()) - { - LOGGER.trace("Committing: batch size " + _command.getBatchSize() ); - } - - // commit/acknowledge remaining messages if necessary - _jmsDelegate.commitOrAcknowledgeMessageIfNecessary(_command.getSessionName(), message); - } - return false; - } - - return true; - } - - - /** - * Intended to be called from a {@link MessageListener}. Updates {@link #_asyncRunHasFinished} if - * no more messages should be processed, causing {@link #doIt(String)} to exit. - */ - public void processAsynchMessage(Message message) - { - boolean continueRunning = true; - try - { - if (_startTime == 0) - { - // reset counter and start time on receiving of first message - _startTime = System.currentTimeMillis(); - } - - continueRunning = processMessage(message); - } - catch (Exception e) - { - LOGGER.error("Error occured consuming message " + _totalNumberOfMessagesReceived, e); - continueRunning = false; - _asyncMessageListenerException = e; - } - - if(!continueRunning) - { - _asyncRunHasFinished.countDown(); - } - } - - @Override - public void releaseResources() - { - _jmsDelegate.closeTestConsumer(_command.getParticipantName()); - } - - private int getPayloadSizeForResultIfConstantOrZeroOtherwise(NavigableSet allSizes) - { - return allSizes.size() == 1 ? _allConsumedPayloadSizes.first() : 0; - } - - private void rethrowAnyAsyncMessageListenerException() - { - if (_asyncMessageListenerException != null) - { - throw new DistributedTestException(_asyncMessageListenerException); - } - } - - private void waitUntilMsgListenerHasFinished() throws Exception - { - LOGGER.debug("waiting until message listener has finished for " + this); - _asyncRunHasFinished.await(); - LOGGER.debug("Message listener has finished for " + this); - } - - @Override - public String getName() - { - return _command.getParticipantName(); - } - - @Override - public String toString() - { - return "ConsumerParticipant [_command=" + _command + ", _startTime=" + _startTime + "]"; - } -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/MessageProvider.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/MessageProvider.java deleted file mode 100644 index 6af1e1316a..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/MessageProvider.java +++ /dev/null @@ -1,218 +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.client; - -import java.lang.reflect.InvocationTargetException; -import java.util.Map; -import java.util.Map.Entry; -import java.util.concurrent.Callable; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; -import java.util.concurrent.Future; -import java.util.concurrent.FutureTask; - -import javax.jms.JMSException; -import javax.jms.Message; -import javax.jms.Session; -import javax.jms.TextMessage; - -import org.apache.commons.beanutils.BeanUtils; -import org.apache.commons.lang.StringUtils; -import org.apache.qpid.disttest.DistributedTestException; -import org.apache.qpid.disttest.client.property.PropertyValue; -import org.apache.qpid.disttest.message.CreateProducerCommand; - -public class MessageProvider -{ - public static final String TTL = "ttl"; - - public static final String DELIVERY_MODE = "deliveryMode"; - - public static final String PRIORITY = "priority"; - - public static final String[] STANDARD_JMS_PROPERTIES = { "correlationID", DELIVERY_MODE, - "expiration", "messageID", PRIORITY, "redelivered", "replyTo", "timestamp", "type", TTL }; - - private Map _messageProperties; - private ConcurrentMap> _payloads; - - public MessageProvider(Map messageProperties) - { - _messageProperties = messageProperties; - _payloads = new ConcurrentHashMap>(); - } - - public Message nextMessage(Session session, CreateProducerCommand command) throws JMSException - { - Message message = createTextMessage(session, command); - setMessageProperties(message); - return message; - } - - public boolean isPropertySet(String name) - { - return _messageProperties != null && _messageProperties.containsKey(name); - } - - public void setMessageProperties(Message message) throws JMSException - { - if (_messageProperties != null) - { - for (Entry entry : _messageProperties.entrySet()) - { - String propertyName = entry.getKey(); - Object propertyValue = entry.getValue().getValue(); - if (isStandardProperty(propertyName)) - { - setStandardProperty(message, propertyName, propertyValue); - } - else - { - setCustomProperty(message, propertyName, propertyValue); - } - } - } - } - - protected void setCustomProperty(Message message, String propertyName, Object propertyValue) throws JMSException - { - if (propertyValue instanceof Integer) - { - message.setIntProperty(propertyName, ((Integer) propertyValue).intValue()); - } - else if (propertyValue instanceof Long) - { - message.setLongProperty(propertyName, ((Long) propertyValue).longValue()); - } - else if (propertyValue instanceof Boolean) - { - message.setBooleanProperty(propertyName, ((Boolean) propertyValue).booleanValue()); - } - else if (propertyValue instanceof Byte) - { - message.setByteProperty(propertyName, ((Byte) propertyValue).byteValue()); - } - else if (propertyValue instanceof Double) - { - message.setDoubleProperty(propertyName, ((Double) propertyValue).doubleValue()); - } - else if (propertyValue instanceof Float) - { - message.setFloatProperty(propertyName, ((Float) propertyValue).floatValue()); - } - else if (propertyValue instanceof Short) - { - message.setShortProperty(propertyName, ((Short) propertyValue).shortValue()); - } - else if (propertyValue instanceof String) - { - message.setStringProperty(propertyName, (String) propertyValue); - } - else - { - message.setObjectProperty(propertyName, propertyValue); - } - } - - protected void setStandardProperty(Message message, String property, Object propertyValue) throws JMSException - { - String propertyName = "JMS" + StringUtils.capitalize(property); - try - { - BeanUtils.setProperty(message, propertyName, propertyValue); - } - catch (IllegalAccessException e) - { - throw new DistributedTestException("Unable to set property " + propertyName + " :" + e.getMessage(), e); - } - catch (InvocationTargetException e) - { - if (e.getCause() instanceof JMSException) - { - throw ((JMSException) e.getCause()); - } - else - { - throw new DistributedTestException("Unable to set property " + propertyName + " :" + e.getMessage(), e); - } - } - } - - protected boolean isStandardProperty(String propertyName) - { - for (int i = 0; i < STANDARD_JMS_PROPERTIES.length; i++) - { - if (propertyName.equals(STANDARD_JMS_PROPERTIES[i])) - { - return true; - } - } - return false; - } - - protected Message createTextMessage(Session ssn, final CreateProducerCommand command) throws JMSException - { - String payload = getMessagePayload(command); - - TextMessage msg = null; - synchronized(ssn) - { - msg = ssn.createTextMessage(); - } - msg.setText(payload); - - return msg; - } - - protected String getMessagePayload(final CreateProducerCommand command) - { - FutureTask createTextFuture = new FutureTask(new Callable() - { - @Override - public String call() throws Exception - { - return StringUtils.repeat("a", command.getMessageSize()); - } - }); - - Future future = _payloads.putIfAbsent(command.getMessageSize(), createTextFuture); - if (future == null) - { - createTextFuture.run(); - future = createTextFuture; - } - String payload = null; - try - { - payload = future.get(); - } - catch (Exception e) - { - throw new DistributedTestException("Unable to create message payload :" + e.getMessage(), e); - } - return payload; - } - - @Override - public String toString() - { - return "MessageProvider [_messageProperties=" + _messageProperties + "]"; - } - -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/Participant.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/Participant.java deleted file mode 100644 index 941ec90565..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/Participant.java +++ /dev/null @@ -1,31 +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.client; - -import org.apache.qpid.disttest.message.ParticipantResult; - -public interface Participant -{ - ParticipantResult doIt(String registeredClientName) throws Exception; - - void releaseResources(); - - String getName(); - -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ParticipantExecutor.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ParticipantExecutor.java deleted file mode 100644 index f34ac941bc..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ParticipantExecutor.java +++ /dev/null @@ -1,145 +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.client; - -import java.util.concurrent.Executor; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.ThreadFactory; - -import org.apache.commons.lang.builder.ToStringBuilder; -import org.apache.commons.lang.builder.ToStringStyle; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.apache.qpid.disttest.message.ParticipantResult; - -public class ParticipantExecutor -{ - private static final Logger LOGGER = LoggerFactory.getLogger(ParticipantExecutor.class); - - private static final ExecutorService SHARED_UNBOUNDED_THREAD_POOL = Executors.newCachedThreadPool(new DaemonThreadFactory()); - - private Executor _executor = SHARED_UNBOUNDED_THREAD_POOL; - - private Client _client; - - private final Participant _participant; - - private final ParticipantResultFactory _factory; - - public ParticipantExecutor(Participant participant) - { - _participant = participant; - _factory = new ParticipantResultFactory(); - } - - /** - * Schedules the test participant to be run in a background thread. - */ - public void start(Client client) - { - _client = client; - - LOGGER.debug("Starting test participant in background thread: " + this); - _executor.execute(new ParticipantRunnable()); - } - - public String getParticipantName() - { - return _participant.getName(); - } - - void setExecutor(Executor executor) - { - _executor = executor; - } - - private class ParticipantRunnable implements Runnable - { - @Override - public final void run() - { - Thread currentThread = Thread.currentThread(); - final String initialThreadName = currentThread.getName(); - currentThread.setName(initialThreadName + "-" + getParticipantName()); - - try - { - runParticipantAndSendResults(); - } - finally - { - currentThread.setName(initialThreadName); - } - } - - private void runParticipantAndSendResults() - { - ParticipantResult result = null; - try - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("About to run participant " + _participant); - } - result = _participant.doIt(_client.getClientName()); - } - catch (Exception t) - { - String errorMessage = "Unhandled error: " + t.getMessage(); - LOGGER.error(errorMessage, t); - result = _factory.createForError(_participant.getName(), _client.getClientName(), errorMessage); - } - finally - { - try - { - _participant.releaseResources(); - } - catch(Exception e) - { - LOGGER.error("Participant " + _participant + " unable to release resources", e); - } - - _client.sendResults(result); - } - } - } - - private static final class DaemonThreadFactory implements ThreadFactory - { - @Override - public Thread newThread(Runnable r) - { - Thread thread = new Thread(r); - thread.setDaemon(true); - return thread; - } - } - - @Override - public String toString() - { - return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) - .append("participantName", getParticipantName()) - .append("client", _client) - .toString(); - } -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ParticipantExecutorRegistry.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ParticipantExecutorRegistry.java deleted file mode 100644 index 3d9780e640..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ParticipantExecutorRegistry.java +++ /dev/null @@ -1,45 +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.client; - -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; - -public class ParticipantExecutorRegistry -{ - private final Set _participantExecutors = Collections.synchronizedSet(new HashSet()); - - public void add(ParticipantExecutor participantExecutor) - { - _participantExecutors.add(participantExecutor); - } - - public void clear() - { - _participantExecutors.clear(); - } - - public Collection executors() - { - return Collections.unmodifiableSet(_participantExecutors); - } -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ParticipantResultFactory.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ParticipantResultFactory.java deleted file mode 100644 index 50c0a74ccd..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ParticipantResultFactory.java +++ /dev/null @@ -1,118 +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.client; - -import java.util.Collection; -import java.util.Date; - -import org.apache.qpid.disttest.message.ConsumerParticipantResult; -import org.apache.qpid.disttest.message.CreateConsumerCommand; -import org.apache.qpid.disttest.message.CreateParticpantCommand; -import org.apache.qpid.disttest.message.CreateProducerCommand; -import org.apache.qpid.disttest.message.ParticipantResult; -import org.apache.qpid.disttest.message.ProducerParticipantResult; -import org.apache.qpid.disttest.results.aggregation.SeriesStatistics; - -public class ParticipantResultFactory -{ - public ConsumerParticipantResult createForConsumer(String participantName, String clientRegisteredName, - CreateConsumerCommand command, int acknowledgeMode, int numberOfMessagesReceived, int payloadSize, - long totalPayloadReceived, Date start, Date end) - { - return createForConsumer(participantName, clientRegisteredName, command, acknowledgeMode, numberOfMessagesReceived, - payloadSize, totalPayloadReceived, start, end, null); - } - - public ConsumerParticipantResult createForConsumer(String participantName, String clientRegisteredName, - CreateConsumerCommand command, int acknowledgeMode, int numberOfMessagesReceived, int payloadSize, - long totalPayloadReceived, Date start, Date end, Collection messageLatencies) - { - ConsumerParticipantResult consumerParticipantResult = new ConsumerParticipantResult(); - consumerParticipantResult.setMessageLatencies(messageLatencies); - - setTestProperties(consumerParticipantResult, command, participantName, clientRegisteredName, acknowledgeMode); - setTestResultProperties(consumerParticipantResult, numberOfMessagesReceived, payloadSize, totalPayloadReceived, start, end); - - consumerParticipantResult.setTopic(command.isTopic()); - consumerParticipantResult.setDurableSubscription(command.isDurableSubscription()); - consumerParticipantResult.setBrowsingSubscription(command.isBrowsingSubscription()); - consumerParticipantResult.setSelector(command.getSelector() != null); - consumerParticipantResult.setNoLocal(command.isNoLocal()); - consumerParticipantResult.setSynchronousConsumer(command.isSynchronous()); - consumerParticipantResult.setTotalNumberOfConsumers(1); - consumerParticipantResult.setTotalNumberOfProducers(0); - - SeriesStatistics statistics = new SeriesStatistics(messageLatencies); - consumerParticipantResult.setAverageLatency(statistics.getAverage()); - consumerParticipantResult.setMinLatency(statistics.getMinimum()); - consumerParticipantResult.setMaxLatency(statistics.getMaximum()); - consumerParticipantResult.setLatencyStandardDeviation(statistics.getStandardDeviation()); - return consumerParticipantResult; - } - - public ProducerParticipantResult createForProducer(String participantName, String clientRegisteredName, CreateProducerCommand command, int acknowledgeMode, int numberOfMessagesSent, int payloadSize, long totalPayloadSent, Date start, Date end) - { - final ProducerParticipantResult producerParticipantResult = new ProducerParticipantResult(); - - producerParticipantResult.setStartDelay(command.getStartDelay()); - producerParticipantResult.setDeliveryMode(command.getDeliveryMode()); - producerParticipantResult.setPriority(command.getPriority()); - producerParticipantResult.setInterval(command.getInterval()); - producerParticipantResult.setTimeToLive(command.getTimeToLive()); - producerParticipantResult.setTotalNumberOfConsumers(0); - producerParticipantResult.setTotalNumberOfProducers(1); - - - setTestProperties(producerParticipantResult, command, participantName, clientRegisteredName, acknowledgeMode); - - setTestResultProperties(producerParticipantResult, numberOfMessagesSent, payloadSize, totalPayloadSent, start, end); - - return producerParticipantResult; - } - - private void setTestResultProperties(final ParticipantResult participantResult, int numberOfMessagesSent, int payloadSize, long totalPayloadReceived, Date start, Date end) - { - participantResult.setNumberOfMessagesProcessed(numberOfMessagesSent); - participantResult.setPayloadSize(payloadSize); - participantResult.setTotalPayloadProcessed(totalPayloadReceived); - participantResult.setStartDate(start); - participantResult.setEndDate(end); - } - - private void setTestProperties(final ParticipantResult participantResult, CreateParticpantCommand command, String participantName, String clientRegisteredName, int acknowledgeMode) - { - participantResult.setParticipantName(participantName); - participantResult.setRegisteredClientName(clientRegisteredName); - participantResult.setBatchSize(command.getBatchSize()); - participantResult.setMaximumDuration(command.getMaximumDuration()); - participantResult.setAcknowledgeMode(acknowledgeMode); - - } - - public ParticipantResult createForError(String participantName, String clientRegisteredName, String errorMessage) - { - ParticipantResult result = new ParticipantResult(); - result.setParticipantName(participantName); - result.setRegisteredClientName(clientRegisteredName); - result.setErrorMessage(errorMessage); - - return result; - } - -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ProducerParticipant.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ProducerParticipant.java deleted file mode 100644 index a9da837dea..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ProducerParticipant.java +++ /dev/null @@ -1,234 +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.client; - -import java.util.Date; -import java.util.NavigableSet; -import java.util.TreeSet; -import java.util.concurrent.Callable; -import java.util.concurrent.CancellationException; - -import javax.jms.Message; - -import org.apache.qpid.disttest.DistributedTestException; -import org.apache.qpid.disttest.client.utils.ExecutorWithLimits; -import org.apache.qpid.disttest.client.utils.ExecutorWithLimitsFactory; -import org.apache.qpid.disttest.jms.ClientJmsDelegate; -import org.apache.qpid.disttest.message.CreateProducerCommand; -import org.apache.qpid.disttest.message.ParticipantResult; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class ProducerParticipant implements Participant -{ - private static final Logger LOGGER = LoggerFactory.getLogger(ProducerParticipant.class); - - private final ClientJmsDelegate _jmsDelegate; - - private final CreateProducerCommand _command; - - private final ParticipantResultFactory _resultFactory; - - private ExecutorWithLimits _limiter; - - public ProducerParticipant(final ClientJmsDelegate jmsDelegate, final CreateProducerCommand command) - { - _jmsDelegate = jmsDelegate; - _command = command; - _resultFactory = new ParticipantResultFactory(); - } - - @Override - public ParticipantResult doIt(String registeredClientName) throws Exception - { - long numberOfMessages = _command.getNumberOfMessages(); - long maximumDuration = _command.getMaximumDuration(); - - if (maximumDuration == 0 && numberOfMessages == 0) - { - throw new DistributedTestException("number of messages and duration cannot both be zero"); - } - - long duration = maximumDuration - _command.getStartDelay(); - if (maximumDuration > 0 && duration <= 0) - { - throw new DistributedTestException("Start delay must be less than maximum test duration"); - } - final long requiredDuration = duration > 0 ? duration : 0; - - doSleepForStartDelay(); - - final int batchSize = _command.getBatchSize(); - final int acknowledgeMode = _jmsDelegate.getAcknowledgeMode(_command.getSessionName()); - final long startTime = System.currentTimeMillis(); - - Message lastPublishedMessage = null; - int numberOfMessagesSent = 0; - long totalPayloadSizeOfAllMessagesSent = 0; - NavigableSet allProducedPayloadSizes = new TreeSet(); - - _limiter = ExecutorWithLimitsFactory.createExecutorWithLimit(startTime, requiredDuration); - - if (LOGGER.isInfoEnabled()) - { - LOGGER.info("Producer {} about to send messages. Duration limit: {} ms, Message limit: {}", - new Object[]{getName(), requiredDuration, numberOfMessages}); - } - - while (true) - { - if (numberOfMessages > 0 && numberOfMessagesSent >= numberOfMessages - || requiredDuration > 0 && System.currentTimeMillis() - startTime >= requiredDuration) - { - break; - } - - try - { - lastPublishedMessage = _limiter.execute(new Callable() - { - @Override - public Message call() throws Exception - { - return _jmsDelegate.sendNextMessage(_command); - } - }); - } - catch (CancellationException ce) - { - LOGGER.debug("Producer send was cancelled due to maximum duration {} ms", requiredDuration); - break; - } - - numberOfMessagesSent++; - - int lastPayloadSize = _jmsDelegate.calculatePayloadSizeFrom(lastPublishedMessage); - totalPayloadSizeOfAllMessagesSent += lastPayloadSize; - allProducedPayloadSizes.add(lastPayloadSize); - - if (LOGGER.isTraceEnabled()) - { - LOGGER.trace("message " + numberOfMessagesSent + " sent by " + this); - } - - final boolean batchLimitReached = batchSize <= 0 - || numberOfMessagesSent % batchSize == 0; - - if (batchLimitReached) - { - if (LOGGER.isTraceEnabled() && batchSize > 0) - { - LOGGER.trace("Committing: batch size " + batchSize ); - } - _jmsDelegate.commitIfNecessary(_command.getSessionName()); - - doSleepForInterval(); - } - } - - // commit the remaining batch messages - if (batchSize > 0 && numberOfMessagesSent % batchSize != 0) - { - if (LOGGER.isTraceEnabled()) - { - LOGGER.trace("Committing: batch size " + batchSize ); - } - _jmsDelegate.commitIfNecessary(_command.getSessionName()); - } - - if (LOGGER.isInfoEnabled()) - { - LOGGER.info("Producer {} finished publishing. Number of messages published: {}", - getName(), numberOfMessagesSent); - } - - Date start = new Date(startTime); - Date end = new Date(); - int payloadSize = getPayloadSizeForResultIfConstantOrZeroOtherwise(allProducedPayloadSizes); - - return _resultFactory.createForProducer( - getName(), - registeredClientName, - _command, - acknowledgeMode, - numberOfMessagesSent, - payloadSize, totalPayloadSizeOfAllMessagesSent, start, end); - } - - private int getPayloadSizeForResultIfConstantOrZeroOtherwise(NavigableSet allPayloadSizes) - { - return allPayloadSizes.size() == 1 ? allPayloadSizes.first() : 0; - } - - private void doSleepForStartDelay() - { - long sleepTime = _command.getStartDelay(); - if (sleepTime > 0) - { - LOGGER.debug("{} sleeping for {} milliseconds before starting", getName(), sleepTime); - // start delay is specified. Sleeping... - doSleep(sleepTime); - } - } - - private void doSleepForInterval() throws InterruptedException - { - long sleepTime = _command.getInterval(); - if (sleepTime > 0) - { - doSleep(sleepTime); - } - } - - private void doSleep(long sleepTime) - { - try - { - Thread.sleep(sleepTime); - } - catch (final InterruptedException e) - { - Thread.currentThread().interrupt(); - } - } - - @Override - public void releaseResources() - { - if (_limiter != null) - { - _limiter.shutdown(); - } - _jmsDelegate.closeTestProducer(_command.getParticipantName()); - } - - @Override - public String getName() - { - return _command.getParticipantName(); - } - - @Override - public String toString() - { - return "ProducerParticipant [command=" + _command + "]"; - } - -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/property/GeneratedPropertySupport.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/property/GeneratedPropertySupport.java deleted file mode 100644 index a49ebf756e..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/property/GeneratedPropertySupport.java +++ /dev/null @@ -1,68 +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.client.property; - -/** - * Provides support to generate message property values. - */ -public abstract class GeneratedPropertySupport implements GeneratedPropertyValue -{ - private Object _lastValue; - - public GeneratedPropertySupport() - { - super(); - _lastValue = null; - } - - @Override - public Object getValue() - { - Object result = nextValue(); - result = evaluate(result); - synchronized(this) - { - _lastValue = result; - } - return result; - } - - protected Object evaluate(Object result) - { - while (result instanceof PropertyValue) - { - result = ((PropertyValue)result).getValue(); - } - return result; - } - - public abstract Object nextValue(); - - public synchronized Object getLastValue() - { - return _lastValue; - } - - @Override - public String toString() - { - return "GeneratedPropertyValue [value=" + getLastValue() + ", @def=" + getDefinition() + "]"; - } - -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/property/GeneratedPropertyValue.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/property/GeneratedPropertyValue.java deleted file mode 100644 index 39c093fac5..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/property/GeneratedPropertyValue.java +++ /dev/null @@ -1,27 +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.client.property; - -/** - * Provides operations to generate message property values. - */ -public interface GeneratedPropertyValue extends PropertyValue -{ - public String getDefinition(); -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/property/ListPropertyValue.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/property/ListPropertyValue.java deleted file mode 100644 index 4444351976..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/property/ListPropertyValue.java +++ /dev/null @@ -1,122 +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.client.property; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -/** - * Provides property values from the underlining list of items. - */ -public class ListPropertyValue extends GeneratedPropertySupport -{ - public static final String DEF_VALUE = "list"; - private List _items; - private boolean _cyclic; - private int _currentIndex; - - public ListPropertyValue() - { - super(); - _cyclic = true; - _currentIndex = 0; - _items = new ArrayList(); - } - - public synchronized void setItems(List items) - { - _items = new ArrayList(items); - } - - public synchronized List getItems() - { - return Collections.unmodifiableList(_items); - } - - public synchronized void setCyclic(boolean cyclic) - { - _cyclic = cyclic; - } - - public synchronized boolean isCyclic() - { - return _cyclic; - } - - @Override - public synchronized Object nextValue() - { - if (_currentIndex >= _items.size()) - { - if (_cyclic) - { - _currentIndex = 0; - } - else - { - _currentIndex = _items.size() -1; - } - } - Object nextValue = _items.get(_currentIndex); - _currentIndex++; - return nextValue; - } - - @Override - public String getDefinition() - { - return DEF_VALUE; - } - - @Override - public int hashCode() - { - final int prime = 31; - int result = super.hashCode(); - result = prime * result + _currentIndex; - result = prime * result + (_cyclic ? 1231 : 1237); - result = prime * result + ((_items == null) ? 0 : _items.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) - { - if (this == obj) - { - return true; - } - if (obj == null || !(obj instanceof ListPropertyValue)) - { - return false; - } - ListPropertyValue other = (ListPropertyValue) obj; - if (_cyclic != other._cyclic) - { - return false; - } - if (_items == null && other._items != null) - { - return false; - } - return _items.equals(other._items); - } - -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/property/NumericGeneratedPropertySupport.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/property/NumericGeneratedPropertySupport.java deleted file mode 100644 index 1cb938e915..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/property/NumericGeneratedPropertySupport.java +++ /dev/null @@ -1,179 +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.client.property; - -import java.util.Arrays; - -/** - * Provides support for numeric generators with lower and upper boundaries. - */ -public abstract class NumericGeneratedPropertySupport extends GeneratedPropertySupport -{ - public static final Class[] SUPPORTED_TYPES = { double.class, float.class, int.class, long.class, short.class, - byte.class }; - - private String _type; - private double _upper; - private double _lower; - - - public NumericGeneratedPropertySupport() - { - super(); - _type = SUPPORTED_TYPES[0].getName(); - _upper = Double.MAX_VALUE; - _lower = 0.0; - } - - public synchronized String getType() - { - return _type; - } - - public synchronized double getUpper() - { - return _upper; - } - - public synchronized double getLower() - { - return _lower; - } - - public synchronized void setUpper(double upper) - { - _upper = upper; - } - - public synchronized void setLower(double lower) - { - _lower = lower; - } - - public synchronized void setType(String type) - { - _type = toClass(type).getName(); - } - - protected Class toClass(String type) - { - Class t = null; - for (int i = 0; i < SUPPORTED_TYPES.length; i++) - { - if (SUPPORTED_TYPES[i].getName().equals(type)) - { - t = SUPPORTED_TYPES[i]; - break; - } - } - if (t == null) - { - throw new IllegalArgumentException("Type " + type + " is not supported: " - + Arrays.toString(SUPPORTED_TYPES)); - } - return t; - } - - @Override - public Object nextValue() - { - double result = nextDouble(); - return doubleToNumber(result, toClass(_type)); - } - - protected Number doubleToNumber(double value, Class targetType) - { - Number result = null; - if (targetType == double.class) - { - result = value; - } - else if (targetType == float.class) - { - result = (float) value; - } - else if (targetType == int.class) - { - result = (int) value; - } - else if (targetType == long.class) - { - result = (long) value; - } - else if (targetType == short.class) - { - result = (short) value; - } - else if (targetType == byte.class) - { - result = (byte) value; - } - else - { - throw new IllegalArgumentException("Type " + targetType + " is not supported: " - + Arrays.toString(SUPPORTED_TYPES)); - } - return result; - } - - protected abstract double nextDouble(); - - @Override - public int hashCode() - { - final int prime = 31; - int result = super.hashCode(); - long temp; - temp = Double.doubleToLongBits(_lower); - result = prime * result + (int) (temp ^ (temp >>> 32)); - result = prime * result + ((_type == null) ? 0 : _type.hashCode()); - temp = Double.doubleToLongBits(_upper); - result = prime * result + (int) (temp ^ (temp >>> 32)); - return result; - } - - @Override - public boolean equals(Object obj) - { - if (this == obj) - { - return true; - } - if (obj == null || !(obj instanceof NumericGeneratedPropertySupport)) - { - return false; - } - NumericGeneratedPropertySupport other = (NumericGeneratedPropertySupport) obj; - if (Double.doubleToLongBits(_lower) != Double.doubleToLongBits(other._lower) - || Double.doubleToLongBits(_upper) != Double.doubleToLongBits(other._upper)) - { - return false; - } - if (_type == null && other._type != null) - { - return false; - } - else if (!_type.equals(other._type)) - { - return false; - } - return true; - } - -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/property/PropertyValue.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/property/PropertyValue.java deleted file mode 100644 index 97adc0cee1..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/property/PropertyValue.java +++ /dev/null @@ -1,27 +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.client.property; - -/** - * Provides operations to get a message property value. - */ -public interface PropertyValue -{ - public Object getValue(); -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/property/PropertyValueFactory.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/property/PropertyValueFactory.java deleted file mode 100644 index fa44b2da1e..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/property/PropertyValueFactory.java +++ /dev/null @@ -1,46 +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.client.property; - -import org.apache.commons.lang.StringUtils; -import org.apache.qpid.disttest.DistributedTestException; - -/** - * Creates property value instances using given alias (type) value. - */ -public class PropertyValueFactory -{ - public PropertyValue createPropertyValue(String type) - { - try - { - return (PropertyValue)getPropertyValueClass(type).newInstance(); - } - catch(Exception e) - { - throw new DistributedTestException("Unable to create a generator for a type:" + type, e); - } - } - - public Class getPropertyValueClass(String type) throws ClassNotFoundException - { - String className = "org.apache.qpid.disttest.client.property." + StringUtils.capitalize(type) + "PropertyValue"; - return Class.forName(className); - } -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/property/RandomPropertyValue.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/property/RandomPropertyValue.java deleted file mode 100644 index 4f44a4bca8..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/property/RandomPropertyValue.java +++ /dev/null @@ -1,47 +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.client.property; - -/** - * Generates random property values in a given lower and upper boundaries. - */ -public class RandomPropertyValue extends NumericGeneratedPropertySupport -{ - public static final String DEF_VALUE = "random"; - - public RandomPropertyValue() - { - super(); - } - - @Override - protected double nextDouble() - { - double lower = getLower(); - double upper = getUpper(); - return lower + Math.random() * (upper - lower); - } - - @Override - public String getDefinition() - { - return DEF_VALUE; - } - -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/property/RangePropertyValue.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/property/RangePropertyValue.java deleted file mode 100644 index 3aca4d4bca..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/property/RangePropertyValue.java +++ /dev/null @@ -1,129 +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.client.property; - -/** - * Generates property values from a range with given lower and upper boundaries. - */ -public class RangePropertyValue extends NumericGeneratedPropertySupport -{ - public static final String DEF_VALUE = "range"; - private double _step; - private double _currentValue; - private boolean _cyclic; - - public RangePropertyValue() - { - super(); - _cyclic = true; - _currentValue = 0.0; - _step = 1.0; - } - - public synchronized double getStep() - { - return _step; - } - - public synchronized boolean isCyclic() - { - return _cyclic; - } - - public synchronized void setCyclic(boolean cyclic) - { - _cyclic = cyclic; - } - - public synchronized void setStep(double step) - { - _step = step; - } - - @Override - public synchronized double nextDouble() - { - double result = 0.0; - double lower = getLower(); - double upper = getUpper(); - if (_currentValue < lower) - { - _currentValue = lower; - } - else if (_currentValue > upper) - { - if (_cyclic) - { - _currentValue = lower; - } - else - { - _currentValue = upper; - } - } - result = _currentValue; - _currentValue += _step; - return result; - } - - @Override - public String getDefinition() - { - return DEF_VALUE; - } - - @Override - public int hashCode() - { - final int prime = 31; - int result = super.hashCode(); - long temp; - temp = Double.doubleToLongBits(_currentValue); - result = prime * result + (int) (temp ^ (temp >>> 32)); - result = prime * result + (_cyclic ? 1231 : 1237); - temp = Double.doubleToLongBits(_step); - result = prime * result + (int) (temp ^ (temp >>> 32)); - return result; - } - - @Override - public boolean equals(Object obj) - { - if (this == obj) - { - return true; - } - if (!(obj instanceof RangePropertyValue)) - { - return false; - } - if (!super.equals(obj)) - { - return false; - } - RangePropertyValue other = (RangePropertyValue) obj; - if (Double.doubleToLongBits(_currentValue) != Double.doubleToLongBits(other._currentValue) - || Double.doubleToLongBits(_step) != Double.doubleToLongBits(other._step) || _cyclic != other._cyclic) - { - return false; - } - - return true; - } -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/property/SimplePropertyValue.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/property/SimplePropertyValue.java deleted file mode 100644 index 9141e68656..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/property/SimplePropertyValue.java +++ /dev/null @@ -1,79 +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.client.property; - -/** - * Simple property value holder for a constant properties. - */ -public class SimplePropertyValue implements PropertyValue -{ - private Object _value; - - public SimplePropertyValue() - { - super(); - } - - public SimplePropertyValue(Object value) - { - super(); - this._value = value; - } - - @Override - public Object getValue() - { - return _value; - } - - @Override - public String toString() - { - return "SimplePropertyValue [value=" + _value + "]"; - } - - @Override - public int hashCode() - { - final int prime = 31; - int result = 1; - result = prime * result + ((_value == null) ? 0 : _value.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) - { - if (this == obj) - { - return true; - } - if (obj == null || getClass() != obj.getClass()) - { - return false; - } - SimplePropertyValue other = (SimplePropertyValue) obj; - if (_value == null && other._value != null) - { - return false; - } - return _value.equals(other._value); - } - -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/utils/ExecutorWithLimits.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/utils/ExecutorWithLimits.java deleted file mode 100644 index f64107c125..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/utils/ExecutorWithLimits.java +++ /dev/null @@ -1,35 +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.client.utils; - -import java.util.concurrent.Callable; -import java.util.concurrent.CancellationException; - -/** - * Implementations of this interface execute a {@link Callable} but place some - * kind of limit on that execution, such as time. - */ -public interface ExecutorWithLimits -{ - T execute(Callable callback) throws CancellationException, Exception; - - void shutdown(); - -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/utils/ExecutorWithLimitsFactory.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/utils/ExecutorWithLimitsFactory.java deleted file mode 100644 index 4d17d76568..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/utils/ExecutorWithLimitsFactory.java +++ /dev/null @@ -1,49 +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.client.utils; - -import java.util.concurrent.Callable; - -public class ExecutorWithLimitsFactory -{ - /** - * Creates an {@link ExecutorWithLimits} that will permit the execution of {@link Callable} implementations until - * until allowedTimeInMillis milliseconds have elapsed beyond startTime. - * If allowedTimeInMillis is less than or equal to zero, a {@link ExecutorWithNoLimits} - * is created that enforces no time-limit. - * - * @param startTime start time (milliseconds) - * @param allowedTimeInMillis allowed time (milliseconds) - * - * @return ExecutionLimiter implementation - */ - public static ExecutorWithLimits createExecutorWithLimit(long startTime, long allowedTimeInMillis) - { - if (allowedTimeInMillis > 0) - { - return new ExecutorWithTimeLimit(startTime, allowedTimeInMillis); - } - else - { - return new ExecutorWithNoLimits(); - } - } - -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/utils/ExecutorWithNoLimits.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/utils/ExecutorWithNoLimits.java deleted file mode 100644 index f729a72fa5..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/utils/ExecutorWithNoLimits.java +++ /dev/null @@ -1,42 +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.client.utils; - -import java.util.concurrent.Callable; - -/** - * Executes a {@link Callable} without any limits. - */ -public class ExecutorWithNoLimits implements ExecutorWithLimits -{ - - @Override - public T execute(Callable _callback) throws Exception - { - return _callback.call(); - } - - @Override - public void shutdown() - { - // Deliberately blank - } - -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/utils/ExecutorWithTimeLimit.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/utils/ExecutorWithTimeLimit.java deleted file mode 100644 index 4fa3960d92..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/utils/ExecutorWithTimeLimit.java +++ /dev/null @@ -1,65 +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.client.utils; - -import java.util.Collections; -import java.util.List; -import java.util.concurrent.Callable; -import java.util.concurrent.CancellationException; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; - -/** - * Executes a {@link Callable} but limits the execution time. If the execution - * time is exceeded the callable will be cancelled. - */ -public class ExecutorWithTimeLimit implements ExecutorWithLimits -{ - private final long _endTime; - private final ExecutorService _singleThreadExecutor = Executors.newSingleThreadExecutor(); - - public ExecutorWithTimeLimit(long startTime, long allowedTimeInMillis) - { - _endTime = startTime + allowedTimeInMillis; - } - - @Override - public T execute(Callable callback) throws CancellationException, Exception - { - final long timeRemaining = _endTime - System.currentTimeMillis(); - if (timeRemaining <= 0) - { - throw new CancellationException("Too little time remains to schedule callable"); - } - - List> l = _singleThreadExecutor.invokeAll(Collections.singletonList(callback), timeRemaining, TimeUnit.MILLISECONDS); - return l.get(0).get(); - } - - @Override - public void shutdown() - { - _singleThreadExecutor.shutdown(); - } - - -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/ClientRegistry.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/ClientRegistry.java deleted file mode 100644 index 559bdf2451..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/ClientRegistry.java +++ /dev/null @@ -1,127 +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.controller; - -import static java.lang.String.valueOf; - -import java.util.Collection; -import java.util.Collections; -import java.util.Set; -import java.util.concurrent.ConcurrentSkipListSet; - -import org.apache.qpid.disttest.DistributedTestException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class ClientRegistry -{ - private static final Logger LOGGER = LoggerFactory.getLogger(ClientRegistry.class); - - private final Set _registeredClientNames = new ConcurrentSkipListSet(); - - private final Object _lock = new Object(); - - public void registerClient(String clientName) - { - final boolean alreadyContainsClient = !_registeredClientNames.add(clientName); - if (alreadyContainsClient) - { - throw new DistributedTestException("Duplicate client name " + clientName); - } - - synchronized (_lock) - { - _lock.notifyAll(); - } - - if (LOGGER.isInfoEnabled()) - { - LOGGER.info("Client registered: " + clientName); - } - } - - - public Collection getClients() - { - return Collections.unmodifiableSet(_registeredClientNames); - } - - /** - * @return the number of clients that are still absent. - */ - public int awaitClients(final int numberOfClientsToAwait, final long idleTimeout) - { - long startTime = System.currentTimeMillis(); - long deadlineForNextRegistration = deadline(idleTimeout); - - synchronized (_lock) - { - int numberOfClientsAbsent = numberAbsent(numberOfClientsToAwait); - - while(numberOfClientsAbsent > 0 && System.currentTimeMillis() < deadlineForNextRegistration) - { - try - { - _lock.wait(idleTimeout); - } - catch (InterruptedException e) - { - Thread.currentThread().interrupt(); - return numberOfClientsAbsent; - } - - int newNumberAbsent = numberAbsent(numberOfClientsToAwait); - if(newNumberAbsent < numberOfClientsAbsent) - { - // a registration was received since the last loop, so reset the timeout - deadlineForNextRegistration = deadline(idleTimeout); - } - - numberOfClientsAbsent = newNumberAbsent; - } - - int retVal = numberOfClientsAbsent < 0 ? 0 : numberOfClientsAbsent; - logAwaitClients(numberOfClientsToAwait, idleTimeout, startTime, retVal); - return retVal; - } - } - - - private void logAwaitClients(int numberOfClientsToAwait, long idleTimeout, long startTime, int retVal) - { - LOGGER.debug( - "awaitClients(numberOfClientsToAwait={}, idleTimeout={}) " + - "returning numberOfClientsAbsent={} after {} ms", - new Object[] { - valueOf(numberOfClientsToAwait), - valueOf(idleTimeout), - valueOf(retVal), - valueOf(System.currentTimeMillis() - startTime)}); - } - - private long deadline(final long idleTimeout) - { - return System.currentTimeMillis() + idleTimeout; - } - - private int numberAbsent(int numberOfClientsToAwait) - { - return numberOfClientsToAwait - _registeredClientNames.size(); - } -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/CommandForClient.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/CommandForClient.java deleted file mode 100644 index 6c0c253807..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/CommandForClient.java +++ /dev/null @@ -1,46 +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.controller; - -import org.apache.qpid.disttest.message.Command; - -public class CommandForClient -{ - private String _clientName; - private Command _command; - - public CommandForClient(String clientName, Command command) - { - _clientName = clientName; - _command = command; - } - - public String getClientName() - { - return _clientName; - } - - public Command getCommand() - { - return _command; - } - - -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/CommandListener.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/CommandListener.java deleted file mode 100644 index e2f40bebe8..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/CommandListener.java +++ /dev/null @@ -1,31 +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.controller; - -import org.apache.qpid.disttest.message.Command; - -public interface CommandListener -{ - - public abstract void processCommand(Command command); - - public boolean supports(Command command); - -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/Controller.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/Controller.java deleted file mode 100644 index 513e633566..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/Controller.java +++ /dev/null @@ -1,231 +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.controller; - -import java.util.Collection; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; - -import org.apache.qpid.disttest.DistributedTestException; -import org.apache.qpid.disttest.controller.config.Config; -import org.apache.qpid.disttest.controller.config.TestInstance; -import org.apache.qpid.disttest.jms.ControllerJmsDelegate; -import org.apache.qpid.disttest.message.Command; -import org.apache.qpid.disttest.message.CommandType; -import org.apache.qpid.disttest.message.RegisterClientCommand; -import org.apache.qpid.disttest.message.Response; -import org.apache.qpid.disttest.message.StopClientCommand; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class Controller -{ - private static final Logger LOGGER = LoggerFactory.getLogger(Controller.class); - - private final long _registrationTimeout; - private final long _commandResponseTimeout; - - private final ControllerJmsDelegate _jmsDelegate; - - private volatile CountDownLatch _stopClientsResponseLatch = null; - - private Config _config; - private TestRunnerFactory _testRunnerFactory; - private ClientRegistry _clientRegistry; - - private long _testResultTimeout = TestRunner.WAIT_FOREVER; - - public Controller(final ControllerJmsDelegate jmsDelegate, long registrationTimeout, long commandResponseTimeout) - { - _jmsDelegate = jmsDelegate; - _registrationTimeout = registrationTimeout; - _commandResponseTimeout = commandResponseTimeout; - _testRunnerFactory = new TestRunnerFactory(); - _clientRegistry = new ClientRegistry(); - - _jmsDelegate.addCommandListener(new RegisterClientCommandListener()); - _jmsDelegate.addCommandListener(new StopClientResponseListener()); - _jmsDelegate.start(); - } - - public void setConfig(Config config) - { - _config = config; - validateConfiguration(); - } - - public void awaitClientRegistrations() - { - LOGGER.info("Awaiting client registrations"); - - final int numberOfAbsentClients = _clientRegistry.awaitClients(_config.getTotalNumberOfClients(), _registrationTimeout); - if (numberOfAbsentClients > 0) - { - String formattedMessage = String.format("Timed out waiting for registrations. Expecting %d more registrations", numberOfAbsentClients); - throw new DistributedTestException(formattedMessage); - } - - } - - private void validateConfiguration() - { - if (_config == null || _config.getTotalNumberOfClients() == 0) - { - throw new DistributedTestException("No controller config or no clients specified in test config"); - } - } - - private void awaitStopResponses(CountDownLatch latch, long timeout) - { - String message = "Timed out after %d waiting for stop command responses. Expecting %d more responses."; - - try - { - boolean countedDownOK = latch.await(timeout, TimeUnit.MILLISECONDS); - if (!countedDownOK) - { - long latchCount = latch.getCount(); - String formattedMessage = String.format(message, timeout, latchCount); - LOGGER.error(formattedMessage); - throw new DistributedTestException(formattedMessage); - } - } - catch (final InterruptedException e) - { - Thread.currentThread().interrupt(); - } - } - - public void registerClient(final RegisterClientCommand registrationCommand) - { - final String clientName = registrationCommand.getClientName(); - - _jmsDelegate.registerClient(registrationCommand); - _clientRegistry.registerClient(clientName); - } - - void processStopClientResponse(final Response response) - { - // TODO clientRegistry should expose a deregisterClient - _stopClientsResponseLatch.countDown(); - if (response.hasError()) - { - LOGGER.error("Client " + response.getRegisteredClientName() + " reported exception in response to command : " + - response.getErrorMessage()); - } - } - - public void stopAllRegisteredClients() - { - Collection registeredClients = _clientRegistry.getClients(); - - LOGGER.info("Stopping all clients"); - _stopClientsResponseLatch = new CountDownLatch(registeredClients.size()); - Command command = new StopClientCommand(); - for (final String clientName : registeredClients) - { - _jmsDelegate.sendCommandToClient(clientName, command); - } - - awaitStopResponses(_stopClientsResponseLatch, _commandResponseTimeout); - - LOGGER.info("Stopped all clients"); - } - - - public ResultsForAllTests runAllTests() - { - LOGGER.info("Running all tests"); - - ResultsForAllTests resultsForAllTests = new ResultsForAllTests(); - - for (TestInstance testInstance : _config.getTests()) - { - - ParticipatingClients participatingClients = new ParticipatingClients(_clientRegistry, testInstance.getClientNames()); - - LOGGER.info("Running test " + testInstance + ". Participating clients: " + participatingClients.getRegisteredNames()); - TestRunner runner = _testRunnerFactory.createTestRunner(participatingClients, - testInstance, - _jmsDelegate, - _commandResponseTimeout, - _testResultTimeout); - - TestResult testResult = runner.run(); - LOGGER.info("Finished test " + testInstance); - - resultsForAllTests.add(testResult); - } - - return resultsForAllTests; - } - - private final class StopClientResponseListener implements CommandListener - { - @Override - public boolean supports(Command command) - { - return command.getType() == CommandType.RESPONSE && ((Response)command).getInReplyToCommandType() == CommandType.STOP_CLIENT; - } - - @Override - public void processCommand(Command command) - { - processStopClientResponse((Response)command); - } - } - - private final class RegisterClientCommandListener implements - CommandListener - { - @Override - public boolean supports(Command command) - { - return command.getType() == CommandType.REGISTER_CLIENT; - } - - @Override - public void processCommand(Command command) - { - registerClient((RegisterClientCommand)command); - } - } - - public void setTestResultTimeout(final long testResultTimeout) - { - _testResultTimeout = testResultTimeout; - - } - - void setClientRegistry(ClientRegistry clientRegistry) - { - _clientRegistry = clientRegistry; - - } - - void setTestRunnerFactory(TestRunnerFactory factory) - { - if (factory == null) - { - throw new IllegalArgumentException("TestRunnerFactory cannot be null!"); - } - _testRunnerFactory = factory; - } -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/ParticipatingClients.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/ParticipatingClients.java deleted file mode 100644 index 077d628697..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/ParticipatingClients.java +++ /dev/null @@ -1,94 +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.controller; - -import java.util.Collection; -import java.util.List; -import java.util.TreeSet; - -import org.apache.commons.collections.BidiMap; -import org.apache.commons.collections.bidimap.DualHashBidiMap; -import org.apache.commons.lang.builder.ToStringBuilder; -import org.apache.commons.lang.builder.ToStringStyle; - -public class ParticipatingClients -{ - private final BidiMap _configuredToRegisteredNameMap; - - public ParticipatingClients(ClientRegistry clientRegistry, List configuredClientNamesForTest) - { - _configuredToRegisteredNameMap = mapConfiguredToRegisteredClientNames(configuredClientNamesForTest, clientRegistry); - } - - public String getRegisteredNameFromConfiguredName(String clientConfiguredName) - { - String registeredClientName = (String) _configuredToRegisteredNameMap.get(clientConfiguredName); - if (registeredClientName == null) - { - throw new IllegalArgumentException("Unrecognised client configured name " + clientConfiguredName - + " Mapping is " + _configuredToRegisteredNameMap); - } - return registeredClientName; - } - - public String getConfiguredNameFromRegisteredName(String registeredClientName) - { - String clientConfiguredName = (String) _configuredToRegisteredNameMap.getKey(registeredClientName); - if (clientConfiguredName == null) - { - throw new IllegalArgumentException("Unrecognised client registered name " + registeredClientName - + " Mapping is " + _configuredToRegisteredNameMap); - } - - return clientConfiguredName; - } - - private BidiMap mapConfiguredToRegisteredClientNames(List configuredClientNamesForTest, ClientRegistry clientRegistry) - { - BidiMap configuredToRegisteredNameMap = new DualHashBidiMap(); - - TreeSet registeredClients = new TreeSet(clientRegistry.getClients()); - for (String configuredClientName : configuredClientNamesForTest) - { - String allocatedClientName = registeredClients.pollFirst(); - if (allocatedClientName == null) - { - throw new IllegalArgumentException("Too few clients in registry " + clientRegistry + " configured clients " + configuredClientNamesForTest); - } - configuredToRegisteredNameMap.put(configuredClientName, allocatedClientName); - } - - return configuredToRegisteredNameMap; - } - - @SuppressWarnings("unchecked") - public Collection getRegisteredNames() - { - return _configuredToRegisteredNameMap.values(); - } - - @Override - public String toString() - { - return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) - .append("configuredToRegisteredNameMap", _configuredToRegisteredNameMap).toString(); - } - - -} 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 deleted file mode 100644 index d4474e2c12..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/ResultsForAllTests.java +++ /dev/null @@ -1,70 +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.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 -{ - private List _results = new ArrayList(); - private boolean _hasErrors; - - public List getTestResults() - { - return _results; - } - - public void add(ITestResult testResult) - { - _results.add(testResult); - if(testResult.hasErrors()) - { - _hasErrors = true; - } - } - - public boolean hasErrors() - { - 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/controller/TestResult.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/TestResult.java deleted file mode 100644 index 756c641532..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/TestResult.java +++ /dev/null @@ -1,70 +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.controller; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.SortedSet; -import java.util.TreeSet; - -import org.apache.qpid.disttest.message.ParticipantResult; -import org.apache.qpid.disttest.results.aggregation.ITestResult; - -public class TestResult implements ITestResult -{ - private final SortedSet _participantResults = Collections.synchronizedSortedSet( - new TreeSet(ParticipantResult.PARTICIPANT_NAME_COMPARATOR)); - - private boolean _hasErrors; - private String _name; - - public TestResult(String name) - { - _name = name; - } - - @Override - public List getParticipantResults() - { - List list = new ArrayList(_participantResults); - return Collections.unmodifiableList(list); - } - - public void addParticipantResult(ParticipantResult participantResult) - { - _participantResults.add(participantResult); - if(participantResult.hasError()) - { - _hasErrors = true; - } - } - - @Override - public boolean hasErrors() - { - return _hasErrors; - } - - @Override - public String getName() - { - return _name; - } -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/TestRunner.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/TestRunner.java deleted file mode 100644 index a60a7ec88f..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/TestRunner.java +++ /dev/null @@ -1,348 +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.controller; - -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.apache.qpid.disttest.DistributedTestException; -import org.apache.qpid.disttest.controller.config.QueueConfig; -import org.apache.qpid.disttest.controller.config.TestInstance; -import org.apache.qpid.disttest.jms.ControllerJmsDelegate; -import org.apache.qpid.disttest.message.Command; -import org.apache.qpid.disttest.message.CommandType; -import org.apache.qpid.disttest.message.ParticipantResult; -import org.apache.qpid.disttest.message.Response; -import org.apache.qpid.disttest.message.StartTestCommand; -import org.apache.qpid.disttest.message.TearDownTestCommand; - -public class TestRunner -{ - private static final Logger LOGGER = LoggerFactory.getLogger(TestRunner.class); - - private static final long PARTICIPANT_RESULTS_LOG_INTERVAL = 60000; - public static final long WAIT_FOREVER = -1; - - private final long _commandResponseTimeout; - - private final Set _setOfResponsesToExpect = Collections.synchronizedSet(new HashSet()); - - private final ParticipatingClients _participatingClients; - - private final TestInstance _testInstance; - private ControllerJmsDelegate _jmsDelegate; - - private volatile CountDownLatch _commandResponseLatch = null; - private final CountDownLatch _testResultsLatch; - private final TestResult _testResult; - - /** Length of time to await test results or {@value #WAIT_FOREVER} */ - private final long _testResultTimeout; - - private Thread _removeQueuesShutdownHook = new Thread() - { - @Override - public void run() - { - LOGGER.info("Shutdown intercepted: deleting test queues"); - try - { - deleteQueues(); - } - catch (Exception t) - { - LOGGER.error("Failed to delete test queues during shutdown", t); - } - } - }; - - public TestRunner(ParticipatingClients participatingClients, TestInstance testInstance, ControllerJmsDelegate jmsDelegate, long commandResponseTimeout, long testResultTimeout) - { - _participatingClients = participatingClients; - _testInstance = testInstance; - _jmsDelegate = jmsDelegate; - _commandResponseTimeout = commandResponseTimeout; - _testResultsLatch = new CountDownLatch(testInstance.getTotalNumberOfParticipants()); - _testResultTimeout = testResultTimeout; - _testResult = new TestResult(testInstance.getName()); - } - - public TestResult run() - { - final ParticipantResultListener participantResultListener = new ParticipantResultListener(); - TestCommandResponseListener testCommandResponseListener = new TestCommandResponseListener(); - - try - { - _jmsDelegate.addCommandListener(testCommandResponseListener); - _jmsDelegate.addCommandListener(participantResultListener); - - runParts(); - - return _testResult; - } - catch(RuntimeException e) - { - LOGGER.error("Couldn't run test", e); - throw e; - } - finally - { - _jmsDelegate.removeCommandListener(participantResultListener); - _jmsDelegate.removeCommandListener(testCommandResponseListener); - } - } - - private void runParts() - { - boolean queuesCreated = false; - - try - { - createQueues(); - queuesCreated = true; - Runtime.getRuntime().addShutdownHook(_removeQueuesShutdownHook); - - sendTestSetupCommands(); - awaitCommandResponses(); - sendCommandToParticipatingClients(new StartTestCommand()); - awaitCommandResponses(); - - awaitTestResults(); - - sendCommandToParticipatingClients(new TearDownTestCommand()); - awaitCommandResponses(); - } - finally - { - - if (queuesCreated) - { - deleteQueues(); - } - - Runtime.getRuntime().removeShutdownHook(_removeQueuesShutdownHook); - } - } - - void createQueues() - { - List queues = _testInstance.getQueues(); - if (!queues.isEmpty()) - { - _jmsDelegate.createQueues(queues); - } - } - - void sendTestSetupCommands() - { - List commandsForAllClients = _testInstance.createCommands(); - final int numberOfCommandsToSend = commandsForAllClients.size(); - _commandResponseLatch = new CountDownLatch(numberOfCommandsToSend); - - LOGGER.debug("About to send {} command(s)", numberOfCommandsToSend); - - for (CommandForClient commandForClient : commandsForAllClients) - { - String configuredClientName = commandForClient.getClientName(); - String registeredClientName = _participatingClients.getRegisteredNameFromConfiguredName(configuredClientName); - - Command command = commandForClient.getCommand(); - - LOGGER.debug("Sending command : {} ", command); - - sendCommandInternal(registeredClientName, command); - } - } - - void awaitCommandResponses() - { - awaitLatch(_commandResponseLatch, _commandResponseTimeout, "Timed out waiting for command responses"); - } - - - void processCommandResponse(final Response response) - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("Received response for command " + response); - } - - _commandResponseLatch.countDown(); - checkForResponseError(response); - } - - - void awaitTestResults() - { - long timeout = _testResultTimeout; - DistributedTestException lastException = null; - - boolean waitForever = _testResultTimeout == WAIT_FOREVER; - final long interval = waitForever ? PARTICIPANT_RESULTS_LOG_INTERVAL : Math.min(PARTICIPANT_RESULTS_LOG_INTERVAL, _testResultTimeout); - - while(_testResultsLatch.getCount() > 0 && (waitForever || timeout > 0)) - { - try - { - awaitLatch(_testResultsLatch, interval, "still waiting for participant results"); - } - catch (DistributedTestException e) - { - lastException = e; - LOGGER.info(e.getMessage()); - } - - if (!waitForever) - { - timeout =- interval; - } - } - - if (_testResultsLatch.getCount() > 0) - { - throw lastException; - } - } - - void deleteQueues() - { - List queues = _testInstance.getQueues(); - if (!queues.isEmpty()) - { - _jmsDelegate.deleteQueues(queues); - } - } - - void sendCommandToParticipatingClients(final Command command) - { - Collection participatingRegisteredClients = _participatingClients.getRegisteredNames(); - final int numberOfClients = participatingRegisteredClients.size(); - _commandResponseLatch = new CountDownLatch(numberOfClients); - - LOGGER.debug("About to send command {} to {} clients", command, numberOfClients); - - for (final String clientName : participatingRegisteredClients) - { - LOGGER.debug("Sending command : {} ", command); - sendCommandInternal(clientName, command); - } - } - - public void processParticipantResult(ParticipantResult result) - { - setOriginalTestDetailsOn(result); - - _testResult.addParticipantResult(result); - LOGGER.debug("Received result " + result); - - _testResultsLatch.countDown(); - checkForResponseError(result); - } - - private void setOriginalTestDetailsOn(ParticipantResult result) - { - // Client knows neither the configured client name nor test name - String registeredClientName = result.getRegisteredClientName(); - String configuredClient = _participatingClients.getConfiguredNameFromRegisteredName(registeredClientName); - - result.setConfiguredClientName(configuredClient); - result.setTestName(_testInstance.getName()); - result.setIterationNumber(_testInstance.getIterationNumber()); - } - - private void sendCommandInternal(String registeredClientName, Command command) - { - _setOfResponsesToExpect.add(command.getType()); - _jmsDelegate.sendCommandToClient(registeredClientName, command); - } - - private void awaitLatch(CountDownLatch latch, long timeout, String message) - { - try - { - final boolean countedDownOK = latch.await(timeout, TimeUnit.MILLISECONDS); - if (!countedDownOK) - { - final long latchCount = latch.getCount(); - String formattedMessage = "After " + timeout + "ms ... " + message + " ... Expecting " + latchCount + " more responses."; - LOGGER.info(formattedMessage); // info rather than error because we time out periodically so we can log progress - throw new DistributedTestException(formattedMessage); - } - } - catch (final InterruptedException e) - { - Thread.currentThread().interrupt(); - } - } - - private void checkForResponseError(final Response response) - { - if (response.hasError()) - { - LOGGER.error("Client " + response.getRegisteredClientName() + " reported error " + response); - } - } - - final class ParticipantResultListener implements CommandListener - { - @Override - public boolean supports(Command command) - { - return command instanceof ParticipantResult; - } - - @Override - public void processCommand(Command command) - { - processParticipantResult((ParticipantResult) command); - - } - } - - final class TestCommandResponseListener implements CommandListener - { - @Override - public void processCommand(Command command) - { - processCommandResponse((Response)command); - } - - @Override - public boolean supports(Command command) - { - CommandType type = command.getType(); - if (type == CommandType.RESPONSE) - { - Response response = (Response)command; - return _setOfResponsesToExpect.contains(response.getInReplyToCommandType()); - } - return false; - } - } - -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/TestRunnerFactory.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/TestRunnerFactory.java deleted file mode 100644 index bf0e5afb9c..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/TestRunnerFactory.java +++ /dev/null @@ -1,31 +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.controller; - -import org.apache.qpid.disttest.controller.config.TestInstance; -import org.apache.qpid.disttest.jms.ControllerJmsDelegate; - -public class TestRunnerFactory -{ - public TestRunner createTestRunner(ParticipatingClients participatingClients, TestInstance testInstance, ControllerJmsDelegate jmsDelegate, long commandResponseTimeout, long testResultTimeout) - { - return new TestRunner(participatingClients, testInstance, jmsDelegate, commandResponseTimeout, testResultTimeout); - } -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/ClientConfig.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/ClientConfig.java deleted file mode 100644 index 4353a85cd3..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/ClientConfig.java +++ /dev/null @@ -1,113 +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.controller.config; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import org.apache.qpid.disttest.controller.CommandForClient; -import org.apache.qpid.disttest.message.Command; - -public class ClientConfig -{ - /* - * TODO add this field when repeating groups of clients need to be used. Talk to Phil and Keith! - * private int _instances; - */ - - private List _connections; - private List _messageProviders; - private String _name; - - public ClientConfig() - { - _name = null; - _connections = Collections.emptyList(); - _messageProviders = Collections.emptyList(); - } - - public ClientConfig(String name, ConnectionConfig... connections) - { - this(name, Arrays.asList(connections), null); - } - - public ClientConfig(String name, List connections, List messageProviders) - { - _name = name; - _connections = connections; - if (messageProviders == null) - { - _messageProviders = Collections.emptyList(); - } - else - { - _messageProviders = messageProviders; - } - } - - public String getName() - { - return _name; - } - - public List getConnections() - { - return Collections.unmodifiableList(_connections); - } - - public List createCommands() - { - List commandsForClient = new ArrayList(); - - for (MessageProviderConfig messageProvider : _messageProviders) - { - Command command = messageProvider.createCommand(); - commandsForClient.add(new CommandForClient(_name, command)); - } - for (ConnectionConfig connection : _connections) - { - List commands = connection.createCommands(); - for (Command command : commands) - { - commandsForClient.add(new CommandForClient(_name, command)); - } - } - return commandsForClient; - } - - public int getTotalNumberOfParticipants() - { - int numOfParticipants = 0; - for (ConnectionConfig connection : _connections) - { - numOfParticipants = numOfParticipants + connection.getTotalNumberOfParticipants(); - } - return numOfParticipants; - } - - public List getMessageProviders() - { - return Collections.unmodifiableList(_messageProviders); - } - - -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/Config.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/Config.java deleted file mode 100644 index 1698008418..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/Config.java +++ /dev/null @@ -1,86 +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.controller.config; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -public class Config -{ - private List _tests; - - public Config() - { - super(); - _tests = Collections.emptyList(); - } - - public Config(List tests) - { - _tests = tests; - } - - public Config(TestConfig... tests) - { - _tests = Arrays.asList(tests); - } - - public List getTests() - { - List testInstances = new ArrayList(); - for (TestConfig testConfig : _tests) - { - int iterationNumber = 0; - - List iterationValues = testConfig.getIterationValues(); - if(iterationValues.isEmpty()) - { - testInstances.add(new TestInstance(testConfig)); - } - else - { - for (IterationValue iterationValue : iterationValues) - { - testInstances.add(new TestInstance(testConfig, iterationNumber, iterationValue)); - iterationNumber++; - } - } - } - - return Collections.unmodifiableList(testInstances); - } - - public List getTestConfigs() - { - return Collections.unmodifiableList(_tests); - } - - public int getTotalNumberOfClients() - { - int numberOfClients = 0; - for (TestConfig testConfig : _tests) - { - numberOfClients = Math.max(testConfig.getTotalNumberOfClients(), numberOfClients); - } - return numberOfClients; - } - -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/ConfigReader.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/ConfigReader.java deleted file mode 100644 index 1f0368e87e..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/ConfigReader.java +++ /dev/null @@ -1,91 +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.controller.config; - -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.IOException; -import java.io.Reader; -import java.io.StringReader; - -import org.apache.qpid.disttest.client.property.PropertyValue; -import org.apache.qpid.disttest.json.PropertyValueAdapter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; - -public class ConfigReader -{ - private static final Logger LOGGER = LoggerFactory.getLogger(ConfigReader.class); - - public Config getConfigFromFile(String fileName) throws IOException - { - Reader reader = getConfigReader(fileName); - - Config config = readConfig(reader); - return config; - } - - public Config readConfig(Reader reader) - { - return readConfig(reader, false); - } - - public Config readConfig(Reader reader, boolean isJavascript) - { - if (isJavascript) - { - return readJson(new StringReader(new JavaScriptConfigEvaluator().evaluateJavaScript(reader))); - } - else - { - return readJson(reader); - } - } - - private Reader getConfigReader(String fileName) throws IOException - { - Reader reader = null; - if (fileName.endsWith(".js")) - { - LOGGER.info("Evaluating javascript:" + fileName); - reader = new StringReader(new JavaScriptConfigEvaluator().evaluateJavaScript(fileName)); - } - else - { - LOGGER.info("Loading JSON:" + fileName); - reader = new FileReader(fileName); - } - return reader; - } - - - private Config readJson(Reader reader) - { - Gson gson = new GsonBuilder() - .registerTypeAdapter(PropertyValue.class, new PropertyValueAdapter()) - .create(); - Config config = gson.fromJson(reader, Config.class); - return config; - } - -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/ConnectionConfig.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/ConnectionConfig.java deleted file mode 100644 index e2cc31e21e..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/ConnectionConfig.java +++ /dev/null @@ -1,91 +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.controller.config; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import org.apache.qpid.disttest.message.Command; -import org.apache.qpid.disttest.message.CreateConnectionCommand; - -public class ConnectionConfig -{ - private String _name; - private List _sessions; - private String _factory; - - // For Gson - public ConnectionConfig() - { - super(); - _sessions = Collections.emptyList(); - } - - public ConnectionConfig(String name, String factory, SessionConfig... sessions) - { - super(); - _name = name; - _factory = factory; - _sessions = Arrays.asList(sessions); - - } - - public List getSessions() - { - return Collections.unmodifiableList(_sessions); - } - - public String getName() - { - return _name; - } - - public List createCommands() - { - List commands = new ArrayList(); - commands.add(createCommand()); - for (SessionConfig sessionConfig : _sessions) - { - commands.addAll(sessionConfig.createCommands(_name)); - } - return commands; - } - - private CreateConnectionCommand createCommand() - { - CreateConnectionCommand command = new CreateConnectionCommand(); - command.setConnectionName(_name); - command.setConnectionFactoryName(_factory); - return command; - } - - public int getTotalNumberOfParticipants() - { - int numOfParticipants = 0; - - for (SessionConfig sessionConfig : _sessions) - { - numOfParticipants = numOfParticipants + sessionConfig.getTotalNumberOfParticipants(); - } - return numOfParticipants; - } -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/ConsumerConfig.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/ConsumerConfig.java deleted file mode 100644 index dcccccdd5f..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/ConsumerConfig.java +++ /dev/null @@ -1,83 +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.controller.config; - -import org.apache.qpid.disttest.message.CreateConsumerCommand; - -public class ConsumerConfig extends ParticipantConfig -{ - private boolean _isDurableSubscription; - private boolean _isBrowsingSubscription; - private String _selector; - private boolean _noLocal; - private boolean _synchronous; - private boolean _evaluateLatency; - - // For Gson - public ConsumerConfig() - { - _isDurableSubscription = false; - _isBrowsingSubscription = false; - _selector = null; - _noLocal = false; - _synchronous = true; - } - - public ConsumerConfig( - String consumerName, - String destinationName, - long numberOfMessages, - int batchSize, - long maximumDuration, - boolean isTopic, - boolean isDurableSubscription, - boolean isBrowsingSubscription, - String selector, - boolean noLocal, - boolean synchronous) - { - super(consumerName, destinationName, isTopic, numberOfMessages, batchSize, maximumDuration); - - _isDurableSubscription = isDurableSubscription; - _isBrowsingSubscription = isBrowsingSubscription; - _selector = selector; - _noLocal = noLocal; - _synchronous = synchronous; - } - - public CreateConsumerCommand createCommand(String sessionName) - { - CreateConsumerCommand createConsumerCommand = new CreateConsumerCommand(); - - setParticipantProperties(createConsumerCommand); - - createConsumerCommand.setSessionName(sessionName); - createConsumerCommand.setDurableSubscription(_isDurableSubscription); - createConsumerCommand.setBrowsingSubscription(_isBrowsingSubscription); - createConsumerCommand.setSelector(_selector); - createConsumerCommand.setNoLocal(_noLocal); - createConsumerCommand.setSynchronous(_synchronous); - createConsumerCommand.setEvaluateLatency(_evaluateLatency); - - return createConsumerCommand; - } - -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/IterationValue.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/IterationValue.java deleted file mode 100644 index ef953a5d07..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/IterationValue.java +++ /dev/null @@ -1,86 +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.controller.config; - -import java.lang.reflect.InvocationTargetException; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import org.apache.commons.beanutils.BeanUtilsBean; -import org.apache.commons.lang.builder.ToStringBuilder; -import org.apache.commons.lang.builder.ToStringStyle; -import org.apache.qpid.disttest.message.Command; - -public class IterationValue -{ - private final Map _iterationPropertyValuesWithUnderscores; - - public IterationValue(Map iterationMap) - { - _iterationPropertyValuesWithUnderscores = iterationMap; - } - - public IterationValue() - { - _iterationPropertyValuesWithUnderscores = Collections.emptyMap(); - } - - public Map getIterationPropertyValuesWithUnderscores() - { - return _iterationPropertyValuesWithUnderscores; - } - - public void applyToCommand(Command command) - { - try - { - Map withoutUnderscoresToMatchCommandPropertyNames = getIterationPropertyValuesWithoutUnderscores(); - BeanUtilsBean.getInstance().copyProperties(command, withoutUnderscoresToMatchCommandPropertyNames); - } - catch (IllegalAccessException e) - { - throw new RuntimeException("Couldn't copy properties from iteration " + this + " to " + command, e); - } - catch (InvocationTargetException e) - { - throw new RuntimeException("Couldn't copy properties from iteration " + this + " to " + command, e); - } - } - - private Map getIterationPropertyValuesWithoutUnderscores() - { - Map iterationPropertyValues = new HashMap(); - for (String propertyNameWithUnderscore : _iterationPropertyValuesWithUnderscores.keySet()) - { - String propertyName = propertyNameWithUnderscore.replaceFirst("_", ""); - String propertyValue = _iterationPropertyValuesWithUnderscores.get(propertyNameWithUnderscore); - - iterationPropertyValues.put(propertyName, propertyValue); - } - return iterationPropertyValues; - } - - @Override - public String toString() - { - return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("iterationMap", _iterationPropertyValuesWithUnderscores).toString(); - } - -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/JavaScriptConfigEvaluator.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/JavaScriptConfigEvaluator.java deleted file mode 100644 index d760ffe06d..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/JavaScriptConfigEvaluator.java +++ /dev/null @@ -1,83 +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.controller.config; - -import java.io.FileReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.Reader; - -import javax.script.ScriptEngine; -import javax.script.ScriptEngineManager; -import javax.script.ScriptException; - -import org.apache.qpid.disttest.DistributedTestException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * A helper class to load and evaluate JavaScript configuration, producing a JSON string. - */ -public class JavaScriptConfigEvaluator -{ - private static final Logger LOGGER = LoggerFactory.getLogger(JavaScriptConfigEvaluator.class); - - public static final String TEST_CONFIG_VARIABLE_NAME = "jsonObject"; - - public String evaluateJavaScript(String fileName) throws IOException - { - FileReader fileReader = null; - try - { - fileReader = new FileReader(fileName); - String result = evaluateJavaScript(fileReader); - LOGGER.debug("Evaluated javascript file " + fileName + ". Generated the following JSON: " + result); - return result; - } - finally - { - if (fileReader != null) - { - fileReader.close(); - } - } - } - - public String evaluateJavaScript(Reader fileReader) - { - ScriptEngineManager mgr = new ScriptEngineManager(); - ScriptEngine engine = mgr.getEngineByName("JavaScript"); - try - { - engine.eval(new InputStreamReader(getClass().getClassLoader().getResourceAsStream("json2.js"))); - engine.eval(new InputStreamReader(getClass().getClassLoader().getResourceAsStream("test-utils.js"))); - engine.eval(fileReader); - engine.eval("jsonString = JSON.stringify(" + TEST_CONFIG_VARIABLE_NAME + ")"); - } - catch (ScriptException e) - { - throw new DistributedTestException("Exception while evaluating test config", e); - } - String result = (String) engine.get("jsonString"); - - return result; - } -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/MessageProviderConfig.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/MessageProviderConfig.java deleted file mode 100644 index 318ec7f045..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/MessageProviderConfig.java +++ /dev/null @@ -1,60 +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.controller.config; - -import java.util.Map; - -import org.apache.qpid.disttest.client.property.PropertyValue; -import org.apache.qpid.disttest.message.CreateMessageProviderCommand; - -public class MessageProviderConfig -{ - private String _name; - private Map _messageProperties; - - public MessageProviderConfig() - { - super(); - } - - public MessageProviderConfig(String name, Map messageProperties) - { - super(); - _name = name; - _messageProperties = messageProperties; - } - - public String getName() - { - return _name; - } - - public Map getMessageProperties() - { - return _messageProperties; - } - - public CreateMessageProviderCommand createCommand() - { - CreateMessageProviderCommand command = new CreateMessageProviderCommand(); - command.setProviderName(_name); - command.setMessageProperties(_messageProperties); - return command; - } -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/ParticipantConfig.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/ParticipantConfig.java deleted file mode 100644 index 99ae4b7426..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/ParticipantConfig.java +++ /dev/null @@ -1,105 +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.controller.config; - -import org.apache.commons.lang.ObjectUtils; -import org.apache.qpid.disttest.message.CreateParticpantCommand; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public abstract class ParticipantConfig -{ - private static final Logger LOGGER = LoggerFactory.getLogger(ParticipantConfig.class); - - public static final String DURATION_OVERRIDE_SYSTEM_PROPERTY = "qpid.disttest.duration"; - - /** used to ensure we only log about the overridden duration once */ - private boolean _alreadyLoggedAboutOverriddenDuration; - - private String _destinationName; - private boolean _isTopic; - private long _numberOfMessages; - private String _name; - private int _batchSize; - private long _maximumDuration; - - // For GSON - public ParticipantConfig() - { - _name = null; - _destinationName = null; - _numberOfMessages = 0; - _batchSize = 0; - _maximumDuration = 0; - } - - public ParticipantConfig( - String name, - String destinationName, - boolean isTopic, - long numberOfMessages, - int batchSize, - long maximumDuration) - { - _name = name; - _destinationName = destinationName; - _isTopic = isTopic; - _numberOfMessages = numberOfMessages; - _batchSize = batchSize; - _maximumDuration = maximumDuration; - } - - protected void setParticipantProperties(CreateParticpantCommand createParticipantCommand) - { - createParticipantCommand.setParticipantName(_name); - createParticipantCommand.setDestinationName(_destinationName); - createParticipantCommand.setTopic(_isTopic); - createParticipantCommand.setNumberOfMessages(_numberOfMessages); - createParticipantCommand.setBatchSize(_batchSize); - - Long maximumDuration = (Long)ObjectUtils.defaultIfNull(getOverriddenDuration(), _maximumDuration); - createParticipantCommand.setMaximumDuration(maximumDuration); - } - - private Long getOverriddenDuration() - { - String overriddenDurationString = System.getProperty(DURATION_OVERRIDE_SYSTEM_PROPERTY); - if(overriddenDurationString != null) - { - try - { - long overriddenDuration = Long.valueOf(overriddenDurationString); - - if(!_alreadyLoggedAboutOverriddenDuration) - { - LOGGER.info("Applied overridden maximum duration " + overriddenDuration); - _alreadyLoggedAboutOverriddenDuration = true; - } - - return overriddenDuration; - } - catch (NumberFormatException e) - { - LOGGER.error("Couldn't parse overridden duration " + overriddenDurationString, e); - } - } - - return null; - } -} \ No newline at end of file diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/ProducerConfig.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/ProducerConfig.java deleted file mode 100644 index b35321fe5d..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/ProducerConfig.java +++ /dev/null @@ -1,121 +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.controller.config; - -import javax.jms.Message; - -import org.apache.commons.lang.ObjectUtils; -import org.apache.qpid.disttest.message.CreateProducerCommand; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class ProducerConfig extends ParticipantConfig -{ - private static final Logger LOGGER = LoggerFactory.getLogger(ProducerConfig.class); - - public static final String MESSAGE_SIZE_OVERRIDE_SYSTEM_PROPERTY = "qpid.disttest.messageSize"; - - private int _deliveryMode; - private int _messageSize; - private int _priority; - private long _timeToLive; - private long _interval; - private long _startDelay; - private String _messageProviderName; - - // For Gson - public ProducerConfig() - { - _deliveryMode = Message.DEFAULT_DELIVERY_MODE; - _messageSize = 1024; - _priority = Message.DEFAULT_PRIORITY; - _timeToLive = Message.DEFAULT_TIME_TO_LIVE; - _interval = 0; - _startDelay = 0; - _messageProviderName = null; - } - - public ProducerConfig( - String producerName, - String destinationName, - long numberOfMessages, - int batchSize, - long maximumDuration, - int deliveryMode, - int messageSize, - int priority, - long timeToLive, - long interval, - long startDelay, - String messageProviderName) - { - super(producerName, destinationName, false, numberOfMessages, batchSize, maximumDuration); - - _deliveryMode = deliveryMode; - _messageSize = messageSize; - _priority = priority; - _timeToLive = timeToLive; - _interval = interval; - _startDelay = startDelay; - _messageProviderName = messageProviderName; - } - - public CreateProducerCommand createCommand(String sessionName) - { - CreateProducerCommand command = new CreateProducerCommand(); - - setParticipantProperties(command); - - command.setSessionName(sessionName); - command.setDeliveryMode(_deliveryMode); - - Integer messageSize = (Integer)ObjectUtils.defaultIfNull(getOverriddenMessageSize(), _messageSize); - - command.setMessageSize(messageSize); - command.setPriority(_priority); - command.setTimeToLive(_timeToLive); - command.setInterval(_interval); - command.setStartDelay(_startDelay); - command.setMessageProviderName(_messageProviderName); - - return command; - } - - private Integer getOverriddenMessageSize() - { - String overriddenMessageSizeString = System.getProperty(MESSAGE_SIZE_OVERRIDE_SYSTEM_PROPERTY); - if(overriddenMessageSizeString != null) - { - try - { - int overriddenMessageSize = Integer.valueOf(overriddenMessageSizeString); - LOGGER.info("Applied overridden message size " + overriddenMessageSize); - return overriddenMessageSize; - } - catch (NumberFormatException e) - { - LOGGER.error("Couldn't parse overridden message size " + overriddenMessageSizeString, e); - } - } - - return null; - } - -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/QueueConfig.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/QueueConfig.java deleted file mode 100644 index 45a4551cbc..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/QueueConfig.java +++ /dev/null @@ -1,66 +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.controller.config; - -import java.util.Collections; -import java.util.Map; - -import org.apache.commons.lang.builder.ReflectionToStringBuilder; -import org.apache.commons.lang.builder.ToStringStyle; - -public class QueueConfig -{ - private String _name; - private boolean _durable; - private Map _attributes; - - public QueueConfig() - { - super(); - _attributes = Collections.emptyMap(); - } - - public QueueConfig(String name, boolean durable, Map attributes) - { - this._name = name; - this._durable = durable; - this._attributes = attributes; - } - - public String getName() - { - return _name; - } - - public Map getAttributes() - { - return _attributes; - } - - public boolean isDurable() - { - return _durable; - } - - @Override - public String toString() - { - return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE); - } -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/SessionConfig.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/SessionConfig.java deleted file mode 100644 index 12372e5391..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/SessionConfig.java +++ /dev/null @@ -1,114 +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.controller.config; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import javax.jms.Session; - -import org.apache.qpid.disttest.message.Command; -import org.apache.qpid.disttest.message.CreateSessionCommand; - -public class SessionConfig -{ - private static final List EMPTY_PRODUCER_LIST = Collections.emptyList(); - private static final List EMPTY_CONSUMER_LIST = Collections.emptyList(); - - private int _acknowledgeMode; - private String _sessionName; - private List _producers; - private List _consumers; - - // For Gson - public SessionConfig() - { - this(null, Session.SESSION_TRANSACTED, EMPTY_CONSUMER_LIST, EMPTY_PRODUCER_LIST); - } - - public SessionConfig(String sessionName, int acknowledgeMode, ProducerConfig...producers) - { - this(sessionName, acknowledgeMode, EMPTY_CONSUMER_LIST, Arrays.asList(producers)); - } - - public SessionConfig(String sessionName, int acknowledgeMode, ConsumerConfig... consumers) - { - this(sessionName, acknowledgeMode, Arrays.asList(consumers), EMPTY_PRODUCER_LIST); - } - - public SessionConfig(String sessionName, int acknowledgeMode, List consumers, List producers) - { - _sessionName = sessionName; - _acknowledgeMode = acknowledgeMode; - _consumers = consumers; - _producers = producers; - } - - public int getAcknowledgeMode() - { - return _acknowledgeMode; - } - - public String getSessionName() - { - return _sessionName; - } - - public List getProducers() - { - return Collections.unmodifiableList(_producers); - } - - public List getConsumers() - { - return Collections.unmodifiableList(_consumers); - } - - public List createCommands(String connectionName) - { - List commands = new ArrayList(); - commands.add(createCommand(connectionName)); - for (ProducerConfig producer : _producers) - { - commands.add(producer.createCommand(_sessionName)); - } - for (ConsumerConfig consumer : _consumers) - { - commands.add(consumer.createCommand(_sessionName)); - } - return commands; - } - - private CreateSessionCommand createCommand(String connectionName) - { - CreateSessionCommand command = new CreateSessionCommand(); - command.setAcknowledgeMode(_acknowledgeMode); - command.setConnectionName(connectionName); - command.setSessionName(_sessionName); - return command; - } - - public int getTotalNumberOfParticipants() - { - return _producers.size() + _consumers.size(); - } -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/TestConfig.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/TestConfig.java deleted file mode 100644 index 2bb5f1b289..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/TestConfig.java +++ /dev/null @@ -1,117 +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.controller.config; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -import org.apache.qpid.disttest.controller.CommandForClient; - -public class TestConfig -{ - private final String _name; - - private final List _clients; - - private final List _queues; - - private final List> _iterations; - - public TestConfig() - { - _clients = Collections.emptyList(); - _queues = Collections.emptyList(); - _name = null; - _iterations = Collections.emptyList(); - } - - public TestConfig(String name, ClientConfig[] clients, QueueConfig[] queues) - { - _clients = Arrays.asList(clients); - _queues = Arrays.asList(queues); - _name = name; - _iterations = Collections.emptyList(); - } - - public List getClientNames() - { - List clientNames = new ArrayList(); - for (ClientConfig clientConfig : _clients) - { - clientNames.add(clientConfig.getName()); - } - return clientNames; - } - - public int getTotalNumberOfClients() - { - return _clients.size(); - } - - public int getTotalNumberOfParticipants() - { - int numOfParticipants = 0; - for (ClientConfig client : _clients) - { - numOfParticipants = numOfParticipants + client.getTotalNumberOfParticipants(); - } - return numOfParticipants; - } - - public List createCommands() - { - List commandsForClients = new ArrayList(); - for (ClientConfig client : _clients) - { - commandsForClients.addAll(client.createCommands()); - } - - return Collections.unmodifiableList(commandsForClients); - } - - public List getQueues() - { - return Collections.unmodifiableList(_queues); - } - - public String getName() - { - return _name; - } - - public List getIterationValues() - { - List iterationValues = new ArrayList(); - for (Map iterationMap : _iterations) - { - iterationValues.add(new IterationValue(iterationMap)); - } - - return iterationValues; - } - - public List getClients() - { - return Collections.unmodifiableList(_clients); - } -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/TestInstance.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/TestInstance.java deleted file mode 100644 index 9f555ef4da..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/TestInstance.java +++ /dev/null @@ -1,102 +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.controller.config; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.lang.builder.ToStringBuilder; -import org.apache.commons.lang.builder.ToStringStyle; -import org.apache.qpid.disttest.controller.CommandForClient; -import org.apache.qpid.disttest.message.Command; - -public class TestInstance -{ - private static final IterationValue EMPTY_ITERATION_VALUES = new IterationValue(); - - private TestConfig _testConfig; - private IterationValue _iterationValue; - private int _iterationNumber; - - public TestInstance(TestConfig testConfig, int iterationNumber, IterationValue iterationValue) - { - _testConfig = testConfig; - _iterationNumber = iterationNumber; - _iterationValue = iterationValue; - } - - public TestInstance(TestConfig testConfig) - { - this(testConfig, 0, EMPTY_ITERATION_VALUES); - } - - public List createCommands() - { - List commands = _testConfig.createCommands(); - List newCommands = new ArrayList(commands.size()); - - for (CommandForClient commandForClient : commands) - { - String clientName = commandForClient.getClientName(); - Command command = commandForClient.getCommand(); - - _iterationValue.applyToCommand(command); - - newCommands.add(new CommandForClient(clientName, command)); - } - - return newCommands; - - } - - public String getName() - { - return _testConfig.getName(); - } - - public int getIterationNumber() - { - return _iterationNumber; - } - - public int getTotalNumberOfParticipants() - { - return _testConfig.getTotalNumberOfParticipants(); - } - - public List getQueues() - { - return _testConfig.getQueues(); - } - - public List getClientNames() - { - return _testConfig.getClientNames(); - } - - @Override - public String toString() - { - return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) - .append("testName", getName()) - .append("iterationNumber", _iterationNumber) - .toString(); - } - -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/db/ResultsDbWriter.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/db/ResultsDbWriter.java deleted file mode 100644 index e4cf80a60f..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/db/ResultsDbWriter.java +++ /dev/null @@ -1,440 +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.db; - -import static org.apache.qpid.disttest.message.ParticipantAttribute.*; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.sql.Timestamp; -import java.util.Calendar; -import java.util.Date; -import java.util.Hashtable; -import java.util.TimeZone; - -import javax.naming.Context; -import javax.naming.NamingException; - -import org.apache.commons.lang.builder.ToStringBuilder; -import org.apache.commons.lang.builder.ToStringStyle; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.apache.qpid.disttest.controller.ResultsForAllTests; -import org.apache.qpid.disttest.message.ParticipantResult; -import org.apache.qpid.disttest.results.aggregation.ITestResult; - -/** - * Intended call sequence: - *
    - *
  • {@link #ResultsDbWriter(Context, String)}
  • - *
  • {@link #createResultsTableIfNecessary()}
  • - *
  • {@link #writeResults(ResultsForAllTests)} (usually multiple times)
  • - *
- */ -public class ResultsDbWriter -{ - private static final Logger _logger = LoggerFactory.getLogger(ResultsDbWriter.class); - - private static final String RESULTS_TABLE_NAME = "RESULTS"; - - /** column name */ - static final String INSERTED_TIMESTAMP = "insertedTimestamp"; - /** column name */ - static final String RUN_ID = "runId"; - - private static final String TABLE_EXISTENCE_QUERY = "SELECT 1 FROM SYS.SYSTABLES WHERE TABLENAME = ?"; - - private static final String CREATE_RESULTS_TABLE = String.format( - "CREATE TABLE %1$s (" + - "%2$s varchar(200) not null" + // TEST_NAME - ", %3$s bigint not null" + // ITERATION_NUMBER - ", %4$s varchar(200) not null" + // PARTICIPANT_NAME - ", %5$s double not null" + // THROUGHPUT - ", %6$s double" + // AVERAGE_LATENCY - ", %7$s varchar(200)" + // CONFIGURED_CLIENT_NAME - ", %8$s bigint" + // NUMBER_OF_MESSAGES_PROCESSED - ", %9$s bigint" + // PAYLOAD_SIZE - ", %10$s bigint" + // PRIORITY - ", %11$s bigint" + // TIME_TO_LIVE - ", %12$s bigint" + // ACKNOWLEDGE_MODE - ", %13$s bigint" + // DELIVERY_MODE - ", %14$s bigint" + // BATCH_SIZE - ", %15$s bigint" + // MAXIMUM_DURATION - ", %16$s bigint" + // PRODUCER_START_DELAY - ", %17$s bigint" + // PRODUCER_INTERVAL - ", %18$s bigint" + // IS_TOPIC - ", %19$s bigint" + // IS_DURABLE_SUBSCRIPTION - ", %20$s bigint" + // IS_BROWSING_SUBSCRIPTION - ", %21$s bigint" + // IS_SELECTOR - ", %22$s bigint" + // IS_NO_LOCAL - ", %23$s bigint" + // IS_SYNCHRONOUS_CONSUMER - ", %24$s bigint" + // TOTAL_NUMBER_OF_CONSUMERS - ", %25$s bigint" + // TOTAL_NUMBER_OF_PRODUCERS - ", %26$s bigint" + // TOTAL_PAYLOAD_PROCESSED - ", %27$s bigint" + // TIME_TAKEN - ", %28$s varchar(2000)" + // ERROR_MESSAGE - ", %29$s bigint" + // MIN_LATENCY - ", %30$s bigint" + // MAX_LATENCY - ", %31$s double" + // LATENCY_STANDARD_DEVIATION - ", %32$s varchar(200) not null" + - ", %33$s timestamp not null" + - ")", - RESULTS_TABLE_NAME, - TEST_NAME.getDisplayName(), - ITERATION_NUMBER.getDisplayName(), - PARTICIPANT_NAME.getDisplayName(), - THROUGHPUT.getDisplayName(), - AVERAGE_LATENCY.getDisplayName(), - CONFIGURED_CLIENT_NAME.getDisplayName(), - NUMBER_OF_MESSAGES_PROCESSED.getDisplayName(), - PAYLOAD_SIZE.getDisplayName(), - PRIORITY.getDisplayName(), - TIME_TO_LIVE.getDisplayName(), - ACKNOWLEDGE_MODE.getDisplayName(), - DELIVERY_MODE.getDisplayName(), - BATCH_SIZE.getDisplayName(), - MAXIMUM_DURATION.getDisplayName(), - PRODUCER_START_DELAY.getDisplayName(), - PRODUCER_INTERVAL.getDisplayName(), - IS_TOPIC.getDisplayName(), - IS_DURABLE_SUBSCRIPTION.getDisplayName(), - IS_BROWSING_SUBSCRIPTION.getDisplayName(), - IS_SELECTOR.getDisplayName(), - IS_NO_LOCAL.getDisplayName(), - IS_SYNCHRONOUS_CONSUMER.getDisplayName(), - TOTAL_NUMBER_OF_CONSUMERS.getDisplayName(), - TOTAL_NUMBER_OF_PRODUCERS.getDisplayName(), - TOTAL_PAYLOAD_PROCESSED.getDisplayName(), - TIME_TAKEN.getDisplayName(), - ERROR_MESSAGE.getDisplayName(), - MIN_LATENCY.getDisplayName(), - MAX_LATENCY.getDisplayName(), - LATENCY_STANDARD_DEVIATION.getDisplayName(), - RUN_ID, - INSERTED_TIMESTAMP - ); - - public static final String DRIVER_NAME = "jdbcDriverClass"; - public static final String URL = "jdbcUrl"; - - private final String _url; - private final String _runId; - - private final Clock _clock; - - /** - * @param runId may be null, in which case a default value is chosen based on current GMT time - * @param context must contain environment entries {@value #DRIVER_NAME} and {@value #URL}. - */ - public ResultsDbWriter(Context context, String runId) - { - this(context, runId, new Clock()); - } - - /** only call directly from tests */ - ResultsDbWriter(Context context, String runId, Clock clock) - { - _clock = clock; - _runId = defaultIfNullRunId(runId); - - _url = initialiseJdbc(context); - } - - private String defaultIfNullRunId(String runId) - { - if(runId == null) - { - Date dateNow = new Date(_clock.currentTimeMillis()); - Calendar calNow = Calendar.getInstance(TimeZone.getTimeZone("GMT+00:00")); - calNow.setTime(dateNow); - return String.format("run %1$tF %1$tT.%tL", calNow); - } - else - { - return runId; - } - } - - public String getRunId() - { - return _runId; - } - - /** - * Uses the context's environment to load the JDBC driver class and return the - * JDBC URL specified therein. - * @return the JDBC URL - */ - private String initialiseJdbc(Context context) - { - Hashtable environment = null; - try - { - environment = context.getEnvironment(); - - String driverName = (String) environment.get(DRIVER_NAME); - if(driverName == null) - { - throw new IllegalArgumentException("JDBC driver name " + DRIVER_NAME - + " missing from context environment: " + environment); - } - - Class.forName(driverName); - - Object url = environment.get(URL); - if(url == null) - { - throw new IllegalArgumentException("JDBC URL " + URL + " missing from context environment: " + environment); - } - return (String) url; - } - catch (NamingException e) - { - throw constructorRethrow(e, environment); - } - catch (ClassNotFoundException e) - { - throw constructorRethrow(e, environment); - } - } - - private RuntimeException constructorRethrow(Exception e, Hashtable environment) - { - return new RuntimeException("Couldn't initialise ResultsDbWriter from context with environment" + environment, e); - } - - public void createResultsTableIfNecessary() - { - try - { - Connection connection = null; - try - { - connection = DriverManager.getConnection(_url); - if(!tableExists(RESULTS_TABLE_NAME, connection)) - { - Statement statement = connection.createStatement(); - try - { - _logger.info("About to create results table using SQL: " + CREATE_RESULTS_TABLE); - statement.execute(CREATE_RESULTS_TABLE); - } - finally - { - statement.close(); - } - } - } - finally - { - if(connection != null) - { - connection.close(); - } - } - } - catch (SQLException e) - { - throw new RuntimeException("Couldn't create results table", e); - } - - } - - private boolean tableExists(final String tableName, final Connection conn) throws SQLException - { - PreparedStatement stmt = conn.prepareStatement(TABLE_EXISTENCE_QUERY); - try - { - stmt.setString(1, tableName); - ResultSet rs = stmt.executeQuery(); - try - { - return rs.next(); - } - finally - { - rs.close(); - } - } - finally - { - stmt.close(); - } - } - - public void writeResults(ResultsForAllTests results) - { - try - { - writeResultsThrowingException(results); - } - catch (SQLException e) - { - throw new RuntimeException("Couldn't write results " + results, e); - } - _logger.info(this + " wrote " + results.getTestResults().size() + " results to database"); - } - - private void writeResultsThrowingException(ResultsForAllTests results) throws SQLException - { - Connection connection = null; - try - { - connection = DriverManager.getConnection(_url); - - for (ITestResult testResult : results.getTestResults()) - { - for (ParticipantResult participantResult : testResult.getParticipantResults()) - { - writeParticipantResult(connection, participantResult); - } - } - } - finally - { - if(connection != null) - { - connection.close(); - } - } - } - - private void writeParticipantResult(Connection connection, ParticipantResult participantResult) throws SQLException - { - if(_logger.isDebugEnabled()) - { - _logger.debug("About to write to DB the following participant result: " + participantResult); - } - - PreparedStatement statement = null; - try - { - String sqlTemplate = String.format( - "INSERT INTO %s (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s) " + - "VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", - RESULTS_TABLE_NAME, - TEST_NAME.getDisplayName(), - ITERATION_NUMBER.getDisplayName(), - PARTICIPANT_NAME.getDisplayName(), - THROUGHPUT.getDisplayName(), - AVERAGE_LATENCY.getDisplayName(), - CONFIGURED_CLIENT_NAME.getDisplayName(), - NUMBER_OF_MESSAGES_PROCESSED.getDisplayName(), - PAYLOAD_SIZE.getDisplayName(), - PRIORITY.getDisplayName(), - TIME_TO_LIVE.getDisplayName(), - ACKNOWLEDGE_MODE.getDisplayName(), - DELIVERY_MODE.getDisplayName(), - BATCH_SIZE.getDisplayName(), - MAXIMUM_DURATION.getDisplayName(), - PRODUCER_START_DELAY.getDisplayName(), - PRODUCER_INTERVAL.getDisplayName(), - IS_TOPIC.getDisplayName(), - IS_DURABLE_SUBSCRIPTION.getDisplayName(), - IS_BROWSING_SUBSCRIPTION.getDisplayName(), - IS_SELECTOR.getDisplayName(), - IS_NO_LOCAL.getDisplayName(), - IS_SYNCHRONOUS_CONSUMER.getDisplayName(), - TOTAL_NUMBER_OF_CONSUMERS.getDisplayName(), - TOTAL_NUMBER_OF_PRODUCERS.getDisplayName(), - TOTAL_PAYLOAD_PROCESSED.getDisplayName(), - TIME_TAKEN.getDisplayName(), - ERROR_MESSAGE.getDisplayName(), - MIN_LATENCY.getDisplayName(), - MAX_LATENCY.getDisplayName(), - LATENCY_STANDARD_DEVIATION.getDisplayName(), - RUN_ID, - INSERTED_TIMESTAMP - ); - statement = connection.prepareStatement(sqlTemplate); - - int columnIndex = 1; - statement.setString(columnIndex++, participantResult.getTestName()); - statement.setInt(columnIndex++, participantResult.getIterationNumber()); - statement.setString(columnIndex++, participantResult.getParticipantName()); - statement.setDouble(columnIndex++, participantResult.getThroughput()); - statement.setDouble(columnIndex++, participantResult.getAverageLatency()); - statement.setString(columnIndex++, participantResult.getConfiguredClientName()); - statement.setLong(columnIndex++, participantResult.getNumberOfMessagesProcessed()); - statement.setLong(columnIndex++, participantResult.getPayloadSize()); - statement.setLong(columnIndex++, participantResult.getPriority()); - statement.setLong(columnIndex++, participantResult.getTimeToLive()); - statement.setLong(columnIndex++, participantResult.getAcknowledgeMode()); - statement.setLong(columnIndex++, participantResult.getDeliveryMode()); - statement.setLong(columnIndex++, participantResult.getBatchSize()); - statement.setLong(columnIndex++, participantResult.getMaximumDuration()); - statement.setLong(columnIndex++, 0 /* TODO PRODUCER_START_DELAY*/); - statement.setLong(columnIndex++, 0 /* TODO PRODUCER_INTERVAL*/); - statement.setLong(columnIndex++, 0 /* TODO IS_TOPIC*/); - statement.setLong(columnIndex++, 0 /* TODO IS_DURABLE_SUBSCRIPTION*/); - statement.setLong(columnIndex++, 0 /* TODO IS_BROWSING_SUBSCRIPTION*/); - statement.setLong(columnIndex++, 0 /* TODO IS_SELECTOR*/); - statement.setLong(columnIndex++, 0 /* TODO IS_NO_LOCAL*/); - statement.setLong(columnIndex++, 0 /* TODO IS_SYNCHRONOUS_CONSUMER*/); - statement.setLong(columnIndex++, participantResult.getTotalNumberOfConsumers()); - statement.setLong(columnIndex++, participantResult.getTotalNumberOfProducers()); - statement.setLong(columnIndex++, participantResult.getTotalPayloadProcessed()); - statement.setLong(columnIndex++, participantResult.getTimeTaken()); - statement.setString(columnIndex++, participantResult.getErrorMessage()); - statement.setLong(columnIndex++, participantResult.getMinLatency()); - statement.setLong(columnIndex++, participantResult.getMaxLatency()); - statement.setDouble(columnIndex++, participantResult.getLatencyStandardDeviation()); - - statement.setString(columnIndex++, _runId); - statement.setTimestamp(columnIndex++, new Timestamp(_clock.currentTimeMillis())); - - statement.execute(); - connection.commit(); - } - catch(SQLException e) - { - _logger.error("Couldn't write " + participantResult, e); - } - finally - { - if (statement != null) - { - statement.close(); - } - } - } - - public static class Clock - { - public long currentTimeMillis() - { - return System.currentTimeMillis(); - } - } - - @Override - public String toString() - { - return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) - .append("runId", _runId) - .append("url", _url) - .toString(); - } -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/ClientJmsDelegate.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/ClientJmsDelegate.java deleted file mode 100644 index 348f398da4..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/ClientJmsDelegate.java +++ /dev/null @@ -1,715 +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.jms; - -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import javax.jms.Connection; -import javax.jms.ConnectionFactory; -import javax.jms.ConnectionMetaData; -import javax.jms.DeliveryMode; -import javax.jms.Destination; -import javax.jms.ExceptionListener; -import javax.jms.JMSException; -import javax.jms.Message; -import javax.jms.MessageConsumer; -import javax.jms.MessageListener; -import javax.jms.MessageProducer; -import javax.jms.Queue; -import javax.jms.Session; -import javax.jms.TextMessage; -import javax.jms.Topic; -import javax.naming.Context; -import javax.naming.NamingException; - -import org.apache.commons.lang.builder.ToStringBuilder; -import org.apache.commons.lang.builder.ToStringStyle; -import org.apache.qpid.disttest.DistributedTestConstants; -import org.apache.qpid.disttest.DistributedTestException; -import org.apache.qpid.disttest.client.Client; -import org.apache.qpid.disttest.client.ConnectionLostListener; -import org.apache.qpid.disttest.client.MessageProvider; -import org.apache.qpid.disttest.message.Command; -import org.apache.qpid.disttest.message.CreateConnectionCommand; -import org.apache.qpid.disttest.message.CreateConsumerCommand; -import org.apache.qpid.disttest.message.CreateMessageProviderCommand; -import org.apache.qpid.disttest.message.CreateProducerCommand; -import org.apache.qpid.disttest.message.CreateSessionCommand; -import org.apache.qpid.disttest.message.RegisterClientCommand; -import org.apache.qpid.disttest.message.Response; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class ClientJmsDelegate -{ - private static final Logger LOGGER = LoggerFactory.getLogger(ClientJmsDelegate.class); - - private final Context _context; - private final Destination _controllerQueue; - private final Connection _controllerConnection; - private final Session _instructionListenerSession; - private final Session _controllerSession; - private final MessageProducer _controlQueueProducer; - - private final String _clientName; - private Queue _instructionQueue; - - private Map _testConnections; - private Map _testSessions; - private Map _testProducers; - private Map _testConsumers; - private Map _testSubscriptions; - private Map _testMessageProviders; - - private final MessageProvider _defaultMessageProvider; - - public ClientJmsDelegate(final Context context) - { - try - { - _context = context; - final ConnectionFactory connectionFactory = (ConnectionFactory) _context.lookup("connectionfactory"); - _controllerConnection = connectionFactory.createConnection(); - _controllerConnection.start(); - _controllerQueue = (Destination) context.lookup(DistributedTestConstants.CONTROLLER_QUEUE_JNDI_NAME); - _instructionListenerSession = _controllerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE); - _controllerSession = _controllerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE); - _controlQueueProducer = _controllerSession.createProducer(_controllerQueue); - _clientName = UUID.randomUUID().toString(); - _testConnections = new HashMap(); - _testSessions = new HashMap(); - _testProducers = new HashMap(); - _testConsumers = new HashMap(); - _testSubscriptions = new HashMap(); - _testMessageProviders = new HashMap(); - _defaultMessageProvider = new MessageProvider(null); - } - catch (final NamingException ne) - { - throw new DistributedTestException("Unable to create client jms delegate", ne); - } - catch (final JMSException jmse) - { - throw new DistributedTestException("Unable to create client jms delegate", jmse); - } - } - - public void setInstructionListener(final Client client) - { - try - { - _instructionQueue = _instructionListenerSession.createTemporaryQueue(); - final MessageConsumer instructionConsumer = _instructionListenerSession.createConsumer(_instructionQueue); - instructionConsumer.setMessageListener(new MessageListener() - { - @Override - public void onMessage(final Message message) - { - client.processInstruction(JmsMessageAdaptor.messageToCommand(message)); - } - }); - } - catch (final JMSException jmse) - { - throw new DistributedTestException("Unable to setup instruction listener", jmse); - } - } - - public void sendRegistrationMessage() - { - Command command; - try - { - command = new RegisterClientCommand(_clientName, _instructionQueue.getQueueName()); - } - catch (final JMSException e) - { - throw new DistributedTestException(e); - } - sendCommand(command); - } - - public void sendResponseMessage(final Response responseMessage) - { - sendCommand(responseMessage); - } - - private void sendCommand(final Command command) - { - try - { - final Message message = JmsMessageAdaptor.commandToMessage(_controllerSession, command); - _controlQueueProducer.send(message); - LOGGER.debug("Sent message for " + command.getType() + ". message id: " + message.getJMSMessageID()); - } - catch (final JMSException jmse) - { - throw new DistributedTestException("Unable to send command: " + command, jmse); - } - } - - public void createConnection(final CreateConnectionCommand command) - { - try - { - final ConnectionFactory connectionFactory = (ConnectionFactory) _context.lookup(command - .getConnectionFactoryName()); - final Connection newConnection = connectionFactory.createConnection(); - addConnection(command.getConnectionName(), newConnection); - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("Connection " + command.getConnectionName() + " is created " + metaDataToString(newConnection.getMetaData())); - } - } - catch (final NamingException ne) - { - throw new DistributedTestException("Unable to lookup factoryName: " + command.getConnectionFactoryName(), - ne); - } - catch (final JMSException jmse) - { - throw new DistributedTestException("Unable to create connection: " + command.getConnectionName() - + " (using factory name: " + command.getConnectionFactoryName() + ")", jmse); - } - } - - private String metaDataToString(ConnectionMetaData metaData) throws JMSException - { - StringBuilder sb = new StringBuilder("ConnectionMetaData["); - sb.append(" JMSProviderName : " + metaData.getJMSProviderName()); - sb.append(" JMSVersion : " + metaData.getJMSVersion() + " (" + metaData.getJMSMajorVersion() + "." + metaData.getJMSMinorVersion() +")"); - sb.append(" ProviderVersion : " + metaData.getProviderVersion()+ " (" + metaData.getProviderMajorVersion()+ "." + metaData.getProviderMinorVersion() +")" ); - sb.append(" JMSXPropertyNames : ["); - Enumeration en = metaData.getJMSXPropertyNames(); - while(en.hasMoreElements()) - { - sb.append(" ").append(en.nextElement()); - if( en.hasMoreElements()) - { - sb.append(","); - } - } - sb.append("]]"); - return sb.toString(); - } - - public void createSession(final CreateSessionCommand command) - { - try - { - final Connection connection = _testConnections.get(command.getConnectionName()); - if (connection == null) - { - throw new DistributedTestException("No test connection found called: " + command.getConnectionName(), - command); - } - final boolean transacted = command.getAcknowledgeMode() == Session.SESSION_TRANSACTED; - - final Session newSession = connection.createSession(transacted, command.getAcknowledgeMode()); - LOGGER.debug("Created session " + command.getSessionName() + " with transacted = " + newSession.getTransacted() + " and acknowledgeMode = " + newSession.getAcknowledgeMode()); - - addSession(command.getSessionName(), newSession); - } - catch (final JMSException jmse) - { - throw new DistributedTestException("Unable to create new session: " + command, jmse); - } - } - - public void createProducer(final CreateProducerCommand command) - { - try - { - final Session session = _testSessions.get(command.getSessionName()); - if (session == null) - { - throw new DistributedTestException("No test session found called: " + command.getSessionName(), command); - } - - synchronized(session) - { - final Destination destination; - if(command.isTopic()) - { - destination = session.createTopic(command.getDestinationName()); - } - else - { - destination = session.createQueue(command.getDestinationName()); - } - - final MessageProducer jmsProducer = session.createProducer(destination); - - if (command.getPriority() != -1) - { - jmsProducer.setPriority(command.getPriority()); - } - if (command.getTimeToLive() > 0) - { - jmsProducer.setTimeToLive(command.getTimeToLive()); - } - - if (command.getDeliveryMode() == DeliveryMode.NON_PERSISTENT - || command.getDeliveryMode() == DeliveryMode.PERSISTENT) - { - jmsProducer.setDeliveryMode(command.getDeliveryMode()); - } - - addProducer(command.getParticipantName(), jmsProducer); - } - } - catch (final JMSException jmse) - { - throw new DistributedTestException("Unable to create new producer: " + command, jmse); - } - } - - public void createConsumer(final CreateConsumerCommand command) - { - try - { - final Session session = _testSessions.get(command.getSessionName()); - if (session == null) - { - throw new DistributedTestException("No test session found called: " + command.getSessionName(), command); - } - - synchronized(session) - { - Destination destination; - MessageConsumer jmsConsumer; - if(command.isTopic()) - { - Topic topic = session.createTopic(command.getDestinationName()); - if(command.isDurableSubscription()) - { - String subscription = "subscription-" + command.getParticipantName() + System.currentTimeMillis(); - jmsConsumer = session.createDurableSubscriber(topic, subscription); - - _testSubscriptions.put(subscription, session); - LOGGER.debug("created durable subscription " + subscription + " to topic " + topic); - } - else - { - jmsConsumer = session.createConsumer(topic, command.getSelector()); - } - - destination = topic; - } - else - { - destination = session.createQueue(command.getDestinationName()); - jmsConsumer = session.createConsumer(destination, command.getSelector()); - } - - _testConsumers.put(command.getParticipantName(), jmsConsumer); - } - } - catch (final JMSException jmse) - { - throw new DistributedTestException("Unable to create new consumer: " + command, jmse); - } - } - - /** - * destroy the client. Don't call from the Dispatcher thread. - */ - public void destroy() - { - try - { - // Stopping the connection allows in-flight onMessage calls to - // finish. - _controllerConnection.stop(); - - if (_instructionListenerSession != null) - { - _instructionListenerSession.close(); - } - if (_controllerSession != null) - { - _controllerSession.close(); - } - _controllerConnection.close(); - - } - catch (final JMSException jmse) - { - throw new DistributedTestException("Unable to destroy cleanly", jmse); - } - } - - public Destination getControllerQueue() - { - return _controllerQueue; - } - - public String getClientName() - { - return _clientName; - } - - public int getNoOfTestConnections() - { - return _testConnections.size(); - } - - public int getNoOfTestSessions() - { - return _testSessions.size(); - } - - public int getNoOfTestProducers() - { - return _testProducers.size(); - } - - public int getNoOfTestConsumers() - { - return _testConsumers.size(); - } - - public void startConnections() - { - // start connections for consumers - // it would be better if we could track consumer connections and start - // only those - if (!_testConsumers.isEmpty()) - { - for (final Map.Entry entry : _testConnections.entrySet()) - { - final Connection connection = entry.getValue(); - try - { - connection.start(); - } - catch (final JMSException e) - { - throw new DistributedTestException("Failed to start connection '" + entry.getKey() + "' :" - + e.getLocalizedMessage()); - } - } - } - } - - public int getAcknowledgeMode(final String sessionName) - { - try - { - final Session session = _testSessions.get(sessionName); - return session.getAcknowledgeMode(); - } - catch (final JMSException jmse) - { - throw new DistributedTestException("Unable to determine acknowledgement mode for session: " + - sessionName, jmse); - } - } - - public Message sendNextMessage(final CreateProducerCommand command) - { - Message sentMessage = null; - MessageProvider messageProvider = _testMessageProviders.get(command.getMessageProviderName()); - if (messageProvider == null) - { - messageProvider = _defaultMessageProvider; - } - - final Session session = _testSessions.get(command.getSessionName()); - final MessageProducer producer = _testProducers.get(command.getParticipantName()); - try - { - sentMessage = messageProvider.nextMessage(session, command); - int deliveryMode = producer.getDeliveryMode(); - int priority = producer.getPriority(); - long ttl = producer.getTimeToLive(); - if (messageProvider.isPropertySet(MessageProvider.PRIORITY)) - { - priority = sentMessage.getJMSPriority(); - } - if (messageProvider.isPropertySet(MessageProvider.DELIVERY_MODE)) - { - deliveryMode = sentMessage.getJMSDeliveryMode(); - } - if (messageProvider.isPropertySet(MessageProvider.TTL)) - { - ttl = sentMessage.getLongProperty(MessageProvider.TTL); - } - producer.send(sentMessage, deliveryMode, priority, ttl); - } - catch (final JMSException jmse) - { - throw new DistributedTestException("Unable to create and send message with producer: " + - command.getParticipantName() + " on session: " + command.getSessionName(), jmse); - } - return sentMessage; - } - - protected void addSession(final String sessionName, final Session newSession) - { - _testSessions.put(sessionName, newSession); - } - - protected void addConnection(final String connectionName, final Connection newConnection) - { - _testConnections.put(connectionName, newConnection); - } - - protected void addProducer(final String producerName, final MessageProducer jmsProducer) - { - _testProducers.put(producerName, jmsProducer); - } - - public Message consumeMessage(String consumerName, long receiveInterval) - { - Message consumedMessage = null; - MessageConsumer consumer = _testConsumers.get(consumerName); - try - { - consumedMessage = consumer.receive(receiveInterval); - } - catch (JMSException e) - { - throw new DistributedTestException("Unable to consume message with consumer: " + consumerName, e); - } - return consumedMessage; - } - - public void registerListener(String consumerName, MessageListener messageListener) - { - MessageConsumer consumer = _testConsumers.get(consumerName); - try - { - consumer.setMessageListener(messageListener); - } - catch (JMSException e) - { - throw new DistributedTestException("Unable to register message listener with consumer: " + consumerName, e); - } - } - - public void commitOrAcknowledgeMessageIfNecessary(final String sessionName, final Message message) - { - try - { - final Session session = _testSessions.get(sessionName); - if (session.getTransacted()) - { - synchronized(session) - { - session.commit(); - } - } - else if (message != null && session.getAcknowledgeMode() == Session.CLIENT_ACKNOWLEDGE) - { - message.acknowledge(); - } - } - catch (final JMSException jmse) - { - throw new DistributedTestException("Unable to commit or acknowledge message on session: " + - sessionName, jmse); - } - } - - public void commitIfNecessary(final String sessionName) - { - commitOrAcknowledgeMessageIfNecessary(sessionName, null); - } - - public void rollbackOrRecoverIfNecessary(String sessionName) - { - try - { - final Session session = _testSessions.get(sessionName); - synchronized(session) - { - if (session.getTransacted()) - { - session.rollback(); - } - else if (session.getAcknowledgeMode() == Session.CLIENT_ACKNOWLEDGE) - { - session.recover(); - } - } - } - catch (final JMSException jmse) - { - throw new DistributedTestException("Unable to rollback or recover on session: " + - sessionName, jmse); - } - } - - @Override - public String toString() - { - return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("clientName", _clientName).toString(); - } - - public void tearDownTest() - { - StringBuilder jmsErrorMessages = new StringBuilder(); - int failureCounter = 0; - - for(String subscription : _testSubscriptions.keySet()) - { - Session session = _testSubscriptions.get(subscription); - try - { - session.unsubscribe(subscription); - } - catch (JMSException e) - { - LOGGER.error("Failed to unsubscribe '" + subscription + "' :" + e.getLocalizedMessage(), e); - failureCounter++; - appendErrorMessage(jmsErrorMessages, e); - } - } - - for (Map.Entry entry : _testConnections.entrySet()) - { - Connection connection = entry.getValue(); - try - { - connection.close(); - } - catch (JMSException e) - { - LOGGER.error("Failed to close connection '" + entry.getKey() + "' :" + e.getLocalizedMessage(), e); - failureCounter++; - appendErrorMessage(jmsErrorMessages, e); - } - } - - _testConnections.clear(); - _testSubscriptions.clear(); - _testSessions.clear(); - _testProducers.clear(); - _testConsumers.clear(); - - if (failureCounter > 0) - { - throw new DistributedTestException("Tear down test encountered " + failureCounter + " failures with the following errors: " + jmsErrorMessages.toString()); - } - } - - private void appendErrorMessage(StringBuilder errorMessages, JMSException e) - { - if (errorMessages.length() > 0) - { - errorMessages.append('\n'); - } - errorMessages.append(e.getMessage()); - } - - public void closeTestConsumer(String consumerName) - { - MessageConsumer consumer = _testConsumers.get(consumerName); - if (consumer != null) - { - try - { - consumer.close(); - LOGGER.debug("Closed test consumer " + consumerName); - } - catch (JMSException e) - { - throw new DistributedTestException("Failed to close consumer: " + consumerName, e); - } - } - } - - public void closeTestProducer(String producerName) - { - MessageProducer producer = _testProducers.get(producerName); - if (producer != null) - { - try - { - producer.close(); - } - catch (JMSException e) - { - throw new DistributedTestException("Failed to close producer: " + producerName, e); - } - } - } - - /** only supports text messages - returns 0 for other message types */ - public int calculatePayloadSizeFrom(Message message) - { - try - { - if (message != null && message instanceof TextMessage) - { - return ((TextMessage) message).getText().getBytes().length; - } - - return 0; - } - catch (JMSException e) - { - throw new DistributedTestException("Unable to determine the payload size for message " + message, e); - } - } - - public void createMessageProvider(CreateMessageProviderCommand command) - { - _testMessageProviders.put(command.getProviderName(), new MessageProvider(command.getMessageProperties())); - } - - public void setConnectionLostListener(final ConnectionLostListener connectionLostListener) - { - try - { - _controllerConnection.setExceptionListener(new ExceptionListener() - { - @Override - public void onException(final JMSException exception) - { - LOGGER.warn("Caught ", exception); - - if (connectionLostListener != null) - { - try - { - _controllerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE).close(); - } - catch (JMSException e) - { - LOGGER.warn("Unable to create/close a new session, assuming the connection is lost ", exception); - - connectionLostListener.connectionLost(); - } - } - - } - }); - } - catch (JMSException e) - { - // ignore - } - } -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/ControllerJmsDelegate.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/ControllerJmsDelegate.java deleted file mode 100644 index 2dfe1050df..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/ControllerJmsDelegate.java +++ /dev/null @@ -1,274 +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.jms; - -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.CopyOnWriteArrayList; - -import javax.jms.Connection; -import javax.jms.ConnectionFactory; -import javax.jms.Destination; -import javax.jms.JMSException; -import javax.jms.Message; -import javax.jms.MessageConsumer; -import javax.jms.MessageListener; -import javax.jms.MessageProducer; -import javax.jms.Session; -import javax.naming.Context; -import javax.naming.NamingException; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.apache.qpid.disttest.DistributedTestException; -import org.apache.qpid.disttest.controller.CommandListener; -import org.apache.qpid.disttest.controller.config.QueueConfig; -import org.apache.qpid.disttest.message.Command; -import org.apache.qpid.disttest.message.RegisterClientCommand; - -public class ControllerJmsDelegate -{ - private static final Logger LOGGER = LoggerFactory.getLogger(ControllerJmsDelegate.class); - - private static final String QUEUE_CREATOR_CLASS_NAME_SYSTEM_PROPERTY = "qpid.disttest.queue.creator.class"; - - private final Map _clientNameToQueueMap = new ConcurrentHashMap(); - private final Connection _connection; - private final Destination _controllerQueue; - private final Session _controllerQueueListenerSession; - private final Session _commandSession; - private QueueCreator _queueCreator; - - private List _commandListeners = new CopyOnWriteArrayList(); - - public ControllerJmsDelegate(final Context context) throws NamingException, JMSException - { - final ConnectionFactory connectionFactory = (ConnectionFactory) context.lookup("connectionfactory"); - _connection = connectionFactory.createConnection(); - _connection.start(); - _controllerQueue = (Destination) context.lookup("controllerqueue"); - _controllerQueueListenerSession = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - _commandSession = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - - createVendorSpecificQueueCreator(); - } - - private void createVendorSpecificQueueCreator() - { - String queueCreatorClassName = System.getProperty(QUEUE_CREATOR_CLASS_NAME_SYSTEM_PROPERTY); - if(queueCreatorClassName == null) - { - queueCreatorClassName = QpidQueueCreator.class.getName(); - } - else - { - LOGGER.info("Using overridden queue creator class " + queueCreatorClassName); - } - - try - { - Class queueCreatorClass = (Class) Class.forName(queueCreatorClassName); - _queueCreator = queueCreatorClass.newInstance(); - } - catch (ClassNotFoundException e) - { - throw new DistributedTestException("Unable to instantiate queue creator using class name " + queueCreatorClassName, e); - } - catch (InstantiationException e) - { - throw new DistributedTestException("Unable to instantiate queue creator using class name " + queueCreatorClassName, e); - } - catch (IllegalAccessException e) - { - throw new DistributedTestException("Unable to instantiate queue creator using class name " + queueCreatorClassName, e); - } - } - - public void start() - { - try - { - final MessageConsumer consumer = _controllerQueueListenerSession.createConsumer(_controllerQueue); - consumer.setMessageListener(new MessageListener() - { - @Override - public void onMessage(final Message message) - { - try - { - String jmsMessageID = message.getJMSMessageID(); - LOGGER.debug("Received message " + jmsMessageID); - - final Command command = JmsMessageAdaptor.messageToCommand(message); - LOGGER.debug("Converted message " + jmsMessageID + " into command: " + command); - - processCommandWithFirstSupportingListener(command); - LOGGER.debug("Finished processing command for message " + jmsMessageID); - } - catch (Exception t) - { - LOGGER.error("Can't handle JMS message", t); - } - } - }); - } - catch (final JMSException e) - { - throw new DistributedTestException(e); - } - } - - /** ensures connections are closed, otherwise the JVM may be prevented from terminating */ - public void closeConnections() - { - if (_commandSession != null) - { - try - { - _commandSession.close(); - } - catch (JMSException e) - { - LOGGER.error("Unable to close command session", e); - } - } - - try - { - _controllerQueueListenerSession.close(); - } - catch (JMSException e) - { - LOGGER.error("Unable to close controller queue listener session", e); - } - - try - { - _connection.stop(); - } - catch (JMSException e) - { - LOGGER.error("Unable to stop connection", e); - } - - try - { - _connection.close(); - } - catch (JMSException e) - { - throw new DistributedTestException("Unable to close connection", e); - } - } - - public void registerClient(final RegisterClientCommand command) - { - final String clientName = command.getClientName(); - final Destination clientIntructionQueue = createDestinationFromString(command.getClientQueueName()); - _clientNameToQueueMap.put(clientName, clientIntructionQueue); - } - - public void sendCommandToClient(final String clientName, final Command command) - { - final Destination clientQueue = _clientNameToQueueMap.get(clientName); - if (clientQueue == null) - { - throw new DistributedTestException("Client name " + clientName + " not known. I know about: " - + _clientNameToQueueMap.keySet()); - } - - MessageProducer producer = null; - try - { - producer =_commandSession.createProducer(clientQueue); - Message message = JmsMessageAdaptor.commandToMessage(_commandSession, command); - - producer.send(message); - } - catch (final JMSException e) - { - throw new DistributedTestException(e); - } - finally - { - if (producer != null) - { - try - { - producer.close(); - } - catch (final JMSException e) - { - throw new DistributedTestException(e); - } - } - } - } - - private void processCommandWithFirstSupportingListener(Command command) - { - for (CommandListener listener : _commandListeners) - { - if (listener.supports(command)) - { - listener.processCommand(command); - return; - } - } - - throw new IllegalStateException("There is no registered listener to process command " + command); - } - - private Destination createDestinationFromString(final String clientQueueName) - { - Destination clientIntructionQueue; - try - { - clientIntructionQueue = _commandSession.createQueue(clientQueueName); - } - catch (JMSException e) - { - throw new DistributedTestException("Unable to create Destination from " + clientQueueName); - } - return clientIntructionQueue; - } - - public void createQueues(List queues) - { - _queueCreator.createQueues(_connection, _commandSession, queues); - } - - public void deleteQueues(List queues) - { - _queueCreator.deleteQueues(_connection, _commandSession, queues); - } - - public void addCommandListener(CommandListener commandListener) - { - _commandListeners.add(commandListener); - } - - public void removeCommandListener(CommandListener commandListener) - { - _commandListeners.remove(commandListener); - } -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/ExistingQueueDrainer.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/ExistingQueueDrainer.java deleted file mode 100644 index 7f8b3caa4f..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/ExistingQueueDrainer.java +++ /dev/null @@ -1,134 +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.jms; - -import org.apache.qpid.disttest.DistributedTestException; -import org.apache.qpid.disttest.controller.config.QueueConfig; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.jms.Connection; -import javax.jms.JMSException; -import javax.jms.MessageConsumer; -import javax.jms.QueueBrowser; -import javax.jms.Session; -import java.util.List; - -public class ExistingQueueDrainer implements QueueCreator -{ - private static final Logger LOGGER = LoggerFactory.getLogger(ExistingQueueDrainer.class); - private static int _drainPollTimeout = Integer.getInteger(QUEUE_CREATOR_DRAIN_POLL_TIMEOUT, 500); - - @Override - public void createQueues(Connection connection, Session session, List configs) - { - } - - @Override - public void deleteQueues(Connection connection, Session session, List configs) - { - for (QueueConfig queueConfig : configs) - { - drainQueue(connection, queueConfig.getName()); - } - } - - private void drainQueue(Connection connection, String queueName) - { - try - { - int counter = 0; - while (queueContainsMessages(connection, queueName)) - { - if (counter == 0) - { - LOGGER.debug("Draining queue {}", queueName); - } - counter += drain(connection, queueName); - } - if (counter > 0) - { - LOGGER.info("Drained {} message(s) from queue {} ", counter, queueName); - } - } - catch (JMSException e) - { - throw new DistributedTestException("Failed to drain queue " + queueName, e); - } - } - - private int drain(Connection connection, String queueName) throws JMSException - { - int counter = 0; - Session session = null; - try - { - session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - MessageConsumer messageConsumer = session.createConsumer(session.createQueue(queueName)); - try - { - while (messageConsumer.receive(_drainPollTimeout) != null) - { - counter++; - } - } - finally - { - messageConsumer.close(); - } - } - finally - { - if (session != null) - { - session.close(); - } - } - return counter; - } - - private boolean queueContainsMessages(Connection connection, String queueName) throws JMSException - { - Session session = null; - try - { - session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - QueueBrowser browser = null; - try - { - browser = session.createBrowser(session.createQueue(queueName)); - return browser.getEnumeration().hasMoreElements(); - } - finally - { - if (browser != null) - { - browser.close(); - } - } - } - finally - { - if (session != null) - { - session.close(); - } - } - } -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/JmsMessageAdaptor.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/JmsMessageAdaptor.java deleted file mode 100644 index c9dba21a74..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/JmsMessageAdaptor.java +++ /dev/null @@ -1,124 +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.jms; - -import javax.jms.JMSException; -import javax.jms.Message; -import javax.jms.Session; - -import org.apache.qpid.disttest.DistributedTestConstants; -import org.apache.qpid.disttest.DistributedTestException; -import org.apache.qpid.disttest.json.JsonHandler; -import org.apache.qpid.disttest.message.Command; -import org.apache.qpid.disttest.message.CommandType; -import org.apache.qpid.disttest.message.ConsumerParticipantResult; -import org.apache.qpid.disttest.message.CreateConnectionCommand; -import org.apache.qpid.disttest.message.CreateConsumerCommand; -import org.apache.qpid.disttest.message.CreateMessageProviderCommand; -import org.apache.qpid.disttest.message.CreateProducerCommand; -import org.apache.qpid.disttest.message.CreateResponderCommand; -import org.apache.qpid.disttest.message.CreateSessionCommand; -import org.apache.qpid.disttest.message.NoOpCommand; -import org.apache.qpid.disttest.message.ParticipantResult; -import org.apache.qpid.disttest.message.ProducerParticipantResult; -import org.apache.qpid.disttest.message.RegisterClientCommand; -import org.apache.qpid.disttest.message.Response; -import org.apache.qpid.disttest.message.StartTestCommand; -import org.apache.qpid.disttest.message.StopClientCommand; -import org.apache.qpid.disttest.message.TearDownTestCommand; - -public class JmsMessageAdaptor -{ - public static Message commandToMessage(final Session session, final Command command) - { - Message jmsMessage = null; - try - { - jmsMessage = session.createMessage(); - jmsMessage.setStringProperty(DistributedTestConstants.MSG_COMMAND_PROPERTY, command.getType().name()); - final JsonHandler jsonHandler = new JsonHandler(); - jmsMessage.setStringProperty(DistributedTestConstants.MSG_JSON_PROPERTY, jsonHandler.marshall(command)); - } - catch (final JMSException jmse) - { - throw new DistributedTestException("Unable to convert command " + command + " to JMS Message", jmse); - } - - return jmsMessage; - } - - public static Command messageToCommand(final Message jmsMessage) - { - Command command = null; - try - { - final CommandType commandType = CommandType.valueOf(jmsMessage - .getStringProperty(DistributedTestConstants.MSG_COMMAND_PROPERTY)); - final JsonHandler jsonHandler = new JsonHandler(); - command = jsonHandler.unmarshall(jmsMessage.getStringProperty(DistributedTestConstants.MSG_JSON_PROPERTY), - getCommandClassFromType(commandType)); - } - catch (final JMSException jmse) - { - throw new DistributedTestException("Unable to convert JMS message " + jmsMessage + " to command object", - jmse); - } - return command; - } - - static Class getCommandClassFromType(final CommandType type) - { - switch (type) - { - case CREATE_CONNECTION: - return CreateConnectionCommand.class; - case CREATE_SESSION: - return CreateSessionCommand.class; - case CREATE_PRODUCER: - return CreateProducerCommand.class; - case CREATE_CONSUMER: - return CreateConsumerCommand.class; - case CREATE_RESPONDER: - return CreateResponderCommand.class; - case NO_OP: - return NoOpCommand.class; - case REGISTER_CLIENT: - return RegisterClientCommand.class; - case STOP_CLIENT: - return StopClientCommand.class; - case RESPONSE: - return Response.class; - case START_TEST: - return StartTestCommand.class; - case TEAR_DOWN_TEST: - return TearDownTestCommand.class; - case PARTICIPANT_RESULT: - return ParticipantResult.class; - case CONSUMER_PARTICIPANT_RESULT: - return ConsumerParticipantResult.class; - case PRODUCER_PARTICIPANT_RESULT: - return ProducerParticipantResult.class; - case CREATE_MESSAGE_PROVIDER: - return CreateMessageProviderCommand.class; - default: - throw new DistributedTestException("No class defined for type: " + type); - } - } -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/NoOpQueueCreator.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/NoOpQueueCreator.java deleted file mode 100644 index d7e0007b28..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/NoOpQueueCreator.java +++ /dev/null @@ -1,38 +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.jms; - -import java.util.List; - -import javax.jms.Connection; -import javax.jms.Session; - -import org.apache.qpid.disttest.controller.config.QueueConfig; -public class NoOpQueueCreator implements QueueCreator -{ - @Override - public void createQueues(Connection connection, Session session, List configs) - { - } - - @Override - public void deleteQueues(Connection connection, Session session, List configs) - { - } -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/QpidQueueCreator.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/QpidQueueCreator.java deleted file mode 100644 index 95a4772198..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/QpidQueueCreator.java +++ /dev/null @@ -1,175 +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.jms; - -import java.util.List; - -import javax.jms.Connection; -import javax.jms.JMSException; -import javax.jms.MessageConsumer; -import javax.jms.Session; - -import org.apache.qpid.client.AMQDestination; -import org.apache.qpid.client.AMQSession; -import org.apache.qpid.disttest.DistributedTestException; -import org.apache.qpid.disttest.controller.config.QueueConfig; -import org.apache.qpid.framing.AMQShortString; -import org.apache.qpid.framing.FieldTable; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class QpidQueueCreator implements QueueCreator -{ - private static final Logger LOGGER = LoggerFactory.getLogger(QpidQueueCreator.class); - private static final FieldTable EMPTY_QUEUE_BIND_ARGUMENTS = new FieldTable(); - private static int _drainPollTimeout = Integer.getInteger(QUEUE_CREATOR_DRAIN_POLL_TIMEOUT, 500); - - @Override - public void createQueues(Connection connection, Session session, List configs) - { - AMQSession amqSession = (AMQSession)session; - for (QueueConfig queueConfig : configs) - { - createQueue(amqSession, queueConfig); - } - } - - @Override - public void deleteQueues(Connection connection, Session session, List configs) - { - AMQSession amqSession = (AMQSession)session; - for (QueueConfig queueConfig : configs) - { - AMQDestination destination = createAMQDestination(amqSession, queueConfig); - - // drainQueue method is added because deletion of queue with a lot - // of messages takes time and might cause the timeout exception - drainQueue(connection, destination); - - deleteQueue(amqSession, destination.getAMQQueueName()); - } - } - - private AMQDestination createAMQDestination(AMQSession amqSession, QueueConfig queueConfig) - { - try - { - return (AMQDestination) amqSession.createQueue(queueConfig.getName()); - } - catch (Exception e) - { - throw new DistributedTestException("Failed to create amq destionation object:" + queueConfig, e); - } - } - - private long getQueueDepth(AMQSession amqSession, AMQDestination destination) - { - try - { - long queueDepth = amqSession.getQueueDepth(destination); - return queueDepth; - } - catch (Exception e) - { - throw new DistributedTestException("Failed to query queue depth:" + destination, e); - } - } - - private void drainQueue(Connection connection, AMQDestination destination) - { - Session noAckSession = null; - try - { - LOGGER.debug("About to drain the queue {}", destination.getQueueName()); - noAckSession = connection.createSession(false, org.apache.qpid.jms.Session.NO_ACKNOWLEDGE); - MessageConsumer messageConsumer = noAckSession.createConsumer(destination); - - long currentQueueDepth = getQueueDepth((AMQSession)noAckSession, destination); - int counter = 0; - while (currentQueueDepth > 0) - { - LOGGER.info("Queue {} has {} message(s)", destination.getQueueName(), currentQueueDepth); - - while(messageConsumer.receive(_drainPollTimeout) != null) - { - counter++; - } - - currentQueueDepth = getQueueDepth((AMQSession)noAckSession, destination); - } - LOGGER.info("Drained {} message(s) from queue {} ", counter, destination.getQueueName()); - messageConsumer.close(); - } - catch (Exception e) - { - throw new DistributedTestException("Failed to drain queue:" + destination, e); - } - finally - { - if (noAckSession != null) - { - try - { - noAckSession.close(); - } - catch (JMSException e) - { - throw new DistributedTestException("Failed to close n/a session:" + noAckSession, e); - } - } - } - } - - private void createQueue(AMQSession session, QueueConfig queueConfig) - { - try - { - AMQDestination destination = (AMQDestination) session.createQueue(queueConfig.getName()); - boolean autoDelete = false; - boolean exclusive = false; - session.createQueue(destination.getAMQQueueName(), autoDelete, - queueConfig.isDurable(), exclusive, queueConfig.getAttributes()); - session.bindQueue(destination.getAMQQueueName(), destination.getRoutingKey(), - EMPTY_QUEUE_BIND_ARGUMENTS, destination.getExchangeName(), - destination, autoDelete); - - LOGGER.debug("Created queue {}", queueConfig); - } - catch (Exception e) - { - throw new DistributedTestException("Failed to create queue:" + queueConfig, e); - } - } - - private void deleteQueue(AMQSession session, AMQShortString queueName) - { - try - { - // The Qpid AMQSession API currently makes the #deleteQueue method protected and the - // raw protocol method public. This should be changed then we should switch the below to - // use #deleteQueue. - session.sendQueueDelete(queueName); - LOGGER.debug("Deleted queue {}", queueName); - } - catch (Exception e) - { - throw new DistributedTestException("Failed to delete queue:" + queueName, e); - } - } -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/QueueCreator.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/QueueCreator.java deleted file mode 100644 index 16769699c1..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/QueueCreator.java +++ /dev/null @@ -1,34 +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.jms; - -import java.util.List; - -import javax.jms.Connection; -import javax.jms.Session; - -import org.apache.qpid.disttest.controller.config.QueueConfig; - -public interface QueueCreator -{ - String QUEUE_CREATOR_DRAIN_POLL_TIMEOUT = "qpid.disttest.queue.creator.drainPollTime"; - - void createQueues(Connection connection, Session session, List configs); - void deleteQueues(Connection connection, Session session, List configs); -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/json/JsonHandler.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/json/JsonHandler.java deleted file mode 100644 index 8e50cd4f11..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/json/JsonHandler.java +++ /dev/null @@ -1,43 +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.json; - -import org.apache.qpid.disttest.client.property.PropertyValue; -import org.apache.qpid.disttest.message.Command; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; - -public class JsonHandler -{ - private final Gson _gson = new GsonBuilder() - .registerTypeAdapter(PropertyValue.class, new PropertyValueAdapter()) - .create(); - - public T unmarshall(final String jsonParams, final Class clazz) - { - return _gson.fromJson(jsonParams, clazz); - } - - public String marshall(final T command) - { - return _gson.toJson(command); - } -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/json/PropertyValueAdapter.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/json/PropertyValueAdapter.java deleted file mode 100644 index 94f712e652..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/json/PropertyValueAdapter.java +++ /dev/null @@ -1,147 +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.json; - -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.qpid.disttest.client.property.GeneratedPropertyValue; -import org.apache.qpid.disttest.client.property.PropertyValue; -import org.apache.qpid.disttest.client.property.PropertyValueFactory; -import org.apache.qpid.disttest.client.property.SimplePropertyValue; - -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.JsonPrimitive; -import com.google.gson.JsonSerializationContext; -import com.google.gson.JsonSerializer; - -public class PropertyValueAdapter implements JsonDeserializer, JsonSerializer -{ - private static final String DEF_FIELD = "@def"; - private PropertyValueFactory _factory = new PropertyValueFactory(); - - @Override - public PropertyValue deserialize(JsonElement json, Type type, JsonDeserializationContext context) - throws JsonParseException - { - if (json.isJsonNull()) - { - return null; - } - else if (json.isJsonPrimitive()) - { - Object result = null; - JsonPrimitive primitive = json.getAsJsonPrimitive(); - if (primitive.isString()) - { - result = primitive.getAsString(); - } - else if (primitive.isNumber()) - { - String asString = primitive.getAsString(); - if (asString.indexOf('.') != -1 || asString.indexOf('e') != -1) - { - result = primitive.getAsDouble(); - } - else - { - result = primitive.getAsLong(); - } - } - else if (primitive.isBoolean()) - { - result = primitive.getAsBoolean(); - } - else - { - throw new JsonParseException("Unsupported primitive value " + primitive); - } - return new SimplePropertyValue(result); - } - else if (json.isJsonArray()) - { - JsonArray array = json.getAsJsonArray(); - List result = new ArrayList(array.size()); - for (JsonElement element : array) - { - result.add(context.deserialize(element, Object.class)); - } - return new SimplePropertyValue(result); - } - else if (json.isJsonObject()) - { - JsonObject object = json.getAsJsonObject(); - JsonElement defElement = object.getAsJsonPrimitive(DEF_FIELD); - Class classInstance = null; - if (defElement != null) - { - try - { - classInstance = _factory.getPropertyValueClass(defElement.getAsString()); - } - catch (ClassNotFoundException e) - { - // ignore - } - } - if (classInstance == null) - { - Map result = new HashMap(); - for (Map.Entry entry : object.entrySet()) - { - Object value = context.deserialize(entry.getValue(), Object.class); - result.put(entry.getKey(), value); - } - return new SimplePropertyValue(result); - } - else - { - return context.deserialize(json, classInstance); - } - } - else - { - throw new JsonParseException("Unsupported JSON type " + json); - } - } - - @Override - public JsonElement serialize(PropertyValue src, Type typeOfSrc, JsonSerializationContext context) - { - if (src instanceof GeneratedPropertyValue) - { - JsonObject object = (JsonObject) context.serialize(src, Object.class); - object.addProperty(DEF_FIELD, ((GeneratedPropertyValue) src).getDefinition()); - return object; - } - else - { - return context.serialize(src.getValue(), Object.class); - } - } - -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/Command.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/Command.java deleted file mode 100644 index 86b4d0e439..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/Command.java +++ /dev/null @@ -1,56 +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.message; - - -import org.apache.commons.lang.builder.ReflectionToStringBuilder; -import org.apache.commons.lang.builder.ToStringStyle; -import org.apache.qpid.disttest.Visitor; -import org.apache.qpid.disttest.client.Client; -import org.apache.qpid.disttest.controller.Controller; - -/** - * A command sent between the {@link Controller} and a {@link Client} - */ -public abstract class Command -{ - private final CommandType type; - - public Command(final CommandType type) - { - this.type = type; - } - - public CommandType getType() - { - return type; - } - - public void accept(Visitor visitor) - { - visitor.visit(this); - } - - @Override - public String toString() - { - return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE); - } -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CommandType.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CommandType.java deleted file mode 100644 index b04cbdaba1..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CommandType.java +++ /dev/null @@ -1,39 +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.message; - -public enum CommandType -{ - CREATE_CONNECTION, - CREATE_CONSUMER, - CREATE_PRODUCER, - CREATE_RESPONDER, - CREATE_SESSION, - NO_OP, - REGISTER_CLIENT, - RESPONSE, - START_TEST, - STOP_CLIENT, - TEAR_DOWN_TEST, - PARTICIPANT_RESULT, - CONSUMER_PARTICIPANT_RESULT, - PRODUCER_PARTICIPANT_RESULT, - CREATE_MESSAGE_PROVIDER -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ConsumerParticipantResult.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ConsumerParticipantResult.java deleted file mode 100644 index e78f6965d2..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ConsumerParticipantResult.java +++ /dev/null @@ -1,185 +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.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 java.util.Collection; - -public class ConsumerParticipantResult extends ParticipantResult -{ - private boolean _topic; - private boolean _durableSubscription; - private boolean _browsingSubscription; - private boolean _selector; - private boolean _noLocal; - private boolean _synchronousConsumer; - - private Collection _messageLatencies; - private long _minLatency; - private long _maxLatency; - private double _averageLatency; - private double _latencyStandardDeviation; - - public ConsumerParticipantResult() - { - super(CommandType.CONSUMER_PARTICIPANT_RESULT); - } - - public ConsumerParticipantResult(String participantName) - { - this(); - setParticipantName(participantName); - } - - @OutputAttribute(attribute=IS_DURABLE_SUBSCRIPTION) - public boolean isDurableSubscription() - { - return _durableSubscription; - } - - public void setDurableSubscription(boolean durable) - { - _durableSubscription = durable; - } - - - @OutputAttribute(attribute=IS_BROWSING_SUBSCRIPTION) - public boolean isBrowsingSubscription() - { - return _browsingSubscription; - } - - public void setBrowsingSubscription(boolean browsingSubscription) - { - _browsingSubscription = browsingSubscription; - } - - - @OutputAttribute(attribute=IS_SELECTOR) - public boolean isSelector() - { - return _selector; - } - - public void setSelector(boolean selector) - { - _selector = selector; - } - - - @OutputAttribute(attribute=IS_NO_LOCAL) - public boolean isNoLocal() - { - return _noLocal; - - } - - public void setNoLocal(boolean noLocal) - { - _noLocal = noLocal; - } - - @OutputAttribute(attribute=IS_SYNCHRONOUS_CONSUMER) - public boolean isSynchronousConsumer() - { - return _synchronousConsumer; - } - - public void setSynchronousConsumer(boolean synchronousConsumer) - { - _synchronousConsumer = synchronousConsumer; - } - - - public void setTopic(boolean isTopic) - { - _topic = isTopic; - } - - @OutputAttribute(attribute=IS_TOPIC) - public boolean isTopic() - { - return _topic; - } - - public Collection getMessageLatencies() - { - return _messageLatencies; - } - - public void setMessageLatencies(Collection messageLatencies) - { - _messageLatencies = messageLatencies; - } - - @Override - @OutputAttribute(attribute=ParticipantAttribute.MIN_LATENCY) - public long getMinLatency() - { - return _minLatency; - } - - public void setMinLatency(long minLatency) - { - _minLatency = minLatency; - } - - @Override - @OutputAttribute(attribute=ParticipantAttribute.MAX_LATENCY) - public long getMaxLatency() - { - return _maxLatency; - } - - public void setMaxLatency(long maxLatency) - { - _maxLatency = maxLatency; - } - - @Override - @OutputAttribute(attribute=ParticipantAttribute.AVERAGE_LATENCY) - public double getAverageLatency() - { - return _averageLatency; - } - - public void setAverageLatency(double averageLatency) - { - _averageLatency = averageLatency; - } - - @Override - @OutputAttribute(attribute=ParticipantAttribute.LATENCY_STANDARD_DEVIATION) - public double getLatencyStandardDeviation() - { - return _latencyStandardDeviation; - } - - public void setLatencyStandardDeviation(double latencyStandardDeviation) - { - _latencyStandardDeviation = latencyStandardDeviation; - } - -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateConnectionCommand.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateConnectionCommand.java deleted file mode 100644 index c5a96e9a94..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateConnectionCommand.java +++ /dev/null @@ -1,58 +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.message; - -public class CreateConnectionCommand extends Command -{ - private String _connectionName; - private String _connectionFactoryName; - - public CreateConnectionCommand() - { - super(CommandType.CREATE_CONNECTION); - } - - public CreateConnectionCommand(String connectionName, String connectionFactoryName) - { - super(CommandType.CREATE_CONNECTION); - _connectionName = connectionName; - _connectionFactoryName = connectionFactoryName; - } - - public void setConnectionName(final String connectionName) - { - this._connectionName = connectionName; - } - - public String getConnectionName() - { - return _connectionName; - } - - public void setConnectionFactoryName(final String connectionFactoryName) - { - this._connectionFactoryName = connectionFactoryName; - } - - public String getConnectionFactoryName() - { - return _connectionFactoryName; - } -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateConsumerCommand.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateConsumerCommand.java deleted file mode 100644 index 07a60504c8..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateConsumerCommand.java +++ /dev/null @@ -1,107 +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.message; - -public class CreateConsumerCommand extends CreateParticpantCommand -{ - private boolean _isDurableSubscription; - private boolean _isBrowsingSubscription; - private String _selector; - private boolean _noLocal; - private boolean _synchronous; - private long _receiveTimeout = 5000; - private boolean _evaluateLatency; - - public CreateConsumerCommand() - { - super(CommandType.CREATE_CONSUMER); - } - - public boolean isDurableSubscription() - { - return _isDurableSubscription; - } - - public void setDurableSubscription(final boolean isDurableSubscription) - { - this._isDurableSubscription = isDurableSubscription; - } - - public boolean isBrowsingSubscription() - { - return _isBrowsingSubscription; - } - - public void setBrowsingSubscription(final boolean isBrowsingSubscription) - { - _isBrowsingSubscription = isBrowsingSubscription; - } - - public String getSelector() - { - return _selector; - } - - public void setSelector(final String selector) - { - this._selector = selector; - } - - public boolean isNoLocal() - { - return _noLocal; - } - - public void setNoLocal(final boolean noLocal) - { - this._noLocal = noLocal; - } - - public boolean isSynchronous() - { - return _synchronous; - } - - public void setSynchronous(boolean synchronous) - { - _synchronous = synchronous; - } - - public void setReceiveTimeout(long receiveTimeout) - { - _receiveTimeout = receiveTimeout; - - } - - public long getReceiveTimeout() - { - return _receiveTimeout; - } - - public boolean isEvaluateLatency() - { - return _evaluateLatency; - } - - public void setEvaluateLatency(boolean evaluateLatency) - { - _evaluateLatency = evaluateLatency; - } -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateMessageProviderCommand.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateMessageProviderCommand.java deleted file mode 100644 index 3f30fdd96a..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateMessageProviderCommand.java +++ /dev/null @@ -1,54 +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.message; - -import java.util.Map; - -import org.apache.qpid.disttest.client.property.PropertyValue; - -public class CreateMessageProviderCommand extends Command -{ - private String _providerName; - private Map _messageProperties; - - public CreateMessageProviderCommand() - { - super(CommandType.CREATE_MESSAGE_PROVIDER); - } - - public String getProviderName() - { - return _providerName; - } - - public void setProviderName(String providerName) - { - this._providerName = providerName; - } - - public Map getMessageProperties() - { - return _messageProperties; - } - - public void setMessageProperties(Map messageProperties) - { - this._messageProperties = messageProperties; - } -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateParticpantCommand.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateParticpantCommand.java deleted file mode 100644 index e7349bf795..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateParticpantCommand.java +++ /dev/null @@ -1,114 +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.message; - -import org.apache.commons.lang.builder.ToStringBuilder; - -public abstract class CreateParticpantCommand extends Command -{ - private boolean _isTopic; - private String _participantName; - private String _sessionName; - private String _destinationName; - private long _numberOfMessages; - private int _batchSize; - private long _maximumDuration; - - public CreateParticpantCommand(CommandType type) - { - super(type); - } - - public String getParticipantName() - { - return _participantName; - } - - public void setParticipantName(final String participantName) - { - _participantName = participantName; - } - - public String getSessionName() - { - return _sessionName; - } - - public void setSessionName(final String sessionName) - { - _sessionName = sessionName; - } - - public String getDestinationName() - { - return _destinationName; - } - - public void setDestinationName(final String destinationName) - { - _destinationName = destinationName; - } - - public boolean isTopic() - { - return _isTopic; - } - - public void setTopic(boolean isTopic) - { - _isTopic = isTopic; - } - - public long getNumberOfMessages() - { - return _numberOfMessages; - } - - public void setNumberOfMessages(final long numberOfMessages) - { - _numberOfMessages = numberOfMessages; - } - - public int getBatchSize() - { - return _batchSize; - } - - public void setBatchSize(int batchSize) - { - _batchSize = batchSize; - } - - public long getMaximumDuration() - { - return _maximumDuration; - } - - public void setMaximumDuration(long maximumDuration) - { - _maximumDuration = maximumDuration; - } - - @Override - public String toString() - { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateProducerCommand.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateProducerCommand.java deleted file mode 100644 index 69dfe1ff5a..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateProducerCommand.java +++ /dev/null @@ -1,106 +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.message; - -public class CreateProducerCommand extends CreateParticpantCommand -{ - private int _deliveryMode; - private int _messageSize; - private int _priority; - private long _timeToLive; - private long _interval; - private long _startDelay; - private String _messageProviderName; - - public CreateProducerCommand() - { - super(CommandType.CREATE_PRODUCER); - } - - public int getMessageSize() - { - return _messageSize; - } - - public void setMessageSize(final int messageSize) - { - this._messageSize = messageSize; - } - - public int getPriority() - { - return _priority; - } - - public void setPriority(final int priority) - { - this._priority = priority; - } - - public int getDeliveryMode() - { - return _deliveryMode; - } - - public void setDeliveryMode(final int deliveryMode) - { - this._deliveryMode = deliveryMode; - } - - public long getTimeToLive() - { - return _timeToLive; - } - - public void setTimeToLive(final long timeToLive) - { - this._timeToLive = timeToLive; - } - - public long getInterval() - { - return _interval; - } - - public void setInterval(long interval) - { - this._interval = interval; - } - - public long getStartDelay() - { - return _startDelay; - } - - public void setStartDelay(long startDelay) - { - this._startDelay = startDelay; - } - - public String getMessageProviderName() - { - return _messageProviderName; - } - - public void setMessageProviderName(String messageProviderName) - { - this._messageProviderName = messageProviderName; - } -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateResponderCommand.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateResponderCommand.java deleted file mode 100644 index 85a2b5e548..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateResponderCommand.java +++ /dev/null @@ -1,28 +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.message; - -public class CreateResponderCommand extends Command -{ - public CreateResponderCommand() - { - super(CommandType.CREATE_RESPONDER); - } -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateSessionCommand.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateSessionCommand.java deleted file mode 100644 index f6f59c26af..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateSessionCommand.java +++ /dev/null @@ -1,62 +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.message; - -public class CreateSessionCommand extends Command -{ - private String sessionName; - private String connectionName; - private int acknowledgeMode; - - public CreateSessionCommand() - { - super(CommandType.CREATE_SESSION); - } - - public String getSessionName() - { - return sessionName; - } - - public void setSessionName(final String sessionName) - { - this.sessionName = sessionName; - } - - public String getConnectionName() - { - return connectionName; - } - - public void setConnectionName(final String connectionName) - { - this.connectionName = connectionName; - } - - public int getAcknowledgeMode() - { - return acknowledgeMode; - } - - public void setAcknowledgeMode(final int acknowledgeMode) - { - this.acknowledgeMode = acknowledgeMode; - } -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/NoOpCommand.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/NoOpCommand.java deleted file mode 100644 index 1cdaf00163..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/NoOpCommand.java +++ /dev/null @@ -1,30 +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.message; - - -public class NoOpCommand extends Command -{ - public NoOpCommand() - { - super(CommandType.NO_OP); - } - -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/OutputAttribute.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/OutputAttribute.java deleted file mode 100644 index b912eaa1cb..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/OutputAttribute.java +++ /dev/null @@ -1,35 +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.message; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - - -/** - * Marks an attribute of {@link ParticipantResult} that should be written to the test output file. - */ -@Target(ElementType.METHOD) -@Retention(RetentionPolicy.RUNTIME) -public @interface OutputAttribute -{ - ParticipantAttribute attribute(); -} 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 deleted file mode 100644 index 1154ff306c..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ParticipantAttribute.java +++ /dev/null @@ -1,111 +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.message; - -import java.text.DecimalFormat; - -import org.apache.qpid.disttest.client.Participant; - -/** - * Meta-date representing the attributes of {@link Participant} that we write to the test output file. - * - * Order of declaration is currently important - it determines they order they appear in the output. - * - * @see OutputAttribute - */ -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"), - PAYLOAD_SIZE("payloadSizeB"), - PRIORITY("priority"), - TIME_TO_LIVE("timeToLiveMs"), - ACKNOWLEDGE_MODE("acknowledgeMode"), - DELIVERY_MODE("deliveryMode"), - BATCH_SIZE("batchSize"), - MAXIMUM_DURATION("maximumDurationMs"), - PRODUCER_START_DELAY("producerStartDelayMs"), - PRODUCER_INTERVAL("producerIntervalMs"), - IS_TOPIC("isTopic"), - IS_DURABLE_SUBSCRIPTION("isDurableSubscription"), - IS_BROWSING_SUBSCRIPTION("isBrowsingSubscription"), - IS_SELECTOR("isSelector"), - IS_NO_LOCAL("isNoLocal"), - IS_SYNCHRONOUS_CONSUMER("isSynchronousConsumer"), - TOTAL_NUMBER_OF_CONSUMERS("totalNumberOfConsumers"), - TOTAL_NUMBER_OF_PRODUCERS("totalNumberOfProducers"), - TOTAL_PAYLOAD_PROCESSED("totalPayloadProcessedB"), - TIME_TAKEN("timeTakenMs"), - ERROR_MESSAGE("errorMessage"), - MIN_LATENCY("minLatency"), - MAX_LATENCY("maxLatency"), - LATENCY_STANDARD_DEVIATION("latencyStandardDeviation"), - MESSAGE_THROUGHPUT("throughputMessagesPerS") - ; - - 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/message/ParticipantAttributeExtractor.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ParticipantAttributeExtractor.java deleted file mode 100644 index 95a19ceefc..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ParticipantAttributeExtractor.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.message; - -import java.beans.PropertyDescriptor; -import java.lang.annotation.Annotation; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.HashMap; -import java.util.Map; - -import org.apache.commons.beanutils.PropertyUtils; - - -public class ParticipantAttributeExtractor -{ - public static Map getAttributes(Object targetObject) - { - Map attributes = new HashMap(); - - - PropertyDescriptor[] descriptors = PropertyUtils.getPropertyDescriptors(targetObject); - for (PropertyDescriptor propertyDescriptor : descriptors) - { - final Method readMethod = getPropertyReadMethod(targetObject, propertyDescriptor); - - for (Annotation annotation : readMethod.getDeclaredAnnotations()) - { - if (annotation instanceof OutputAttribute) - { - OutputAttribute outputAttribute = (OutputAttribute) annotation; - - Object value = getPropertyValue(targetObject, propertyDescriptor.getName()); - attributes.put(outputAttribute.attribute(), value); - } - } - } - - return attributes; - } - - public static Method getPropertyReadMethod(Object targetObject, PropertyDescriptor propertyDescriptor) - { - final Method readMethod = propertyDescriptor.getReadMethod(); - - if (readMethod == null) - { - throw new RuntimeException("No read method for property " + propertyDescriptor.getName() + " on " + targetObject); - } - return readMethod; - } - - public static Object getPropertyValue(Object targetObject, String propertyName) - { - try - { - return PropertyUtils.getProperty(targetObject, propertyName); - } - catch (IllegalAccessException e) - { - throw new RuntimeException("Couldn't get value of property " + propertyName + " from " + targetObject, e); - } - catch (InvocationTargetException e) - { - throw new RuntimeException("Couldn't get value of property " + propertyName + " from " + targetObject, e); - } - catch (NoSuchMethodException e) - { - throw new RuntimeException("Couldn't get value of property " + propertyName + " from " + targetObject, e); - } - - } -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ParticipantResult.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ParticipantResult.java deleted file mode 100644 index 0a824a316b..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ParticipantResult.java +++ /dev/null @@ -1,322 +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.message; - -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.ITERATION_NUMBER; -import static org.apache.qpid.disttest.message.ParticipantAttribute.MAXIMUM_DURATION; -import static org.apache.qpid.disttest.message.ParticipantAttribute.MESSAGE_THROUGHPUT; -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.TEST_NAME; -import static org.apache.qpid.disttest.message.ParticipantAttribute.THROUGHPUT; - -import java.util.Comparator; -import java.util.Date; -import java.util.Map; - -public class ParticipantResult extends Response -{ - private String _testName; - private String _participantName; - private int _iterationNumber; - - private long _startInMillis; - private long _endInMillis; - private int _batchSize; - private long _maximumDuration; - - private String _configuredClientName; - - private long _numberOfMessagesProcessed; - private long _totalPayloadProcessed; - private int _payloadSize; - private double _throughput; - private int _messageThroughput; - - private int _totalNumberOfConsumers; - private int _totalNumberOfProducers; - - // As Session.SESSION_TRANSACTED is 0, we use value -1 so we can distinguish the case where an aggregated result - // summarizes results from participants using different session acknowledge modes. - private int _acknowledgeMode = -1; - - public static final Comparator PARTICIPANT_NAME_COMPARATOR = new Comparator() - { - @Override - public int compare(ParticipantResult participantResult1, ParticipantResult participantResult2) - { - return participantResult1.getParticipantName().compareTo(participantResult2.getParticipantName()); - } - }; - - public ParticipantResult() - { - this(CommandType.PARTICIPANT_RESULT); - } - - public ParticipantResult(CommandType commandType) - { - super(commandType); - } - - public ParticipantResult(String participantName) - { - this(); - setParticipantName(participantName); - } - - @OutputAttribute(attribute=TEST_NAME) - public String getTestName() - { - return _testName; - } - - public void setTestName(String testName) - { - _testName = testName; - } - - @OutputAttribute(attribute=ITERATION_NUMBER) - public int getIterationNumber() - { - return _iterationNumber; - } - - public void setIterationNumber(int iterationNumber) - { - _iterationNumber = iterationNumber; - } - - public void setStartDate(Date start) - { - _startInMillis = start.getTime(); - } - - public void setEndDate(Date end) - { - _endInMillis = end.getTime(); - } - - public Date getStartDate() - { - return new Date(_startInMillis); - } - - public Date getEndDate() - { - return new Date(_endInMillis); - } - - - public long getStartInMillis() - { - return _startInMillis; - } - - public long getEndInMillis() - { - return _endInMillis; - } - - - @OutputAttribute(attribute=PARTICIPANT_NAME) - public String getParticipantName() - { - return _participantName; - } - - - public void setParticipantName(String participantName) - { - _participantName = participantName; - } - - @OutputAttribute(attribute=ParticipantAttribute.TIME_TAKEN) - public long getTimeTaken() - { - return _endInMillis - _startInMillis; - } - - @OutputAttribute(attribute=CONFIGURED_CLIENT_NAME) - public String getConfiguredClientName() - { - return _configuredClientName; - } - - public void setConfiguredClientName(String configuredClientName) - { - _configuredClientName = configuredClientName; - } - - @OutputAttribute(attribute=NUMBER_OF_MESSAGES_PROCESSED) - public long getNumberOfMessagesProcessed() - { - return _numberOfMessagesProcessed; - } - - public void setNumberOfMessagesProcessed(long numberOfMessagesProcessed) - { - _numberOfMessagesProcessed = numberOfMessagesProcessed; - } - - @OutputAttribute(attribute=ParticipantAttribute.TOTAL_PAYLOAD_PROCESSED) - public long getTotalPayloadProcessed() - { - return _totalPayloadProcessed; - } - - @OutputAttribute(attribute = PAYLOAD_SIZE) - public int getPayloadSize() - { - return _payloadSize; - } - - public void setPayloadSize(int payloadSize) - { - _payloadSize = payloadSize; - } - - public void setTotalPayloadProcessed(long totalPayloadProcessed) - { - _totalPayloadProcessed = totalPayloadProcessed; - } - - public Map getAttributes() - { - return ParticipantAttributeExtractor.getAttributes(this); - } - - public void setBatchSize(int batchSize) - { - _batchSize = batchSize; - } - - @OutputAttribute(attribute=BATCH_SIZE) - public int getBatchSize() - { - return _batchSize; - } - - public void setMaximumDuration(long maximumDuration) - { - _maximumDuration = maximumDuration; - } - - @OutputAttribute(attribute=MAXIMUM_DURATION) - public long getMaximumDuration() - { - return _maximumDuration; - } - - @OutputAttribute(attribute=THROUGHPUT) - public double getThroughput() - { - return _throughput; - } - - public void setThroughput(double throughput) - { - _throughput = throughput; - } - - @OutputAttribute(attribute=MESSAGE_THROUGHPUT) - public int getMessageThroughput() - { - return _messageThroughput; - } - - public void setMessageThroughput(int throughput) - { - _messageThroughput = throughput; - } - - public void setTotalNumberOfConsumers(int totalNumberOfConsumers) - { - _totalNumberOfConsumers = totalNumberOfConsumers; - } - - @OutputAttribute(attribute=ParticipantAttribute.TOTAL_NUMBER_OF_CONSUMERS) - public int getTotalNumberOfConsumers() - { - return _totalNumberOfConsumers; - } - - public void setTotalNumberOfProducers(int totalNumberOfProducers) - { - _totalNumberOfProducers = totalNumberOfProducers; - } - - @OutputAttribute(attribute=ParticipantAttribute.TOTAL_NUMBER_OF_PRODUCERS) - public int getTotalNumberOfProducers() - { - return _totalNumberOfProducers; - } - - @OutputAttribute(attribute=ParticipantAttribute.ACKNOWLEDGE_MODE) - public int getAcknowledgeMode() - { - return _acknowledgeMode; - } - - public void setAcknowledgeMode(int acknowledgeMode) - { - _acknowledgeMode = acknowledgeMode; - } - - public double getLatencyStandardDeviation() - { - return 0.0; - } - - @OutputAttribute(attribute = ParticipantAttribute.MIN_LATENCY) - public long getMinLatency() - { - return 0; - } - - @OutputAttribute(attribute = ParticipantAttribute.MAX_LATENCY) - public long getMaxLatency() - { - return 0; - } - - @OutputAttribute(attribute = ParticipantAttribute.AVERAGE_LATENCY) - public double getAverageLatency() - { - return 0; - } - - public int getPriority() - { - return 0; - } - - public long getTimeToLive() - { - return 0; - } - - public int getDeliveryMode() - { - return 0; - } -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ProducerParticipantResult.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ProducerParticipantResult.java deleted file mode 100644 index 2d9399a3d3..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ProducerParticipantResult.java +++ /dev/null @@ -1,102 +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.message; - -import static org.apache.qpid.disttest.message.ParticipantAttribute.DELIVERY_MODE; -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.TIME_TO_LIVE; - -public class ProducerParticipantResult extends ParticipantResult -{ - private int _priority; - private long _timeToLive; - private long _startDelay; - private long _interval; - private int _deliveryMode; - public ProducerParticipantResult() - { - super(CommandType.PRODUCER_PARTICIPANT_RESULT); - } - - public ProducerParticipantResult(String participantName) - { - this(); - setParticipantName(participantName); - } - - @Override - @OutputAttribute(attribute=PRIORITY) - public int getPriority() - { - return _priority; - } - - public void setPriority(int priority) - { - _priority = priority; - } - - @Override - @OutputAttribute(attribute=TIME_TO_LIVE) - public long getTimeToLive() - { - return _timeToLive; - } - - public void setTimeToLive(long timeToLive) - { - _timeToLive = timeToLive; - } - - @OutputAttribute(attribute=PRODUCER_START_DELAY) - public long getStartDelay() - { - return _startDelay; - } - - public void setStartDelay(long startDelay) - { - _startDelay = startDelay; - } - - @OutputAttribute(attribute=PRODUCER_INTERVAL) - public long getInterval() - { - return _interval; - } - - public void setInterval(long producerInterval) - { - _interval = producerInterval; - } - - @Override - @OutputAttribute(attribute=DELIVERY_MODE) - public int getDeliveryMode() - { - return _deliveryMode; - } - - public void setDeliveryMode(int deliveryMode) - { - this._deliveryMode = deliveryMode; - } -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/RegisterClientCommand.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/RegisterClientCommand.java deleted file mode 100644 index af880a37d9..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/RegisterClientCommand.java +++ /dev/null @@ -1,43 +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.message; - -public class RegisterClientCommand extends Command -{ - private final String _clientName; - private final String _clientQueueName; - - public RegisterClientCommand(final String clientName, final String clientQueueName) - { - super(CommandType.REGISTER_CLIENT); - _clientName = clientName; - _clientQueueName = clientQueueName; - } - - public String getClientName() - { - return _clientName; - } - - public String getClientQueueName() - { - return _clientQueueName; - } -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/Response.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/Response.java deleted file mode 100644 index aac056efcb..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/Response.java +++ /dev/null @@ -1,80 +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.message; - - -public class Response extends Command -{ - protected String _registeredClientName; - protected String _errorMessage; - private CommandType _inReplyToCommandType; - - public Response(final String registeredclientName, final CommandType inReplyToCommandType, final String errorMessage) - { - super(CommandType.RESPONSE); - _registeredClientName = registeredclientName; - _errorMessage = errorMessage; - _inReplyToCommandType = inReplyToCommandType; - } - - public Response(String clientName, CommandType inReplyToCommandType) - { - this(clientName, inReplyToCommandType, null); - } - - /** - * Provided so that subclasses can call super(commandType) - */ - protected Response(CommandType commandType) - { - super(commandType); - } - - public String getRegisteredClientName() - { - return _registeredClientName; - } - - public void setRegisteredClientName(String registeredClientName) - { - _registeredClientName = registeredClientName; - } - - @OutputAttribute(attribute=ParticipantAttribute.ERROR_MESSAGE) - public String getErrorMessage() - { - return _errorMessage; - } - - public void setErrorMessage(String errorMessage) - { - _errorMessage = errorMessage; - } - - public boolean hasError() - { - return _errorMessage != null; - } - - public CommandType getInReplyToCommandType() - { - return _inReplyToCommandType; - } -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/StartTestCommand.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/StartTestCommand.java deleted file mode 100644 index 4a53697ecd..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/StartTestCommand.java +++ /dev/null @@ -1,29 +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.message; - -public class StartTestCommand extends Command -{ - - public StartTestCommand() - { - super(CommandType.START_TEST); - } - -} \ No newline at end of file diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/StopClientCommand.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/StopClientCommand.java deleted file mode 100644 index 08758aaa69..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/StopClientCommand.java +++ /dev/null @@ -1,28 +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.message; - -public class StopClientCommand extends Command -{ - public StopClientCommand() - { - super(CommandType.STOP_CLIENT); - } -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/TearDownTestCommand.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/TearDownTestCommand.java deleted file mode 100644 index 6b1367d4f9..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/TearDownTestCommand.java +++ /dev/null @@ -1,29 +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.message; - -public class TearDownTestCommand extends Command -{ - - public TearDownTestCommand() - { - super(CommandType.TEAR_DOWN_TEST); - } - -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/BenchmarkResultWriter.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/BenchmarkResultWriter.java deleted file mode 100644 index a184b53668..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/BenchmarkResultWriter.java +++ /dev/null @@ -1,68 +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; - -import java.util.List; - -import org.apache.qpid.disttest.controller.ResultsForAllTests; -import org.apache.qpid.disttest.message.ParticipantResult; -import org.apache.qpid.disttest.results.aggregation.ITestResult; - -public class BenchmarkResultWriter implements ResultsWriter -{ - private final boolean _reportMessageTotals; - - public BenchmarkResultWriter(boolean reportMessageTotals) - { - _reportMessageTotals = reportMessageTotals; - } - - @Override - public void writeResults(ResultsForAllTests resultsForAllTests, String testConfigFile) - { - for (ITestResult allResult : resultsForAllTests.getAllParticipantsResult().getTestResults()) - { - ParticipantResult allRowData = allResult.getParticipantResults().iterator().next(); - - if (allRowData.getErrorMessage() == null) - { - final String output; - if (_reportMessageTotals) - { - output = String.format("%s : %,d (total payload/bytes) : %,d (time taken/ms) : %,d (total messages) : %,d (messages/s) %,.2f (Kbytes/s)", - allResult.getName(), allRowData.getTotalPayloadProcessed(), allRowData.getTimeTaken(), allRowData.getNumberOfMessagesProcessed(), allRowData.getMessageThroughput(), allRowData.getThroughput()); - } - else - { - output = String.format("%s : %,d (messages/s) %,.2f (Kbytes/s)", allResult.getName(), allRowData.getMessageThroughput(), allRowData.getThroughput()); - } - System.out.println(output); - } - else - { - System.err.println(allRowData.getErrorMessage()); - } - } - } - - @Override - public void writeResultsSummary(List allResultsList) - { - } -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/ResultsCsvWriter.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/ResultsCsvWriter.java deleted file mode 100644 index a041233ea3..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/ResultsCsvWriter.java +++ /dev/null @@ -1,115 +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; - -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.util.List; - -import org.apache.qpid.disttest.DistributedTestException; -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 ResultsCsvWriter implements ResultsWriter -{ - private static final Logger LOGGER = LoggerFactory.getLogger(ResultsCsvWriter.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 ResultsCsvWriter(File outputDir) - { - _outputDir = outputDir; - } - - @Override - public void writeResults(ResultsForAllTests resultsForAllTests, String testConfigFile) - { - final String outputFile = generateOutputCsvNameFrom(testConfigFile); - writeResultsToOutputFile(resultsForAllTests, outputFile); - } - - @Override - 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); - } - } - } - } - - public 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/results/ResultsWriter.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/ResultsWriter.java deleted file mode 100644 index 4cc8c9cf87..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/ResultsWriter.java +++ /dev/null @@ -1,34 +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; - -import java.util.List; - -import org.apache.qpid.disttest.controller.ResultsForAllTests; - -public interface ResultsWriter -{ - - void writeResults(ResultsForAllTests resultsForAllTests, String testConfigFile); - - void writeResultsSummary(List allResultsList); - -} \ No newline at end of file diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/AggregatedTestResult.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/AggregatedTestResult.java deleted file mode 100644 index 5e6da2e65b..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/AggregatedTestResult.java +++ /dev/null @@ -1,97 +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.aggregation; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.qpid.disttest.message.ParticipantResult; - -public class AggregatedTestResult implements ITestResult -{ - private ParticipantResult _allParticipantResult; - private ParticipantResult _allConsumerParticipantResult; - private ParticipantResult _allProducerParticipantResult; - private final ITestResult _originalTestResult; - - public AggregatedTestResult(ITestResult originalTestResult) - { - _originalTestResult = originalTestResult; - } - - /** - * Returns the result where {@link ParticipantResult#getNumberOfMessagesProcessed()} - * is the total number of messages consumed during the test, and {@link ParticipantResult#getTimeTaken()} - * is the time between the start of the first producer and the end of the last consumer to finish. - */ - public ParticipantResult getAllParticipantResult() - { - return _allParticipantResult; - } - - public void setAllParticipantResult(ParticipantResult allParticipantResult) - { - _allParticipantResult = allParticipantResult; - } - - public ParticipantResult getAllConsumerParticipantResult() - { - return _allConsumerParticipantResult; - } - public void setAllConsumerParticipantResult(ParticipantResult allConsumerParticipantResult) - { - _allConsumerParticipantResult = allConsumerParticipantResult; - } - public ParticipantResult getAllProducerParticipantResult() - { - return _allProducerParticipantResult; - } - public void setAllProducerParticipantResult(ParticipantResult allProducerParticipantResult) - { - _allProducerParticipantResult = allProducerParticipantResult; - } - - // TODO should weaken to Collection - @Override - public List getParticipantResults() - { - List allParticipantResults = new ArrayList(_originalTestResult.getParticipantResults()); - - allParticipantResults.add(_allConsumerParticipantResult); - allParticipantResults.add(_allProducerParticipantResult); - allParticipantResults.add(_allParticipantResult); - - return allParticipantResults; - } - - @Override - public boolean hasErrors() - { - return _originalTestResult.hasErrors(); - } - - @Override - public String getName() - { - return _originalTestResult.getName(); - } - - - -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/Aggregator.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/Aggregator.java deleted file mode 100644 index cde30d36e5..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/Aggregator.java +++ /dev/null @@ -1,49 +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.aggregation; - -import org.apache.qpid.disttest.controller.ResultsForAllTests; - -public class Aggregator -{ - - private TestResultAggregator _testResultAggregator = new TestResultAggregator(); - - public ResultsForAllTests aggregateResults(ResultsForAllTests rawResultsForAllTests) - { - - ResultsForAllTests aggregatedResultsForAllTests = new ResultsForAllTests(); - - - for (ITestResult testResult : rawResultsForAllTests.getTestResults()) - { - AggregatedTestResult aggregateTestResult = _testResultAggregator.aggregateTestResult(testResult); - aggregatedResultsForAllTests.add(aggregateTestResult); - } - - - return aggregatedResultsForAllTests; - } - - void setTestResultAggregator(TestResultAggregator testResultAggregator) - { - _testResultAggregator = testResultAggregator; - } - -} 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 deleted file mode 100644 index 6230067486..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/ITestResult.java +++ /dev/null @@ -1,34 +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.aggregation; - -import java.util.List; - -import org.apache.qpid.disttest.message.ParticipantResult; - -public interface ITestResult -{ - // TODO should weaken to Collection - List getParticipantResults(); - - boolean hasErrors(); - - String getName(); - -} \ No newline at end of file diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/ParticipantResultAggregator.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/ParticipantResultAggregator.java deleted file mode 100644 index c21a78d359..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/ParticipantResultAggregator.java +++ /dev/null @@ -1,211 +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.aggregation; - -import java.util.Date; -import java.util.NavigableSet; -import java.util.TreeSet; - -import org.apache.qpid.disttest.message.ConsumerParticipantResult; -import org.apache.qpid.disttest.message.ParticipantResult; -import org.apache.qpid.disttest.message.ProducerParticipantResult; - -public class ParticipantResultAggregator -{ - private final String _aggregatedResultName; - private final Class _targetClass; - - private long _minStartDate = Long.MAX_VALUE; - private long _maxEndDate = 0; - private long _numberOfMessagesProcessed = 0; - private long _totalPayloadProcessed = 0; - - private int _totalNumberOfConsumers = 0; - private int _totalNumberOfProducers = 0; - - private NavigableSet _encounteredPayloadSizes = new TreeSet(); - private NavigableSet _encounteredIterationNumbers = new TreeSet(); - private NavigableSet _encounteredBatchSizes = new TreeSet(); - private NavigableSet _encounteredAcknowledgeMode = new TreeSet(); - private NavigableSet _encounteredDeliveryModes = new TreeSet(); - private NavigableSet _encounteredDurableSubscriptions = new TreeSet(); - private NavigableSet _encounteredTopics = new TreeSet(); - private NavigableSet _encountedTestNames = new TreeSet(); - - private SeriesStatistics _latencyStatistics = new SeriesStatistics(); - - public ParticipantResultAggregator(Class targetClass, String aggregateResultName) - { - _aggregatedResultName = aggregateResultName; - _targetClass = targetClass; - } - - public void aggregate(ParticipantResult result) - { - if (isAggregatable(result)) - { - rollupConstantAttributes(result); - computeVariableAttributes(result); - if (result instanceof ConsumerParticipantResult) - { - ConsumerParticipantResult consumerParticipantResult = (ConsumerParticipantResult)result; - _latencyStatistics.addMessageLatencies(consumerParticipantResult.getMessageLatencies()); - _latencyStatistics.aggregate(); - } - } - } - - public ParticipantResult getAggregatedResult() - { - ParticipantResult aggregatedResult; - if (_targetClass == ConsumerParticipantResult.class) - { - ConsumerParticipantResult consumerParticipantResult = new ConsumerParticipantResult(_aggregatedResultName); - consumerParticipantResult.setAverageLatency(_latencyStatistics.getAverage()); - consumerParticipantResult.setMinLatency(_latencyStatistics.getMinimum()); - consumerParticipantResult.setMaxLatency(_latencyStatistics.getMaximum()); - consumerParticipantResult.setLatencyStandardDeviation(_latencyStatistics.getStandardDeviation()); - aggregatedResult = consumerParticipantResult; - } - else - { - aggregatedResult = new ParticipantResult(_aggregatedResultName); - } - - setRolledUpConstantAttributes(aggregatedResult); - setComputedVariableAttributes(aggregatedResult); - - return aggregatedResult; - } - - private boolean isAggregatable(ParticipantResult result) - { - return _targetClass.isAssignableFrom(result.getClass()); - } - - private void computeVariableAttributes(ParticipantResult result) - { - _numberOfMessagesProcessed += result.getNumberOfMessagesProcessed(); - _totalPayloadProcessed += result.getTotalPayloadProcessed(); - _totalNumberOfConsumers += result.getTotalNumberOfConsumers(); - _totalNumberOfProducers += result.getTotalNumberOfProducers(); - _minStartDate = Math.min(_minStartDate, result.getStartInMillis()); - _maxEndDate = Math.max(_maxEndDate, result.getEndInMillis()); - } - - private void rollupConstantAttributes(ParticipantResult result) - { - if (result.getTestName() != null) - { - _encountedTestNames.add(result.getTestName()); - } - _encounteredPayloadSizes.add(result.getPayloadSize()); - _encounteredIterationNumbers.add(result.getIterationNumber()); - _encounteredBatchSizes.add(result.getBatchSize()); - _encounteredAcknowledgeMode.add(result.getAcknowledgeMode()); - if (result instanceof ProducerParticipantResult) - { - ProducerParticipantResult producerParticipantResult = (ProducerParticipantResult) result; - _encounteredDeliveryModes.add(producerParticipantResult.getDeliveryMode()); - } - else if(result instanceof ConsumerParticipantResult) - { - ConsumerParticipantResult consumerParticipantResult = (ConsumerParticipantResult)result; - _encounteredDurableSubscriptions.add(consumerParticipantResult.isDurableSubscription()); - _encounteredTopics.add(consumerParticipantResult.isTopic()); - } - } - - private void setComputedVariableAttributes(ParticipantResult aggregatedResult) - { - aggregatedResult.setNumberOfMessagesProcessed(_numberOfMessagesProcessed); - aggregatedResult.setTotalPayloadProcessed(_totalPayloadProcessed); - aggregatedResult.setTotalNumberOfConsumers(_totalNumberOfConsumers); - aggregatedResult.setTotalNumberOfProducers(_totalNumberOfProducers); - aggregatedResult.setStartDate(new Date(_minStartDate)); - aggregatedResult.setEndDate(new Date(_maxEndDate)); - aggregatedResult.setThroughput(calculateThroughputInKiloBytesPerSecond()); - aggregatedResult.setMessageThroughput(calculateThroughputInMessagesPerSecond()); - } - - private void setRolledUpConstantAttributes(ParticipantResult aggregatedResult) - { - if (_encounteredIterationNumbers.size() == 1) - { - aggregatedResult.setIterationNumber( _encounteredIterationNumbers.first()); - } - if (_encounteredPayloadSizes.size() == 1) - { - aggregatedResult.setPayloadSize(_encounteredPayloadSizes.first()); - } - if (_encountedTestNames.size() == 1) - { - aggregatedResult.setTestName(_encountedTestNames.first()); - } - if (_encounteredBatchSizes.size() == 1) - { - aggregatedResult.setBatchSize(_encounteredBatchSizes.first()); - } - if (_encounteredAcknowledgeMode.size() == 1) - { - aggregatedResult.setAcknowledgeMode(_encounteredAcknowledgeMode.first()); - } - if (aggregatedResult instanceof ProducerParticipantResult) - { - ProducerParticipantResult producerParticipantResult = (ProducerParticipantResult) aggregatedResult; - if(_encounteredDeliveryModes.size() == 1) - { - producerParticipantResult.setDeliveryMode(_encounteredDeliveryModes.first()); - } - } - if (aggregatedResult instanceof ConsumerParticipantResult) - { - ConsumerParticipantResult consumerParticipantResult = (ConsumerParticipantResult) aggregatedResult; - if(_encounteredDurableSubscriptions.size() == 1) - { - consumerParticipantResult.setDurableSubscription(_encounteredDurableSubscriptions.first()); - } - if(_encounteredTopics.size() == 1) - { - consumerParticipantResult.setTopic(_encounteredTopics.first()); - } - } - } - - private double calculateThroughputInKiloBytesPerSecond() - { - double durationInMillis = _maxEndDate - _minStartDate; - double durationInSeconds = durationInMillis / 1000; - double totalPayloadProcessedInKiloBytes = ((double)_totalPayloadProcessed) / 1024; - - return totalPayloadProcessedInKiloBytes/durationInSeconds; - } - - private int calculateThroughputInMessagesPerSecond() - { - double durationInMillis = _maxEndDate - _minStartDate; - if (durationInMillis == 0 ) - { - return 0; - } - - return (int)Math.round((_numberOfMessagesProcessed * 1000.0d)/durationInMillis); - } -} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/SeriesStatistics.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/SeriesStatistics.java deleted file mode 100644 index b93c210473..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/SeriesStatistics.java +++ /dev/null @@ -1,111 +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.aggregation; - -import java.util.Collection; -import java.util.concurrent.CopyOnWriteArrayList; - -public class SeriesStatistics -{ - private long _minValue; - private long _maxValue; - private double _mean; - private double _standardDeviation; - private Collection _series = new CopyOnWriteArrayList(); - - public SeriesStatistics() - { - super(); - } - - public SeriesStatistics(Collection messageLatencies) - { - setMessageLatencies(messageLatencies); - } - - public void addMessageLatencies(Collection messageLatencies) - { - if (messageLatencies != null) - { - _series.addAll(messageLatencies); - } - } - - public void setMessageLatencies(Collection messageLatencies) - { - _series = messageLatencies; - aggregate(); - } - - public void aggregate() - { - if (_series != null && _series.size() > 0) - { - long minLatency = Long.MAX_VALUE; - long maxLatency = Long.MIN_VALUE; - long totalLatency = 0; - for (Long latency : _series) - { - totalLatency += latency; - minLatency = Math.min(minLatency, latency); - maxLatency = Math.max(maxLatency, latency); - } - _mean = ((double) totalLatency) / (double) _series.size(); - _minValue = minLatency; - _maxValue = maxLatency; - double sum = 0; - for (Long latency : _series) - { - double diff = latency - _mean; - sum += diff * diff; - } - long size = _series.size() == 1 ? 1: _series.size() - 1; - _standardDeviation = Math.sqrt(sum / (double) size); - } - else - { - _mean = 0; - _minValue = 0; - _maxValue = 0; - _standardDeviation = 0; - } - } - - public long getMinimum() - { - return _minValue; - } - - public long getMaximum() - { - return _maxValue; - } - - public double getAverage() - { - return _mean; - } - - public double getStandardDeviation() - { - return _standardDeviation; - } -} 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 deleted file mode 100644 index 954828b043..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/TestResultAggregator.java +++ /dev/null @@ -1,130 +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.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; - -public class TestResultAggregator -{ - static final String AGGREGATED_ERROR_MESSAGE = "One or more participants reported errors."; - public static final String ALL_PARTICIPANTS_NAME = "All"; - public static final String ALL_PRODUCER_PARTICIPANTS_NAME = "All Producers"; - public static final String ALL_CONSUMER_PARTICIPANTS_NAME = "All Consumers"; - - public AggregatedTestResult aggregateTestResult(ITestResult originalTestResult) - { - ParticipantResultAggregator consumerResultAggregator = new ParticipantResultAggregator(ConsumerParticipantResult.class, - ALL_CONSUMER_PARTICIPANTS_NAME); - ParticipantResultAggregator producerResultAggregator = new ParticipantResultAggregator(ProducerParticipantResult.class, - ALL_PRODUCER_PARTICIPANTS_NAME); - ParticipantResultAggregator aggregatedResultsAggregator = new ParticipantResultAggregator(ParticipantResult.class, - ALL_PARTICIPANTS_NAME); - - boolean hasError = aggregateOriginalResults(originalTestResult, - consumerResultAggregator, - producerResultAggregator); - - ParticipantResult aggregatedProducerResult = producerResultAggregator.getAggregatedResult(); - ParticipantResult aggregaredConsumerResult = consumerResultAggregator.getAggregatedResult(); - - ParticipantResult aggregatedAllResult = aggregateAggregatedResults( - aggregatedResultsAggregator, aggregatedProducerResult, - aggregaredConsumerResult); - - applyNonAggregateablesToAll(aggregatedAllResult, - aggregatedProducerResult, aggregaredConsumerResult); - - AggregatedTestResult newTestResult = new AggregatedTestResult(originalTestResult); - newTestResult.setAllProducerParticipantResult(aggregatedProducerResult); - newTestResult.setAllConsumerParticipantResult(aggregaredConsumerResult); - newTestResult.setAllParticipantResult(aggregatedAllResult); - - if (hasError) - { - aggregatedAllResult.setErrorMessage(TestResultAggregator.AGGREGATED_ERROR_MESSAGE); - } - - return newTestResult; - } - - private ParticipantResult aggregateAggregatedResults( - ParticipantResultAggregator aggregatedResultsAggregator, - ParticipantResult aggregatedProducerResult, - ParticipantResult aggregaredConsumerResult) - { - aggregatedResultsAggregator.aggregate(aggregatedProducerResult); - aggregatedResultsAggregator.aggregate(aggregaredConsumerResult); - ParticipantResult aggregatedAllResult = aggregatedResultsAggregator.getAggregatedResult(); - return aggregatedAllResult; - } - - private boolean aggregateOriginalResults(ITestResult originalTestResult, - ParticipantResultAggregator consumerParticipantResultAggregator, - ParticipantResultAggregator producerParticipantResultAggregator) - { - boolean hasError = false; - for (ParticipantResult result : originalTestResult.getParticipantResults()) - { - consumerParticipantResultAggregator.aggregate(result); - producerParticipantResultAggregator.aggregate(result); - - if (result.hasError()) - { - hasError = true; - } - } - return hasError; - } - - private void applyNonAggregateablesToAll(ParticipantResult aggregatedAllResult, ParticipantResult aggregatedProducerResult, ParticipantResult aggregatedConsumerResult) - { - aggregatedAllResult.setStartDate(aggregatedProducerResult.getStartDate()); - aggregatedAllResult.setEndDate(aggregatedConsumerResult.getEndDate()); - - aggregatedAllResult.setNumberOfMessagesProcessed(aggregatedConsumerResult.getNumberOfMessagesProcessed()); - aggregatedAllResult.setTotalPayloadProcessed(aggregatedConsumerResult.getTotalPayloadProcessed()); - aggregatedAllResult.setThroughput(aggregatedConsumerResult.getThroughput()); - aggregatedAllResult.setMessageThroughput(aggregatedConsumerResult.getMessageThroughput()); - } - - /** - * 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/CSVFormatter.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/formatting/CSVFormatter.java deleted file mode 100644 index ea7a3f78c7..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/formatting/CSVFormatter.java +++ /dev/null @@ -1,91 +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 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/main/java/org/apache/qpid/disttest/results/formatting/CSVOrderParticipantResultComparator.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/formatting/CSVOrderParticipantResultComparator.java deleted file mode 100644 index 0e1fbbc3c6..0000000000 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/formatting/CSVOrderParticipantResultComparator.java +++ /dev/null @@ -1,55 +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.Comparator; -import java.util.HashMap; -import java.util.Map; - -import org.apache.commons.lang.builder.CompareToBuilder; -import org.apache.qpid.disttest.message.ConsumerParticipantResult; -import org.apache.qpid.disttest.message.ParticipantResult; -import org.apache.qpid.disttest.message.ProducerParticipantResult; - -public class CSVOrderParticipantResultComparator implements Comparator -{ - // TODO yuk - private static final Map, Integer> TYPE_CODES = new HashMap, Integer>(); - static { - TYPE_CODES.put(ProducerParticipantResult.class, 0); - TYPE_CODES.put(ConsumerParticipantResult.class, 1); - TYPE_CODES.put(ParticipantResult.class, 2); - } - - @Override - public int compare(ParticipantResult left, ParticipantResult right) - { - return new CompareToBuilder() - .append(getTypeCode(left), getTypeCode(right)) - .append(left.getParticipantName(), right.getParticipantName()) - .toComparison(); - } - - - private int getTypeCode(ParticipantResult participantResult) - { - return TYPE_CODES.get(participantResult.getClass()); - } - -} diff --git a/qpid/java/perftests/src/main/java/test-utils.js b/qpid/java/perftests/src/main/java/test-utils.js deleted file mode 100644 index fd7ed38ff5..0000000000 --- a/qpid/java/perftests/src/main/java/test-utils.js +++ /dev/null @@ -1,105 +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. - * - */ -var QPID; -if (!QPID) { - QPID = {}; -} -(function () { - 'use strict'; - - if (typeof QPID.times !== 'function') { - QPID.times = function (multiplicity, template, timeIndexName) - { - var retVal = new Array(); - for (var i = 0; i < multiplicity; i++) - { - var templateName = template._name; - var teamplateAsString = JSON.stringify(template); - if (timeIndexName) - { - teamplateAsString = teamplateAsString.replace(new RegExp(timeIndexName, "g"), i); - } - var expandedObject = JSON.parse(teamplateAsString); - if (!(timeIndexName)) - { - expandedObject._name = templateName + "_" + i; - } - retVal[i] = expandedObject; - } - return retVal; - } - } - - if (typeof QPID.iterations !== 'function') { - QPID.iterations = function (values, template) - { - var retVal = new Array() - - var iterationNumber = 0; - - for (var variableName in values) - { - var variableValues = values[variableName] - for (var i in variableValues) - { - var variableValue = variableValues[i] - var templateTestString = JSON.stringify(template) - var actualString = templateTestString.replace(new RegExp(variableName, "g"), variableValue) - var iteration = JSON.parse(actualString) - iteration._iterationNumber = iterationNumber - retVal[iterationNumber] = iteration - iterationNumber++ - } - } - - return retVal - } - } - - if (typeof QPID.transform !== 'function') { - - /** - * Function to transform JSON using specified transformation function. - * Any number of transformation function could be passed after the template argument. - * Each function should return a transformed JSON object. - * Example - * var json = transform({"name": "Test1"}, function(json){json.name="Test"; return json;}); - */ - QPID.transform = function (template) - { - var json = template; - for (var i=1, len=arguments.length; i _options = new HashMap(); - - private ArgumentParser _parser; - - @Override - protected void setUp() throws Exception - { - super.setUp(); - _parser = new ArgumentParser(); - - _options.clear(); - _options.put(TEST_CONFIG_PROP, TEST_CONFIG_DEFAULT); - _options.put(JNDI_CONFIG_PROP, JNDI_CONFIG_DEFAULT); - _options.put(DISTRIBUTED_PROP, DISTRIBUTED_DEFAULT); - } - - public void testInvalidArguments() - { - String[] args = new String[]{"nonExistentConfigProperty" + "=" + TEST_CONFIG_FILENAME}; - - try - { - _parser.parseArgumentsIntoConfig(_options, args); - fail("expected exception to be thrown due to provision of a non existent config property"); - } - catch(IllegalArgumentException e) - { - //expected - } - } - - public void testDefaultConfigValues() - { - String[] args = new String[0]; - - _parser.parseArgumentsIntoConfig(_options, args); - - assertEquals("unexpected config value", TEST_CONFIG_DEFAULT, _options.get(TEST_CONFIG_PROP)); - assertEquals("unexpected config value", JNDI_CONFIG_DEFAULT, _options.get(JNDI_CONFIG_PROP)); - assertEquals("unexpected config value", DISTRIBUTED_DEFAULT, _options.get(DISTRIBUTED_PROP)); - } - - public void testConfigurationParsingOverridesDefault() throws Exception - { - String[] args = new String[]{TEST_CONFIG_PROP + "=" + TEST_CONFIG_FILENAME, - JNDI_CONFIG_PROP + "=" + JNDI_CONFIG_FILENAME, - DISTRIBUTED_PROP + "=" + DISTRIBUTED_MODE}; - - _parser.parseArgumentsIntoConfig(_options, args); - - assertEquals("unexpected config value", TEST_CONFIG_FILENAME, _options.get(TEST_CONFIG_PROP)); - assertEquals("unexpected config value", JNDI_CONFIG_FILENAME, _options.get(JNDI_CONFIG_PROP)); - assertEquals("unexpected config value", DISTRIBUTED_MODE, _options.get(DISTRIBUTED_PROP)); - assertFalse("override value was the same as the default", DISTRIBUTED_MODE.equalsIgnoreCase(_options.get(DISTRIBUTED_DEFAULT))); - } -} 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 deleted file mode 100644 index 629442d86c..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/ConfigFileHelperTest.java +++ /dev/null @@ -1,71 +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; - -import java.io.File; -import java.io.IOException; -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.apache.qpid.test.utils.QpidTestCase; -import org.apache.qpid.test.utils.TestFileUtils; - -public class ConfigFileHelperTest extends QpidTestCase -{ - private File _testDir; - private ConfigFileHelper _configFileHelper = new ConfigFileHelper(); - - @Override - protected void setUp() throws Exception - { - _testDir = TestFileUtils.createTestDirectory(); - } - - public void testGetTestConfigFilesForDirectory() throws Exception - { - String jsFile = createFile("file1.js"); - String jsonFile = createFile("file2.json"); - createFile("file.txt"); - createDir("dir.js"); - - String testConfigPath = _testDir.getAbsolutePath(); - - List configFiles = _configFileHelper.getTestConfigFiles(testConfigPath); - - Set expectedFiles = new HashSet(Arrays.asList(jsFile, jsonFile)); - Set actualFiles = new HashSet(configFiles); - - assertEquals(expectedFiles, actualFiles); - } - - private void createDir(String dirName) - { - File dir = new File(_testDir, dirName); - dir.mkdir(); - } - - private String createFile(String fileName) throws IOException - { - File file = new File(_testDir, fileName); - file.createNewFile(); - return file.getAbsolutePath(); - } -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/ConfigFileTestHelper.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/ConfigFileTestHelper.java deleted file mode 100644 index 71cd61db82..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/ConfigFileTestHelper.java +++ /dev/null @@ -1,48 +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; - -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; - -import org.apache.qpid.disttest.controller.config.Config; -import org.apache.qpid.disttest.controller.config.ConfigReader; - -public class ConfigFileTestHelper -{ - public static Reader getConfigFileReader(Class testClass, String resourceName) - { - InputStream inputStream = testClass.getResourceAsStream(resourceName); - if(inputStream == null) - { - throw new RuntimeException("Can't find resource " + resourceName + " using classloader of class " + testClass); - } - Reader reader = new InputStreamReader(inputStream); - return reader; - } - - public static Config getConfigFromResource(Class testClass, String resourceName) - { - ConfigReader configReader = new ConfigReader(); - Config config = configReader.readConfig(getConfigFileReader(testClass, resourceName)); - return config; - } -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/PerfTestConstants.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/PerfTestConstants.java deleted file mode 100644 index 5e56f3a89f..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/PerfTestConstants.java +++ /dev/null @@ -1,28 +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; - -public abstract class PerfTestConstants -{ - public static final long REGISTRATION_TIMEOUT = 20000; - public static final long COMMAND_RESPONSE_TIMEOUT = 30000; - public static final long TEST_RESULT_TIMEOUT = 20000; - -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/VisitorTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/VisitorTest.java deleted file mode 100644 index 09f7da4efb..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/VisitorTest.java +++ /dev/null @@ -1,91 +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; - -import org.apache.qpid.disttest.message.Command; -import org.apache.qpid.test.utils.QpidTestCase; - - -public class VisitorTest extends QpidTestCase -{ - - public void testStringVisited() throws Exception - { - Object argument = new String(); - - TestVisitor visitor = new TestVisitor(); - visitor.visit(argument); - - assertSame(argument, visitor._string); - } - - public void testCommandVisited() throws Exception - { - Object argument = new TestCommand(); - - TestVisitor visitor = new TestVisitor(); - visitor.visit(argument); - - assertSame(argument, visitor._testCommand); - } - - public void testNoVisitIntegerImplementatiom() throws Exception - { - Integer argument = Integer.valueOf(1); - - TestVisitor visitor = new TestVisitor(); - - try - { - visitor.visit(argument); - fail("Exception not thrown"); - } - catch (DistributedTestException e) - { - assertNotNull(e.getCause()); - assertEquals(NoSuchMethodException.class, e.getCause().getClass()); - } - } - - class TestVisitor extends Visitor - { - String _string = null; - TestCommand _testCommand = null; - - public void visit(String string) - { - _string = string; - } - - public void visit(TestCommand command) - { - _testCommand = command; - } - } - - class TestCommand extends Command - { - - public TestCommand() - { - super(null); - } - } -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ClientCommandVisitorTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ClientCommandVisitorTest.java deleted file mode 100644 index 2b29471558..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ClientCommandVisitorTest.java +++ /dev/null @@ -1,108 +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.client; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; - -import org.apache.qpid.disttest.jms.ClientJmsDelegate; -import org.apache.qpid.disttest.message.CreateConnectionCommand; -import org.apache.qpid.disttest.message.CreateConsumerCommand; -import org.apache.qpid.disttest.message.CreateMessageProviderCommand; -import org.apache.qpid.disttest.message.CreateProducerCommand; -import org.apache.qpid.disttest.message.CreateSessionCommand; -import org.apache.qpid.disttest.message.StartTestCommand; -import org.apache.qpid.disttest.message.StopClientCommand; -import org.apache.qpid.disttest.message.TearDownTestCommand; -import org.apache.qpid.test.utils.QpidTestCase; - -public class ClientCommandVisitorTest extends QpidTestCase -{ - private Client _client; - private ClientCommandVisitor _visitor; - private ClientJmsDelegate _delegate; - - - @Override - protected void setUp() throws Exception - { - super.setUp(); - _client = mock(Client.class); - _delegate = mock(ClientJmsDelegate.class); - _visitor = new ClientCommandVisitor(_client, _delegate); - } - - public void testStopClient() - { - StopClientCommand command = new StopClientCommand(); - _visitor.visit(command); - verify(_client).stop(); - } - - public void testCreateConnection() throws Exception - { - final CreateConnectionCommand command = new CreateConnectionCommand(); - _visitor.visit(command); - verify(_delegate).createConnection(command); - } - - public void testCreateSession() throws Exception - { - final CreateSessionCommand command = new CreateSessionCommand(); - _visitor.visit(command); - verify(_delegate).createSession(command); - } - - public void testCreateProducer() throws Exception - { - final CreateProducerCommand command = new CreateProducerCommand(); - _visitor.visit(command); - verify(_delegate).createProducer(command); - } - - public void testCreateConsumer() throws Exception - { - final CreateConsumerCommand command = new CreateConsumerCommand(); - _visitor.visit(command); - verify(_delegate).createConsumer(command); - } - - public void testStartTest() throws Exception - { - final StartTestCommand command = new StartTestCommand(); - _visitor.visit(command); - verify(_client).startTest(); - } - - public void testStopTest() throws Exception - { - final TearDownTestCommand stopCommand = new TearDownTestCommand(); - _visitor.visit(stopCommand); - verify(_client).tearDownTest(); - } - - public void testCreateMessageProvider() throws Exception - { - final CreateMessageProviderCommand command = new CreateMessageProviderCommand(); - command.setProviderName("test"); - _visitor.visit(command); - verify(_delegate).createMessageProvider(command); - } -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ClientTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ClientTest.java deleted file mode 100644 index 8139961fa4..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ClientTest.java +++ /dev/null @@ -1,158 +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.client; - -import static org.mockito.Matchers.isA; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.Collections; -import java.util.Timer; -import java.util.TimerTask; - -import org.apache.qpid.disttest.jms.ClientJmsDelegate; -import org.apache.qpid.disttest.message.Command; -import org.apache.qpid.disttest.message.ParticipantResult; -import org.apache.qpid.disttest.message.Response; -import org.apache.qpid.disttest.message.StopClientCommand; -import org.apache.qpid.test.utils.QpidTestCase; -import org.mockito.InOrder; -import org.mockito.Mockito; - -public class ClientTest extends QpidTestCase -{ - private Client _client; - private ClientJmsDelegate _delegate; - private ClientCommandVisitor _visitor; - private ParticipantExecutor _participant; - private ParticipantExecutorRegistry _participantRegistry; - - @Override - protected void setUp() throws Exception - { - super.setUp(); - _delegate = mock(ClientJmsDelegate.class); - _visitor = mock(ClientCommandVisitor.class); - _client = new Client(_delegate); - _client.setClientCommandVisitor(_visitor); - _participant = mock(ParticipantExecutor.class); - when(_participant.getParticipantName()).thenReturn("testParticipantMock"); - - _participantRegistry = mock(ParticipantExecutorRegistry.class); - when(_participantRegistry.executors()).thenReturn(Collections.singletonList(_participant)); - _client.setParticipantRegistry(_participantRegistry); - } - - public void testInitialState() throws Exception - { - assertEquals("Expected client to be in CREATED state", ClientState.CREATED, _client.getState()); - } - - public void testStart() throws Exception - { - _client.start(); - final InOrder inOrder = inOrder(_delegate); - inOrder.verify(_delegate).setInstructionListener(_client); - inOrder.verify(_delegate).sendRegistrationMessage(); - assertEquals("Expected client to be in STARTED state", ClientState.READY, _client.getState()); - } - - public void testStopClient() throws Exception - { - _client.stop(); - - assertEquals("Expected client to be in STOPPED state", ClientState.STOPPED, _client.getState()); - } - - public void testProcessInstructionVisitsCommandAndResponds() throws Exception - { - // has to be declared to be of supertype Command otherwise Mockito verify() - // refers to wrong method - final Command command = new StopClientCommand(); - _client.processInstruction(command); - - verify(_visitor).visit(command); - verify(_delegate).sendResponseMessage(isA(Response.class)); - } - - public void testWaitUntilStopped() throws Exception - { - stopClientLater(500); - _client.waitUntilStopped(1000); - verify(_delegate).destroy(); - } - - public void testStartTest() throws Exception - { - _client.start(); - _client.addParticipantExecutor(_participant); - - verify(_participantRegistry).add(_participant); - - _client.startTest(); - - InOrder inOrder = Mockito.inOrder(_delegate, _participant); - inOrder.verify(_delegate).startConnections(); - inOrder.verify(_participant).start(_client); - } - - public void testTearDownTest() throws Exception - { - // before we can tear down the test the client needs to be in the "running test" state, which requires a participant - _client.start(); - _client.addParticipantExecutor(_participant); - _client.startTest(); - - _client.tearDownTest(); - - verify(_delegate).tearDownTest(); - - verify(_participantRegistry).clear(); - } - - public void testResults() throws Exception - { - ParticipantResult testResult = mock(ParticipantResult.class); - _client.sendResults(testResult); - verify(_delegate).sendResponseMessage(testResult); - } - - private void stopClientLater(long delay) - { - doLater(new TimerTask() - { - @Override - public void run() - { - _client.stop(); - } - - }, delay); - } - - private void doLater(TimerTask task, long delayInMillis) - { - Timer timer = new Timer(); - timer.schedule(task, delayInMillis); - } - -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ConsumerParticipantTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ConsumerParticipantTest.java deleted file mode 100644 index f75415a2bf..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ConsumerParticipantTest.java +++ /dev/null @@ -1,202 +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.client; - -import static org.apache.qpid.disttest.client.ParticipantTestHelper.assertExpectedConsumerResults; -import static org.mockito.Matchers.anyLong; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.atLeastOnce; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.Collection; - -import javax.jms.Message; -import javax.jms.Session; - -import org.apache.qpid.disttest.DistributedTestException; -import org.apache.qpid.disttest.jms.ClientJmsDelegate; -import org.apache.qpid.disttest.message.ConsumerParticipantResult; -import org.apache.qpid.disttest.message.CreateConsumerCommand; -import org.apache.qpid.disttest.message.ParticipantResult; -import org.apache.qpid.test.utils.QpidTestCase; -import org.mockito.InOrder; - -public class ConsumerParticipantTest extends QpidTestCase -{ - private static final String SESSION_NAME1 = "SESSION1"; - private static final String PARTICIPANT_NAME1 = "PARTICIPANT_NAME1"; - private static final long RECEIVE_TIMEOUT = 100; - private static final String CLIENT_NAME = "CLIENT_NAME"; - private static final int PAYLOAD_SIZE_PER_MESSAGE = 1024; - - private final Message _mockMessage = mock(Message.class); - private final CreateConsumerCommand _command = new CreateConsumerCommand(); - private ClientJmsDelegate _delegate; - private ConsumerParticipant _consumerParticipant; - private InOrder _inOrder; - - /** used to check start/end time of results */ - private long _testStartTime; - - @Override - protected void setUp() throws Exception - { - super.setUp(); - _delegate = mock(ClientJmsDelegate.class); - _inOrder = inOrder(_delegate); - - _command.setSessionName(SESSION_NAME1); - _command.setParticipantName(PARTICIPANT_NAME1); - _command.setSynchronous(true); - _command.setReceiveTimeout(RECEIVE_TIMEOUT); - - _consumerParticipant = new ConsumerParticipant(_delegate, _command); - - when(_delegate.consumeMessage(PARTICIPANT_NAME1, RECEIVE_TIMEOUT)).thenReturn(_mockMessage); - when(_delegate.calculatePayloadSizeFrom(_mockMessage)).thenReturn(PAYLOAD_SIZE_PER_MESSAGE); - when(_delegate.getAcknowledgeMode(SESSION_NAME1)).thenReturn(Session.CLIENT_ACKNOWLEDGE); - - _testStartTime = System.currentTimeMillis(); - } - - public void testNoMessagesToReceive() throws Exception - { - _command.setNumberOfMessages(0); - _command.setMaximumDuration(0); - - try - { - _consumerParticipant.doIt(CLIENT_NAME); - fail("Exception not thrown"); - } - catch(DistributedTestException e) - { - // PASS - assertEquals("number of messages and duration cannot both be zero", e.getMessage()); - - } - - verify(_delegate, never()).consumeMessage(anyString(), anyLong()); - } - - public void testReceiveOneMessageSynch() throws Exception - { - int numberOfMessages = 1; - long totalPayloadSize = PAYLOAD_SIZE_PER_MESSAGE * numberOfMessages; - _command.setNumberOfMessages(numberOfMessages); - - ParticipantResult result = _consumerParticipant.doIt(CLIENT_NAME); - - assertExpectedConsumerResults(result, PARTICIPANT_NAME1, CLIENT_NAME, _testStartTime, - Session.CLIENT_ACKNOWLEDGE, null, numberOfMessages, PAYLOAD_SIZE_PER_MESSAGE, totalPayloadSize, null); - - _inOrder.verify(_delegate).consumeMessage(PARTICIPANT_NAME1, RECEIVE_TIMEOUT); - _inOrder.verify(_delegate).calculatePayloadSizeFrom(_mockMessage); - _inOrder.verify(_delegate).commitOrAcknowledgeMessageIfNecessary(SESSION_NAME1, _mockMessage); - } - - public void testReceiveMessagesForDurationSynch() throws Exception - { - long duration = 100; - _command.setMaximumDuration(duration); - - ParticipantResult result = _consumerParticipant.doIt(CLIENT_NAME); - - assertExpectedConsumerResults(result, PARTICIPANT_NAME1, CLIENT_NAME, _testStartTime, - Session.CLIENT_ACKNOWLEDGE, null, null, PAYLOAD_SIZE_PER_MESSAGE, null, duration); - - verify(_delegate, atLeastOnce()).consumeMessage(PARTICIPANT_NAME1, RECEIVE_TIMEOUT); - verify(_delegate, atLeastOnce()).calculatePayloadSizeFrom(_mockMessage); - verify(_delegate, atLeastOnce()).commitOrAcknowledgeMessageIfNecessary(SESSION_NAME1, _mockMessage); - } - - public void testReceiveMessagesBatchedSynch() throws Exception - { - int numberOfMessages = 10; - final int batchSize = 3; - long totalPayloadSize = PAYLOAD_SIZE_PER_MESSAGE * numberOfMessages; - _command.setNumberOfMessages(numberOfMessages); - _command.setBatchSize(batchSize); - - ParticipantResult result = _consumerParticipant.doIt(CLIENT_NAME); - - assertExpectedConsumerResults(result, PARTICIPANT_NAME1, CLIENT_NAME, _testStartTime, - Session.CLIENT_ACKNOWLEDGE, batchSize, numberOfMessages, PAYLOAD_SIZE_PER_MESSAGE, totalPayloadSize, null); - - verify(_delegate, times(numberOfMessages)).consumeMessage(PARTICIPANT_NAME1, RECEIVE_TIMEOUT); - verify(_delegate, times(numberOfMessages)).calculatePayloadSizeFrom(_mockMessage); - verify(_delegate, times(4)).commitOrAcknowledgeMessageIfNecessary(SESSION_NAME1, _mockMessage); - } - - public void testReceiveMessagesWithVaryingPayloadSize() throws Exception - { - int numberOfMessages = 3; - - int firstPayloadSize = PAYLOAD_SIZE_PER_MESSAGE; - int secondPayloadSize = PAYLOAD_SIZE_PER_MESSAGE * 2; - int thirdPayloadSize = PAYLOAD_SIZE_PER_MESSAGE * 4; - - _command.setNumberOfMessages(numberOfMessages); - - when(_delegate.calculatePayloadSizeFrom(_mockMessage)).thenReturn(firstPayloadSize, secondPayloadSize, thirdPayloadSize); - - ParticipantResult result = _consumerParticipant.doIt(CLIENT_NAME); - - final int expectedPayloadResultPayloadSize = 0; - final long totalPayloadSize = firstPayloadSize + secondPayloadSize + thirdPayloadSize; - assertExpectedConsumerResults(result, PARTICIPANT_NAME1, CLIENT_NAME, _testStartTime, - Session.CLIENT_ACKNOWLEDGE, null, numberOfMessages, expectedPayloadResultPayloadSize, totalPayloadSize, null); - - verify(_delegate, times(numberOfMessages)).consumeMessage(PARTICIPANT_NAME1, RECEIVE_TIMEOUT); - verify(_delegate, times(numberOfMessages)).calculatePayloadSizeFrom(_mockMessage); - verify(_delegate, times(numberOfMessages)).commitOrAcknowledgeMessageIfNecessary(SESSION_NAME1, _mockMessage); - } - - public void testReleaseResources() - { - _consumerParticipant.releaseResources(); - verify(_delegate).closeTestConsumer(PARTICIPANT_NAME1); - } - - public void testLatency() throws Exception - { - int numberOfMessages = 1; - long totalPayloadSize = PAYLOAD_SIZE_PER_MESSAGE * numberOfMessages; - _command.setNumberOfMessages(numberOfMessages); - _command.setEvaluateLatency(true); - _consumerParticipant = new ConsumerParticipant(_delegate, _command); - ParticipantResult result = _consumerParticipant.doIt(CLIENT_NAME); - - assertExpectedConsumerResults(result, PARTICIPANT_NAME1, CLIENT_NAME, _testStartTime, - Session.CLIENT_ACKNOWLEDGE, null, numberOfMessages, PAYLOAD_SIZE_PER_MESSAGE, totalPayloadSize, null); - - _inOrder.verify(_delegate).consumeMessage(PARTICIPANT_NAME1, RECEIVE_TIMEOUT); - _inOrder.verify(_delegate).calculatePayloadSizeFrom(_mockMessage); - _inOrder.verify(_delegate).commitOrAcknowledgeMessageIfNecessary(SESSION_NAME1, _mockMessage); - assertTrue("Unexpected consuemr results", result instanceof ConsumerParticipantResult); - Collection latencies = ((ConsumerParticipantResult)result).getMessageLatencies(); - assertNotNull("Message latency is not cllected", latencies); - assertEquals("Unexpected message latency results", 1, latencies.size()); - } -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/MessageProviderTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/MessageProviderTest.java deleted file mode 100644 index 8863e0f289..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/MessageProviderTest.java +++ /dev/null @@ -1,107 +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.client; - -import static org.mockito.Matchers.isA; -import static org.mockito.Mockito.atLeastOnce; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.jms.Message; -import javax.jms.Session; -import javax.jms.TextMessage; - -import org.apache.qpid.disttest.client.property.ListPropertyValue; -import org.apache.qpid.disttest.client.property.PropertyValue; -import org.apache.qpid.disttest.client.property.SimplePropertyValue; -import org.apache.qpid.disttest.message.CreateProducerCommand; -import org.apache.qpid.test.utils.QpidTestCase; - -public class MessageProviderTest extends QpidTestCase -{ - private Session _session; - private TextMessage _message; - - @Override - protected void setUp() throws Exception - { - super.setUp(); - _session = mock(Session.class); - _message = mock(TextMessage.class); - when(_session.createTextMessage(isA(String.class))).thenReturn(_message); - when(_session.createTextMessage()).thenReturn(_message); - } - - public void testGetMessagePayload() throws Exception - { - MessageProvider messageProvider = new MessageProvider(null) - { - @Override - public String getMessagePayload(CreateProducerCommand command) - { - return super.getMessagePayload(command); - } - }; - CreateProducerCommand command = new CreateProducerCommand(); - command.setMessageSize(100); - String payloadValue = messageProvider.getMessagePayload(command); - assertNotNull("Mesage payload should not be null", payloadValue); - assertEquals("Unexpected payload size", 100, payloadValue.length()); - } - - public void testNextMessage() throws Exception - { - MessageProvider messageProvider = new MessageProvider(null); - CreateProducerCommand command = new CreateProducerCommand(); - command.setMessageSize(100); - Message message = messageProvider.nextMessage(_session, command); - assertNotNull("Mesage should be returned", message); - verify(_message, atLeastOnce()).setText(isA(String.class)); - } - - public void testNextMessageWithProperties() throws Exception - { - Map properties = new HashMap(); - properties.put("test1", new SimplePropertyValue("testValue1")); - properties.put("test2", new SimplePropertyValue(new Integer(1))); - properties.put("priority", new SimplePropertyValue(new Integer(2))); - List listItems = new ArrayList(); - listItems.add(new SimplePropertyValue(new Double(2.0))); - ListPropertyValue list = new ListPropertyValue(); - list.setItems(listItems); - properties.put("test3", list); - - MessageProvider messageProvider = new MessageProvider(properties); - CreateProducerCommand command = new CreateProducerCommand(); - command.setMessageSize(100); - Message message = messageProvider.nextMessage(_session, command); - assertNotNull("Mesage should be returned", message); - verify(_message, atLeastOnce()).setText(isA(String.class)); - verify(_message, atLeastOnce()).setJMSPriority(2); - verify(_message, atLeastOnce()).setStringProperty("test1", "testValue1"); - verify(_message, atLeastOnce()).setIntProperty("test2", 1); - verify(_message, atLeastOnce()).setDoubleProperty("test3", 2.0); - } -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ParticipantExecutorTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ParticipantExecutorTest.java deleted file mode 100644 index 6720047cd1..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ParticipantExecutorTest.java +++ /dev/null @@ -1,198 +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.client; - -import static org.mockito.Matchers.argThat; -import static org.mockito.Mockito.doThrow; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.Executor; -import java.util.concurrent.TimeUnit; - -import org.apache.qpid.disttest.DistributedTestException; -import org.apache.qpid.disttest.message.ParticipantResult; -import org.apache.qpid.test.utils.QpidTestCase; -import org.mockito.ArgumentMatcher; -import org.mockito.InOrder; - -public class ParticipantExecutorTest extends QpidTestCase -{ - private static final ResultHasError HAS_ERROR = new ResultHasError(); - private static final String CLIENT_NAME = "CLIENT_NAME"; - private static final String PARTICIPANT_NAME = "PARTICIPANT_NAME"; - private ParticipantExecutor _participantExecutor = null; - private Client _client = null; - private Participant _participant = null; - private ParticipantResult _mockResult; - - @Override - protected void setUp() throws Exception - { - super.setUp(); - - _client = mock(Client.class); - when(_client.getClientName()).thenReturn(CLIENT_NAME); - _participant = mock(Participant.class); - - _participantExecutor = new ParticipantExecutor(_participant); - _participantExecutor.setExecutor(new SynchronousExecutor()); - - _mockResult = mock(ParticipantResult.class); - } - - public void testStart() throws Exception - { - when(_participant.doIt(CLIENT_NAME)).thenReturn(_mockResult); - - _participantExecutor.start(_client); - - InOrder inOrder = inOrder(_participant, _client); - - inOrder.verify(_participant).doIt(CLIENT_NAME); - inOrder.verify(_participant).releaseResources(); - inOrder.verify(_client).sendResults(_mockResult); - } - - public void testParticipantThrowsException() throws Exception - { - when(_participant.doIt(CLIENT_NAME)).thenThrow(DistributedTestException.class); - - _participantExecutor.start(_client); - - InOrder inOrder = inOrder(_participant, _client); - - inOrder.verify(_participant).doIt(CLIENT_NAME); - inOrder.verify(_participant).releaseResources(); - inOrder.verify(_client).sendResults(argThat(HAS_ERROR)); - } - - public void testReleaseResourcesThrowsException() throws Exception - { - when(_participant.doIt(CLIENT_NAME)).thenReturn(_mockResult); - doThrow(DistributedTestException.class).when(_participant).releaseResources(); - - _participantExecutor.start(_client); - - InOrder inOrder = inOrder(_participant, _client); - - inOrder.verify(_participant).doIt(CLIENT_NAME); - inOrder.verify(_participant).releaseResources(); - - // check that sendResults is called even though releaseResources threw an exception - inOrder.verify(_client).sendResults(_mockResult); - } - - public void testThreadNameAndDaemonness() throws Exception - { - ThreadPropertyReportingParticipant participant = new ThreadPropertyReportingParticipant(PARTICIPANT_NAME); - _participantExecutor = new ParticipantExecutor(participant); - - _participantExecutor.start(_client); - participant.awaitExecution(); - - assertTrue("Participant should be run in a thread named after it", participant.threadWasCalled().endsWith(PARTICIPANT_NAME)); - assertTrue("Executor should use daemon threads to avoid them preventing JVM termination", participant.wasDaemon()); - } - - private static final class ThreadPropertyReportingParticipant implements Participant - { - private final String _participantName; - private final CountDownLatch _participantExecuted = new CountDownLatch(1); - private String _threadName; - private boolean _daemon; - - public ThreadPropertyReportingParticipant(String participantName) - { - _participantName = participantName; - } - - public String threadWasCalled() - { - return _threadName; - } - - public boolean wasDaemon() - { - return _daemon; - } - - @Override - public void releaseResources() - { - } - - @Override - public String getName() - { - return _participantName; - } - - @Override - public ParticipantResult doIt(String registeredClientName) throws Exception - { - Thread currentThread = Thread.currentThread(); - _threadName = currentThread.getName(); - _daemon = currentThread.isDaemon(); - - _participantExecuted.countDown(); - - return null; // unused - } - - public void awaitExecution() - { - boolean success = false; - try - { - success = _participantExecuted.await(5, TimeUnit.SECONDS); - } - catch (InterruptedException e) - { - Thread.currentThread().interrupt(); - } - - assertTrue("Participant not executed", success); - } - } - - /** avoids our unit test needing to use multiple threads */ - private final class SynchronousExecutor implements Executor - { - @Override - public void execute(Runnable command) - { - command.run(); - } - } - - private static class ResultHasError extends ArgumentMatcher - { - @Override - public boolean matches(Object argument) - { - ParticipantResult result = (ParticipantResult) argument; - return result.hasError(); - } - } - -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ParticipantRegistryTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ParticipantRegistryTest.java deleted file mode 100644 index 5cc8d2f30a..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ParticipantRegistryTest.java +++ /dev/null @@ -1,56 +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.client; - -import static org.mockito.Mockito.mock; - -import org.apache.qpid.test.utils.QpidTestCase; - -public class ParticipantRegistryTest extends QpidTestCase -{ - private ParticipantExecutorRegistry _participantRegistry = new ParticipantExecutorRegistry(); - - private ParticipantExecutor _testParticipant1 = mock(ParticipantExecutor.class); - private ParticipantExecutor _testParticipant2 = mock(ParticipantExecutor.class); - - public void testAdd() - { - assertTrue(_participantRegistry.executors().isEmpty()); - - _participantRegistry.add(_testParticipant1); - - assertTrue(_participantRegistry.executors().contains(_testParticipant1)); - - _participantRegistry.add(_testParticipant2); - - assertTrue(_participantRegistry.executors().contains(_testParticipant2)); - } - - public void testClear() - { - _participantRegistry.add(_testParticipant1); - - assertEquals(1, _participantRegistry.executors().size()); - - _participantRegistry.clear(); - - assertTrue(_participantRegistry.executors().isEmpty()); - } -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ParticipantResultFactoryTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ParticipantResultFactoryTest.java deleted file mode 100644 index 9eab459443..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ParticipantResultFactoryTest.java +++ /dev/null @@ -1,182 +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.client; - -import java.util.Date; - -import javax.jms.DeliveryMode; - -import org.apache.qpid.disttest.message.ConsumerParticipantResult; -import org.apache.qpid.disttest.message.CreateConsumerCommand; -import org.apache.qpid.disttest.message.CreateParticpantCommand; -import org.apache.qpid.disttest.message.CreateProducerCommand; -import org.apache.qpid.disttest.message.ParticipantResult; -import org.apache.qpid.disttest.message.ProducerParticipantResult; -import org.apache.qpid.test.utils.QpidTestCase; - -public class ParticipantResultFactoryTest extends QpidTestCase -{ - private static final String PARTICIPANT_NAME = "participantName"; - private static final String REGISTERED_CLIENT_NAME = "registeredClientName"; - - private static final int BATCH_SIZE = 10; - private static final long MAXIMUM_DURATION = 500; - private static final int NUMBER_OF_MESSAGES_PROCESSED = 100; - private static final long TIME_TAKEN = 100; - private static final long TOTAL_PAYLOAD_PROCESSED = 200; - private static final int PAYLOAD_SIZE = 300; - - private static final Date START = new Date(0); - private static final Date END = new Date(START.getTime() + TIME_TAKEN); - - private ParticipantResultFactory _participantResultFactory; - - @Override - protected void setUp() throws Exception - { - super.setUp(); - - _participantResultFactory = new ParticipantResultFactory(); - } - - public void testCreateForProducer() - { - CreateProducerCommand command = new CreateProducerCommand(); - setCommonCommandFields(command); - - long producerStartDelay = 30; - command.setStartDelay(producerStartDelay); - - int deliveryMode = DeliveryMode.PERSISTENT; - command.setDeliveryMode(deliveryMode); - - int priority = 5; - command.setPriority(priority); - - long producerInterval = 50; - command.setInterval(producerInterval); - - long timeToLive = 60; - command.setTimeToLive(timeToLive); - - int totalNumberOfConsumers = 0; - int totalNumberOfProducers = 1; - - int acknowledgeMode = 1; - - ProducerParticipantResult result = _participantResultFactory.createForProducer(PARTICIPANT_NAME, - REGISTERED_CLIENT_NAME, - command, - acknowledgeMode, - NUMBER_OF_MESSAGES_PROCESSED, - PAYLOAD_SIZE, - TOTAL_PAYLOAD_PROCESSED, - START, END); - - assertCommonResultProperties(result); - - assertEquals(deliveryMode, result.getDeliveryMode()); - assertEquals(acknowledgeMode, result.getAcknowledgeMode()); - assertEquals(priority, result.getPriority()); - assertEquals(producerInterval, result.getInterval()); - assertEquals(producerStartDelay, result.getStartDelay()); - assertEquals(timeToLive, result.getTimeToLive()); - assertEquals(totalNumberOfConsumers, result.getTotalNumberOfConsumers()); - assertEquals(totalNumberOfProducers, result.getTotalNumberOfProducers()); - } - - public void testCreateForConsumer() - { - CreateConsumerCommand command = new CreateConsumerCommand(); - setCommonCommandFields(command); - - boolean topic = true; - command.setTopic(topic); - - boolean durable = true; - command.setDurableSubscription(durable); - - boolean browsingSubscription = false; - command.setBrowsingSubscription(browsingSubscription); - - String selector = "selector"; - boolean isSelector = true; - command.setSelector(selector); - - boolean noLocal = false; - command.setNoLocal(noLocal); - - boolean synchronousConsumer = true; - command.setSynchronous(synchronousConsumer); - - int totalNumberOfConsumers = 1; - int totalNumberOfProducers = 0; - - int acknowledgeMode = 2; - - ConsumerParticipantResult result = _participantResultFactory.createForConsumer(PARTICIPANT_NAME, - REGISTERED_CLIENT_NAME, - command, - acknowledgeMode, - NUMBER_OF_MESSAGES_PROCESSED, - PAYLOAD_SIZE, - TOTAL_PAYLOAD_PROCESSED, - START, END); - - assertCommonResultProperties(result); - - assertEquals(topic, result.isTopic()); - assertEquals(durable, result.isDurableSubscription()); - assertEquals(browsingSubscription, result.isBrowsingSubscription()); - assertEquals(isSelector, result.isSelector()); - assertEquals(noLocal, result.isNoLocal()); - assertEquals(synchronousConsumer, result.isSynchronousConsumer()); - assertEquals(totalNumberOfConsumers, result.getTotalNumberOfConsumers()); - assertEquals(totalNumberOfProducers, result.getTotalNumberOfProducers()); - } - - public void testCreateForError() - { - String errorMessage = "error"; - ParticipantResult result = _participantResultFactory.createForError(PARTICIPANT_NAME, REGISTERED_CLIENT_NAME, errorMessage); - assertEquals(PARTICIPANT_NAME, result.getParticipantName()); - assertEquals(REGISTERED_CLIENT_NAME, result.getRegisteredClientName()); - } - - - private void setCommonCommandFields(CreateParticpantCommand command) - { - command.setBatchSize(BATCH_SIZE); - command.setMaximumDuration(MAXIMUM_DURATION); - } - - - private void assertCommonResultProperties(ParticipantResult result) - { - assertEquals(PARTICIPANT_NAME, result.getParticipantName()); - assertEquals(REGISTERED_CLIENT_NAME, result.getRegisteredClientName()); - assertEquals(BATCH_SIZE, result.getBatchSize()); - assertEquals(MAXIMUM_DURATION, result.getMaximumDuration()); - assertEquals(TIME_TAKEN, result.getTimeTaken()); - assertEquals(NUMBER_OF_MESSAGES_PROCESSED, result.getNumberOfMessagesProcessed()); - assertEquals(TOTAL_PAYLOAD_PROCESSED, result.getTotalPayloadProcessed()); - assertEquals(PAYLOAD_SIZE, result.getPayloadSize()); - } - -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ParticipantTestHelper.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ParticipantTestHelper.java deleted file mode 100644 index 5508ac8aca..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ParticipantTestHelper.java +++ /dev/null @@ -1,83 +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.client; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -import org.apache.qpid.disttest.message.ParticipantResult; - -public class ParticipantTestHelper -{ - - public static void assertAtLeast(String message, final long minimumExpected, final long actual) - { - assertTrue(message + " " + actual, actual >= minimumExpected); - } - - public static void assertExpectedConsumerResults(ParticipantResult result, String participantName, String registeredClientName, long expectedTestStartTime, int expectedAcknowledgeMode, Integer expectedBatchSize, Integer expectedNumberOfMessages, Integer expectedPayloadSize, Long expectedTotalPayloadProcessed, Long expectedMinimumExpectedDuration) - { - assertExpectedResults(result, participantName, registeredClientName, expectedTestStartTime, - expectedAcknowledgeMode, expectedBatchSize, expectedNumberOfMessages, expectedPayloadSize, expectedTotalPayloadProcessed, expectedMinimumExpectedDuration); - assertEquals("Unexpected number of consumers", 1, result.getTotalNumberOfConsumers()); - assertEquals("Unexpected number of producers", 0, result.getTotalNumberOfProducers()); - } - - public static void assertExpectedProducerResults(ParticipantResult result, String participantName, String registeredClientName, long expectedTestStartTime, int expectedAcknowledgeMode, Integer expectedBatchSize, Integer expectedNumberOfMessages, Integer expectedPayloadSize, Long expectedTotalPayloadProcessed, Long expectedMinimumExpectedDuration) - { - assertExpectedResults(result, participantName, registeredClientName, expectedTestStartTime, expectedAcknowledgeMode, expectedBatchSize, expectedNumberOfMessages, expectedPayloadSize, expectedTotalPayloadProcessed, expectedMinimumExpectedDuration); - assertEquals("Unexpected number of producers", 1, result.getTotalNumberOfProducers()); - assertEquals("Unexpected number of consumers", 0, result.getTotalNumberOfConsumers()); - } - - private static void assertExpectedResults(ParticipantResult result, String participantName, String registeredClientName, long expectedTestStartTime, int expectedAcknowledgeMode, Integer expectedBatchSize, Integer expectedNumberOfMessages, Integer expectedPayloadSize, Long expectedTotalPayloadProcessed, Long expectedMinimumExpectedDuration) - { - assertFalse(result.hasError()); - - assertEquals("unexpected participant name", participantName, result.getParticipantName()); - assertEquals("unexpected client name", registeredClientName, result.getRegisteredClientName()); - - assertAtLeast("start time of result is too low", expectedTestStartTime, result.getStartInMillis()); - assertAtLeast("end time of result should be after start time", result.getStartInMillis(), result.getEndInMillis()); - - assertEquals("unexpected acknowledge mode", expectedAcknowledgeMode, result.getAcknowledgeMode()); - - if(expectedNumberOfMessages != null) - { - assertEquals("unexpected number of messages", expectedNumberOfMessages.intValue(), result.getNumberOfMessagesProcessed()); - } - if(expectedBatchSize != null) - { - assertEquals("unexpected batch size", expectedBatchSize.intValue(), result.getBatchSize()); - } - if (expectedPayloadSize != null) - { - assertEquals("unexpected payload size", expectedPayloadSize.intValue(), result.getPayloadSize()); - } - if (expectedTotalPayloadProcessed != null) - { - assertEquals("unexpected total payload processed", expectedTotalPayloadProcessed.longValue(), result.getTotalPayloadProcessed()); - } - if(expectedMinimumExpectedDuration != null) - { - assertAtLeast("participant did not take a sufficient length of time.", expectedMinimumExpectedDuration, result.getTimeTaken()); - } - } -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ProducerParticipantTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ProducerParticipantTest.java deleted file mode 100644 index 08ee8715fd..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ProducerParticipantTest.java +++ /dev/null @@ -1,235 +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.client; - -import static org.apache.qpid.disttest.client.ParticipantTestHelper.assertExpectedProducerResults; -import static org.mockito.Matchers.isA; -import static org.mockito.Mockito.atLeastOnce; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import javax.jms.DeliveryMode; -import javax.jms.Message; -import javax.jms.Session; - -import org.apache.qpid.disttest.DistributedTestException; -import org.apache.qpid.disttest.jms.ClientJmsDelegate; -import org.apache.qpid.disttest.message.CreateProducerCommand; -import org.apache.qpid.disttest.message.ParticipantResult; -import org.apache.qpid.test.utils.QpidTestCase; -import org.mockito.InOrder; - -public class ProducerParticipantTest extends QpidTestCase -{ - private ProducerParticipant _producer; - - private static final String SESSION_NAME1 = "SESSION1"; - private static final String PARTICIPANT_NAME1 = "PARTICIPANT_NAME1"; - - private static final String CLIENT_NAME = "CLIENT_NAME"; - private static final int PAYLOAD_SIZE_PER_MESSAGE = 1024; - - - private final Message _mockMessage = mock(Message.class); - private final CreateProducerCommand _command = new CreateProducerCommand(); - private ClientJmsDelegate _delegate; - private InOrder _inOrder; - - /** used to check start/end time of results */ - private long _testStartTime; - - @Override - protected void setUp() throws Exception - { - super.setUp(); - _delegate = mock(ClientJmsDelegate.class); - _inOrder = inOrder(_delegate); - - _command.setSessionName(SESSION_NAME1); - _command.setParticipantName(PARTICIPANT_NAME1); - - when(_delegate.sendNextMessage(isA(CreateProducerCommand.class))).thenReturn(_mockMessage); - when(_delegate.calculatePayloadSizeFrom(_mockMessage)).thenReturn(PAYLOAD_SIZE_PER_MESSAGE); - when(_delegate.getAcknowledgeMode(SESSION_NAME1)).thenReturn(Session.AUTO_ACKNOWLEDGE); - - _producer = new ProducerParticipant(_delegate, _command); - - _testStartTime = System.currentTimeMillis(); - } - - public void testStartDelay() throws Exception - { - final long delay = 100; - int numberOfMessages = 1; - long totalPayloadSize = PAYLOAD_SIZE_PER_MESSAGE * numberOfMessages; - - _command.setStartDelay(delay); - _command.setNumberOfMessages(numberOfMessages); - - ParticipantResult result = _producer.doIt(CLIENT_NAME); - - long expectedPublishedStartTime = _testStartTime + delay; - assertExpectedProducerResults(result, PARTICIPANT_NAME1, CLIENT_NAME, expectedPublishedStartTime, Session.AUTO_ACKNOWLEDGE, null, numberOfMessages, PAYLOAD_SIZE_PER_MESSAGE, totalPayloadSize, null); - } - - - public void testNoMessagesToSend() throws Exception - { - _command.setNumberOfMessages(0); - _command.setMaximumDuration(0); - - try - { - _producer.doIt(CLIENT_NAME); - fail("Exception not thrown"); - } - catch (DistributedTestException e) - { - // PASS - assertEquals("number of messages and duration cannot both be zero", e.getMessage()); - } - } - - public void testOneMessageToSend() throws Exception - { - int batchSize = 1; - int numberOfMessages = 1; - long totalPayloadSize = PAYLOAD_SIZE_PER_MESSAGE * numberOfMessages; - int deliveryMode = DeliveryMode.PERSISTENT; - - _command.setNumberOfMessages(numberOfMessages); - _command.setBatchSize(batchSize); - _command.setDeliveryMode(deliveryMode); - - ParticipantResult result = _producer.doIt(CLIENT_NAME); - assertExpectedProducerResults(result, PARTICIPANT_NAME1, CLIENT_NAME, _testStartTime, - Session.AUTO_ACKNOWLEDGE, null, numberOfMessages, PAYLOAD_SIZE_PER_MESSAGE, totalPayloadSize, null); - - _inOrder.verify(_delegate).sendNextMessage(isA(CreateProducerCommand.class)); - _inOrder.verify(_delegate).calculatePayloadSizeFrom(_mockMessage); - _inOrder.verify(_delegate).commitIfNecessary(SESSION_NAME1); - - } - - public void testSendMessagesForDuration() throws Exception - { - final long duration = 1000; - _command.setMaximumDuration(duration); - - ParticipantResult result = _producer.doIt(CLIENT_NAME); - assertExpectedProducerResults(result, PARTICIPANT_NAME1, CLIENT_NAME, _testStartTime, - Session.AUTO_ACKNOWLEDGE, null, null, PAYLOAD_SIZE_PER_MESSAGE, null, duration); - - verify(_delegate, atLeastOnce()).sendNextMessage(isA(CreateProducerCommand.class)); - verify(_delegate, atLeastOnce()).calculatePayloadSizeFrom(_mockMessage); - verify(_delegate, atLeastOnce()).commitIfNecessary(SESSION_NAME1); - } - - public void testSendMessagesForDurationWithDelayExceedingDuration() throws Exception - { - final long duration = 100; - _command.setMaximumDuration(duration); - _command.setStartDelay(150); - - try - { - _producer.doIt(CLIENT_NAME); - fail("Exception should be thrown indicating configuration error"); - } - catch(DistributedTestException e) - { - assertEquals("Start delay must be less than maximum test duration", e.getMessage()); - } - } - - public void testSendMessageBatches() throws Exception - { - final int batchSize = 3; - final int numberOfMessages = 10; - final int expectedNumberOfCommits = 4; // one for each batch of 3 messages, plus one more at the end of the test for the tenth msg. - long totalPayloadSize = PAYLOAD_SIZE_PER_MESSAGE * numberOfMessages; - - _command.setNumberOfMessages(numberOfMessages); - _command.setBatchSize(batchSize); - - ParticipantResult result = _producer.doIt(CLIENT_NAME); - assertExpectedProducerResults(result, PARTICIPANT_NAME1, CLIENT_NAME, _testStartTime, - Session.AUTO_ACKNOWLEDGE, batchSize, numberOfMessages, PAYLOAD_SIZE_PER_MESSAGE, totalPayloadSize, null); - - verify(_delegate, times(numberOfMessages)).sendNextMessage(isA(CreateProducerCommand.class)); - verify(_delegate, times(numberOfMessages)).calculatePayloadSizeFrom(_mockMessage); - verify(_delegate, times(expectedNumberOfCommits)).commitIfNecessary(SESSION_NAME1); - } - - public void testSendMessageWithPublishInterval() throws Exception - { - final int batchSize = 3; - final long publishInterval = 100; - int numberOfMessages = 10; - long totalPayloadSize = PAYLOAD_SIZE_PER_MESSAGE * numberOfMessages; - - final long expectedTimeToRunTest = batchSize * publishInterval; - - _command.setNumberOfMessages(numberOfMessages); - _command.setBatchSize(batchSize); - _command.setInterval(publishInterval); - - ParticipantResult result = _producer.doIt(CLIENT_NAME); - assertExpectedProducerResults(result, PARTICIPANT_NAME1, CLIENT_NAME, _testStartTime, - Session.AUTO_ACKNOWLEDGE, null, numberOfMessages, null, totalPayloadSize, expectedTimeToRunTest); - - verify(_delegate, times(numberOfMessages)).sendNextMessage(isA(CreateProducerCommand.class)); - verify(_delegate, times(numberOfMessages)).calculatePayloadSizeFrom(_mockMessage); - verify(_delegate, times(4)).commitIfNecessary(SESSION_NAME1); - } - - public void testSendMessageWithVaryingPayloadSize() throws Exception - { - int numberOfMessages = 3; - - int firstPayloadSize = PAYLOAD_SIZE_PER_MESSAGE; - int secondPayloadSize = PAYLOAD_SIZE_PER_MESSAGE * 2; - int thirdPayloadSize = PAYLOAD_SIZE_PER_MESSAGE * 4; - - final long totalPayloadSize = firstPayloadSize + secondPayloadSize + thirdPayloadSize; - - when(_delegate.calculatePayloadSizeFrom(_mockMessage)).thenReturn(firstPayloadSize, secondPayloadSize, thirdPayloadSize); - - _command.setNumberOfMessages(numberOfMessages); - - ParticipantResult result = _producer.doIt(CLIENT_NAME); - - final int expectedPayloadResultPayloadSize = 0; - assertExpectedProducerResults(result, PARTICIPANT_NAME1, CLIENT_NAME, _testStartTime, - Session.AUTO_ACKNOWLEDGE, null, numberOfMessages, expectedPayloadResultPayloadSize, totalPayloadSize, null); - - verify(_delegate, times(numberOfMessages)).sendNextMessage(isA(CreateProducerCommand.class)); - verify(_delegate, times(numberOfMessages)).calculatePayloadSizeFrom(_mockMessage); - verify(_delegate, times(numberOfMessages)).commitIfNecessary(SESSION_NAME1); - } - - public void testReleaseResources() - { - _producer.releaseResources(); - verify(_delegate).closeTestProducer(PARTICIPANT_NAME1); - } -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/property/ListPropertyValueTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/property/ListPropertyValueTest.java deleted file mode 100644 index 3172eb07ed..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/property/ListPropertyValueTest.java +++ /dev/null @@ -1,85 +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.client.property; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.qpid.test.utils.QpidTestCase; - -public class ListPropertyValueTest extends QpidTestCase -{ - private ListPropertyValue _generator; - private List _items; - - @Override - public void setUp() throws Exception - { - super.setUp(); - _generator = new ListPropertyValue(); - _items = new ArrayList(); - _items.add(new SimplePropertyValue(new Integer(1))); - _items.add(new SimplePropertyValue(new Double(2.1))); - _items.add(new SimplePropertyValue(new Boolean(true))); - ListPropertyValue innerList = new ListPropertyValue(); - List innerListItems = new ArrayList(); - innerListItems.add(new SimplePropertyValue("test")); - innerListItems.add(new SimplePropertyValue(new Integer(2))); - innerList.setItems(innerListItems); - _items.add(innerList); - _generator.setItems(_items); - } - - public void testGetItems() - { - List items = _generator.getItems(); - assertEquals("Unexpected list items", _items, items); - } - - public void testGetValue() - { - for (int i = 0; i < 2; i++) - { - assertEquals("Unexpected first item", new Integer(1), _generator.getValue()); - assertEquals("Unexpected second item", new Double(2.1), _generator.getValue()); - assertEquals("Unexpected third item", new Boolean(true), _generator.getValue()); - if (i == 0) - { - assertEquals("Unexpected forth item", "test", _generator.getValue()); - } - else - { - assertEquals("Unexpected forth item", new Integer(2), _generator.getValue()); - } - } - } - - public void testNonCyclicGetValue() - { - _generator.setCyclic(false); - assertFalse("Generator should not be cyclic", _generator.isCyclic()); - assertEquals("Unexpected first item", new Integer(1), _generator.getValue()); - assertEquals("Unexpected second item", new Double(2.1), _generator.getValue()); - assertEquals("Unexpected third item", new Boolean(true), _generator.getValue()); - assertEquals("Unexpected forth item", "test", _generator.getValue()); - assertEquals("Unexpected fifth item", new Integer(2), _generator.getValue()); - assertEquals("Unexpected sixs item", "test", _generator.getValue()); - assertEquals("Unexpected sevens item", new Integer(2), _generator.getValue()); - } -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/property/PropertyValueFactoryTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/property/PropertyValueFactoryTest.java deleted file mode 100644 index eba1bcc435..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/property/PropertyValueFactoryTest.java +++ /dev/null @@ -1,74 +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.client.property; - -import org.apache.qpid.test.utils.QpidTestCase; - -public class PropertyValueFactoryTest extends QpidTestCase -{ - private PropertyValueFactory _factory; - - @Override - public void setUp() throws Exception - { - super.setUp(); - _factory = new PropertyValueFactory(); - } - - public void testCreateListPropertyValue() - { - PropertyValue propertyValue = _factory.createPropertyValue("list"); - assertNotNull("List generator is not created", propertyValue); - assertTrue("Unexpected type of list generator", propertyValue instanceof ListPropertyValue); - } - - public void testCreateRangePropertyValue() - { - PropertyValue propertyValue = _factory.createPropertyValue("range"); - assertNotNull("Range generator is not created", propertyValue); - assertTrue("Unexpected type of range generator", propertyValue instanceof RangePropertyValue); - } - - public void testCreateRandomPropertyValue() - { - PropertyValue propertyValue = _factory.createPropertyValue("random"); - assertNotNull("Random generator is not created", propertyValue); - assertTrue("Unexpected type of range generator", propertyValue instanceof RandomPropertyValue); - } - - public void testCreateSimplePropertyValue() - { - PropertyValue propertyValue = _factory.createPropertyValue("simple"); - assertNotNull("Simple property value is not created", propertyValue); - assertTrue("Unexpected type of property value", propertyValue instanceof SimplePropertyValue); - } - - public void testCreateNonExistingPropertyValue() - { - try - { - _factory.createPropertyValue("nonExisting"); - fail("Non existing property value should not be created"); - } - catch (Exception e) - { - // pass - } - } -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/property/RandomPropertyValueTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/property/RandomPropertyValueTest.java deleted file mode 100644 index 9651dd95ce..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/property/RandomPropertyValueTest.java +++ /dev/null @@ -1,75 +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.client.property; - -import org.apache.qpid.test.utils.QpidTestCase; - -public class RandomPropertyValueTest extends QpidTestCase -{ - private RandomPropertyValue _generator; - - @Override - public void setUp() throws Exception - { - super.setUp(); - _generator = new RandomPropertyValue(); - _generator.setUpper(20.0); - _generator.setLower(10.0); - _generator.setType("double"); - } - - public void testGetters() - { - assertEquals("Unexpected upper boundary", new Double(20.0), _generator.getUpper()); - assertEquals("Unexpected lower boundary", new Double(10.0), _generator.getLower()); - assertEquals("Unexpected type", "double", _generator.getType()); - } - - public void testGetValue() - { - Object value = _generator.getValue(); - assertTrue("Unexpected type", value instanceof Double); - assertTrue("Unexpected value", ((Double) value).doubleValue() >= 10.0 - && ((Double) value).doubleValue() <= 20.0); - } - - public void testGetValueInt() - { - _generator.setType("int"); - Object value = _generator.getValue(); - assertTrue("Unexpected type", value instanceof Integer); - assertTrue("Unexpected value", ((Integer) value).intValue() >= 10 && ((Integer) value).intValue() <= 20); - } - - public void testGetValueLong() - { - _generator.setType("long"); - Object value = _generator.getValue(); - assertTrue("Unexpected type", value instanceof Long); - assertTrue("Unexpected value", ((Long) value).longValue() >= 10 && ((Long) value).longValue() <= 20); - } - - public void testGetValueFloat() - { - _generator.setType("float"); - Object value = _generator.getValue(); - assertTrue("Unexpected type", value instanceof Float); - assertTrue("Unexpected value", ((Float) value).floatValue() >= 10.0 && ((Float) value).floatValue() <= 20.0); - } -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/property/RangePropertyValueTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/property/RangePropertyValueTest.java deleted file mode 100644 index b0649a49ae..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/property/RangePropertyValueTest.java +++ /dev/null @@ -1,152 +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.client.property; - -import org.apache.qpid.test.utils.QpidTestCase; - -public class RangePropertyValueTest extends QpidTestCase -{ - private RangePropertyValue _generator; - - @Override - public void setUp() throws Exception - { - super.setUp(); - _generator = new RangePropertyValue(); - _generator.setUpper(10.0); - _generator.setLower(0.0); - _generator.setStep(2.0); - _generator.setType("double"); - } - - public void testGetters() - { - assertEquals("Unexpected upper boundary", new Double(10.0), _generator.getUpper()); - assertEquals("Unexpected lower boundary", new Double(0.0), _generator.getLower()); - assertEquals("Unexpected step", new Double(2.0), _generator.getStep()); - assertEquals("Unexpected type", "double", _generator.getType()); - assertTrue("Unexpected cyclic", _generator.isCyclic()); - } - - public void testGetValue() - { - double[] expected = { 0.0, 2.0, 4.0, 6.0, 8.0, 10.0 }; - for (int j = 0; j < 2; j++) - { - for (int i = 0; i < expected.length; i++) - { - Object value = _generator.getValue(); - assertTrue("Should be Double", value instanceof Double); - assertEquals("Unexpected value ", expected[i], value); - } - } - } - - public void testGetValueNonCyclic() - { - _generator.setCyclic(false); - double[] expected = { 0.0, 2.0, 4.0, 6.0, 8.0, 10.0 }; - for (int i = 0; i < expected.length; i++) - { - Object value = _generator.getValue(); - assertTrue("Should be Double", value instanceof Double); - assertEquals("Unexpected value ", expected[i], value); - } - for (int i = 0; i < expected.length; i++) - { - Object value = _generator.getValue(); - assertEquals("Unexpected value ", expected[expected.length - 1], value); - } - } - - public void testGetValueInt() - { - _generator.setType("int"); - int[] expected = { 0, 2, 4, 6, 8, 10 }; - for (int j = 0; j < 2; j++) - { - for (int i = 0; i < expected.length; i++) - { - Object value = _generator.getValue(); - assertTrue("Should be Double", value instanceof Integer); - assertEquals("Unexpected value ", expected[i], value); - } - } - } - - public void testGetValueByte() - { - _generator.setType("byte"); - byte[] expected = { 0, 2, 4, 6, 8, 10 }; - for (int j = 0; j < 2; j++) - { - for (int i = 0; i < expected.length; i++) - { - Object value = _generator.getValue(); - assertTrue("Should be Double", value instanceof Byte); - assertEquals("Unexpected value ", expected[i], value); - } - } - } - - public void testGetValueLong() - { - _generator.setType("long"); - long[] expected = { 0, 2, 4, 6, 8, 10 }; - for (int j = 0; j < 2; j++) - { - for (int i = 0; i < expected.length; i++) - { - Object value = _generator.getValue(); - assertTrue("Should be Double", value instanceof Long); - assertEquals("Unexpected value ", expected[i], value); - } - } - } - - public void testGetValueShort() - { - _generator.setType("short"); - short[] expected = { 0, 2, 4, 6, 8, 10 }; - for (int j = 0; j < 2; j++) - { - for (int i = 0; i < expected.length; i++) - { - Object value = _generator.getValue(); - assertTrue("Should be Double", value instanceof Short); - assertEquals("Unexpected value ", expected[i], value); - } - } - } - - public void testGetValueFloat() - { - _generator.setType("float"); - float[] expected = { 0.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f }; - for (int j = 0; j < 2; j++) - { - for (int i = 0; i < expected.length; i++) - { - Object value = _generator.getValue(); - assertTrue("Should be Double", value instanceof Float); - assertEquals("Unexpected value ", expected[i], value); - } - } - } -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/property/SimplePropertyValueTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/property/SimplePropertyValueTest.java deleted file mode 100644 index f1977015fe..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/property/SimplePropertyValueTest.java +++ /dev/null @@ -1,30 +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.client.property; - -import org.apache.qpid.test.utils.QpidTestCase; - -public class SimplePropertyValueTest extends QpidTestCase -{ - public void testGetValue() - { - SimplePropertyValue value = new SimplePropertyValue(new Integer(1)); - assertEquals("Unexpected value", new Integer(1), value.getValue()); - } -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/utils/ExecutorWithNoLimitsTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/utils/ExecutorWithNoLimitsTest.java deleted file mode 100644 index 0880512333..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/utils/ExecutorWithNoLimitsTest.java +++ /dev/null @@ -1,61 +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.client.utils; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.concurrent.Callable; - -import org.apache.qpid.test.utils.QpidTestCase; - -public class ExecutorWithNoLimitsTest extends QpidTestCase -{ - private final static Object RESULT = new Object(); - - private ExecutorWithLimits _limiter = new ExecutorWithNoLimits(); - @SuppressWarnings("unchecked") - private Callable _callback = mock(Callable.class); - - public void testNormalExecution() throws Exception - { - when(_callback.call()).thenReturn(RESULT); - final Object actualResult = _limiter.execute(_callback); - verify(_callback).call(); - assertEquals(RESULT, actualResult); - } - - public void testCallableThrowsException() throws Exception - { - when(_callback.call()).thenThrow(new Exception("mocked exception")); - - try - { - _limiter.execute(_callback); - fail("Exception not thrown"); - } - catch (Exception e) - { - // PASS - } - verify(_callback).call(); - } -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/utils/ExecutorWithTimeLimitTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/utils/ExecutorWithTimeLimitTest.java deleted file mode 100644 index 2abdba2446..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/utils/ExecutorWithTimeLimitTest.java +++ /dev/null @@ -1,131 +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.client.utils; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.concurrent.Callable; -import java.util.concurrent.CancellationException; - -import org.apache.qpid.test.utils.QpidTestCase; - -public class ExecutorWithTimeLimitTest extends QpidTestCase -{ - private static final int TIMEOUT = 500; - private static final Object RESULT = new Object(); - - private ExecutorWithLimits _limiter; - @SuppressWarnings("unchecked") - private Callable _callback = mock(Callable.class); - - @Override - protected void setUp() throws Exception - { - super.setUp(); - _limiter = new ExecutorWithTimeLimit(System.currentTimeMillis(), TIMEOUT); - } - - @Override - protected void tearDown() throws Exception - { - super.tearDown(); - if (_limiter != null) - { - _limiter.shutdown(); - } - } - - public void testCallableCompletesNormally() throws Exception - { - when(_callback.call()).thenReturn(RESULT); - - final Object actualResult = _limiter.execute(_callback); - - verify(_callback).call(); - assertEquals(RESULT, actualResult); - } - - public void testCallableThrowsException() throws Exception - { - when(_callback.call()).thenThrow(new Exception("mocked exception")); - - try - { - _limiter.execute(_callback); - fail("Exception not thrown"); - } - catch (CancellationException ce) - { - fail("Wrong exception thrown"); - } - catch (Exception e) - { - // PASS - } - verify(_callback).call(); - } - - public void testCallableNotRunDueToInsufficentTimeRemaining() throws Exception - { - long now = System.currentTimeMillis(); - ExecutorWithLimits shortTimeLimiter = new ExecutorWithTimeLimit(now - 100, 100); - try - { - shortTimeLimiter.execute(_callback); - fail("Exception not thrown"); - } - catch (CancellationException ca) - { - // PASS - } - finally - { - shortTimeLimiter.shutdown(); - } - - verify(_callback, never()).call(); - } - - public void testExecutionInterruptedByTimeout() throws Exception - { - Callable oversleepingCallback = new Callable() - { - @Override - public Void call() throws Exception - { - Thread.sleep(TIMEOUT * 2); - return null; - } - }; - - try - { - _limiter.execute(oversleepingCallback); - fail("Exception not thrown"); - } - catch (CancellationException ca) - { - // PASS - } - } -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/ClientRegistryTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/ClientRegistryTest.java deleted file mode 100644 index c07d9fcb81..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/ClientRegistryTest.java +++ /dev/null @@ -1,135 +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.controller; - -import java.util.Timer; -import java.util.TimerTask; - -import org.apache.qpid.disttest.DistributedTestException; -import org.apache.qpid.test.utils.QpidTestCase; - -public class ClientRegistryTest extends QpidTestCase -{ - private static final String CLIENT1_REGISTERED_NAME = "CLIENT1_REGISTERED_NAME"; - private static final String CLIENT2_REGISTERED_NAME = "CLIENT2_REGISTERED_NAME"; - private static final String CLIENT3_REGISTERED_NAME = "CLIENT3_REGISTERED_NAME"; - - private static final int AWAIT_DELAY = 100; - - private ClientRegistry _clientRegistry = new ClientRegistry(); - - public void testRegisterClient() - { - assertEquals(0, _clientRegistry.getClients().size()); - - _clientRegistry.registerClient(CLIENT1_REGISTERED_NAME); - assertEquals(1, _clientRegistry.getClients().size()); - - } - - public void testRejectsDuplicateClientNames() - { - _clientRegistry.registerClient(CLIENT1_REGISTERED_NAME); - try - { - _clientRegistry.registerClient(CLIENT1_REGISTERED_NAME); - fail("Should have thrown an exception"); - } - catch (final DistributedTestException e) - { - // pass - } - } - - public void testAwaitOneClientWhenClientNotRegistered() - { - int numberOfClientsAbsent = _clientRegistry.awaitClients(1, AWAIT_DELAY); - assertEquals(1, numberOfClientsAbsent); - } - - public void testAwaitOneClientWhenClientAlreadyRegistered() - { - _clientRegistry.registerClient(CLIENT1_REGISTERED_NAME); - - int numberOfClientsAbsent = _clientRegistry.awaitClients(1, AWAIT_DELAY); - assertEquals(0, numberOfClientsAbsent); - } - - public void testAwaitTwoClientsWhenClientRegistersWhilstWaiting() - { - _clientRegistry.registerClient(CLIENT1_REGISTERED_NAME); - registerClientLater(CLIENT2_REGISTERED_NAME, 50); - - int numberOfClientsAbsent = _clientRegistry.awaitClients(2, AWAIT_DELAY); - assertEquals(0, numberOfClientsAbsent); - } - - public void testAwaitTimeoutForPromptRegistrations() - { - registerClientsLaterAndAssertResult("Clients registering every 100ms should be within 600ms timeout", - new int[] {300, 400, 500}, - 600, - 0); - } - - public void testAwaitTimeoutForWhenThirdRegistrationIsLate() - { - registerClientsLaterAndAssertResult("Third client registering tardily should exceed timeout", - new int[] {300, 400, 1500}, - 600, - 1); - } - - public void testAwaitTimeoutWhenSecondAndThirdRegistrationsAreLate() - { - registerClientsLaterAndAssertResult("Second and third clients registering tardily should exceed timeout", - new int[] {300, 1500, 1500}, - 600, - 2); - } - - private void registerClientsLaterAndAssertResult(String message, int[] registrationDelays, int timeout, int expectedNumberOfAbsentees) - { - registerClientLater(CLIENT1_REGISTERED_NAME, registrationDelays[0]); - registerClientLater(CLIENT2_REGISTERED_NAME, registrationDelays[1]); - registerClientLater(CLIENT3_REGISTERED_NAME, registrationDelays[2]); - - int numberOfClientsAbsent = _clientRegistry.awaitClients(3, timeout); - - assertEquals(message, expectedNumberOfAbsentees, numberOfClientsAbsent); - } - - private void registerClientLater(final String clientName, long delayInMillis) - { - doLater(new TimerTask() - { - @Override - public void run() - { - _clientRegistry.registerClient(clientName); - } - }, delayInMillis); - } - - private void doLater(TimerTask task, long delayInMillis) - { - Timer timer = new Timer(); - timer.schedule(task, delayInMillis); - } -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/ControllerTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/ControllerTest.java deleted file mode 100644 index e482268ab2..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/ControllerTest.java +++ /dev/null @@ -1,196 +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.controller; - -import static org.apache.qpid.disttest.PerfTestConstants.COMMAND_RESPONSE_TIMEOUT; -import static org.apache.qpid.disttest.PerfTestConstants.REGISTRATION_TIMEOUT; -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.eq; -import static org.mockito.Matchers.isA; -import static org.mockito.Mockito.doAnswer; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import org.apache.qpid.disttest.DistributedTestException; -import org.apache.qpid.disttest.controller.config.Config; -import org.apache.qpid.disttest.controller.config.TestInstance; -import org.apache.qpid.disttest.jms.ControllerJmsDelegate; -import org.apache.qpid.disttest.message.Command; -import org.apache.qpid.disttest.message.RegisterClientCommand; -import org.apache.qpid.disttest.message.Response; -import org.apache.qpid.disttest.message.StopClientCommand; -import org.apache.qpid.disttest.results.aggregation.ITestResult; -import org.apache.qpid.test.utils.QpidTestCase; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; - -public class ControllerTest extends QpidTestCase -{ - private static final String CLIENT1_REGISTERED_NAME = "client-uid1"; - - private Controller _controller; - private ControllerJmsDelegate _respondingJmsDelegate; - private TestRunner _testRunner; - private ClientRegistry _clientRegistry; - - @Override - protected void setUp() throws Exception - { - super.setUp(); - _respondingJmsDelegate = mock(ControllerJmsDelegate.class); - _controller = new Controller(_respondingJmsDelegate, REGISTRATION_TIMEOUT, COMMAND_RESPONSE_TIMEOUT); - _testRunner = mock(TestRunner.class); - _clientRegistry = mock(ClientRegistry.class); - - Config configWithOneClient = createMockConfig(1); - _controller.setConfig(configWithOneClient); - _controller.setClientRegistry(_clientRegistry); - _controller.setTestRunnerFactory(createTestFactoryReturningMock()); - - doAnswer(new Answer() - { - @Override - public Void answer(InvocationOnMock invocation) throws Throwable - { - final String clientName = (String)invocation.getArguments()[0]; - final Command command = (Command)invocation.getArguments()[1]; - _controller.processStopClientResponse(new Response(clientName, command.getType())); - return null; - } - }).when(_respondingJmsDelegate).sendCommandToClient(anyString(), isA(Command.class)); - } - - - public void testControllerRejectsEmptyConfiguration() - { - Config configWithZeroClients = createMockConfig(0); - - try - { - _controller.setConfig(configWithZeroClients); - fail("Exception not thrown"); - } - catch (DistributedTestException e) - { - // PASS - } - } - - public void testControllerReceivesTwoExpectedClientRegistrations() - { - Config configWithTwoClients = createMockConfig(2); - _controller.setConfig(configWithTwoClients); - when(_clientRegistry.awaitClients(2, REGISTRATION_TIMEOUT)).thenReturn(0); - - _controller.awaitClientRegistrations(); - } - - public void testControllerDoesntReceiveAnyRegistrations() - { - when(_clientRegistry.awaitClients(1, REGISTRATION_TIMEOUT)).thenReturn(1); - - try - { - _controller.awaitClientRegistrations(); - fail("Exception not thrown"); - } - catch (DistributedTestException e) - { - // PASS - } - } - - public void testRegisterClient() - { - RegisterClientCommand command = new RegisterClientCommand(CLIENT1_REGISTERED_NAME, "dummy"); - _controller.registerClient(command); - - verify(_clientRegistry).registerClient(CLIENT1_REGISTERED_NAME); - verify(_respondingJmsDelegate).registerClient(command); - - } - - public void testControllerSendsClientStopCommandToClient() - { - when(_clientRegistry.getClients()).thenReturn(Collections.singleton(CLIENT1_REGISTERED_NAME)); - - _controller.stopAllRegisteredClients(); - - verify(_respondingJmsDelegate).sendCommandToClient(eq(CLIENT1_REGISTERED_NAME), isA(StopClientCommand.class)); - } - - public void testRunAllTests() - { - Config config = createSimpleConfig(); - _controller.setConfig(config); - - TestResult testResult = new TestResult("test1"); - - when(_testRunner.run()).thenReturn(testResult); - - ResultsForAllTests results = _controller.runAllTests(); - - List testResults = results.getTestResults(); - assertEquals(1, testResults.size()); - assertSame(testResult, testResults.get(0)); - - verify(_testRunner).run(); - } - - private Config createSimpleConfig() - { - Config config = mock(Config.class); - TestInstance testInstance = mock(TestInstance.class); - - List testInstances = Arrays.asList(testInstance); - - when(config.getTests()).thenReturn(testInstances); - when(config.getTotalNumberOfClients()).thenReturn(1); // necessary otherwise controller rejects "invalid" config - - return config; - } - - private Config createMockConfig(int numberOfClients) - { - Config config = mock(Config.class); - when(config.getTotalNumberOfClients()).thenReturn(numberOfClients); - return config; - } - - private TestRunnerFactory createTestFactoryReturningMock() - { - TestRunnerFactory testRunnerFactory = mock(TestRunnerFactory.class); - - when(testRunnerFactory.createTestRunner( - isA(ParticipatingClients.class), - isA(TestInstance.class), - isA(ControllerJmsDelegate.class), - isA(Long.class), - isA(Long.class))) - .thenReturn(_testRunner); - - return testRunnerFactory; - } -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/ParticipatingClientsTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/ParticipatingClientsTest.java deleted file mode 100644 index da180f328f..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/ParticipatingClientsTest.java +++ /dev/null @@ -1,144 +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.controller; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.util.Arrays; -import java.util.Collection; -import java.util.List; - -import org.apache.qpid.test.utils.QpidTestCase; - -public class ParticipatingClientsTest extends QpidTestCase -{ - private static final String CLIENT1_CONFIGURED_NAME = "CLIENT1_CONFIGURED_NAME"; - private static final String CLIENT2_CONFIGURED_NAME = "CLIENT2_CONFIGURED_NAME"; - - private static final String CLIENT1_REGISTERED_NAME = "CLIENT1_REGISTERED_NAME"; - private static final String CLIENT2_REGISTERED_NAME = "CLIENT2_REGISTERED_NAME"; - private static final String CLIENT3_REGISTERED_NAME = "CLIENT3_REGISTERED_NAME"; - private ClientRegistry _clientRegistry; - private List _configuredClientNamesForTest; - - @Override - protected void setUp() throws Exception - { - super.setUp(); - _clientRegistry = mock(ClientRegistry.class); - } - - public void testTooFewRegisteredClientsForTest() - { - _configuredClientNamesForTest = Arrays.asList(CLIENT1_CONFIGURED_NAME, CLIENT2_CONFIGURED_NAME); - when(_clientRegistry.getClients()).thenReturn(Arrays.asList(CLIENT1_REGISTERED_NAME)); - - try - { - new ParticipatingClients(_clientRegistry, _configuredClientNamesForTest); - fail("Exception not thrown"); - } - catch (IllegalArgumentException e) - { - // PASS - } - - } - - - public void testSelectOneClientFromPoolOfOne() - { - _configuredClientNamesForTest = Arrays.asList(CLIENT1_CONFIGURED_NAME); - when(_clientRegistry.getClients()).thenReturn(Arrays.asList(CLIENT1_REGISTERED_NAME)); - - ParticipatingClients clients = new ParticipatingClients(_clientRegistry, _configuredClientNamesForTest); - assertBothWays(clients, CLIENT1_REGISTERED_NAME, CLIENT1_CONFIGURED_NAME); - } - - public void testSelectTwoClientFromPoolOfMany() - { - _configuredClientNamesForTest = Arrays.asList(CLIENT1_CONFIGURED_NAME, CLIENT2_CONFIGURED_NAME); - when(_clientRegistry.getClients()).thenReturn(Arrays.asList(CLIENT1_REGISTERED_NAME, CLIENT2_REGISTERED_NAME, CLIENT3_REGISTERED_NAME)); - - ParticipatingClients clients = new ParticipatingClients(_clientRegistry, _configuredClientNamesForTest); - - assertBothWays(clients, CLIENT1_REGISTERED_NAME, CLIENT1_CONFIGURED_NAME); - assertBothWays(clients, CLIENT2_REGISTERED_NAME, CLIENT2_CONFIGURED_NAME); - } - - public void testGetUnrecognisedConfiguredName() - { - _configuredClientNamesForTest = Arrays.asList(CLIENT1_CONFIGURED_NAME); - when(_clientRegistry.getClients()).thenReturn(Arrays.asList(CLIENT1_REGISTERED_NAME)); - - ParticipatingClients clients = new ParticipatingClients(_clientRegistry, _configuredClientNamesForTest); - - testUnrecognisedClientConfiguredName(clients, "unknown"); - testUnrecognisedClientRegisteredName(clients, "unknown"); - } - - public void testGetRegisteredClientNames() - { - _configuredClientNamesForTest = Arrays.asList(CLIENT1_CONFIGURED_NAME); - List registeredNames = Arrays.asList(CLIENT1_REGISTERED_NAME); - when(_clientRegistry.getClients()).thenReturn(registeredNames); - - ParticipatingClients clients = new ParticipatingClients(_clientRegistry, _configuredClientNamesForTest); - - Collection registeredParticipatingNames = clients.getRegisteredNames(); - assertEquals(1, registeredParticipatingNames.size()); - assertTrue(registeredParticipatingNames.contains(CLIENT1_REGISTERED_NAME)); - } - - private void testUnrecognisedClientConfiguredName(ParticipatingClients clients, String unrecognisedClientConfiguredName) - { - try - { - clients.getRegisteredNameFromConfiguredName(unrecognisedClientConfiguredName); - fail("Exception not thrown"); - } - catch (IllegalArgumentException e) - { - // PASS - } - } - - private void testUnrecognisedClientRegisteredName(ParticipatingClients clients, String unrecognisedClientRegisteredName) - { - try - { - clients.getConfiguredNameFromRegisteredName(unrecognisedClientRegisteredName); - fail("Exception not thrown"); - } - catch (IllegalArgumentException e) - { - // PASS - } - } - - private void assertBothWays(ParticipatingClients clients, String registeredName, String configuredName) - { - assertEquals(registeredName, clients.getRegisteredNameFromConfiguredName(configuredName)); - assertEquals(configuredName, clients.getConfiguredNameFromRegisteredName(registeredName)); - } - - - -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/TestRunnerTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/TestRunnerTest.java deleted file mode 100644 index d8b25e76fa..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/TestRunnerTest.java +++ /dev/null @@ -1,252 +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.controller; - -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.eq; -import static org.mockito.Matchers.isA; -import static org.mockito.Mockito.doAnswer; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Timer; -import java.util.TimerTask; - -import org.apache.qpid.disttest.DistributedTestException; -import org.apache.qpid.disttest.controller.config.QueueConfig; -import org.apache.qpid.disttest.controller.config.TestInstance; -import org.apache.qpid.disttest.jms.ControllerJmsDelegate; -import org.apache.qpid.disttest.message.Command; -import org.apache.qpid.disttest.message.CreateConnectionCommand; -import org.apache.qpid.disttest.message.NoOpCommand; -import org.apache.qpid.disttest.message.ParticipantResult; -import org.apache.qpid.disttest.message.Response; -import org.apache.qpid.disttest.message.StartTestCommand; -import org.apache.qpid.disttest.message.TearDownTestCommand; -import org.apache.qpid.test.utils.QpidTestCase; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; - -public class TestRunnerTest extends QpidTestCase -{ - private static final String TEST_NAME = "TEST_NAME"; - private static final String PARTICIPANT_NAME = "TEST_PARTICIPANT_NAME"; - private static final int ITERATION_NUMBER = 1; - - private static final String CLIENT1_REGISTERED_NAME = "client-uid1"; - private static final String CLIENT1_CONFIGURED_NAME = "client1"; - - private static final long COMMAND_RESPONSE_TIMEOUT = 1000; - private static final long TEST_RESULT_TIMEOUT = 2000; - private static final long DELAY = 100; - - private TestRunner _testRunner; - private TestInstance _testInstance; - private ControllerJmsDelegate _respondingJmsDelegate; - private ParticipatingClients _participatingClients; - - @Override - protected void setUp() throws Exception - { - super.setUp(); - _respondingJmsDelegate = mock(ControllerJmsDelegate.class); - - _participatingClients = mock(ParticipatingClients.class); - when(_participatingClients.getRegisteredNameFromConfiguredName(CLIENT1_CONFIGURED_NAME)).thenReturn(CLIENT1_REGISTERED_NAME); - when(_participatingClients.getConfiguredNameFromRegisteredName(CLIENT1_REGISTERED_NAME)).thenReturn(CLIENT1_CONFIGURED_NAME); - when(_participatingClients.getRegisteredNames()).thenReturn(Collections.singleton(CLIENT1_REGISTERED_NAME)); - - doAnswer(new Answer() - { - @Override - public Void answer(InvocationOnMock invocation) throws Throwable - { - final String clientName = (String)invocation.getArguments()[0]; - final Command command = (Command)invocation.getArguments()[1]; - _testRunner.processCommandResponse(new Response(clientName, command.getType())); - return null; - } - }).when(_respondingJmsDelegate).sendCommandToClient(anyString(), isA(Command.class)); - } - - public void testSendConnectionCommandToClient() - { - _testInstance = createTestInstanceWithConnection(); - - _testRunner = new TestRunner(_participatingClients, _testInstance , _respondingJmsDelegate, COMMAND_RESPONSE_TIMEOUT, TEST_RESULT_TIMEOUT); - _testRunner.sendTestSetupCommands(); - - verify(_respondingJmsDelegate).sendCommandToClient(eq(CLIENT1_REGISTERED_NAME), isA(CreateConnectionCommand.class)); - } - - public void testSendCommandToAllParticipatingClients() - { - _testRunner = new TestRunner(_participatingClients, mock(TestInstance.class), _respondingJmsDelegate, COMMAND_RESPONSE_TIMEOUT, TEST_RESULT_TIMEOUT); - - StartTestCommand startTestCommand = new StartTestCommand(); - _testRunner.sendCommandToParticipatingClients(startTestCommand); - - verify(_respondingJmsDelegate).sendCommandToClient(CLIENT1_REGISTERED_NAME, startTestCommand); - } - - public void testWaitsForCommandResponses() - { - _testInstance = createTestInstanceWithConnection(); - _testRunner = new TestRunner(_participatingClients, _testInstance , _respondingJmsDelegate, COMMAND_RESPONSE_TIMEOUT, TEST_RESULT_TIMEOUT); - - _testRunner.sendTestSetupCommands(); - - _testRunner.awaitCommandResponses(); - } - - public void testClientFailsToSendCommandResponseWithinTimeout() - { - ControllerJmsDelegate jmsDelegate = mock(ControllerJmsDelegate.class); - - _testInstance = createTestInstanceWithConnection(); - _testRunner = new TestRunner(_participatingClients, _testInstance , jmsDelegate, COMMAND_RESPONSE_TIMEOUT, TEST_RESULT_TIMEOUT); - - _testRunner.sendTestSetupCommands(); - // we don't call sendCommandResponseLater so controller should time out - - try - { - _testRunner.awaitCommandResponses(); - fail("Exception not thrown"); - } - catch (DistributedTestException e) - { - // PASS - } - } - - public void testCreateAndDeleteQueues() - { - _testInstance = mock(TestInstance.class); - List queues = mock(List.class); - when(_testInstance.getQueues()).thenReturn(queues); - - _testRunner = new TestRunner(_participatingClients, _testInstance, _respondingJmsDelegate, COMMAND_RESPONSE_TIMEOUT, TEST_RESULT_TIMEOUT); - - _testRunner.createQueues(); - verify(_respondingJmsDelegate).createQueues(queues); - - _testRunner.deleteQueues(); - verify(_respondingJmsDelegate).deleteQueues(queues); - } - - public void testRun() - { - _testInstance = createTestInstanceWithOneParticipant(); - _testRunner = new TestRunner(_participatingClients, _testInstance , _respondingJmsDelegate, COMMAND_RESPONSE_TIMEOUT, TEST_RESULT_TIMEOUT); - - ParticipantResult incomingParticipantResult = new ParticipantResult(PARTICIPANT_NAME); - incomingParticipantResult.setRegisteredClientName(CLIENT1_REGISTERED_NAME); - sendTestResultsLater(_testRunner, incomingParticipantResult); - - TestResult results = _testRunner.run(); - - verify(_respondingJmsDelegate).addCommandListener(isA(TestRunner.TestCommandResponseListener.class)); - verify(_respondingJmsDelegate).addCommandListener(isA(TestRunner.ParticipantResultListener.class)); - - verify(_respondingJmsDelegate).createQueues(isA(List.class)); - - verify(_respondingJmsDelegate).sendCommandToClient(eq(CLIENT1_REGISTERED_NAME), isA(StartTestCommand.class)); - verify(_respondingJmsDelegate).sendCommandToClient(eq(CLIENT1_REGISTERED_NAME), isA(NoOpCommand.class)); - verify(_respondingJmsDelegate).sendCommandToClient(eq(CLIENT1_REGISTERED_NAME), isA(TearDownTestCommand.class)); - - verify(_respondingJmsDelegate).deleteQueues(isA(List.class)); - - verify(_respondingJmsDelegate).removeCommandListener(isA(TestRunner.ParticipantResultListener.class)); - verify(_respondingJmsDelegate).removeCommandListener(isA(TestRunner.TestCommandResponseListener.class)); - - List participantResults = results.getParticipantResults(); - assertEquals(1, participantResults.size()); - ParticipantResult resultingParticipantResult = participantResults.get(0); - - assertResultHasCorrectTestDetails(resultingParticipantResult); - } - - private void assertResultHasCorrectTestDetails(ParticipantResult resultingParticipantResult) - { - assertEquals("Test runner should have set configured name when it received participant results", - CLIENT1_CONFIGURED_NAME, resultingParticipantResult.getConfiguredClientName()); - assertEquals("Test runner should have set test name when it received participant results", - TEST_NAME, resultingParticipantResult.getTestName()); - assertEquals("Test runner should have set test iteration number when it received participant results", - ITERATION_NUMBER, resultingParticipantResult.getIterationNumber()); - } - - - private TestInstance createTestInstanceWithOneParticipant() - { - TestInstance testInstance = mock(TestInstance.class); - - List commands = Arrays.asList( - new CommandForClient(CLIENT1_CONFIGURED_NAME, new NoOpCommand())); - - when(testInstance.createCommands()).thenReturn(commands); - - when(testInstance.getTotalNumberOfParticipants()).thenReturn(1); - - when(testInstance.getName()).thenReturn(TEST_NAME); - - List queues = mock(List.class); - when(testInstance.getQueues()).thenReturn(queues); - - when(testInstance.getIterationNumber()).thenReturn(ITERATION_NUMBER); - - return testInstance; - } - - private TestInstance createTestInstanceWithConnection() - { - TestInstance testInstance = mock(TestInstance.class); - - List commands = Arrays.asList( - new CommandForClient(CLIENT1_CONFIGURED_NAME, new CreateConnectionCommand("conn1", "factory"))); - - when(testInstance.createCommands()).thenReturn(commands); - - return testInstance; - } - - private void sendTestResultsLater(final TestRunner runner, final ParticipantResult result) - { - doLater(new TimerTask() - { - @Override - public void run() - { - runner.processParticipantResult(result); - } - }, DELAY); - } - - private void doLater(TimerTask task, long delayInMillis) - { - Timer timer = new Timer(); - timer.schedule(task, delayInMillis); - } - -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/ClientConfigTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/ClientConfigTest.java deleted file mode 100644 index 4bf4307eaf..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/ClientConfigTest.java +++ /dev/null @@ -1,110 +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.controller.config; - -import static org.apache.qpid.disttest.controller.config.ConfigTestUtils.assertCommandForClient; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.qpid.disttest.client.property.PropertyValue; -import org.apache.qpid.disttest.client.property.SimplePropertyValue; -import org.apache.qpid.disttest.controller.CommandForClient; -import org.apache.qpid.disttest.message.Command; -import org.apache.qpid.disttest.message.CreateMessageProviderCommand; -import org.apache.qpid.disttest.message.NoOpCommand; -import org.apache.qpid.test.utils.QpidTestCase; - -public class ClientConfigTest extends QpidTestCase -{ - private static final String CLIENT1 = "client1"; - - public void testClientConfigHasZeroArgConstructorForGson() - { - ClientConfig c = new ClientConfig(); - assertNotNull(c); - } - - public void testCreateCommands() - { - ClientConfig clientConfig = createClientConfigWithConnectionConfigReturningChildCommands(); - - List commands = clientConfig.createCommands(); - assertEquals(2, commands.size()); - - assertCommandForClient(commands, 0, CLIENT1, NoOpCommand.class); - assertCommandForClient(commands, 1, CLIENT1, NoOpCommand.class); - } - - public void testCreateCommandsForMessageProvider() - { - ClientConfig clientConfig = createClientConfigWithMessageProviderConfigReturningCommands(); - - List commands = clientConfig.createCommands(); - assertEquals(1, commands.size()); - - assertCommandForClient(commands, 0, CLIENT1, CreateMessageProviderCommand.class); - } - - public void testGetTotalNumberOfParticipants() - { - ClientConfig clientConfig = createClientConfigWithTwoParticipants(); - assertEquals(2, clientConfig.getTotalNumberOfParticipants()); - } - - private ClientConfig createClientConfigWithConnectionConfigReturningChildCommands() - { - ConnectionConfig connectionConfig = mock(ConnectionConfig.class); - - List commands = Arrays.asList((Command)new NoOpCommand(), (Command)new NoOpCommand()); - when(connectionConfig.createCommands()).thenReturn(commands); - - return new ClientConfig(CLIENT1, connectionConfig); - } - - private ClientConfig createClientConfigWithMessageProviderConfigReturningCommands() - { - Map messageProperties = new HashMap(); - messageProperties.put("test", new SimplePropertyValue("testValue")); - MessageProviderConfig config = new MessageProviderConfig("test", messageProperties); - - List providerConfigs = new ArrayList(); - providerConfigs.add(config); - - return new ClientConfig(CLIENT1, new ArrayList(), providerConfigs); - } - - private ClientConfig createClientConfigWithTwoParticipants() - { - ConnectionConfig connectionConfig1 = mock(ConnectionConfig.class); - ConnectionConfig connectionConfig2 = mock(ConnectionConfig.class); - - when(connectionConfig1.getTotalNumberOfParticipants()).thenReturn(1); - when(connectionConfig2.getTotalNumberOfParticipants()).thenReturn(1); - - ClientConfig clientConfig = new ClientConfig(CLIENT1, connectionConfig1, connectionConfig2); - return clientConfig; - } -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/ConfigReaderTest-test-config.js b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/ConfigReaderTest-test-config.js deleted file mode 100644 index 527300eff4..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/ConfigReaderTest-test-config.js +++ /dev/null @@ -1,54 +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. - * - */ -jsonObject = { - "_tests": - QPID.iterations( { "__ACK_MODE": [ 0, 1 ] }, - { - // this is a comment - it wouldn't be allowed if this were pure JSON - - "_name": "Test 1", - "_queues": [ - { - "_name": "Json-Queue-Name" - } - ], - - "_clients": QPID.times(2, - { - "_name": "repeatingClient__CLIENT_INDEX", - "_connections": [ - { - "_name": "connection1", - "_sessions": [ - { - "_sessionName": "session1", - "_acknowledgeMode": "__ACK_MODE", - "_consumers": [] - } - ] - } - ] - }, - "__CLIENT_INDEX" - ) - }) - -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/ConfigReaderTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/ConfigReaderTest.java deleted file mode 100644 index e208945901..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/ConfigReaderTest.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.controller.config; - -import java.io.Reader; -import java.util.List; -import java.util.Map; - -import org.apache.qpid.disttest.ConfigFileTestHelper; -import org.apache.qpid.disttest.client.property.PropertyValue; -import org.apache.qpid.test.utils.QpidTestCase; -import org.apache.qpid.test.utils.TestFileUtils; - -public class ConfigReaderTest extends QpidTestCase -{ - private Config _config; - - @Override - protected void setUp() - { - ConfigReader configReader = new ConfigReader(); - Reader reader = ConfigFileTestHelper.getConfigFileReader(getClass(), "sampleConfig.json"); - _config = configReader.readConfig(reader); - } - - public void testReadTest() - { - List tests = _config.getTestConfigs(); - assertEquals("Unexpected number of tests", 2, tests.size()); - TestConfig test1Config = tests.get(0); - assertNotNull("Test 1 configuration is expected", test1Config); - assertEquals("Unexpected test name", "Test 1", test1Config.getName()); - - TestConfig test2Config = tests.get(1); - assertNotNull("Test 2 configuration is expected", test2Config); - } - - public void testReadsTestWithQueues() - { - TestConfig test1Config = _config.getTestConfigs().get(0); - List queues = test1Config.getQueues(); - assertEquals("Unexpected number of queues", 2, queues.size()); - QueueConfig queue1Config = queues.get(0); - assertNotNull("Expected queue 1 config", queue1Config); - assertEquals("Unexpected queue name", "Json-Queue-Name", queue1Config.getName()); - assertTrue("Unexpected attributes", queue1Config.getAttributes().isEmpty()); - assertFalse("Unexpected durable", queue1Config.isDurable()); - - QueueConfig queue2Config = queues.get(1); - assertNotNull("Expected queue 2 config", queue2Config); - assertEquals("Unexpected queue name", "Json Queue Name 2", queue2Config.getName()); - assertTrue("Unexpected durable", queue2Config.isDurable()); - Map attributes = queue2Config.getAttributes(); - assertNotNull("Expected attributes", attributes); - assertFalse("Attributes are not loaded", attributes.isEmpty()); - assertEquals("Unexpected number of attributes", 1, attributes.size()); - assertEquals("Unexpected attribute 'x-qpid-priorities' value", 10, - ((Number)attributes.get("x-qpid-priorities")).intValue()); - } - - public void testReadsTestWithIterations() - { - TestConfig testConfig = _config.getTestConfigs().get(0); - List iterationValues = testConfig.getIterationValues(); - assertEquals("Unexpected number of iterations", 2, iterationValues.size()); - - IterationValue iteration1 = iterationValues.get(0); - - String messageSizeProperty = "_messageSize"; - - assertEquals("Unexpected value for property " + messageSizeProperty, - "100", - iteration1.getIterationPropertyValuesWithUnderscores().get(messageSizeProperty)); - } - - public void testReadsMessageProviders() - { - TestConfig testConfig = _config.getTestConfigs().get(0); - ClientConfig cleintConfig = testConfig.getClients().get(0); - List configs = cleintConfig.getMessageProviders(); - assertNotNull("Message provider configs should not be null", configs); - assertEquals("Unexpected number of message providers", 1, configs.size()); - MessageProviderConfig messageProvider = configs.get(0); - assertNotNull("Message provider config should not be null", messageProvider); - assertEquals("Unexpected provider name", "testProvider1", messageProvider.getName()); - Map properties = messageProvider.getMessageProperties(); - assertNotNull("Message properties should not be null", properties); - assertEquals("Unexpected number of message properties", 3, properties.size()); - assertNotNull("test property is not found", properties.get("test")); - assertNotNull("priority property is not found", properties.get("priority")); - assertNotNull("id property is not found", properties.get("id")); - } - - public void testReadsJS() throws Exception - { - ConfigReader configReader = new ConfigReader(); - String path = TestFileUtils.createTempFileFromResource(this, "ConfigReaderTest-test-config.js").getAbsolutePath(); - _config = configReader.getConfigFromFile(path); - - List testConfigs = _config.getTestConfigs(); - assertEquals("Unexpected number of tests", 2, testConfigs.size()); - TestConfig testConfig1 = _config.getTestConfigs().get(0); - List cleintConfigs = testConfig1.getClients(); - assertEquals("Unexpected number of test 1 clients", 2, cleintConfigs.size()); - List queueConfigs = testConfig1.getQueues(); - assertEquals("Unexpected number of test 1 queue", 1, queueConfigs.size()); - assertEquals("Unexpected queue name", "Json-Queue-Name", queueConfigs.get(0).getName()); - ClientConfig cleintConfig = cleintConfigs.get(0); - List connectionConfigs = cleintConfig.getConnections(); - assertEquals("Unexpected number of connections", 1, connectionConfigs.size()); - List sessionConfigs = connectionConfigs.get(0).getSessions(); - assertEquals("Unexpected number of sessions", 1, sessionConfigs.size()); - assertEquals("Unexpected ack mode", 0, sessionConfigs.get(0).getAcknowledgeMode()); - - TestConfig testConfig2 = _config.getTestConfigs().get(1); - List cleintConfigs2 = testConfig2.getClients(); - assertEquals("Unexpected number of test 1 clients", 2, cleintConfigs2.size()); - List queueConfigs2 = testConfig2.getQueues(); - assertEquals("Unexpected number of test 1 queue", 1, queueConfigs2.size()); - assertEquals("Unexpected queue name", "Json-Queue-Name", queueConfigs2.get(0).getName()); - ClientConfig cleintConfig2 = cleintConfigs2.get(0); - List connectionConfigs2 = cleintConfig2.getConnections(); - assertEquals("Unexpected number of connections", 1, connectionConfigs2.size()); - List sessionConfigs2 = connectionConfigs2.get(0).getSessions(); - assertEquals("Unexpected number of sessions", 1, sessionConfigs2.size()); - assertEquals("Unexpected ack mode", 1, sessionConfigs2.get(0).getAcknowledgeMode()); - } - -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/ConfigTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/ConfigTest.java deleted file mode 100644 index 291ce2af78..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/ConfigTest.java +++ /dev/null @@ -1,56 +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.controller.config; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.util.Arrays; -import java.util.List; - -import org.apache.qpid.test.utils.QpidTestCase; - -public class ConfigTest extends QpidTestCase -{ - public void testGetTestsForTestWithIteratingMessageSizes() - { - Config config = createConfigWithIteratingMessageSizes(); - List testConfigs = config.getTests(); - - assertEquals("should have a test config for each message size", 2, testConfigs.size()); - - TestInstance instance0 = testConfigs.get(0); - assertEquals(0, instance0.getIterationNumber()); - - TestInstance instance1 = testConfigs.get(1); - assertEquals(1, instance1.getIterationNumber()); - } - - private Config createConfigWithIteratingMessageSizes() - { - TestConfig testConfig = mock(TestConfig.class); - - when(testConfig.getIterationValues()).thenReturn(Arrays.asList(new IterationValue(),new IterationValue())); - - Config config = new Config(testConfig); - - return config; - } - -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/ConfigTestUtils.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/ConfigTestUtils.java deleted file mode 100644 index 6ee42c62c6..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/ConfigTestUtils.java +++ /dev/null @@ -1,56 +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.controller.config; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.util.List; - -import org.apache.qpid.disttest.controller.CommandForClient; -import org.apache.qpid.disttest.message.Command; - -public class ConfigTestUtils -{ - public static void assertCommandForClient(final List commandsForClients, final int index, final String expectedRegisteredClientName, final Class expectedCommandClass) - { - final CommandForClient commandForClient = commandsForClients.get(index); - assertEquals(expectedRegisteredClientName, commandForClient.getClientName()); - final Command command = commandForClient.getCommand(); - assertTrue("Command " + index + " is of class " + command.getClass() + " but expecting " + expectedCommandClass, - expectedCommandClass.isAssignableFrom(command.getClass())); - } - - public static void assertCommandEquals(final List commands, final int index, final Class expectedCommandClass) - { - @SuppressWarnings("unchecked") - C command = (C) getCommand(commands, index); //explicit cast added to get round oracle compiler bug (id 6302954) - assertTrue("Command " + index + " is of class " + command.getClass() + " but expecting " + expectedCommandClass, - expectedCommandClass.isAssignableFrom(command.getClass())); - } - - public static C getCommand(final List commands, final int index) - { - @SuppressWarnings("unchecked") - C command = (C) commands.get(index); - return command; - } - -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/ConnectionConfigTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/ConnectionConfigTest.java deleted file mode 100644 index 0eee80e425..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/ConnectionConfigTest.java +++ /dev/null @@ -1,93 +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.controller.config; - -import static org.apache.qpid.disttest.controller.config.ConfigTestUtils.assertCommandEquals; -import static org.apache.qpid.disttest.controller.config.ConfigTestUtils.getCommand; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.util.Arrays; -import java.util.List; - -import org.apache.qpid.disttest.message.Command; -import org.apache.qpid.disttest.message.CreateConnectionCommand; -import org.apache.qpid.disttest.message.NoOpCommand; -import org.apache.qpid.test.utils.QpidTestCase; - -public class ConnectionConfigTest extends QpidTestCase -{ - private static final String CONNECTION_FACTORY_NAME = "ConnectionFactoryName"; - private static final String CONNECTION_NAME = "ConnectionName"; - - public void testConnectionConfigHasZeroArgConstructorForGson() - { - ConnectionConfig c = new ConnectionConfig(); - assertNotNull(c); - } - - public void testCreateCommandsForConnectionAndChildren() - { - ConnectionConfig connectionConfig = createConnectionConfigWithChildCommands(); - - List commands = connectionConfig.createCommands(); - assertEquals(3, commands.size()); - - assertCommandEquals(commands, 0, CreateConnectionCommand.class); - assertCommandEquals(commands, 1, NoOpCommand.class); - assertCommandEquals(commands, 2, NoOpCommand.class); - - CreateConnectionCommand createConnectionCommand = getCommand(commands, 0); - assertEquals(CONNECTION_NAME, createConnectionCommand.getConnectionName()); - assertEquals(CONNECTION_FACTORY_NAME, createConnectionCommand.getConnectionFactoryName()); - } - - public void testGetTotalNumberOfParticipants() - { - ConnectionConfig connectionConfig = createConnectionConfigWithTwoParticipants(); - assertEquals(2, connectionConfig.getTotalNumberOfParticipants()); - } - - private ConnectionConfig createConnectionConfigWithTwoParticipants() - { - SessionConfig sessionConfig1 = mock(SessionConfig.class); - SessionConfig sessionConfig2 = mock(SessionConfig.class); - - when(sessionConfig1.getTotalNumberOfParticipants()).thenReturn(1); - when(sessionConfig2.getTotalNumberOfParticipants()).thenReturn(1); - - ConnectionConfig connectionConfig = new ConnectionConfig(CONNECTION_NAME, CONNECTION_FACTORY_NAME, sessionConfig1, sessionConfig2); - - return connectionConfig; - } - - private ConnectionConfig createConnectionConfigWithChildCommands() - { - SessionConfig sessionConfig = mock(SessionConfig.class); - - NoOpCommand cmd1 = mock(NoOpCommand.class); - NoOpCommand cmd2 = mock(NoOpCommand.class); - List commands = Arrays.asList((Command)cmd1, (Command)cmd2); - when(sessionConfig.createCommands(CONNECTION_NAME)).thenReturn(commands); - - return new ConnectionConfig(CONNECTION_NAME, CONNECTION_FACTORY_NAME, sessionConfig); - } - -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/ConsumerConfigTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/ConsumerConfigTest.java deleted file mode 100644 index 0aa05a176e..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/ConsumerConfigTest.java +++ /dev/null @@ -1,78 +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.controller.config; - -import org.apache.qpid.disttest.message.CreateConsumerCommand; -import org.apache.qpid.test.utils.QpidTestCase; - -public class ConsumerConfigTest extends QpidTestCase -{ - public void testConsumerHasZeroArgConstructorForGson() - { - ConsumerConfig c = new ConsumerConfig(); - assertNotNull(c); - } - - public void testCreateConsumerCommand() - { - boolean isTopic = true; - boolean isDurableSubscription = true; - boolean isBrowsingSubscription = true; - boolean noLocal = true; - long numberOfMessages = 100; - String consumerName = "consumerName"; - String sessionName = "sessionName"; - String destinationName = "destinationName"; - String selector = "selector"; - int batchSize = 10;; - long maximumDuration = 50; - boolean isSynchronousNonDefault = false; - - ConsumerConfig consumerConfig = new ConsumerConfig( - consumerName, - destinationName, - numberOfMessages, - batchSize, - maximumDuration, - isTopic, - isDurableSubscription, - isBrowsingSubscription, - selector, - noLocal, - isSynchronousNonDefault); - - CreateConsumerCommand createConsumerCommand = consumerConfig.createCommand(sessionName); - - assertEquals(sessionName, createConsumerCommand.getSessionName()); - assertEquals(consumerName, createConsumerCommand.getParticipantName()); - assertEquals(destinationName, createConsumerCommand.getDestinationName()); - assertEquals(numberOfMessages, createConsumerCommand.getNumberOfMessages()); - assertEquals(batchSize, createConsumerCommand.getBatchSize()); - assertEquals(maximumDuration, createConsumerCommand.getMaximumDuration()); - - assertEquals(isTopic, createConsumerCommand.isTopic()); - assertEquals(isDurableSubscription, createConsumerCommand.isDurableSubscription()); - assertEquals(isBrowsingSubscription, createConsumerCommand.isBrowsingSubscription()); - assertEquals(selector, createConsumerCommand.getSelector()); - assertEquals(noLocal, createConsumerCommand.isNoLocal()); - assertEquals(isSynchronousNonDefault, createConsumerCommand.isSynchronous()); - } - -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/IterationValueTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/IterationValueTest.java deleted file mode 100644 index 860f6af565..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/IterationValueTest.java +++ /dev/null @@ -1,81 +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.controller.config; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; - -import java.util.HashMap; -import java.util.Map; - -import org.apache.qpid.disttest.message.CreateConnectionCommand; -import org.apache.qpid.disttest.message.CreateConsumerCommand; -import org.apache.qpid.test.utils.QpidTestCase; - -public class IterationValueTest extends QpidTestCase -{ - private static final int MAXIMUM_DURATION = 10; - - private static final boolean IS_DURABLE_SUBSCRIPTION = true; - - private CreateConsumerCommand _createConsumerCommand; - private Map _iterationValueMap; - - @Override - protected void setUp() throws Exception - { - super.setUp(); - _createConsumerCommand = mock(CreateConsumerCommand.class); - - _iterationValueMap = new HashMap(); - _iterationValueMap.put("_maximumDuration", String.valueOf(MAXIMUM_DURATION)); - _iterationValueMap.put("_durableSubscription", String.valueOf(IS_DURABLE_SUBSCRIPTION)); - } - - public void testApplyPopulatedIterationValueToCommandWithMatchingProperties() throws Exception - { - IterationValue iterationValue = new IterationValue(_iterationValueMap); - - iterationValue.applyToCommand(_createConsumerCommand); - - verify(_createConsumerCommand).setMaximumDuration(MAXIMUM_DURATION); - verify(_createConsumerCommand).setDurableSubscription(IS_DURABLE_SUBSCRIPTION); - } - - public void testApplyPopulatedIterationValueToCommandWithoutMatchingProperties() throws Exception - { - IterationValue iterationValue = new IterationValue(_iterationValueMap); - - CreateConnectionCommand createConnectionCommand = mock(CreateConnectionCommand.class); - iterationValue.applyToCommand(createConnectionCommand); - - verifyZeroInteractions(createConnectionCommand); - } - - public void testApplyUnpopulatedIterationValueToCommand() throws Exception - { - IterationValue iterationValue = new IterationValue(); - - iterationValue.applyToCommand(_createConsumerCommand); - - verifyZeroInteractions(_createConsumerCommand); - } - -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/JavaScriptConfigEvaluatorTest-test-config.js b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/JavaScriptConfigEvaluatorTest-test-config.js deleted file mode 100644 index eab98e8bd7..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/JavaScriptConfigEvaluatorTest-test-config.js +++ /dev/null @@ -1,43 +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. - * - */ -jsonObject = { - "_countries": - QPID.iterations( { "__ITERATING_VALUE": [ 0, 1 ] }, - { - // this is a comment - it wouldn't be allowed if this were pure JSON - - "_name": "Country", - "_regions": QPID.times(2, - { - "_name": "repeatingRegion__REGION_INDEX", - "_towns": [ - { - "_name": "town1", - "_iteratingAttribute": "__ITERATING_VALUE", - "_consumers": [] - } - ] - }, - "__REGION_INDEX" - ) - }) - -} 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 deleted file mode 100644 index 174bd8092c..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/JavaScriptConfigEvaluatorTest.java +++ /dev/null @@ -1,111 +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.controller.config; - -import static org.apache.commons.beanutils.PropertyUtils.getProperty; - -import java.io.FileReader; -import java.util.List; -import java.util.TreeMap; - -import org.apache.qpid.test.utils.QpidTestCase; -import org.apache.qpid.test.utils.TestFileUtils; - -import com.google.gson.Gson; - -public class JavaScriptConfigEvaluatorTest extends QpidTestCase -{ - public void testEvaluateJavaScript() throws Exception - { - String jsFilePath = TestFileUtils.createTempFileFromResource(this, "JavaScriptConfigEvaluatorTest-test-config.js").getAbsolutePath(); - - String rawConfig = new JavaScriptConfigEvaluator().evaluateJavaScript(jsFilePath); - - 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")); - } - - 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); - - return propertyValue.intValue(); - } - - private List getPropertyAsList(Object configAsObject, String property) - throws Exception - { - return (List)getProperty(configAsObject, property); - } - - private Object getObject(String jsonStringIn) - { - Gson gson = new Gson(); - @SuppressWarnings("rawtypes") - TreeMap object = gson.fromJson(jsonStringIn, TreeMap.class); - return object; - } -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/MessageProviderConfigTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/MessageProviderConfigTest.java deleted file mode 100644 index 148c07b1ca..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/MessageProviderConfigTest.java +++ /dev/null @@ -1,50 +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.controller.config; - -import java.util.HashMap; -import java.util.Map; - -import org.apache.qpid.disttest.client.property.PropertyValue; -import org.apache.qpid.disttest.client.property.SimplePropertyValue; -import org.apache.qpid.disttest.message.CreateMessageProviderCommand; -import org.apache.qpid.test.utils.QpidTestCase; - -public class MessageProviderConfigTest extends QpidTestCase -{ - public void testCreateCommandsForMessageProvider() - { - Map messageProperties = new HashMap(); - messageProperties.put("test", new SimplePropertyValue("testValue")); - MessageProviderConfig config = new MessageProviderConfig("test", messageProperties); - CreateMessageProviderCommand command = config.createCommand(); - assertNotNull("Command should not be null", command); - assertNotNull("Unexpected name", command.getProviderName()); - assertEquals("Unexpected properties", messageProperties, command.getMessageProperties()); - } - - public void testMessageProviderConfig() - { - Map messageProperties = new HashMap(); - messageProperties.put("test", new SimplePropertyValue("testValue")); - MessageProviderConfig config = new MessageProviderConfig("test", messageProperties); - assertEquals("Unexpected name", "test", config.getName()); - assertEquals("Unexpected properties", messageProperties, config.getMessageProperties()); - } -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/ParticipantConfigTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/ParticipantConfigTest.java deleted file mode 100644 index b6efd68cbd..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/ParticipantConfigTest.java +++ /dev/null @@ -1,43 +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.controller.config; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; - -import org.apache.qpid.disttest.message.CreateParticpantCommand; -import org.apache.qpid.test.utils.QpidTestCase; - -public class ParticipantConfigTest extends QpidTestCase -{ - public void testCreateProducerCommandAppliesDurationOverride() - { - long overriddenDuration = 123; - setTestSystemProperty(ParticipantConfig.DURATION_OVERRIDE_SYSTEM_PROPERTY, String.valueOf(overriddenDuration)); - - CreateParticpantCommand createParticipantCommand = mock(CreateParticpantCommand.class); - ParticipantConfig participantConfig = new ParticipantConfig("name", "destinationName", false, 1, 2, 5000) - { - }; - - participantConfig.setParticipantProperties(createParticipantCommand); - - verify(createParticipantCommand).setMaximumDuration(overriddenDuration); - } -} 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 deleted file mode 100644 index ea9a406b1d..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/ProducerConfigTest.java +++ /dev/null @@ -1,103 +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.controller.config; - -import javax.jms.DeliveryMode; -import javax.jms.Message; - -import org.apache.qpid.disttest.message.CreateProducerCommand; -import org.apache.qpid.test.utils.QpidTestCase; - -public class ProducerConfigTest extends QpidTestCase -{ - public void testProducerHasZeroArgConstructorForGson() - { - ProducerConfig p = new ProducerConfig(); - assertNotNull(p); - } - - public void testConfigProvidesJmsDefaults() - { - CreateProducerCommand p = new ProducerConfig().createCommand("session1"); - assertEquals(Message.DEFAULT_DELIVERY_MODE, p.getDeliveryMode()); - assertEquals(Message.DEFAULT_PRIORITY, p.getPriority()); - 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"; - int messageSize = 1000; - int numberOfMessages = 10; - int priority = 4; - long timeToLive = 10000; - int batchSize = 5; - long interval = 60; - long maximumDuration = 70; - long startDelay = 80; - String providerName = "testProvider1"; - - ProducerConfig producerConfig = new ProducerConfig( - "producer1", - destination, - numberOfMessages, - batchSize, - maximumDuration, - DeliveryMode.NON_PERSISTENT, - messageSize, - priority, - timeToLive, - interval, - startDelay, - providerName); - - CreateProducerCommand command = producerConfig.createCommand("session1"); - - assertEquals("session1", command.getSessionName()); - assertEquals("producer1", command.getParticipantName()); - assertEquals(destination, command.getDestinationName()); - assertEquals(numberOfMessages, command.getNumberOfMessages()); - assertEquals(batchSize, command.getBatchSize()); - assertEquals(maximumDuration, command.getMaximumDuration()); - - assertEquals(DeliveryMode.NON_PERSISTENT, command.getDeliveryMode()); - assertEquals(messageSize, command.getMessageSize()); - assertEquals(priority, command.getPriority()); - assertEquals(timeToLive, command.getTimeToLive()); - assertEquals(interval, command.getInterval()); - assertEquals(startDelay, command.getStartDelay()); - assertEquals(providerName, command.getMessageProviderName()); - } -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/SessionConfigTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/SessionConfigTest.java deleted file mode 100644 index 02cdbb8fca..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/SessionConfigTest.java +++ /dev/null @@ -1,92 +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.controller.config; - -import static org.apache.qpid.disttest.controller.config.ConfigTestUtils.assertCommandEquals; -import static org.apache.qpid.disttest.controller.config.ConfigTestUtils.getCommand; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.util.Collections; -import java.util.List; - -import javax.jms.Session; - -import org.apache.qpid.disttest.message.Command; -import org.apache.qpid.disttest.message.CreateConsumerCommand; -import org.apache.qpid.disttest.message.CreateProducerCommand; -import org.apache.qpid.disttest.message.CreateSessionCommand; -import org.apache.qpid.test.utils.QpidTestCase; - -public class SessionConfigTest extends QpidTestCase -{ - private static final String CONNECTION_NAME = "conn1"; - private static final String SESSION = "session1"; - - public void testSessionHasZeroArgConstructorForGson() - { - SessionConfig s = new SessionConfig(); - assertNotNull(s); - } - - public void testCreateCommandsForSessionAndChildren() - { - SessionConfig sessionConfig = createSessionConfigWithChildCommands(); - - List commands = sessionConfig.createCommands(CONNECTION_NAME); - assertEquals(3, commands.size()); - - assertCommandEquals(commands, 0, CreateSessionCommand.class); - assertCommandEquals(commands, 1, CreateProducerCommand.class); - assertCommandEquals(commands, 2, CreateConsumerCommand.class); - - CreateSessionCommand createSessionCommand = getCommand(commands, 0); - assertEquals(Session.AUTO_ACKNOWLEDGE, createSessionCommand.getAcknowledgeMode()); - assertEquals(SESSION, createSessionCommand.getSessionName()); - assertEquals(CONNECTION_NAME, createSessionCommand.getConnectionName()); - } - - public void testGetTotalNumberOfParticipants() - { - SessionConfig sessionConfig = createSessionConfigWithOneConsumerAndOneProducer(); - assertEquals(2, sessionConfig.getTotalNumberOfParticipants()); - } - - private SessionConfig createSessionConfigWithOneConsumerAndOneProducer() - { - return createSessionConfigWithChildCommands(); - } - - private SessionConfig createSessionConfigWithChildCommands() - { - ProducerConfig producerConfig = mock(ProducerConfig.class); - ConsumerConfig consumerConfig = mock(ConsumerConfig.class); - - when(producerConfig.createCommand(SESSION)).thenReturn(mock(CreateProducerCommand.class)); - when(consumerConfig.createCommand(SESSION)).thenReturn(mock(CreateConsumerCommand.class)); - - return new SessionConfig(SESSION, - Session.AUTO_ACKNOWLEDGE, - Collections.singletonList(consumerConfig), - Collections.singletonList(producerConfig)); - } - - -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/TestConfigTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/TestConfigTest.java deleted file mode 100644 index be7c7a7c8c..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/TestConfigTest.java +++ /dev/null @@ -1,112 +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.controller.config; - -import static org.apache.qpid.disttest.controller.config.ConfigTestUtils.assertCommandForClient; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.qpid.disttest.controller.CommandForClient; -import org.apache.qpid.disttest.message.NoOpCommand; -import org.apache.qpid.test.utils.QpidTestCase; - -public class TestConfigTest extends QpidTestCase -{ - private static final QueueConfig[] EMPTY_QUEUES_ARRAY = new QueueConfig[0]; - private static final String CLIENT1 = "client1"; - private static final String CLIENT2 = "client2"; - private static final String TEST1 = "test1"; - - public void testConfigHasZeroArgConstructorForGson() - { - TestConfig c = new TestConfig(); - assertNotNull(c); - } - - public void testCreateCommandsForClient() - { - TestConfig config = createTestConfigWithClientConfigReturningChildCommands(); - - List commandsForClients = config.createCommands(); - assertEquals("Unexpected number of commands for client", 3, commandsForClients.size()); - - assertCommandForClient(commandsForClients, 0, CLIENT1, NoOpCommand.class); - assertCommandForClient(commandsForClients, 1, CLIENT1, NoOpCommand.class); - assertCommandForClient(commandsForClients, 2, CLIENT2, NoOpCommand.class); - } - - public void testGetClientNames() - { - TestConfig config = createTestConfigWithTwoClients(); - - assertEquals(2, config.getClientNames().size()); - } - - public void testGetTotalNumberOfClients() - { - TestConfig config = createTestConfigWithTwoClients(); - assertEquals(2, config.getTotalNumberOfClients()); - } - - public void testGetTotalNumberOfParticipants() - { - TestConfig config = createTestConfigWithTwoClients(); - assertEquals(2, config.getTotalNumberOfParticipants()); - } - - private TestConfig createTestConfigWithClientConfigReturningChildCommands() - { - ClientConfig clientConfig1 = createClientConfigReturningCommands(CLIENT1, 2); - ClientConfig clientConfig2 = createClientConfigReturningCommands(CLIENT2, 1); - - TestConfig config = new TestConfig(TEST1, new ClientConfig[] { clientConfig1, clientConfig2 }, EMPTY_QUEUES_ARRAY); - return config; - } - - private ClientConfig createClientConfigReturningCommands(final String clientName, int numberOfCommands) - { - ClientConfig clientConfig = mock(ClientConfig.class); - - List commandList = new ArrayList(); - - for (int i = 1 ; i <= numberOfCommands; i++) - { - commandList.add(new CommandForClient(clientName, new NoOpCommand())); - } - - when(clientConfig.createCommands()).thenReturn(commandList); - return clientConfig; - } - - private TestConfig createTestConfigWithTwoClients() - { - ClientConfig clientConfig1 = mock(ClientConfig.class); - ClientConfig clientConfig2 = mock(ClientConfig.class); - - when(clientConfig1.getTotalNumberOfParticipants()).thenReturn(1); - when(clientConfig2.getTotalNumberOfParticipants()).thenReturn(1); - - TestConfig config = new TestConfig(TEST1, new ClientConfig[] { clientConfig1, clientConfig2 }, EMPTY_QUEUES_ARRAY); - return config; - } -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/TestInstanceTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/TestInstanceTest.java deleted file mode 100644 index 187b57c399..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/TestInstanceTest.java +++ /dev/null @@ -1,101 +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.controller.config; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import org.apache.qpid.disttest.controller.CommandForClient; -import org.apache.qpid.disttest.message.CreateConsumerCommand; -import org.apache.qpid.disttest.message.CreateProducerCommand; -import org.apache.qpid.disttest.message.NoOpCommand; -import org.apache.qpid.test.utils.QpidTestCase; - -public class TestInstanceTest extends QpidTestCase -{ - private static final String CLIENT_NAME = "CLIENT_NAME"; - private static final int ITERATION_NUMBER = 0; - - private NoOpCommand _noOpCommand; - private CreateProducerCommand _createProducerCommand; - private CreateConsumerCommand _createConsumerCommand; - - @Override - protected void setUp() throws Exception - { - super.setUp(); - _noOpCommand = mock(NoOpCommand.class); - _createProducerCommand = mock(CreateProducerCommand.class); - _createConsumerCommand = mock(CreateConsumerCommand.class); - } - - public void testCreateCommandsWithIterationValues() - { - IterationValue iterationValue = mock(IterationValue.class); - - TestConfig config = createTestConfig(); - - TestInstance testInstance = new TestInstance(config, ITERATION_NUMBER, iterationValue); - - List commandsForClients = testInstance.createCommands(); - assertEquals("Unexpected number of commands for client", 3, commandsForClients.size()); - - verify(iterationValue).applyToCommand(_noOpCommand); - verify(iterationValue).applyToCommand(_createProducerCommand); - verify(iterationValue).applyToCommand(_createConsumerCommand); - } - - public void testCreateCommandsWithoutIterationValues() - { - TestConfig config = createTestConfig(); - TestInstance testInstance = new TestInstance(config); - - List commandsForClients = testInstance.createCommands(); - assertEquals("Unexpected number of commands for client", 3, commandsForClients.size()); - } - - public void testGetConfiguredClientNames() - { - TestConfig testConfig = mock(TestConfig.class); - when(testConfig.getClientNames()).thenReturn(Collections.singletonList(CLIENT_NAME)); - TestInstance testInstance = new TestInstance(testConfig); - - List clientNames = testInstance.getClientNames(); - assertEquals(1, clientNames.size()); - assertEquals(CLIENT_NAME, clientNames.get(0)); - } - - private TestConfig createTestConfig() - { - CommandForClient commandForClient1 = new CommandForClient(CLIENT_NAME, _noOpCommand); - CommandForClient commandForClient2 = new CommandForClient(CLIENT_NAME, _createProducerCommand); - CommandForClient commandForClient3 = new CommandForClient(CLIENT_NAME, _createConsumerCommand); - - TestConfig config = mock(TestConfig.class); - when(config.createCommands()).thenReturn(Arrays.asList(commandForClient1, commandForClient2, commandForClient3)); - - return config; - } - -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/sampleConfig.json b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/sampleConfig.json deleted file mode 100644 index 9e1168129b..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/sampleConfig.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "_tests": [ - { - "_name": "Test 1", - "_queues": [ - { - "_name": "Json-Queue-Name", - "_durable": false, - "_attributes": {} - }, - { - "_name": "Json Queue Name 2", - "_durable": true, - "_attributes": { - "x-qpid-priorities": 10.0 - } - } - ], - "_iterations": [ - { - "_messageSize": 100, - "_numberOfMessages": 10 - }, - { - "_messageSize": 200, - "_numberOfMessages": 5 - } - ], - "_clients": [ - { - "_connections": [ - { - "_name": "connection1", - "_sessions": [] - } - ]; - "_messageProviders":[ - { - "_name": "testProvider1"; - "_messageProperties": { - "priority": {"@def": "list"; "_items": [1,2,3,4,4]}; - "id": {"@def": "random"; "_upper": 10}; - "test": "test-value" - } - } - ] - } - ] - }, - { - "_name": "Test 2", - "_queues": [ - { - "_name": "Json-Queue-Name", - "_durable": false, - "_attributes": {} - } - ], - "_iterations": [], - "_clients": [ - { - "_connections": [ - { - "_name": "connection1", - "_sessions": [] - } - ] - } - ] - } - ] -} \ No newline at end of file diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/db/ResultsDbWriterTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/db/ResultsDbWriterTest.java deleted file mode 100644 index abc6b44493..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/db/ResultsDbWriterTest.java +++ /dev/null @@ -1,158 +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.db; - -import static org.apache.qpid.disttest.message.ParticipantAttribute.ITERATION_NUMBER; -import static org.apache.qpid.disttest.message.ParticipantAttribute.PARTICIPANT_NAME; -import static org.apache.qpid.disttest.message.ParticipantAttribute.TEST_NAME; -import static org.apache.qpid.disttest.message.ParticipantAttribute.THROUGHPUT; -import static org.apache.qpid.test.utils.TestFileUtils.createTestDirectory; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.io.File; -import java.sql.Connection; -import java.sql.Driver; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.Statement; -import java.sql.Timestamp; -import java.util.Hashtable; -import java.util.TimeZone; - -import javax.naming.Context; -import javax.naming.NamingException; - -import org.apache.qpid.disttest.controller.ResultsForAllTests; -import org.apache.qpid.disttest.db.ResultsDbWriter.Clock; -import org.apache.qpid.disttest.message.ParticipantResult; -import org.apache.qpid.disttest.results.ResultsTestFixture; -import org.apache.qpid.test.utils.QpidTestCase; -import org.apache.qpid.util.FileUtils; - -public class ResultsDbWriterTest extends QpidTestCase -{ - private static final long _dummyTimestamp = 1234; - - private File _tempDbDirectory; - private Clock _clock = mock(Clock.class); - private ResultsTestFixture _resultsTestFixture = new ResultsTestFixture(); - - @Override - protected void setUp() throws Exception - { - super.setUp(); - _tempDbDirectory = createTestDirectory(); - when(_clock.currentTimeMillis()).thenReturn(_dummyTimestamp); - } - - - @Override - protected void tearDown() throws Exception - { - try - { - FileUtils.deleteDirectory(_tempDbDirectory.getAbsolutePath()); - } - finally - { - super.tearDown(); - } - } - - - public void testWriteResults() throws Exception - { - Context context = getContext(); - ResultsForAllTests results = _resultsTestFixture.createResultsForAllTests(); - String runId = "myRunId"; - - ResultsDbWriter resultsDbWriter = new ResultsDbWriter(context, runId, _clock); - resultsDbWriter.createResultsTableIfNecessary(); - - resultsDbWriter.writeResults(results); - - ParticipantResult expectedResult = _resultsTestFixture.getFirstParticipantResult(results); - assertResultsAreInDb(context, expectedResult, runId); - } - - public void testDefaultRunId() throws Exception - { - TimeZone defaultTimeZone = TimeZone.getDefault(); - try - { - // set non-GMT timezone to make the test more rigorous. - TimeZone.setDefault(TimeZone.getTimeZone("GMT-05:00")); - ResultsDbWriter resultsDbWriter = new ResultsDbWriter(getContext(), null, _clock); - String runId = resultsDbWriter.getRunId(); - assertEquals( - "Default run id '" + runId + "' should correspond to dummy timestamp " + _clock.currentTimeMillis(), - "run 1970-01-01 00:00:01.234", - runId); - } - finally - { - TimeZone.setDefault(defaultTimeZone); - } - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - private Context getContext() throws NamingException - { - Context context = mock(Context.class); - Hashtable environment = new Hashtable(); - - environment.put(ResultsDbWriter.DRIVER_NAME, "org.apache.derby.jdbc.EmbeddedDriver"); - environment.put(ResultsDbWriter.URL, "jdbc:derby:" + _tempDbDirectory + "perftestResultsDb;create=true"); - - when(context.getEnvironment()).thenReturn(environment); - return context; - } - - @SuppressWarnings("unchecked") - private void assertResultsAreInDb(Context context, ParticipantResult participantResult, String expectedRunId) throws Exception - { - String driverName = (String) context.getEnvironment().get(ResultsDbWriter.DRIVER_NAME); - Class driverClass = (Class) Class.forName(driverName); - driverClass.newInstance(); - String url = (String) context.getEnvironment().get(ResultsDbWriter.URL); - - Connection connection = DriverManager.getConnection(url); - Statement statement = connection.createStatement(); - ResultSet rs = statement.executeQuery( - "SELECT * FROM results WHERE testName='" + participantResult.getTestName() + - "' AND runId='" + expectedRunId + "'"); - - try - { - rs.next(); - assertEquals(participantResult.getTestName(), rs.getString(TEST_NAME.getDisplayName())); - assertEquals(participantResult.getIterationNumber(), rs.getInt(ITERATION_NUMBER.getDisplayName())); - assertEquals(participantResult.getParticipantName(), rs.getString(PARTICIPANT_NAME.getDisplayName())); - assertEquals(participantResult.getThroughput(), rs.getDouble(THROUGHPUT.getDisplayName())); - assertEquals(expectedRunId, rs.getString(ResultsDbWriter.RUN_ID)); - assertEquals(new Timestamp(_dummyTimestamp), rs.getTimestamp(ResultsDbWriter.INSERTED_TIMESTAMP)); - } - finally - { - connection.close(); - } - } -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/jms/JmsMessageAdaptorTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/jms/JmsMessageAdaptorTest.java deleted file mode 100644 index d4f0cb1f22..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/jms/JmsMessageAdaptorTest.java +++ /dev/null @@ -1,39 +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.jms; - -import org.apache.qpid.disttest.message.Command; -import org.apache.qpid.disttest.message.CommandType; -import org.apache.qpid.test.utils.QpidTestCase; - -public class JmsMessageAdaptorTest extends QpidTestCase -{ - - public void testCheckAllCommandTypes() - { - for (CommandType commandType : CommandType.values()) - { - Class clazz = JmsMessageAdaptor.getCommandClassFromType(commandType); - assertNotNull(clazz); - - } - - } - -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/message/JsonHandlerTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/message/JsonHandlerTest.java deleted file mode 100644 index 2e0c2e1ecd..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/message/JsonHandlerTest.java +++ /dev/null @@ -1,182 +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.message; - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang.builder.EqualsBuilder; -import org.apache.qpid.disttest.client.property.ListPropertyValue; -import org.apache.qpid.disttest.client.property.PropertyValue; -import org.apache.qpid.disttest.json.JsonHandler; -import org.apache.qpid.test.utils.QpidTestCase; - -public class JsonHandlerTest extends QpidTestCase -{ - private JsonHandler _jsonHandler = null; - private SendChristmasCards _testCommand = null; - - @Override - protected void setUp() throws Exception - { - super.setUp(); - - _jsonHandler = new JsonHandler(); - - _testCommand = new SendChristmasCards(CommandType.START_TEST, Collections.singletonMap(SendChristmasCards.CardType.FUNNY, 5)); - _testCommand.persons = Arrays.asList(new Person("Phil"), new Person("Andrew")); - } - - public void testMarshallUnmarshall() throws Exception - { - final String jsonString = _jsonHandler.marshall(_testCommand); - - final SendChristmasCards unmarshalledCommand = _jsonHandler.unmarshall(jsonString, SendChristmasCards.class); - - assertEquals("Unmarshalled command should be equal to the original object", _testCommand, unmarshalledCommand); - } - - public void testGeneratorDesrialization() - { - String json = "{_messageProperties: {test: 1; generator: {'@def': 'list'; _cyclic: false; _items: ['first', " + - "{'@def': 'range'; _upper:10; '_type':'int'}]}}}"; - final TestCommand unmarshalledCommand = _jsonHandler.unmarshall(json, TestCommand.class); - Map properties = unmarshalledCommand.getMessageProperties(); - assertNotNull("Properties should not be null", properties); - assertFalse("Properties should not be empty", properties.isEmpty()); - assertEquals("Unexpected properties size", 2, properties.size()); - PropertyValue testProperty = properties.get("test"); - assertNotNull("Unexpected property test", testProperty); - assertTrue("Unexpected property test", testProperty.getValue() instanceof Number); - assertEquals("Unexpected property value", 1, ((Number)testProperty.getValue()).intValue()); - Object generatorObject = properties.get("generator"); - assertTrue("Unexpected generator object", generatorObject instanceof ListPropertyValue); - PropertyValue generator = (PropertyValue)generatorObject; - assertEquals("Unexpected generator value", "first", generator.getValue()); - for (int i = 0; i < 10; i++) - { - assertEquals("Unexpected generator value", new Integer(i), generator.getValue()); - } - String newJson =_jsonHandler.marshall(unmarshalledCommand); - final TestCommand newUnmarshalledCommand = _jsonHandler.unmarshall(newJson, TestCommand.class); - assertEquals("Unmarshalled command should be equal to the original object", unmarshalledCommand, newUnmarshalledCommand); - } - - /** - * A {@link Command} designed to exercise {@link JsonHandler}, e.g does it handle a map of enums?. - * - * This class is non-private to avoid auto-deletion of "unused" fields/methods - */ - static class SendChristmasCards extends Command - { - enum CardType {FUNNY, TRADITIONAL} - - private Map _cardTypes; - private List persons; - - public SendChristmasCards(final CommandType type, Map cardTypes) - { - super(type); - _cardTypes = cardTypes; - } - - public Map getCardTypes() - { - return _cardTypes; - } - - public List getPersons() - { - return persons; - } - - @Override - public boolean equals(final Object obj) - { - return EqualsBuilder.reflectionEquals(this, obj); - } - } - - /** - * This class is non-private to avoid auto-deletion of "unused" fields/methods - */ - static class Person - { - private String _firstName; - - public Person(final String firstName) - { - _firstName = firstName; - } - - public String getFirstName() - { - return _firstName; - } - - @Override - public boolean equals(final Object obj) - { - return EqualsBuilder.reflectionEquals(this, obj); - } - - } - - /** - * Yet another test class - */ - static class TestCommand extends Command - { - - private Map _messageProperties; - - public TestCommand(CommandType type) - { - super(type); - } - - public Map getMessageProperties() - { - return _messageProperties; - } - - public void setMessageProperties(Map _messageProperties) - { - this._messageProperties = _messageProperties; - } - - @Override - public boolean equals(final Object obj) - { - if (obj == null || !(obj instanceof TestCommand)) - { - return false; - } - TestCommand other = (TestCommand)obj; - if (_messageProperties == null && other._messageProperties != null ) - { - return false; - } - return _messageProperties.equals(other._messageProperties); - } - } -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/message/ParticipantResultTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/message/ParticipantResultTest.java deleted file mode 100644 index e9d444d59c..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/message/ParticipantResultTest.java +++ /dev/null @@ -1,165 +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.message; - -import static org.apache.qpid.disttest.message.ParticipantAttribute.ACKNOWLEDGE_MODE; -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.DELIVERY_MODE; -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.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 java.util.Date; - -import javax.jms.DeliveryMode; - -import org.apache.qpid.test.utils.QpidTestCase; - -public class ParticipantResultTest extends QpidTestCase -{ - - public void testSharedParticipantResultAttributes() throws Exception - { - final String participantName = "PARTICIPANT_NAME1"; - final String testName = "TEST_NAME1"; - String clientConfiguredName = "CLIENT_CONFIGURED_NAME"; - String errorMessage = "errorMessage"; - int iterationNumber = 1; - - ParticipantResult result = new ParticipantResult(); - - long numberOfMessages = 500; - long timeTaken = 30; - int batchSize = 10; - - long startTime = System.currentTimeMillis(); - long endTime = startTime + timeTaken; - long maximumDuration = 1000; - - int totalNumberOfConsumers = 1; - int totalNumberOfProducers = 1; - - int acknowledgeMode = 1; - - result.setParticipantName(participantName); - result.setTestName(testName); - result.setIterationNumber(iterationNumber); - result.setConfiguredClientName(clientConfiguredName); - - result.setAcknowledgeMode(acknowledgeMode); - result.setNumberOfMessagesProcessed(numberOfMessages); - result.setConfiguredClientName(clientConfiguredName); - result.setBatchSize(batchSize); - - result.setStartDate(new Date(startTime)); - result.setEndDate(new Date(endTime)); - result.setMaximumDuration(maximumDuration); - - result.setTotalNumberOfConsumers(totalNumberOfConsumers); - result.setTotalNumberOfProducers(totalNumberOfProducers); - - result.setErrorMessage(errorMessage); - - assertEquals(participantName, result.getAttributes().get(PARTICIPANT_NAME)); - assertEquals(testName, result.getAttributes().get(TEST_NAME)); - assertEquals(iterationNumber, result.getAttributes().get(ITERATION_NUMBER)); - assertEquals(clientConfiguredName, result.getAttributes().get(CONFIGURED_CLIENT_NAME)); - assertEquals(numberOfMessages, result.getAttributes().get(NUMBER_OF_MESSAGES_PROCESSED)); - assertEquals(timeTaken, result.getAttributes().get(TIME_TAKEN)); - assertEquals(timeTaken, result.getAttributes().get(TIME_TAKEN)); - assertEquals(timeTaken, result.getAttributes().get(TIME_TAKEN)); - assertEquals(batchSize, result.getAttributes().get(BATCH_SIZE)); - assertEquals(maximumDuration, result.getAttributes().get(MAXIMUM_DURATION)); - assertEquals(totalNumberOfConsumers, result.getAttributes().get(TOTAL_NUMBER_OF_CONSUMERS)); - assertEquals(totalNumberOfProducers, result.getAttributes().get(TOTAL_NUMBER_OF_PRODUCERS)); - assertEquals(acknowledgeMode, result.getAttributes().get(ACKNOWLEDGE_MODE)); - assertEquals(errorMessage, result.getAttributes().get(ERROR_MESSAGE)); - } - - public void testConsumerParticipantResultAttributes() throws Exception - { - ConsumerParticipantResult result = new ConsumerParticipantResult(); - - boolean topic = true; - boolean durable = true; - boolean browsingSubscription = false; - boolean selector = true; - boolean noLocal = false; - boolean synchronousConsumer = true; - - result.setTopic(topic); - result.setDurableSubscription(durable); - result.setBrowsingSubscription(browsingSubscription); - result.setSelector(selector); - result.setNoLocal(noLocal); - result.setSynchronousConsumer(synchronousConsumer); - - assertEquals(topic, result.getAttributes().get(IS_TOPIC)); - assertEquals(durable, result.getAttributes().get(IS_DURABLE_SUBSCRIPTION)); - assertEquals(browsingSubscription, result.getAttributes().get(IS_BROWSING_SUBSCRIPTION)); - assertEquals(selector, result.getAttributes().get(IS_SELECTOR)); - assertEquals(noLocal, result.getAttributes().get(IS_NO_LOCAL)); - assertEquals(synchronousConsumer, result.getAttributes().get(IS_SYNCHRONOUS_CONSUMER)); - } - - public void testProducerParticipantResultAttributes() throws Exception - { - ProducerParticipantResult result = new ProducerParticipantResult(); - - int priority = 2; - long timeToLive = 30; - long producerStartDelay = 40; - long producerInterval = 50; - int messageSize = 60; - int deliveryMode = DeliveryMode.PERSISTENT; - - result.setPriority(priority); - result.setTimeToLive(timeToLive); - result.setStartDelay(producerStartDelay); - result.setInterval(producerInterval); - result.setPayloadSize(messageSize); - result.setDeliveryMode(deliveryMode); - - - assertEquals(priority, result.getAttributes().get(PRIORITY)); - assertEquals(timeToLive, result.getAttributes().get(TIME_TO_LIVE)); - assertEquals(producerStartDelay, result.getAttributes().get(PRODUCER_START_DELAY)); - assertEquals(producerInterval, result.getAttributes().get(PRODUCER_INTERVAL)); - assertEquals(messageSize, result.getAttributes().get(PAYLOAD_SIZE)); - assertEquals(deliveryMode, result.getAttributes().get(DELIVERY_MODE)); - } -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/ResultsFileWriterTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/ResultsFileWriterTest.java deleted file mode 100644 index db306ea1a4..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/ResultsFileWriterTest.java +++ /dev/null @@ -1,86 +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; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -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; -import org.apache.qpid.test.utils.TestFileUtils; -import org.apache.qpid.util.FileUtils; - -public class ResultsFileWriterTest extends QpidTestCase -{ - private CSVFormatter _csvFormater = mock(CSVFormatter.class); - private TestResultAggregator _testResultAggregator = mock(TestResultAggregator.class); - - private File _outputDir = TestFileUtils.createTestDirectory(); - - private ResultsCsvWriter _resultsFileWriter = new ResultsCsvWriter(_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.writeResults(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, ResultsCsvWriter.TEST_SUMMARY_FILE_NAME); - - assertEquals(expectedSummaryFileContents, FileUtils.readFileAsString(summaryFile)); - } - -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/ResultsTestFixture.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/ResultsTestFixture.java deleted file mode 100644 index 1edef031bf..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/ResultsTestFixture.java +++ /dev/null @@ -1,138 +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; - -import static org.apache.qpid.disttest.message.ParticipantAttribute.ACKNOWLEDGE_MODE; -import static org.apache.qpid.disttest.message.ParticipantAttribute.AVERAGE_LATENCY; -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.DELIVERY_MODE; -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.LATENCY_STANDARD_DEVIATION; -import static org.apache.qpid.disttest.message.ParticipantAttribute.MAXIMUM_DURATION; -import static org.apache.qpid.disttest.message.ParticipantAttribute.MAX_LATENCY; -import static org.apache.qpid.disttest.message.ParticipantAttribute.MESSAGE_THROUGHPUT; -import static org.apache.qpid.disttest.message.ParticipantAttribute.MIN_LATENCY; -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.util.HashMap; -import java.util.List; -import java.util.Map; - -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; -import org.apache.qpid.disttest.results.aggregation.ITestResult; - -public class ResultsTestFixture -{ - public static final double THROUGHPUT_VALUE = 2048.49; - - private static final String TEST1 = "TEST1"; - private static final String PARTICIPANT = "PARTICIPANT"; - private static final String CONFIGURED_CLIENT1 = "CONFIGURED_CLIENT1"; - - public ResultsForAllTests createResultsForAllTests() - { - ParticipantResult participantResult = mock(ParticipantResult.class); - Map participantAttributes = getParticipantAttributes(); - - when(participantResult.getAttributes()).thenReturn(participantAttributes); - when(participantResult.getParticipantName()).thenReturn(PARTICIPANT); - when(participantResult.getTestName()).thenReturn(TEST1); - when(participantResult.getIterationNumber()).thenReturn(0); - when(participantResult.getThroughput()).thenReturn(THROUGHPUT_VALUE); - - TestResult testResult = new TestResult(TEST1); - testResult.addParticipantResult(participantResult); - - ResultsForAllTests resultsForAllTests = new ResultsForAllTests(); - resultsForAllTests.add(testResult); - return resultsForAllTests; - } - - 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, 2); - 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, THROUGHPUT_VALUE); - 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); - participantAttributes.put(MESSAGE_THROUGHPUT, 2); - return participantAttributes; - } - - public ParticipantResult getFirstParticipantResult(ResultsForAllTests results) - { - List testResults = results.getTestResults(); - ITestResult testResult = testResults.iterator().next(); - List participantResults = testResult.getParticipantResults(); - return participantResults.iterator().next(); - } -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/aggregation/AggregatorTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/aggregation/AggregatorTest.java deleted file mode 100644 index 011eb4e68b..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/aggregation/AggregatorTest.java +++ /dev/null @@ -1,60 +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.aggregation; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.Arrays; - -import org.apache.qpid.disttest.controller.ResultsForAllTests; -import org.apache.qpid.test.utils.QpidTestCase; - -public class AggregatorTest extends QpidTestCase -{ - private Aggregator _aggregator = new Aggregator(); - private TestResultAggregator _testResultAggregator = mock(TestResultAggregator.class); - - @Override - protected void setUp() throws Exception - { - super.setUp(); - _aggregator.setTestResultAggregator(_testResultAggregator); - } - - public void testAggregrateManyTestResults() throws Exception - { - ResultsForAllTests resultsForAllTests = mock(ResultsForAllTests.class); - ITestResult testResult1 = mock(ITestResult.class); - ITestResult testResult2 = mock(ITestResult.class); - - when(resultsForAllTests.getTestResults()).thenReturn(Arrays.asList(testResult1, testResult2)); - when(_testResultAggregator.aggregateTestResult(testResult1)).thenReturn(mock(AggregatedTestResult.class)); - when(_testResultAggregator.aggregateTestResult(testResult2)).thenReturn(mock(AggregatedTestResult.class)); - - ResultsForAllTests aggregatedResultsForAllTests = _aggregator.aggregateResults(resultsForAllTests); - assertEquals(2, aggregatedResultsForAllTests.getTestResults().size()); - - verify(_testResultAggregator).aggregateTestResult(testResult1); - verify(_testResultAggregator).aggregateTestResult(testResult2); - - } - -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/aggregation/ParticipantResultAggregatorTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/aggregation/ParticipantResultAggregatorTest.java deleted file mode 100644 index 41da1edb33..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/aggregation/ParticipantResultAggregatorTest.java +++ /dev/null @@ -1,294 +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.aggregation; - -import java.util.Date; - -import javax.jms.Session; - -import org.apache.qpid.disttest.message.ParticipantResult; -import org.apache.qpid.test.utils.QpidTestCase; - -public class ParticipantResultAggregatorTest extends QpidTestCase -{ - private ParticipantResultAggregator _aggregator = new ParticipantResultAggregator(ParticipantResult.class, AGGREGATED_RESULT_NAME); - - private static final String TEST_NAME = "TEST_NAME"; - private static final String AGGREGATED_RESULT_NAME = "AGGREGATED_RESULT_NAME"; - private static final int TEST_ITERATION_NUMBER = 1; - - private static final long PARTICIPANT1_STARTDATE = 50; - private static final long PARTICIPANT1_ENDDATE = 20000; - private static final long PARTICIPANT1_TOTAL_PROCESSED = 1024; - private static final int PARTICIPANT1_NUMBER_OF_MESSAGES_PROCESSED = 20000; - - private static final long PARTICIPANT2_STARTDATE = 100; - private static final long PARTICIPANT2_ENDDATE = 21000; - private static final long PARTICIPANT2_TOTAL_PROCESSED = 2048; - private static final int PARTICIPANT2_NUMBER_OF_MESSAGES_PROCESSED = 950; - - private static final long OVERALL_PROCESSED = PARTICIPANT1_TOTAL_PROCESSED + PARTICIPANT2_TOTAL_PROCESSED; - private static final double OVERALL_TIMETAKEN = PARTICIPANT2_ENDDATE - PARTICIPANT1_STARTDATE; - private static final long OVERALL_NUMBER_OF_MESSAGES_PROCESSED = PARTICIPANT1_NUMBER_OF_MESSAGES_PROCESSED + PARTICIPANT2_NUMBER_OF_MESSAGES_PROCESSED; - - private static final double EXPECTED_AGGREGATED_ALL_THROUGHPUT = ((OVERALL_PROCESSED)/1024)/((OVERALL_TIMETAKEN)/1000); - private static final int EXPECTED_AGGREGATED_MESSAGE_THROUGHPUT = (int)(OVERALL_NUMBER_OF_MESSAGES_PROCESSED * 1000.0d/OVERALL_TIMETAKEN); - - public void testStartAndEndDateForOneParticipantResult() - { - ParticipantResult result = new ParticipantResult(); - result.setStartDate(new Date(PARTICIPANT1_STARTDATE)); - result.setEndDate(new Date(PARTICIPANT1_ENDDATE)); - - _aggregator.aggregate(result); - ParticipantResult aggregratedResult = _aggregator.getAggregatedResult(); - assertEquals(PARTICIPANT1_STARTDATE, aggregratedResult.getStartInMillis()); - assertEquals(PARTICIPANT1_ENDDATE, aggregratedResult.getEndInMillis()); - } - - public void testStartAndEndDateForTwoParticipantResults() - { - ParticipantResult result1 = new ParticipantResult(); - result1.setStartDate(new Date(PARTICIPANT1_STARTDATE)); - result1.setEndDate(new Date(PARTICIPANT1_ENDDATE)); - - ParticipantResult result2 = new ParticipantResult(); - result2.setStartDate(new Date(PARTICIPANT2_STARTDATE)); - result2.setEndDate(new Date(PARTICIPANT2_ENDDATE)); - - _aggregator.aggregate(result1); - _aggregator.aggregate(result2); - - ParticipantResult aggregratedResult = _aggregator.getAggregatedResult(); - assertEquals(PARTICIPANT1_STARTDATE, aggregratedResult.getStartInMillis()); - assertEquals(PARTICIPANT2_ENDDATE, aggregratedResult.getEndInMillis()); - } - - public void testComputeNumberOfMessagesProcessed() - { - ParticipantResult result1 = new ParticipantResult(); - result1.setNumberOfMessagesProcessed(10); - - ParticipantResult result2 = new ParticipantResult(); - result2.setNumberOfMessagesProcessed(15); - - _aggregator.aggregate(result1); - _aggregator.aggregate(result2); - - ParticipantResult aggregratedResult = _aggregator.getAggregatedResult(); - assertEquals(25, aggregratedResult.getNumberOfMessagesProcessed()); - } - - public void testComputeTotalPayloadProcessed() - { - ParticipantResult result1 = new ParticipantResult(); - result1.setTotalPayloadProcessed(PARTICIPANT1_TOTAL_PROCESSED); - - ParticipantResult result2 = new ParticipantResult(); - result2.setTotalPayloadProcessed(PARTICIPANT2_TOTAL_PROCESSED); - - _aggregator.aggregate(result1); - _aggregator.aggregate(result2); - - ParticipantResult aggregratedResult = _aggregator.getAggregatedResult(); - assertEquals(OVERALL_PROCESSED, aggregratedResult.getTotalPayloadProcessed()); - } - - public void testComputeThroughput() - { - ParticipantResult result1 = new ParticipantResult(); - result1.setStartDate(new Date(PARTICIPANT1_STARTDATE)); - result1.setEndDate(new Date(PARTICIPANT1_ENDDATE)); - result1.setTotalPayloadProcessed(PARTICIPANT1_TOTAL_PROCESSED); - - ParticipantResult result2 = new ParticipantResult(); - result2.setStartDate(new Date(PARTICIPANT2_STARTDATE)); - result2.setEndDate(new Date(PARTICIPANT2_ENDDATE)); - result2.setTotalPayloadProcessed(PARTICIPANT2_TOTAL_PROCESSED); - - _aggregator.aggregate(result1); - _aggregator.aggregate(result2); - - ParticipantResult aggregratedResult = _aggregator.getAggregatedResult(); - assertEquals(EXPECTED_AGGREGATED_ALL_THROUGHPUT, aggregratedResult.getThroughput(), 0.1); - } - - public void testComputeMessageThroughput() - { - ParticipantResult result1 = new ParticipantResult(); - result1.setStartDate(new Date(PARTICIPANT1_STARTDATE)); - result1.setEndDate(new Date(PARTICIPANT1_ENDDATE)); - result1.setNumberOfMessagesProcessed(PARTICIPANT1_NUMBER_OF_MESSAGES_PROCESSED); - - ParticipantResult result2 = new ParticipantResult(); - result2.setStartDate(new Date(PARTICIPANT2_STARTDATE)); - result2.setEndDate(new Date(PARTICIPANT2_ENDDATE)); - result2.setNumberOfMessagesProcessed(PARTICIPANT2_NUMBER_OF_MESSAGES_PROCESSED); - - _aggregator.aggregate(result1); - _aggregator.aggregate(result2); - - ParticipantResult aggregratedResult = _aggregator.getAggregatedResult(); - assertEquals(EXPECTED_AGGREGATED_MESSAGE_THROUGHPUT, aggregratedResult.getMessageThroughput()); - - } - - public void testConstantTestNameAndIterationNumberRolledUp() throws Exception - { - ParticipantResult result1 = new ParticipantResult(); - result1.setTestName(TEST_NAME); - result1.setIterationNumber(TEST_ITERATION_NUMBER); - - ParticipantResult result2 = new ParticipantResult(); - result2.setTestName(TEST_NAME); - result2.setIterationNumber(TEST_ITERATION_NUMBER); - - _aggregator.aggregate(result1); - _aggregator.aggregate(result2); - - ParticipantResult aggregratedResult = _aggregator.getAggregatedResult(); - assertEquals(TEST_ITERATION_NUMBER, aggregratedResult.getIterationNumber()); - assertEquals(TEST_NAME, aggregratedResult.getTestName()); - } - - public void testConstantPayloadSizesRolledUp() throws Exception - { - final int payloadSize = 1024; - - ParticipantResult result1 = new ParticipantResult(); - result1.setPayloadSize(payloadSize); - - ParticipantResult result2 = new ParticipantResult(); - result2.setPayloadSize(payloadSize); - - _aggregator.aggregate(result1); - _aggregator.aggregate(result2); - - ParticipantResult aggregratedResult = _aggregator.getAggregatedResult(); - assertEquals(payloadSize, aggregratedResult.getPayloadSize()); - } - - public void testDifferingPayloadSizesNotRolledUp() throws Exception - { - final int payload1Size = 1024; - final int payload2Size = 2048; - - ParticipantResult result1 = new ParticipantResult(); - result1.setPayloadSize(payload1Size); - - ParticipantResult result2 = new ParticipantResult(); - result2.setPayloadSize(payload2Size); - - _aggregator.aggregate(result1); - _aggregator.aggregate(result2); - - ParticipantResult aggregratedResult = _aggregator.getAggregatedResult(); - assertEquals(0, aggregratedResult.getPayloadSize()); - } - - public void testConstantBatchSizesRolledUp() throws Exception - { - final int batchSize = 10; - - ParticipantResult result1 = new ParticipantResult(); - result1.setBatchSize(batchSize); - - ParticipantResult result2 = new ParticipantResult(); - result2.setBatchSize(batchSize); - - _aggregator.aggregate(result1); - _aggregator.aggregate(result2); - - ParticipantResult aggregratedResult = _aggregator.getAggregatedResult(); - assertEquals(batchSize, aggregratedResult.getBatchSize()); - } - - public void testDifferingBatchSizesNotRolledUp() throws Exception - { - final int batch1Size = 10; - final int batch2Size = 20; - - ParticipantResult result1 = new ParticipantResult(); - result1.setBatchSize(batch1Size); - - ParticipantResult result2 = new ParticipantResult(); - result2.setBatchSize(batch2Size); - - _aggregator.aggregate(result1); - _aggregator.aggregate(result2); - - ParticipantResult aggregratedResult = _aggregator.getAggregatedResult(); - assertEquals(0, aggregratedResult.getBatchSize()); - } - - public void testConstantAcknowledgeModesRolledUp() throws Exception - { - ParticipantResult result1 = new ParticipantResult(); - result1.setAcknowledgeMode(Session.DUPS_OK_ACKNOWLEDGE); - - ParticipantResult result2 = new ParticipantResult(); - result2.setAcknowledgeMode(Session.DUPS_OK_ACKNOWLEDGE); - - _aggregator.aggregate(result1); - _aggregator.aggregate(result2); - - ParticipantResult aggregratedResult = _aggregator.getAggregatedResult(); - assertEquals(Session.DUPS_OK_ACKNOWLEDGE, aggregratedResult.getAcknowledgeMode()); - } - - public void testDifferingAcknowledgeModesNotRolledUp() throws Exception - { - ParticipantResult result1 = new ParticipantResult(); - result1.setBatchSize(Session.AUTO_ACKNOWLEDGE); - - ParticipantResult result2 = new ParticipantResult(); - result2.setBatchSize(Session.SESSION_TRANSACTED); - - _aggregator.aggregate(result1); - _aggregator.aggregate(result2); - - ParticipantResult aggregratedResult = _aggregator.getAggregatedResult(); - assertEquals(-1, aggregratedResult.getAcknowledgeMode()); - } - - public void testSumNumberOfConsumerAndProducers() throws Exception - { - final int expectedNumberOfProducers = 1; - final int expectedNumberOfConsumers = 2; - - ParticipantResult result1 = new ParticipantResult(); - result1.setTotalNumberOfConsumers(1); - - ParticipantResult result2 = new ParticipantResult(); - result2.setTotalNumberOfConsumers(1); - - ParticipantResult result3 = new ParticipantResult(); - result2.setTotalNumberOfProducers(1); - - _aggregator.aggregate(result1); - _aggregator.aggregate(result2); - _aggregator.aggregate(result3); - - ParticipantResult aggregratedResult = _aggregator.getAggregatedResult(); - assertEquals(expectedNumberOfConsumers, aggregratedResult.getTotalNumberOfConsumers()); - assertEquals(expectedNumberOfProducers, aggregratedResult.getTotalNumberOfProducers()); - } - -} diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/aggregation/SeriesStatisticsTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/aggregation/SeriesStatisticsTest.java deleted file mode 100644 index 7417dddc4f..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/aggregation/SeriesStatisticsTest.java +++ /dev/null @@ -1,43 +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.aggregation; - -import java.util.Arrays; -import java.util.Collection; - -import org.apache.qpid.test.utils.QpidTestCase; - -public class SeriesStatisticsTest extends QpidTestCase -{ - public static Collection SERIES = Arrays.asList(new Long[] { 2l, 4l, 4l, 4l, 5l, 5l, 7l, 9l, 5l }); - - public void testAggregate() - { - SeriesStatistics results = new SeriesStatistics(); - results.addMessageLatencies(SERIES); - results.aggregate(); - assertEquals("Unexpected average", 5.0, results.getAverage(), 0.01); - assertEquals("Unexpected min", 2, results.getMinimum()); - assertEquals("Unexpected max", 9, results.getMaximum()); - assertEquals("Unexpected standard deviation", 2.0, results.getStandardDeviation(), 0.01); - } - -} 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 deleted file mode 100644 index b254a0e3bf..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/aggregation/TestResultAggregatorTest.java +++ /dev/null @@ -1,233 +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.aggregation; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.util.Arrays; -import java.util.Date; -import java.util.List; - -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; -import org.apache.qpid.disttest.message.ProducerParticipantResult; -import org.apache.qpid.test.utils.QpidTestCase; - -public class TestResultAggregatorTest extends QpidTestCase -{ - 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; - - private static final long CONSUMER2_STARTDATE = 100; - private static final long CONSUMER2_ENDDATE = 21000; - - private static final long PRODUCER_STARTDATE = 0; - private static final long PRODUCER_ENDDATE = 19000; - - private static final long NUMBER_OF_MESSAGES_PROCESSED_PER_CONSUMER = 50; - private static final long NUMBER_OF_MESSAGES_CONSUMED_IN_TOTAL = NUMBER_OF_MESSAGES_PROCESSED_PER_CONSUMER * 2; - private static final long NUMBER_OF_MESSAGES_PRODUCED = NUMBER_OF_MESSAGES_PROCESSED_PER_CONSUMER * 2; - - private static final int PAYLOAD_SIZE = 1024; - private static final long TOTAL_PAYLOAD_PROCESSED_PER_CONSUMER = NUMBER_OF_MESSAGES_PROCESSED_PER_CONSUMER * PAYLOAD_SIZE; - private static final long TOTAL_PAYLOAD_PRODUCED_IN_TOTAL = TOTAL_PAYLOAD_PROCESSED_PER_CONSUMER * 2; - - private static final int EXPECTED_NUMBER_OF_AGGREGATED_RESULTS = 3; - - private static final int BATCH_SIZE = 3; - - 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(); - - int numberOfOriginalParticipantResults = originalTestResult.getParticipantResults().size(); - int expectedNumberOfResults = numberOfOriginalParticipantResults + EXPECTED_NUMBER_OF_AGGREGATED_RESULTS; - - AggregatedTestResult aggregatedTestResult = _aggregator.aggregateTestResult(originalTestResult); - - aggregatedTestResult.getAllConsumerParticipantResult().getTotalPayloadProcessed(); - assertEquals(expectedNumberOfResults, aggregatedTestResult.getParticipantResults().size()); - - assertMinimalAggregatedResults( - aggregatedTestResult.getAllConsumerParticipantResult(), - TEST1_NAME, TEST1_ITERATION_NUMBER, - BATCH_SIZE, NUMBER_OF_MESSAGES_CONSUMED_IN_TOTAL, 2, 0); - - assertMinimalAggregatedResults( - aggregatedTestResult.getAllProducerParticipantResult(), - TEST1_NAME, TEST1_ITERATION_NUMBER, - BATCH_SIZE, NUMBER_OF_MESSAGES_PRODUCED, 0, 1); - - assertMinimalAggregatedResults( - aggregatedTestResult.getAllParticipantResult(), - TEST1_NAME, TEST1_ITERATION_NUMBER, - BATCH_SIZE, NUMBER_OF_MESSAGES_CONSUMED_IN_TOTAL, 2, 1); - } - - public void testAggregateResultsWhenParticipantErrored() - { - ParticipantResult failedParticipantResult = new ParticipantResult(); - failedParticipantResult.setParticipantName(PRODUCER_PARTICIPANT_NAME); - failedParticipantResult.setErrorMessage("error"); - TestResult result = new TestResult(TEST1_NAME); - result.addParticipantResult(failedParticipantResult); - - AggregatedTestResult aggregatedTestResult = _aggregator.aggregateTestResult(result); - assertEquals(TestResultAggregator.AGGREGATED_ERROR_MESSAGE, aggregatedTestResult.getAllParticipantResult().getErrorMessage()); - } - - public void testAggregateResultsForConsumerWithLatencyResults() throws Exception - { - TestResult originalTestResult = createResultsFromTest(); - List results = originalTestResult.getParticipantResults(); - for (ParticipantResult participantResult : results) - { - if (participantResult instanceof ConsumerParticipantResult) - { - ((ConsumerParticipantResult)participantResult).setMessageLatencies(SeriesStatisticsTest.SERIES); - break; - } - } - - int numberOfOriginalParticipantResults = originalTestResult.getParticipantResults().size(); - int expectedNumberOfResults = numberOfOriginalParticipantResults + EXPECTED_NUMBER_OF_AGGREGATED_RESULTS; - - AggregatedTestResult aggregatedTestResult = _aggregator.aggregateTestResult(originalTestResult); - - aggregatedTestResult.getAllConsumerParticipantResult().getTotalPayloadProcessed(); - assertEquals(expectedNumberOfResults, aggregatedTestResult.getParticipantResults().size()); - - assertMinimalAggregatedResults( - aggregatedTestResult.getAllConsumerParticipantResult(), - TEST1_NAME, TEST1_ITERATION_NUMBER, - BATCH_SIZE, NUMBER_OF_MESSAGES_CONSUMED_IN_TOTAL, 2, 0); - - assertLatencyAggregatedResults(aggregatedTestResult.getAllConsumerParticipantResult()); - - assertMinimalAggregatedResults( - aggregatedTestResult.getAllProducerParticipantResult(), - TEST1_NAME, TEST1_ITERATION_NUMBER, - BATCH_SIZE, NUMBER_OF_MESSAGES_PRODUCED, 0, 1); - - assertMinimalAggregatedResults( - aggregatedTestResult.getAllParticipantResult(), - TEST1_NAME, TEST1_ITERATION_NUMBER, - BATCH_SIZE, NUMBER_OF_MESSAGES_CONSUMED_IN_TOTAL, 2, 1); - - int expectedThroughtput = (int)Math.round(NUMBER_OF_MESSAGES_PRODUCED * 1000.0d /(CONSUMER2_ENDDATE - PRODUCER_STARTDATE)); - ParticipantResult result = aggregatedTestResult.getAllParticipantResult(); - assertEquals("Unexpected message throughtput", expectedThroughtput, result.getMessageThroughput()); - } - - private void assertLatencyAggregatedResults(ParticipantResult allConsumerParticipantResult) - { - assertTrue("Unexpected result", allConsumerParticipantResult instanceof ConsumerParticipantResult); - ConsumerParticipantResult results = (ConsumerParticipantResult)allConsumerParticipantResult; - assertEquals("Unexpected average", 5.0, results.getAverageLatency(), 0.01); - assertEquals("Unexpected min", 2, results.getMinLatency()); - assertEquals("Unexpected max", 9, results.getMaxLatency()); - assertEquals("Unexpected standard deviation", 2.0, results.getLatencyStandardDeviation(), 0.01); - } - - private void assertMinimalAggregatedResults(ParticipantResult result, String expectedTestName, int expectedIterationNumber, int expectedBatchSize, long expectedNumberOfMessagesProcessed, int expectedTotalNumberOfConsumers, int expectedTotalNumberOfProducers) - { - assertEquals("Unexpected test name in " + result.getParticipantName(), expectedTestName, result.getTestName()); - assertEquals("Unexpected iteration number in " + result.getParticipantName(), expectedIterationNumber, result.getIterationNumber()); - assertEquals("Unexpected batch size " + result.getParticipantName(), expectedBatchSize, result.getBatchSize()); - assertEquals("Unexpected number of messages processed in " + result.getParticipantName(), expectedNumberOfMessagesProcessed, result.getNumberOfMessagesProcessed()); - assertEquals("Unexpected total number of consumers " + result.getParticipantName(), expectedTotalNumberOfConsumers, result.getTotalNumberOfConsumers()); - assertEquals("Unexpected total number of producers " + result.getParticipantName(), expectedTotalNumberOfProducers, result.getTotalNumberOfProducers()); - } - - private TestResult createResultsFromTest() - { - TestResult testResult = new TestResult(TEST1_NAME); - - ConsumerParticipantResult consumerResult1 = new ConsumerParticipantResult(); - setPropertiesOn(consumerResult1, TEST1_NAME, TEST1_ITERATION_NUMBER, CONSUMER_PARTICIPANT_NAME1, NUMBER_OF_MESSAGES_PROCESSED_PER_CONSUMER, BATCH_SIZE, PAYLOAD_SIZE, TOTAL_PAYLOAD_PROCESSED_PER_CONSUMER, CONSUMER1_STARTDATE, CONSUMER1_ENDDATE, 1, 0); - testResult.addParticipantResult(consumerResult1); - - ConsumerParticipantResult consumerResult2 = new ConsumerParticipantResult(); - setPropertiesOn(consumerResult2, TEST1_NAME, TEST1_ITERATION_NUMBER, CONSUMER_PARTICIPANT_NAME2, NUMBER_OF_MESSAGES_PROCESSED_PER_CONSUMER, BATCH_SIZE, PAYLOAD_SIZE, TOTAL_PAYLOAD_PROCESSED_PER_CONSUMER, CONSUMER2_STARTDATE, CONSUMER2_ENDDATE, 1, 0); - testResult.addParticipantResult(consumerResult2); - - ParticipantResult producerResult = new ProducerParticipantResult(); - setPropertiesOn(producerResult, TEST1_NAME, TEST1_ITERATION_NUMBER, PRODUCER_PARTICIPANT_NAME, NUMBER_OF_MESSAGES_PRODUCED, BATCH_SIZE, PAYLOAD_SIZE, TOTAL_PAYLOAD_PRODUCED_IN_TOTAL, PRODUCER_STARTDATE, PRODUCER_ENDDATE, 0, 1); - testResult.addParticipantResult(producerResult); - - return testResult; - } - - private void setPropertiesOn(ParticipantResult participantResult, String testName, int iterationNumber, String participantName, long numberOfMessagesProcessed, int batchSize, int payloadSize, long totalPayloadProcessed, long start, long end, int totalNumberOfConsumers, int totalNumberOfProducers) - { - participantResult.setParticipantName(participantName); - participantResult.setTestName(testName); - participantResult.setIterationNumber(iterationNumber); - participantResult.setTotalNumberOfConsumers(totalNumberOfConsumers); - participantResult.setTotalNumberOfProducers(totalNumberOfProducers); - - participantResult.setNumberOfMessagesProcessed(numberOfMessagesProcessed); - participantResult.setPayloadSize(payloadSize); - participantResult.setTotalPayloadProcessed(totalPayloadProcessed); - participantResult.setStartDate(new Date(start)); - participantResult.setEndDate(new Date(end)); - participantResult.setBatchSize(batchSize); - } - -} 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 deleted file mode 100644 index bbf73b23d2..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/formatting/CSVFormatterTest.java +++ /dev/null @@ -1,62 +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.io.BufferedReader; -import java.io.InputStream; -import java.io.InputStreamReader; - -import org.apache.qpid.disttest.controller.ResultsForAllTests; -import org.apache.qpid.disttest.results.ResultsTestFixture; -import org.apache.qpid.test.utils.QpidTestCase; - -public class CSVFormatterTest extends QpidTestCase -{ - private CSVFormatter _formatter = new CSVFormatter(); - - public void testResultsFileWithWithOneRow() throws Exception - { - ResultsTestFixture resultsTestFixture = new ResultsTestFixture(); - ResultsForAllTests resultsForAllTests = resultsTestFixture.createResultsForAllTests(); - - String output = _formatter.format(resultsForAllTests); - - String expectedOutput = readCsvOutputFileAsString("expectedOutput.csv"); - - assertEquals(expectedOutput, output); - } - - 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/CSVOrderParticipantResultComparatorTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/formatting/CSVOrderParticipantResultComparatorTest.java deleted file mode 100644 index ed109a2e27..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/formatting/CSVOrderParticipantResultComparatorTest.java +++ /dev/null @@ -1,87 +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 org.apache.qpid.disttest.message.ConsumerParticipantResult; -import org.apache.qpid.disttest.message.ParticipantResult; -import org.apache.qpid.disttest.message.ProducerParticipantResult; -import org.apache.qpid.disttest.results.aggregation.TestResultAggregator; -import org.apache.qpid.test.utils.QpidTestCase; - -public class CSVOrderParticipantResultComparatorTest extends QpidTestCase -{ - CSVOrderParticipantResultComparator _comparator = new CSVOrderParticipantResultComparator(); - - public void testOrderedConsumerParticipants() throws Exception - { - assertCompare( - new ConsumerParticipantResult("apple"), - new ConsumerParticipantResult("banana")); - - } - public void testProducerPrecedesConsumerParticipants() throws Exception - { - assertCompare( - new ProducerParticipantResult(), - new ConsumerParticipantResult()); - } - - public void testProducerPrecedesAllProducersResult() - { - assertCompare( - new ProducerParticipantResult("participantName"), - new ParticipantResult(TestResultAggregator.ALL_PRODUCER_PARTICIPANTS_NAME)); - } - - public void testConsumerPrecedesAllConsumersResult() - { - assertCompare( - new ConsumerParticipantResult("participantName"), - new ParticipantResult(TestResultAggregator.ALL_CONSUMER_PARTICIPANTS_NAME)); - } - - public void testAllParticipantsPrecedesAllConsumersResult() - { - assertCompare( - new ParticipantResult(TestResultAggregator.ALL_PARTICIPANTS_NAME), - new ParticipantResult(TestResultAggregator.ALL_CONSUMER_PARTICIPANTS_NAME)); - } - - public void testAllParticipantsPrecedesAllProducersResult() - { - assertCompare( - new ParticipantResult(TestResultAggregator.ALL_PARTICIPANTS_NAME), - new ParticipantResult(TestResultAggregator.ALL_PRODUCER_PARTICIPANTS_NAME)); - } - - private void assertCompare(ParticipantResult smaller, ParticipantResult bigger) - { - assertEquals("Expected " + smaller + " to 'equal' itself", - 0, - _comparator.compare(smaller, smaller)); - - String failureMsg = "Expected " + smaller + " to be smaller than " + bigger; - - assertTrue(failureMsg, _comparator.compare(smaller, bigger) < 0); - assertTrue(failureMsg, _comparator.compare(bigger, smaller) > 0); - } - -} -// 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 deleted file mode 100644 index 02ea67d56d..0000000000 --- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/formatting/expectedOutput.csv +++ /dev/null @@ -1,2 +0,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,throughputMessagesPerS -TEST1,0,2048,5,CONFIGURED_CLIENT1,PARTICIPANT,2,1,2,3,4,5,6,7,8,9,true,false,true,false,true,false,1,2,1024,1000,error,2,9,2.0,2 diff --git a/qpid/java/perftests/visualisation-jfc/pom.xml b/qpid/java/perftests/visualisation-jfc/pom.xml deleted file mode 100644 index bab40cede8..0000000000 --- a/qpid/java/perftests/visualisation-jfc/pom.xml +++ /dev/null @@ -1,204 +0,0 @@ - - - - 4.0.0 - - - org.apache.qpid - qpid-java-build - 0.32-SNAPSHOT - ../../pom.xml - - - qpid-perftests-visualisation-jfc - Qpid Performance Tests Visualisation JFC - Performance testing visualisation using JFreeChart - - - - org.apache.qpid - qpid-perftests - ${project.version} - - - org.apache.qpid - qpid-client - - - - - - org.slf4j - slf4j-api - ${slf4j-version} - - - - org.apache.derby - derby - ${derby-version} - runtime - - - - - net.sourceforge.csvjdbc - csvjdbc - ${csvjdbc-version} - provided - - - - jfree - jfreechart - ${jfreechart-version} - provided - - - - - org.apache.qpid - qpid-test-utils - ${project.version} - test - - - - org.apache.qpid - qpid-common - ${project.version} - test - - - - - - - src/main/resources - - - src/main/java - - **/*.java/ - - - - - - - src/test/java - - **/*.java - - - - src/test/resources - - - - - - org.apache.maven.plugins - maven-deploy-plugin - - - true - - - - - org.codehaus.mojo - exec-maven-plugin - 1.3.2 - - - - java - - - - - org.apache.qpid.disttest.charting.ChartingUtil - true - - chart-defs=${basedir}/../etc/chartdefs - - - - log4j.configurationfile:log4j.properties - - - java.awt.headlesstrue - - - csvCurrentDir${basedir}/../target/data/current - - - csvBaselineDir${basedir}/../target/data/baseline - - - - - - net.sourceforge.csvjdbc - csvjdbc - ${csvjdbc-version} - - - jfree - jfreechart - ${jfreechart-version} - - - - - org.apache.maven.plugins - maven-assembly-plugin - - - - src/main/assembly/qpid-perftests-visualisation-jfc-bin.xml - - - - - make-assembly - package - - single - - - - - - - - - - csvjdbc.releases - http://csvjdbc.sourceforge.net/maven2 - default - - true - - - false - - - - diff --git a/qpid/java/perftests/visualisation-jfc/src/main/assembly/qpid-perftests-visualisation-jfc-bin.xml b/qpid/java/perftests/visualisation-jfc/src/main/assembly/qpid-perftests-visualisation-jfc-bin.xml deleted file mode 100644 index f6bc7137f8..0000000000 --- a/qpid/java/perftests/visualisation-jfc/src/main/assembly/qpid-perftests-visualisation-jfc-bin.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - bin - - tar.gz - - qpid-perftests-visualisation-jfc/${project.version} - - - ${basedir}/src/main/assembly/ - / - - README.txt - NOTICE - LICENSE - - 0644 - 0755 - - - - - /lib - true - - - - diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/ChartType.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/ChartType.java deleted file mode 100644 index 5a77f22148..0000000000 --- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/ChartType.java +++ /dev/null @@ -1,25 +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.charting; - -public enum ChartType -{ - LINE, LINE3D, BAR, BAR3D, XYLINE, TIMELINE, STATISTICAL_BAR -} diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/ChartingException.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/ChartingException.java deleted file mode 100644 index 120a4dc750..0000000000 --- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/ChartingException.java +++ /dev/null @@ -1,46 +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.charting; - -public class ChartingException extends RuntimeException -{ - private static final long serialVersionUID = 1L; - - public ChartingException() - { - super(); - } - - public ChartingException(String message) - { - super(message); - } - - public ChartingException(Throwable cause) - { - super(cause); - } - - public ChartingException(String message, Throwable cause) - { - super(message, cause); - } - -} diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/ChartingUtil.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/ChartingUtil.java deleted file mode 100644 index 9401b77ab0..0000000000 --- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/ChartingUtil.java +++ /dev/null @@ -1,160 +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.charting; - -import java.io.File; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.qpid.disttest.ArgumentParser; -import org.apache.qpid.disttest.charting.chartbuilder.ChartBuilder; -import org.apache.qpid.disttest.charting.chartbuilder.ChartBuilderFactory; -import org.apache.qpid.disttest.charting.definition.ChartingDefinition; -import org.apache.qpid.disttest.charting.definition.ChartingDefinitionCreator; -import org.apache.qpid.disttest.charting.seriesbuilder.JdbcSeriesBuilder; -import org.apache.qpid.disttest.charting.seriesbuilder.JdbcUrlGenerator; -import org.apache.qpid.disttest.charting.seriesbuilder.SeriesBuilder; -import org.apache.qpid.disttest.charting.writer.ChartWriter; -import org.jfree.chart.JFreeChart; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Draws charts for data drawn from CSV datasources using rules described in - * charting definitions (.chartdef) files. - *

- * The following arguments are understood: - *

- *
    - *
  1. {@link #OUTPUT_DIR_PROP}
  2. - *
  3. {@link #CHART_DEFINITIONS_PROP}
  4. - *
  5. {@link #SUMMARY_TITLE_PROP}
  6. - *
  7. {@link #JDBC_DRIVER_NAME_PROP}
  8. - *
  9. {@link #JDBC_URL_PROP}
  10. - *
- * Default values are indicated by the similarly named constants in this class. - */ -public class ChartingUtil -{ - private static final Logger LOGGER = LoggerFactory.getLogger(ChartingUtil.class); - - /** directory in which to produce the PNGs */ - public static final String OUTPUT_DIR_PROP = "outputdir"; - public static final String OUTPUT_DIR_DEFAULT = "."; - - /** the path to the directory containing the chart definition files */ - public static final String CHART_DEFINITIONS_PROP = "chart-defs"; - public static final String CHART_DEFINITIONS_DEFAULT = "."; - - public static final String SUMMARY_TITLE_PROP = "summary-title"; - public static final String SUMMARY_TITLE_DEFAULT = "Performance Charts"; - - /** the class name of the JDBC driver to use for reading the chart data */ - public static final String JDBC_DRIVER_NAME_PROP = "jdbcDriverClass"; - public static final String JDBC_DRIVER_NAME_DEFAULT = JdbcUrlGenerator.DEFAULT_JDBC_DRIVER_NAME; - - /** the JDBC URL of the data to be charted */ - public static final String JDBC_URL_PROP = "jdbcUrl"; - public static final String JDBC_URL_DEFAULT = null; - - - private Map _cliOptions = new HashMap(); - - { - _cliOptions.put(OUTPUT_DIR_PROP, OUTPUT_DIR_DEFAULT); - _cliOptions.put(CHART_DEFINITIONS_PROP, CHART_DEFINITIONS_DEFAULT); - _cliOptions.put(SUMMARY_TITLE_PROP, SUMMARY_TITLE_DEFAULT); - _cliOptions.put(JDBC_DRIVER_NAME_PROP, JDBC_DRIVER_NAME_DEFAULT); - _cliOptions.put(JDBC_URL_PROP, JDBC_URL_DEFAULT); - } - - public static void main(String[] args) throws Exception - { - try - { - LOGGER.info("Starting charting"); - - ChartingUtil chartingUtil = new ChartingUtil(); - chartingUtil.parseArgumentsIntoConfig(args); - chartingUtil.produceAllCharts(); - } - finally - { - LOGGER.info("Charting complete"); - } - } - - private void produceAllCharts() - { - - final ChartWriter writer = new ChartWriter(); - writer.setOutputDirectory(new File(_cliOptions.get(OUTPUT_DIR_PROP))); - - SeriesBuilder seriesBuilder = new JdbcSeriesBuilder( - _cliOptions.get(JDBC_DRIVER_NAME_PROP), - _cliOptions.get(JDBC_URL_PROP)); - - for (ChartingDefinition chartingDefinition : loadChartDefinitions()) - { - try - { - ChartBuilder chartBuilder = ChartBuilderFactory.createChartBuilder( - chartingDefinition.getChartType(), - seriesBuilder); - - JFreeChart chart = chartBuilder.buildChart(chartingDefinition); - writer.writeChartToFileSystem(chart, chartingDefinition); - } - catch (Exception e) - { - LOGGER.error("Couldn't produce chart " + chartingDefinition, e); - } - } - - final String summaryChartTitle = _cliOptions.get(SUMMARY_TITLE_PROP); - writer.writeHtmlSummaryToFileSystem(summaryChartTitle); - } - - private List loadChartDefinitions() - { - final String chartingDefsDir = _cliOptions.get(CHART_DEFINITIONS_PROP); - - LOGGER.info("Chart chartdef directory/file: {}", chartingDefsDir); - - List definitions = loadChartDefinitions(chartingDefsDir); - - LOGGER.info("There are {} chart(s) to produce", definitions.size()); - return definitions; - } - - private List loadChartDefinitions(String chartingDefsDir) - { - ChartingDefinitionCreator chartingDefinitionLoader = new ChartingDefinitionCreator(); - return chartingDefinitionLoader.createFromFileOrDirectory(chartingDefsDir); - } - - private void parseArgumentsIntoConfig(String[] args) - { - ArgumentParser argumentParser = new ArgumentParser(); - argumentParser.parseArgumentsIntoConfig(_cliOptions, args); - } -} diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/BarChart3DBuilder.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/BarChart3DBuilder.java deleted file mode 100644 index b10fd477ed..0000000000 --- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/BarChart3DBuilder.java +++ /dev/null @@ -1,56 +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.charting.chartbuilder; - - -import org.apache.qpid.disttest.charting.seriesbuilder.SeriesBuilder; -import org.jfree.chart.ChartFactory; -import org.jfree.chart.JFreeChart; -import org.jfree.chart.plot.PlotOrientation; -import org.jfree.data.category.CategoryDataset; -import org.jfree.data.general.Dataset; - -public class BarChart3DBuilder extends CategoryDataSetBasedChartBuilder -{ - - public BarChart3DBuilder(SeriesBuilder seriesBuilder) - { - super(seriesBuilder); - } - - @Override - protected JFreeChart createCategoryChart(String title, String xAxisTitle, - String yAxisTitle, final Dataset dataset, PlotOrientation plotOrientation, - boolean showLegend, boolean showToolTips, boolean showUrls) - { - JFreeChart chart = ChartFactory.createBarChart3D(title, - xAxisTitle, - yAxisTitle, - (CategoryDataset)dataset, - plotOrientation, - showLegend, - showToolTips, - showUrls); - - return chart; - } - - -} diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/BarChartBuilder.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/BarChartBuilder.java deleted file mode 100644 index 7705ef5d3a..0000000000 --- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/BarChartBuilder.java +++ /dev/null @@ -1,54 +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.charting.chartbuilder; - -import org.apache.qpid.disttest.charting.seriesbuilder.SeriesBuilder; -import org.jfree.chart.ChartFactory; -import org.jfree.chart.JFreeChart; -import org.jfree.chart.plot.PlotOrientation; -import org.jfree.data.category.CategoryDataset; -import org.jfree.data.general.Dataset; - -public class BarChartBuilder extends CategoryDataSetBasedChartBuilder -{ - - public BarChartBuilder(SeriesBuilder seriesBuilder) - { - super(seriesBuilder); - } - - @Override - protected JFreeChart createCategoryChart(String title, String xAxisTitle, - String yAxisTitle, final Dataset dataset, PlotOrientation plotOrientation, - boolean showLegend, boolean showToolTips, boolean showUrls) - { - JFreeChart chart = ChartFactory.createBarChart(title, - xAxisTitle, - yAxisTitle, - (CategoryDataset) dataset, - plotOrientation, - showLegend, - showToolTips, - showUrls); - return chart; - } - - -} diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/BaseChartBuilder.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/BaseChartBuilder.java deleted file mode 100644 index 9cadf0ec3c..0000000000 --- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/BaseChartBuilder.java +++ /dev/null @@ -1,112 +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.charting.chartbuilder; - -import java.awt.Color; -import java.awt.GradientPaint; - -import org.apache.qpid.disttest.charting.definition.ChartingDefinition; -import org.apache.qpid.disttest.charting.seriesbuilder.DatasetHolder; -import org.apache.qpid.disttest.charting.seriesbuilder.SeriesBuilder; -import org.jfree.chart.ChartFactory; -import org.jfree.chart.JFreeChart; -import org.jfree.chart.plot.PlotOrientation; -import org.jfree.chart.title.ShortTextTitle; -import org.jfree.data.general.Dataset; - -public abstract class BaseChartBuilder implements ChartBuilder -{ - static final GradientPaint BLUE_GRADIENT = new GradientPaint(0, 0, Color.white, 0, 1000, Color.blue); - - private SeriesPainter _seriesPainter = new SeriesPainter(); - - private final SeriesBuilder _seriesBuilder; - - protected BaseChartBuilder(SeriesBuilder seriesBuilder) - { - _seriesBuilder = seriesBuilder; - } - - @Override - public JFreeChart buildChart(ChartingDefinition chartingDefinition) - { - _seriesBuilder.setDatasetHolder(newDatasetHolder()); - Dataset dataset = _seriesBuilder.build(chartingDefinition.getSeriesDefinitions()); - - JFreeChart chart = createChart(chartingDefinition, dataset); - return chart; - } - - - /** - * return a holder of an empty dataset suitable for use with the chart type - * returned by {@link #createChartImpl(String, String, String, Dataset, PlotOrientation, boolean, boolean, boolean)}. - */ - protected abstract DatasetHolder newDatasetHolder(); - - /** - * Create a chart with the supplied parameters. - * - * For ease of implementation, the signature is intentionally similar - * to {@link ChartFactory}'s factory methods. - */ - protected abstract JFreeChart createChartImpl( - String title, String xAxisTitle, String yAxisTitle, - final Dataset dataset, - PlotOrientation plotOrientation, boolean showLegend, boolean showToolTips, boolean showUrls); - - /** - * Create a {@link SeriesStrokeAndPaintApplier} that will be used to format a chart - */ - protected abstract SeriesStrokeAndPaintApplier newStrokeAndPaintApplier(); - - - private JFreeChart createChart(ChartingDefinition chartingDefinition, final Dataset dataset) - { - String title = chartingDefinition.getChartTitle(); - String xAxisTitle = chartingDefinition.getXAxisTitle(); - String yAxisTitle = chartingDefinition.getYAxisTitle(); - - final JFreeChart chart = createChartImpl( - title, xAxisTitle, yAxisTitle, - dataset, - PLOT_ORIENTATION, SHOW_LEGEND, SHOW_TOOL_TIPS, SHOW_URLS); - - addSubtitle(chart, chartingDefinition); - chart.setBackgroundPaint(BLUE_GRADIENT); - _seriesPainter.applySeriesAppearance(chart, chartingDefinition.getSeriesDefinitions(), newStrokeAndPaintApplier()); - - return chart; - } - - private void addSubtitle(JFreeChart chart, ChartingDefinition chartingDefinition) - { - if (chartingDefinition.getChartSubtitle() != null) - { - chart.addSubtitle(new ShortTextTitle(chartingDefinition.getChartSubtitle())); - } - } - - void setSeriesPainter(SeriesPainter seriesPainter) - { - _seriesPainter = seriesPainter; - } - -} diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/CategoryDataSetBasedChartBuilder.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/CategoryDataSetBasedChartBuilder.java deleted file mode 100644 index 0d08fd8ad1..0000000000 --- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/CategoryDataSetBasedChartBuilder.java +++ /dev/null @@ -1,96 +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.charting.chartbuilder; - - -import org.apache.qpid.disttest.charting.definition.SeriesDefinition; -import org.apache.qpid.disttest.charting.seriesbuilder.DatasetHolder; -import org.apache.qpid.disttest.charting.seriesbuilder.SeriesBuilder; -import org.apache.qpid.disttest.charting.seriesbuilder.SeriesRow; -import org.jfree.chart.JFreeChart; -import org.jfree.chart.axis.CategoryLabelPositions; -import org.jfree.chart.plot.PlotOrientation; -import org.jfree.data.category.DefaultCategoryDataset; -import org.jfree.data.general.Dataset; - -public abstract class CategoryDataSetBasedChartBuilder extends BaseChartBuilder -{ - public CategoryDataSetBasedChartBuilder(SeriesBuilder seriesBuilder) - { - super(seriesBuilder); - } - - @Override - protected DatasetHolder newDatasetHolder() - { - return new DatasetHolder() - { - final private DefaultCategoryDataset _dataset = new DefaultCategoryDataset(); - - @Override - public void addDataPointToSeries(SeriesDefinition seriesDefinition, SeriesRow row) - { - String x = row.dimensionAsString(0); - double y = row.dimensionAsDouble(1); - _dataset.addValue(y, seriesDefinition.getSeriesLegend(), x); - } - - @Override - public void beginSeries(SeriesDefinition seriesDefinition) - { - // unused - } - - @Override - public void endSeries(SeriesDefinition seriesDefinition) - { - // unused - } - - @Override - public int getNumberOfDimensions() - { - return 2; - } - - @Override - public Dataset getPopulatedDataset() - { - return _dataset; - } - }; - } - - @Override - protected SeriesStrokeAndPaintApplier newStrokeAndPaintApplier() - { - return new CategoryStrokeAndPaintApplier(); - } - - @Override - protected final JFreeChart createChartImpl(String title, String xAxisTitle, String yAxisTitle, Dataset dataset, PlotOrientation plotOrientation, boolean showLegend, boolean showToolTips, boolean showUrls) - { - JFreeChart chart = createCategoryChart(title, xAxisTitle, yAxisTitle, dataset, plotOrientation, showLegend, showToolTips, showUrls); - chart.getCategoryPlot().getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.UP_45); - return chart; - } - - protected abstract JFreeChart createCategoryChart(String title, String xAxisTitle, String yAxisTitle, Dataset dataset, PlotOrientation plotOrientation, boolean showLegend, boolean showToolTips, boolean showUrls); -} diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/CategoryStrokeAndPaintApplier.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/CategoryStrokeAndPaintApplier.java deleted file mode 100644 index cbf5cbe515..0000000000 --- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/CategoryStrokeAndPaintApplier.java +++ /dev/null @@ -1,41 +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.charting.chartbuilder; - -import java.awt.Color; -import java.awt.Stroke; - -import org.jfree.chart.JFreeChart; - -class CategoryStrokeAndPaintApplier implements SeriesStrokeAndPaintApplier -{ - @Override - public void setSeriesStroke(int seriesIndex, Stroke stroke, JFreeChart targetChart) - { - targetChart.getCategoryPlot().getRenderer().setSeriesStroke(seriesIndex, stroke); - } - - @Override - public void setSeriesPaint(int seriesIndex, Color colour, JFreeChart targetChart) - { - targetChart.getCategoryPlot().getRenderer().setSeriesPaint(seriesIndex, colour); - } -} \ No newline at end of file diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/ChartBuilder.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/ChartBuilder.java deleted file mode 100644 index 425b83596f..0000000000 --- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/ChartBuilder.java +++ /dev/null @@ -1,34 +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.charting.chartbuilder; - -import org.apache.qpid.disttest.charting.definition.ChartingDefinition; -import org.jfree.chart.JFreeChart; -import org.jfree.chart.plot.PlotOrientation; - -public interface ChartBuilder -{ - public static final boolean SHOW_URLS = false; - public static final boolean SHOW_TOOL_TIPS = false; - public static final boolean SHOW_LEGEND = true; - public static final PlotOrientation PLOT_ORIENTATION = PlotOrientation.VERTICAL; - - public JFreeChart buildChart(ChartingDefinition chartingDefinition); -} diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/ChartBuilderFactory.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/ChartBuilderFactory.java deleted file mode 100644 index 63a0573676..0000000000 --- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/ChartBuilderFactory.java +++ /dev/null @@ -1,51 +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.charting.chartbuilder; - -import org.apache.qpid.disttest.charting.ChartType; -import org.apache.qpid.disttest.charting.seriesbuilder.SeriesBuilder; - -public class ChartBuilderFactory -{ - - public static ChartBuilder createChartBuilder(ChartType chartType, SeriesBuilder seriesBuilder) - { - switch (chartType) - { - case LINE: - return new LineChartBuilder(seriesBuilder); - case LINE3D: - return new LineChart3DBuilder(seriesBuilder); - case BAR: - return new BarChartBuilder(seriesBuilder); - case BAR3D: - return new BarChart3DBuilder(seriesBuilder); - case XYLINE: - return new XYLineChartBuilder(seriesBuilder); - case TIMELINE: - return new TimeSeriesLineChartBuilder(seriesBuilder); - case STATISTICAL_BAR: - return new StatisticalBarChartBuilder(seriesBuilder); - default: - throw new IllegalArgumentException("Unknown chart type " + chartType); - } - } - -} diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/ColorFactory.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/ColorFactory.java deleted file mode 100644 index 49d777c506..0000000000 --- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/ColorFactory.java +++ /dev/null @@ -1,66 +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.charting.chartbuilder; - -import java.awt.Color; - -public class ColorFactory -{ - /** - * Converts a colour name known to the JDK into a {@link Color} instance. Additionally, - * if the work dark_ is prepended to the colour, a darker shade of the same colour is - * produced. - * - * @param colourName - * @return colour instance - */ - public static Color toColour(String colourName) - { - boolean darkVersion = false; - if (colourName.toLowerCase().startsWith("dark_")) - { - colourName = colourName.replaceFirst("(?i)dark_", ""); - darkVersion = true; - } - - Color colour = getColourFromStaticField(colourName); - if (darkVersion) - { - return colour.darker(); - } - else - { - return colour; - } - } - - private static Color getColourFromStaticField(String colourName) - { - try - { - return (Color) Color.class.getField(colourName.toLowerCase()).get(null); - } - catch (Exception e) - { - throw new RuntimeException("Could not find colour for " + colourName, e); - } - } - -} diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/LineChart3DBuilder.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/LineChart3DBuilder.java deleted file mode 100644 index b92a25f5ac..0000000000 --- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/LineChart3DBuilder.java +++ /dev/null @@ -1,52 +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.charting.chartbuilder; - -import org.apache.qpid.disttest.charting.seriesbuilder.SeriesBuilder; -import org.jfree.chart.ChartFactory; -import org.jfree.chart.JFreeChart; -import org.jfree.chart.plot.PlotOrientation; -import org.jfree.data.category.CategoryDataset; -import org.jfree.data.general.Dataset; - -public class LineChart3DBuilder extends CategoryDataSetBasedChartBuilder -{ - public LineChart3DBuilder(SeriesBuilder seriesBuilder) - { - super(seriesBuilder); - } - - @Override - protected JFreeChart createCategoryChart(String title, String xAxisTitle, - String yAxisTitle, final Dataset dataset, PlotOrientation plotOrientation, - boolean showLegend, boolean showToolTips, boolean showUrls) - { - JFreeChart chart = ChartFactory.createLineChart3D(title, - xAxisTitle, - yAxisTitle, - (CategoryDataset)dataset, - plotOrientation, - showLegend, - showToolTips, - showUrls); - return chart; - } - -} diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/LineChartBuilder.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/LineChartBuilder.java deleted file mode 100644 index 3f5b18acda..0000000000 --- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/LineChartBuilder.java +++ /dev/null @@ -1,53 +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.charting.chartbuilder; - -import org.apache.qpid.disttest.charting.seriesbuilder.SeriesBuilder; -import org.jfree.chart.ChartFactory; -import org.jfree.chart.JFreeChart; -import org.jfree.chart.plot.PlotOrientation; -import org.jfree.data.category.CategoryDataset; -import org.jfree.data.general.Dataset; - -public class LineChartBuilder extends CategoryDataSetBasedChartBuilder -{ - - public LineChartBuilder(SeriesBuilder seriesBuilder) - { - super(seriesBuilder); - } - - @Override - protected JFreeChart createCategoryChart(String title, String xAxisTitle, - String yAxisTitle, final Dataset dataset, PlotOrientation plotOrientation, - boolean showLegend, boolean showToolTips, boolean showUrls) - { - JFreeChart chart = ChartFactory.createLineChart(title, - xAxisTitle, - yAxisTitle, - (CategoryDataset)dataset, - plotOrientation, - showLegend, - showToolTips, - showUrls); - return chart; - } - -} diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/SeriesPainter.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/SeriesPainter.java deleted file mode 100644 index 854635dc87..0000000000 --- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/SeriesPainter.java +++ /dev/null @@ -1,63 +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.charting.chartbuilder; - -import java.awt.BasicStroke; -import java.util.List; - -import org.apache.qpid.disttest.charting.definition.SeriesDefinition; -import org.jfree.chart.JFreeChart; - -public class SeriesPainter -{ - public void applySeriesAppearance(JFreeChart chart, List seriesDefinitions, SeriesStrokeAndPaintApplier strokeAndPaintApplier) - { - for (int i = 0; i < seriesDefinitions.size(); i++) - { - SeriesDefinition seriesDefinition = seriesDefinitions.get(i); - if (seriesDefinition.getSeriesColourName() != null) - { - strokeAndPaintApplier.setSeriesPaint(i, ColorFactory.toColour(seriesDefinition.getSeriesColourName()), chart); - } - if (seriesDefinition.getStrokeWidth() != null) - { - // Negative width used to signify dashed - boolean dashed = seriesDefinition.getStrokeWidth() < 0; - float width = Math.abs(seriesDefinition.getStrokeWidth()); - BasicStroke stroke = buildStrokeOfWidth(width, dashed); - strokeAndPaintApplier.setSeriesStroke(i, stroke, chart); - } - } - } - - private BasicStroke buildStrokeOfWidth(float width, boolean dashed) - { - final BasicStroke stroke; - if (dashed) - { - stroke = new BasicStroke(width, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] {5.0f, 3.0f}, 0.0f); - } - else - { - stroke = new BasicStroke(width, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND); - } - return stroke; - } -} diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/SeriesStrokeAndPaintApplier.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/SeriesStrokeAndPaintApplier.java deleted file mode 100644 index 4d6c37a9f4..0000000000 --- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/SeriesStrokeAndPaintApplier.java +++ /dev/null @@ -1,35 +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.charting.chartbuilder; - -import java.awt.Color; -import java.awt.Stroke; - -import org.jfree.chart.JFreeChart; - -/** - * Applies the supplied stroke and color to a series in the target chart. - * Multiple implementations exist to because of the various chart types. - */ -public interface SeriesStrokeAndPaintApplier -{ - void setSeriesStroke(int seriesIndex, Stroke stroke, JFreeChart targetChart); - void setSeriesPaint(int seriesIndex, Color color, JFreeChart targetChart); -} diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/StatisticalBarChartBuilder.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/StatisticalBarChartBuilder.java deleted file mode 100644 index c5ad2d7dad..0000000000 --- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/StatisticalBarChartBuilder.java +++ /dev/null @@ -1,114 +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.charting.chartbuilder; - -import java.awt.Font; - -import org.apache.qpid.disttest.charting.definition.SeriesDefinition; -import org.apache.qpid.disttest.charting.seriesbuilder.DatasetHolder; -import org.apache.qpid.disttest.charting.seriesbuilder.SeriesBuilder; -import org.apache.qpid.disttest.charting.seriesbuilder.SeriesRow; -import org.jfree.chart.JFreeChart; -import org.jfree.chart.axis.CategoryAxis; -import org.jfree.chart.axis.CategoryLabelPositions; -import org.jfree.chart.axis.NumberAxis; -import org.jfree.chart.axis.ValueAxis; -import org.jfree.chart.plot.CategoryPlot; -import org.jfree.chart.plot.PlotOrientation; -import org.jfree.chart.renderer.category.CategoryItemRenderer; -import org.jfree.chart.renderer.category.StatisticalBarRenderer; -import org.jfree.data.general.Dataset; -import org.jfree.data.statistics.DefaultStatisticalCategoryDataset; -import org.jfree.data.statistics.StatisticalCategoryDataset; - -public class StatisticalBarChartBuilder extends BaseChartBuilder -{ - public StatisticalBarChartBuilder(SeriesBuilder seriesBuilder) - { - super(seriesBuilder); - } - - @Override - protected DatasetHolder newDatasetHolder() - { - return new DatasetHolder() - { - private final DefaultStatisticalCategoryDataset _dataset = new DefaultStatisticalCategoryDataset(); - - @Override - public void addDataPointToSeries(SeriesDefinition seriesDefinition, SeriesRow row) - { - String x = row.dimensionAsString(0); - double mean = row.dimensionAsDouble(1); - double stdDev = row.dimensionAsDouble(2); - _dataset.add(mean, stdDev, seriesDefinition.getSeriesLegend(), x); - } - - @Override - public void beginSeries(SeriesDefinition seriesDefinition) - { - // unused - } - - @Override - public void endSeries(SeriesDefinition seriesDefinition) - { - // unused - } - - @Override - public int getNumberOfDimensions() - { - return 3; - } - - @Override - public Dataset getPopulatedDataset() - { - return _dataset; - } - }; - } - - @Override - protected SeriesStrokeAndPaintApplier newStrokeAndPaintApplier() - { - return new CategoryStrokeAndPaintApplier(); - } - - @Override - public JFreeChart createChartImpl(String title, String xAxisTitle, String yAxisTitle, final Dataset dataset, - PlotOrientation plotOrientation, boolean showLegend, boolean showToolTips, boolean showUrls) - { - CategoryAxis xAxis = new CategoryAxis(xAxisTitle); - ValueAxis yAxis = new NumberAxis(yAxisTitle); - CategoryItemRenderer renderer = new StatisticalBarRenderer(); - - CategoryPlot plot = new CategoryPlot((StatisticalCategoryDataset) dataset, xAxis, yAxis, renderer); - - JFreeChart chart = new JFreeChart(title, new Font("Arial", Font.PLAIN, 10), plot, true); - - chart.getCategoryPlot().getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.UP_45); - - return chart; - } - -} diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/TimeSeriesHolder.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/TimeSeriesHolder.java deleted file mode 100644 index 803a098dfa..0000000000 --- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/TimeSeriesHolder.java +++ /dev/null @@ -1,70 +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.charting.chartbuilder; - -import java.util.Date; - -import org.apache.qpid.disttest.charting.definition.SeriesDefinition; -import org.apache.qpid.disttest.charting.seriesbuilder.DatasetHolder; -import org.apache.qpid.disttest.charting.seriesbuilder.SeriesRow; -import org.jfree.data.general.Dataset; -import org.jfree.data.time.Millisecond; -import org.jfree.data.time.RegularTimePeriod; -import org.jfree.data.time.TimeSeries; -import org.jfree.data.time.TimeSeriesCollection; - -class TimeSeriesHolder implements DatasetHolder -{ - private final TimeSeriesCollection _timeSeriesCollection = new TimeSeriesCollection(); - private TimeSeries _timeSeries; - - @Override - public void beginSeries(SeriesDefinition seriesDefinition) - { - _timeSeries = new TimeSeries(seriesDefinition.getSeriesLegend()); - } - - @Override - public void addDataPointToSeries(SeriesDefinition seriesDefinition, SeriesRow row) - { - Date x = row.dimensionAsDate(0); - double y = row.dimensionAsDouble(1); - RegularTimePeriod jfreeChartDate = new Millisecond(x); - _timeSeries.add(jfreeChartDate, y); - } - - @Override - public void endSeries(SeriesDefinition seriesDefinition) - { - _timeSeriesCollection.addSeries(_timeSeries); - } - - @Override - public int getNumberOfDimensions() - { - return 2; - } - - @Override - public Dataset getPopulatedDataset() - { - return _timeSeriesCollection; - } -} \ No newline at end of file diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/TimeSeriesLineChartBuilder.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/TimeSeriesLineChartBuilder.java deleted file mode 100644 index 7249ae6332..0000000000 --- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/TimeSeriesLineChartBuilder.java +++ /dev/null @@ -1,59 +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.charting.chartbuilder; - -import org.apache.qpid.disttest.charting.seriesbuilder.DatasetHolder; -import org.apache.qpid.disttest.charting.seriesbuilder.SeriesBuilder; -import org.jfree.chart.ChartFactory; -import org.jfree.chart.JFreeChart; -import org.jfree.chart.plot.PlotOrientation; -import org.jfree.data.general.Dataset; -import org.jfree.data.xy.XYDataset; - -public class TimeSeriesLineChartBuilder extends XYDataSetBasedChartBuilder -{ - public TimeSeriesLineChartBuilder(SeriesBuilder seriesBuilder) - { - super(seriesBuilder); - } - - @Override - protected DatasetHolder newDatasetHolder() - { - return new TimeSeriesHolder(); - } - - @Override - public JFreeChart createChartImpl(String title, String xAxisTitle, - String yAxisTitle, final Dataset dataset, PlotOrientation plotOrientation, - boolean showLegend, boolean showToolTips, boolean showUrls) - { - JFreeChart chart = ChartFactory.createTimeSeriesChart( - title, - xAxisTitle, - yAxisTitle, - (XYDataset)dataset, - showLegend, - showToolTips, - showUrls); - - return chart; - } -} diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/XYDataSetBasedChartBuilder.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/XYDataSetBasedChartBuilder.java deleted file mode 100644 index 575712f06c..0000000000 --- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/XYDataSetBasedChartBuilder.java +++ /dev/null @@ -1,119 +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.charting.chartbuilder; - -import java.awt.Color; -import java.awt.Stroke; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.apache.qpid.disttest.charting.definition.SeriesDefinition; -import org.apache.qpid.disttest.charting.seriesbuilder.DatasetHolder; -import org.apache.qpid.disttest.charting.seriesbuilder.SeriesBuilder; -import org.apache.qpid.disttest.charting.seriesbuilder.SeriesRow; -import org.jfree.chart.JFreeChart; -import org.jfree.data.general.Dataset; -import org.jfree.data.xy.DefaultXYDataset; - - -public abstract class XYDataSetBasedChartBuilder extends BaseChartBuilder -{ - public XYDataSetBasedChartBuilder(SeriesBuilder seriesBuilder) - { - super(seriesBuilder); - } - - @Override - protected DatasetHolder newDatasetHolder() - { - return new DatasetHolder() - { - private final DefaultXYDataset _dataset = new DefaultXYDataset(); - private List _xyPairs = null; - - @Override - public void beginSeries(SeriesDefinition seriesDefinition) - { - _xyPairs = new ArrayList(); - } - - @Override - public void addDataPointToSeries(SeriesDefinition seriesDefinition, SeriesRow row) - { - double x = row.dimensionAsDouble(0); - double y = row.dimensionAsDouble(1); - _xyPairs.add(new Double[] {x, y}); - } - - @Override - public void endSeries(SeriesDefinition seriesDefinition) - { - double[][] seriesData = listToSeriesDataArray(); - _dataset.addSeries(seriesDefinition.getSeriesLegend(), seriesData); - } - - @Override - public int getNumberOfDimensions() - { - return 2; - } - - private double[][] listToSeriesDataArray() - { - double[][] seriesData = new double[2][_xyPairs.size()]; - int i = 0; - for (Iterator iterator = _xyPairs.iterator(); iterator.hasNext();) - { - Double[] xyPair = iterator.next(); - seriesData[0][i] = xyPair[0]; - seriesData[1][i] = xyPair[1]; - i++; - } - return seriesData; - } - - @Override - public Dataset getPopulatedDataset() - { - return _dataset; - } - }; - } - - @Override - protected SeriesStrokeAndPaintApplier newStrokeAndPaintApplier() - { - return new SeriesStrokeAndPaintApplier() - { - @Override - public void setSeriesStroke(int seriesIndex, Stroke stroke, JFreeChart targetChart) - { - targetChart.getXYPlot().getRenderer().setSeriesStroke(seriesIndex, stroke); - } - - @Override - public void setSeriesPaint(int seriesIndex, Color colour, JFreeChart targetChart) - { - targetChart.getXYPlot().getRenderer().setSeriesPaint(seriesIndex, colour); - } - }; - } -} diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/XYLineChartBuilder.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/XYLineChartBuilder.java deleted file mode 100644 index 48b02a7c60..0000000000 --- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/XYLineChartBuilder.java +++ /dev/null @@ -1,51 +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.charting.chartbuilder; - -import org.apache.qpid.disttest.charting.seriesbuilder.SeriesBuilder; -import org.jfree.chart.ChartFactory; -import org.jfree.chart.JFreeChart; -import org.jfree.chart.plot.PlotOrientation; -import org.jfree.data.general.Dataset; -import org.jfree.data.xy.XYDataset; - -public class XYLineChartBuilder extends XYDataSetBasedChartBuilder -{ - public XYLineChartBuilder(SeriesBuilder seriesBuilder) - { - super(seriesBuilder); - } - - @Override - public JFreeChart createChartImpl(String title, String xAxisTitle, - String yAxisTitle, final Dataset dataset, PlotOrientation plotOrientation, - boolean showLegend, boolean showToolTips, boolean showUrls) - { - JFreeChart chart = ChartFactory.createXYLineChart(title, - xAxisTitle, - yAxisTitle, - (XYDataset)dataset, - plotOrientation, - showLegend, - showToolTips, - showUrls); - return chart; - } -} diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/definition/ChartingDefinition.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/definition/ChartingDefinition.java deleted file mode 100644 index 5030c42e89..0000000000 --- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/definition/ChartingDefinition.java +++ /dev/null @@ -1,104 +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.charting.definition; - -import java.util.Collections; -import java.util.List; - -import org.apache.commons.lang.builder.ToStringBuilder; -import org.apache.qpid.disttest.charting.ChartType; - -public class ChartingDefinition -{ - private final String _chartStemName; - private final ChartType _chartType; - private final String _chartTitle; - private final String _chartSubtitle; - private final String _chartDescription; - private final String _xaxisTitle; - private final String _yaxisTitle; - private final List _seriesDefinitions; - - - public ChartingDefinition(final String chartStemName, - final ChartType chartType, - final String chartTitle, - final String chartSubtitle, - final String chartDescription, - final String xaxisTitle, final String yaxisTitle, List seriesDefinitions) - { - _chartStemName = chartStemName; - _chartType = chartType; - _chartTitle = chartTitle; - _chartSubtitle = chartSubtitle; - _chartDescription = chartDescription; - _xaxisTitle = xaxisTitle; - _yaxisTitle = yaxisTitle; - _seriesDefinitions = seriesDefinitions; - } - - public String getChartStemName() - { - return _chartStemName; - } - - public String getChartTitle() - { - return _chartTitle; - } - - public String getChartSubtitle() - { - return _chartSubtitle; - } - - public String getChartDescription() - { - return _chartDescription; - } - - public String getXAxisTitle() - { - return _xaxisTitle; - } - - - public String getYAxisTitle() - { - return _yaxisTitle; - } - - public ChartType getChartType() - { - return _chartType; - } - - public List getSeriesDefinitions() - { - return Collections.unmodifiableList(_seriesDefinitions); - } - - @Override - public String toString() - { - return new ToStringBuilder(this).append("chartTitle", _chartTitle).toString(); - } - -} diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/definition/ChartingDefinitionCreator.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/definition/ChartingDefinitionCreator.java deleted file mode 100644 index e0f43cb34a..0000000000 --- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/definition/ChartingDefinitionCreator.java +++ /dev/null @@ -1,143 +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.charting.definition; - -import static org.apache.commons.lang.text.StrSubstitutor.replaceSystemProperties; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileFilter; -import java.io.FileReader; -import java.io.IOException; -import java.io.Reader; -import java.util.ArrayList; -import java.util.List; -import java.util.Properties; - -import org.apache.qpid.disttest.charting.ChartType; -import org.apache.qpid.disttest.charting.ChartingException; - -public class ChartingDefinitionCreator -{ - public static final String CHARTDEF_FILE_EXTENSION = ".chartdef"; - - public static final String CHART_TYPE_KEY = "chartType"; - public static final String CHART_TITLE_KEY = "chartTitle"; - public static final String CHART_SUBTITLE_KEY = "chartSubtitle"; - public static final String CHART_DESCRIPTION_KEY = "chartDescription"; - public static final String XAXIS_TITLE_KEY = "xAxisTitle"; - public static final String YAXIS_TITLE_KEY = "yAxisTitle"; - - private SeriesDefinitionCreator _seriesDefinitionCreator = new SeriesDefinitionCreator(); - - public List createFromFileOrDirectory(String chartingDefinitionFileOrDirectory) - { - List definitions = new ArrayList(); - - File fileOrDirectory = new File(chartingDefinitionFileOrDirectory); - if (fileOrDirectory.isDirectory()) - { - File[] matchingFiles = fileOrDirectory.listFiles(new CHARTDEF_FILE_FILTER()); - - for (File file : matchingFiles) - { - final ChartingDefinition chartDefinition = createChartDefinition(file); - definitions.add(chartDefinition); - } - } - else - { - final ChartingDefinition chartDefinition = createChartDefinition(fileOrDirectory); - definitions.add(chartDefinition); - } - - return definitions; - } - - private ChartingDefinition createChartDefinition(File file) - { - Reader reader = null; - try - { - reader = new BufferedReader(new FileReader(file)); - Properties props = new Properties(); - props.load(reader); - - final String chartStemName = getStemNameFrom(file); - - final ChartType chartType = ChartType.valueOf(replaceSystemProperties(props.getProperty(CHART_TYPE_KEY))); - final String chartTitle = replaceSystemProperties(props.getProperty(CHART_TITLE_KEY)); - final String chartSubtitle = replaceSystemProperties(props.getProperty(CHART_SUBTITLE_KEY)); - final String chartDescription = replaceSystemProperties(props.getProperty(CHART_DESCRIPTION_KEY)); - final String xAxisTitle = replaceSystemProperties(props.getProperty(XAXIS_TITLE_KEY)); - final String yAxisTitle = replaceSystemProperties(props.getProperty(YAXIS_TITLE_KEY)); - - final List seriesDefinitions = createSeriesDefinitions(props); - - final ChartingDefinition chartDefinition = new ChartingDefinition(chartStemName, - chartType, - chartTitle, - chartSubtitle, - chartDescription, - xAxisTitle, yAxisTitle, seriesDefinitions); - return chartDefinition; - } - catch (IOException e) - { - throw new ChartingException("Unable to open file " + file, e); - } - finally - { - if (reader != null) - { - try - { - reader.close(); - } - catch (IOException e) - { - throw new ChartingException(e); - } - } - } - - } - - private String getStemNameFrom(File file) - { - final String nameWithExtension = file.getName(); - final String nameWithoutExtensionPart = nameWithExtension.replaceAll("\\.[^\\.]*$", ""); - return nameWithoutExtensionPart; - } - - private List createSeriesDefinitions(Properties props) - { - return _seriesDefinitionCreator.createFromProperties(props); - } - - private final class CHARTDEF_FILE_FILTER implements FileFilter - { - @Override - public boolean accept(File pathname) - { - return pathname.isFile() && pathname.getName().endsWith(CHARTDEF_FILE_EXTENSION); - } - } -} diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/definition/SeriesDefinition.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/definition/SeriesDefinition.java deleted file mode 100644 index d89ff855e2..0000000000 --- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/definition/SeriesDefinition.java +++ /dev/null @@ -1,75 +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.charting.definition; - -import org.apache.commons.lang.builder.ToStringBuilder; -import org.apache.commons.lang.builder.ToStringStyle; - -public class SeriesDefinition -{ - private final String _seriesStatement; - private final String _seriesLegend; - private final String _seriesDirectory; - private final String _seriesColourName; - private final Integer _seriesStrokeWidth; - - public SeriesDefinition(String seriesStatement, String seriesLegend, String seriesDirectory, String seriesColourName, Integer seriesStrokeWidth) - { - _seriesStatement = seriesStatement; - _seriesLegend = seriesLegend; - _seriesDirectory = seriesDirectory; - _seriesColourName = seriesColourName; - _seriesStrokeWidth = seriesStrokeWidth; - } - - public String getSeriesStatement() - { - return _seriesStatement; - } - - public String getSeriesLegend() - { - return _seriesLegend; - } - - public String getSeriesDirectory() - { - return _seriesDirectory; - } - - public String getSeriesColourName() - { - return _seriesColourName; - } - - public Integer getStrokeWidth() - { - return _seriesStrokeWidth; - } - - @Override - public String toString() - { - return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) - .append("seriesLegend", _seriesLegend) - .append("seriesStatement", _seriesStatement) - .append("seriesDirectory", _seriesDirectory).toString(); - } -} diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/definition/SeriesDefinitionCreator.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/definition/SeriesDefinitionCreator.java deleted file mode 100644 index e7d828bdcc..0000000000 --- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/definition/SeriesDefinitionCreator.java +++ /dev/null @@ -1,65 +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.charting.definition; - -import static org.apache.commons.lang.text.StrSubstitutor.replaceSystemProperties; - -import java.util.ArrayList; -import java.util.List; -import java.util.Properties; - -public class SeriesDefinitionCreator -{ - public static final String SERIES_STATEMENT_KEY_FORMAT = "series.%d.statement"; - public static final String SERIES_LEGEND_KEY_FORMAT = "series.%d.legend"; - public static final String SERIES_DIRECTORY_KEY_FORMAT = "series.%d.dir"; - public static final String SERIES_COLOUR_NAME_FORMAT = "series.%d.colourName"; - public static final String SERIES_STROKE_WIDTH_FORMAT = "series.%d.strokeWidth"; - - public List createFromProperties(Properties properties) - { - final List seriesDefinitions = new ArrayList(); - - int index = 1; - boolean moreSeriesDefinitions = true; - while(moreSeriesDefinitions) - { - String seriesStatement = replaceSystemProperties(properties.getProperty(String.format(SERIES_STATEMENT_KEY_FORMAT, index))); - String seriesLegend = replaceSystemProperties(properties.getProperty(String.format(SERIES_LEGEND_KEY_FORMAT, index))); - String seriesDir = replaceSystemProperties(properties.getProperty(String.format(SERIES_DIRECTORY_KEY_FORMAT, index))); - String seriesColourName = replaceSystemProperties(properties.getProperty(String.format(SERIES_COLOUR_NAME_FORMAT, index))); - Integer seriesStrokeWidth = properties.getProperty(String.format(SERIES_STROKE_WIDTH_FORMAT, index)) == null - ? null : Integer.parseInt(properties.getProperty(String.format(SERIES_STROKE_WIDTH_FORMAT, index))); - - if (seriesStatement != null) - { - final SeriesDefinition seriesDefinition = new SeriesDefinition(seriesStatement, seriesLegend, seriesDir, seriesColourName, seriesStrokeWidth); - seriesDefinitions.add(seriesDefinition); - } - else - { - moreSeriesDefinitions = false; - } - index++; - } - return seriesDefinitions; - } - -} diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/seriesbuilder/DatasetHolder.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/seriesbuilder/DatasetHolder.java deleted file mode 100644 index 14fd50facc..0000000000 --- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/seriesbuilder/DatasetHolder.java +++ /dev/null @@ -1,37 +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.charting.seriesbuilder; - -import org.apache.qpid.disttest.charting.definition.SeriesDefinition; -import org.jfree.data.general.Dataset; - -/** - * Accepts data in the form of {@link SeriesDefinition}s and {@link SeriesRow}s, - * and returns it as a {@link Dataset} for use by a JFreeChart chart. - */ -public interface DatasetHolder -{ - int getNumberOfDimensions(); - void beginSeries(SeriesDefinition seriesDefinition); - void addDataPointToSeries(SeriesDefinition seriesDefinition, SeriesRow row); - void endSeries(SeriesDefinition seriesDefinition); - - Dataset getPopulatedDataset(); -} diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/seriesbuilder/JdbcSeriesBuilder.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/seriesbuilder/JdbcSeriesBuilder.java deleted file mode 100644 index 180aa54c6d..0000000000 --- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/seriesbuilder/JdbcSeriesBuilder.java +++ /dev/null @@ -1,157 +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.charting.seriesbuilder; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.Iterator; -import java.util.List; - -import org.apache.commons.lang.builder.ToStringBuilder; -import org.apache.commons.lang.builder.ToStringStyle; -import org.apache.qpid.disttest.charting.ChartingException; -import org.apache.qpid.disttest.charting.definition.SeriesDefinition; -import org.jfree.data.general.Dataset; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * A {@link SeriesBuilder} that uses JDBC to read series data. - * The actual JDBC URL used is determined by my {@link JdbcUrlGenerator}. - */ -public class JdbcSeriesBuilder implements SeriesBuilder -{ - private static final Logger LOGGER = LoggerFactory.getLogger(JdbcSeriesBuilder.class); - - private DatasetHolder _datasetHolder; - - private final JdbcUrlGenerator _jdbcUrlGenerator; - - /** - * @param providedJdbcUrl the JDBC URL. Provide null if the value should be - * inferred by {@link #_jdbcUrlGenerator}. - */ - public JdbcSeriesBuilder(String jdbcDriverClass, String providedJdbcUrl) - { - registerDriver(jdbcDriverClass); - _jdbcUrlGenerator = new JdbcUrlGenerator(providedJdbcUrl); - LOGGER.info("Created: " + this); - } - - @Override - public void setDatasetHolder(DatasetHolder callback) - { - _datasetHolder = callback; - } - - @Override - public Dataset build(List seriesDefinitions) - { - for (Iterator iterator = seriesDefinitions.iterator(); iterator.hasNext();) - { - SeriesDefinition series = iterator.next(); - buildDataSetForSingleSeries(series); - } - return _datasetHolder.getPopulatedDataset(); - } - - private void buildDataSetForSingleSeries(SeriesDefinition seriesDefinition) - { - Connection conn = null; - Statement stmt = null; - try - { - String jdbcUrl = _jdbcUrlGenerator.getJdbcUrl(seriesDefinition); - conn = DriverManager.getConnection(jdbcUrl); - - final String seriesStatement = seriesDefinition.getSeriesStatement(); - - stmt = conn.createStatement(); - ResultSet results = stmt.executeQuery(seriesStatement); - int columnCount = results.getMetaData().getColumnCount(); - _datasetHolder.beginSeries(seriesDefinition); - while (results.next()) - { - Object[] row = new Object[columnCount]; - for (int i = 0; i < row.length; i++) - { - row[i] = results.getObject(i+1); - } - - SeriesRow seriesRow = SeriesRow.createValidSeriesRow(_datasetHolder.getNumberOfDimensions(), row); - _datasetHolder.addDataPointToSeries(seriesDefinition, seriesRow); - } - _datasetHolder.endSeries(seriesDefinition); - } - catch (SQLException e) - { - throw new ChartingException("Failed to create chart dataset", e); - } - finally - { - if (stmt != null) - { - try - { - stmt.close(); - } - catch (SQLException e) - { - throw new RuntimeException("Failed to close statement", e); - } - } - if (conn != null) - { - try - { - conn.close(); - } - catch (SQLException e) - { - throw new RuntimeException("Failed to close connection", e); - } - } - } - } - - private void registerDriver(String driverClassName) throws ExceptionInInitializerError - { - try - { - Class.forName(driverClassName); - LOGGER.info("Loaded JDBC driver class " + driverClassName); - } - catch (ClassNotFoundException e) - { - throw new RuntimeException("Could not load JDBC driver " + driverClassName, e); - } - } - - @Override - public String toString() - { - return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) - .append("jdbcUrlGenerator", _jdbcUrlGenerator) - .toString(); - } -} diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/seriesbuilder/JdbcUrlGenerator.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/seriesbuilder/JdbcUrlGenerator.java deleted file mode 100644 index 77f367b0f1..0000000000 --- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/seriesbuilder/JdbcUrlGenerator.java +++ /dev/null @@ -1,81 +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.charting.seriesbuilder; - -import static org.apache.commons.lang.StringUtils.isBlank; -import static org.apache.commons.lang.StringUtils.isNotBlank; - -import org.apache.commons.lang.builder.ToStringBuilder; -import org.apache.commons.lang.builder.ToStringStyle; -import org.apache.qpid.disttest.charting.definition.SeriesDefinition; - -public class JdbcUrlGenerator -{ - private String _providedJdbdUrl; - - public static final String DEFAULT_JDBC_DRIVER_NAME = "org.relique.jdbc.csv.CsvDriver"; - - /** - * Used to create the JDBC URL if one has not been passed in. - */ - private static final String CSV_JDBC_URL_BASE = "jdbc:relique:csv:"; - - /** - * @param providedJdbcUrl the JDBC URL. Provide null if the value should be - * inferred. - */ - public JdbcUrlGenerator(String providedJdbcUrl) - { - _providedJdbdUrl = providedJdbcUrl; - } - - /** - * Returns either the provided value ({@link #_providedJdbdUrl}) - * or a CSV JDBC URL pointing at {@link SeriesDefinition#getSeriesDirectory()} value. - */ - public String getJdbcUrl(SeriesDefinition seriesDefinition) - { - String seriesDir = seriesDefinition.getSeriesDirectory(); - - if(_providedJdbdUrl == null) - { - if(isBlank(seriesDir)) - { - throw new IllegalArgumentException("Neither a series directory nor a JDBC url have been specified. Series definition: " + seriesDefinition); - } - return CSV_JDBC_URL_BASE + seriesDir; - } - else - { - if(isNotBlank(seriesDir)) - { - throw new IllegalArgumentException("Both a series directory '" + seriesDir + "' and a JDBC url have been specified. Series definition: " + seriesDefinition); - } - return _providedJdbdUrl; - } - } - - @Override - public String toString() - { - return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) - .append("providedJdbdUrl", _providedJdbdUrl) - .toString(); - } -} \ No newline at end of file diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/seriesbuilder/SeriesBuilder.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/seriesbuilder/SeriesBuilder.java deleted file mode 100644 index a865c838c6..0000000000 --- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/seriesbuilder/SeriesBuilder.java +++ /dev/null @@ -1,41 +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.charting.seriesbuilder; - -import java.util.List; - -import org.apache.qpid.disttest.charting.definition.SeriesDefinition; -import org.jfree.data.general.Dataset; - -public interface SeriesBuilder -{ - /** - * Uses the supplied {@link SeriesDefinition}s to read the series data - * and pass it to the dataset holder set up in {@link #setDatasetHolder(DatasetHolder)}. - * - * @return the populated dataset - */ - Dataset build(List seriesDefinitions); - - /** - * Stores the supplied dataset holder so it can be populated in {@link #build(List)}. - */ - void setDatasetHolder(DatasetHolder datasetHolder); -} \ No newline at end of file diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/seriesbuilder/SeriesRow.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/seriesbuilder/SeriesRow.java deleted file mode 100644 index 9c16866939..0000000000 --- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/seriesbuilder/SeriesRow.java +++ /dev/null @@ -1,98 +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.charting.seriesbuilder; - -import java.util.Arrays; -import java.util.Date; - -import org.apache.commons.lang.builder.EqualsBuilder; -import org.apache.commons.lang.builder.HashCodeBuilder; - -/** - * A data point in a chart. Thinly wraps an array to provide a convenient place to validate the number of dimensions, - * and to access dimensions in a typesafe manner. - */ -public class SeriesRow -{ - private final Object[] _dimensions; - - public static SeriesRow createValidSeriesRow(int expectedNumberOfDimensions, Object[] dimensions) - { - int actualNumberOfDimensions = dimensions.length; - if(expectedNumberOfDimensions != actualNumberOfDimensions) - { - throw new IllegalArgumentException("Expected " + expectedNumberOfDimensions - + " dimensions but found " + actualNumberOfDimensions - + " in: " + Arrays.asList(dimensions)); - } - return new SeriesRow(dimensions); - } - - public SeriesRow(Object... dimensions) - { - _dimensions = dimensions; - } - - public Object dimension(int dimension) - { - return _dimensions[dimension]; - } - - public String dimensionAsString(int dimension) - { - return String.valueOf(dimension(dimension)); - } - - public double dimensionAsDouble(int dimension) - { - return Double.parseDouble(dimensionAsString(dimension)); - } - - public Date dimensionAsDate(int dimension) - { - return (Date) dimension(dimension); - } - - @Override - public int hashCode() - { - return new HashCodeBuilder().append(_dimensions).toHashCode(); - } - - @Override - public boolean equals(Object obj) - { - if (obj == null) - { - return false; - } - if (obj == this) - { - return true; - } - if (obj.getClass() != getClass()) - { - return false; - } - SeriesRow rhs = (SeriesRow) obj; - return new EqualsBuilder().append(_dimensions, rhs._dimensions).isEquals(); - } - - -} \ No newline at end of file diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/writer/ChartWriter.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/writer/ChartWriter.java deleted file mode 100644 index 341f01ccd1..0000000000 --- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/writer/ChartWriter.java +++ /dev/null @@ -1,158 +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.charting.writer; - -import java.io.BufferedOutputStream; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileOutputStream; -import java.io.FileWriter; -import java.io.IOException; -import java.io.OutputStream; -import java.util.SortedMap; -import java.util.TreeMap; - -import org.apache.qpid.disttest.charting.ChartingException; -import org.apache.qpid.disttest.charting.definition.ChartingDefinition; -import org.jfree.chart.ChartUtilities; -import org.jfree.chart.JFreeChart; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class ChartWriter -{ - private static final Logger LOGGER = LoggerFactory.getLogger(ChartWriter.class); - - static final String SUMMARY_FILE_NAME = "chart-summary.html"; - - private File _chartDirectory = new File("."); - private SortedMap _chartFilesToChartDef = new TreeMap(); - - public void writeChartToFileSystem(JFreeChart chart, ChartingDefinition chartDef) - { - OutputStream pngOutputStream = null; - try - { - File pngFile = new File(_chartDirectory, chartDef.getChartStemName() + ".png"); - pngOutputStream = new BufferedOutputStream(new FileOutputStream(pngFile)); - ChartUtilities.writeChartAsPNG(pngOutputStream, chart, 600, 400, true, 0); - pngOutputStream.close(); - - _chartFilesToChartDef.put(pngFile, chartDef); - - LOGGER.info("Written {} chart", pngFile); - } - catch (IOException e) - { - throw new ChartingException("Failed to create chart", e); - } - finally - { - if (pngOutputStream != null) - { - try - { - pngOutputStream.close(); - } - catch (IOException e) - { - throw new ChartingException("Failed to create chart", e); - } - } - } - } - - public void writeHtmlSummaryToFileSystem(String summaryPageTitle) - { - if(_chartFilesToChartDef.size() < 2) - { - LOGGER.info("Only {} chart image(s) have been written so no HTML summary file will be produced", _chartFilesToChartDef.size()); - return; - } - - String htmlHeader = String.format( - "\n" + - " \n" + - " %s\n" + - " \n" + - " \n" + - " \n", summaryPageTitle); - - String htmlFooter = - " \n" + - ""; - - BufferedWriter writer = null; - try - { - File summaryFile = new File(_chartDirectory, SUMMARY_FILE_NAME); - LOGGER.debug("About to produce HTML summary file " + summaryFile.getAbsolutePath() + " from charts " + _chartFilesToChartDef); - - writer = new BufferedWriter(new FileWriter(summaryFile)); - writer.write(htmlHeader); - - writer.write("
    \n"); - for (File chartFile : _chartFilesToChartDef.keySet()) - { - writer.write("
  • " + chartFile.getName() + "
  • \n"); - } - writer.write("
\n"); - - for (File chartFile : _chartFilesToChartDef.keySet()) - { - ChartingDefinition def = _chartFilesToChartDef.get(chartFile); - writer.write("
\n"); - writer.write(" \n"); - writer.write(" \n"); - if (def.getChartDescription() != null) - { - writer.write("
" + def.getChartDescription() + "
\n"); - } - writer.write("
\n"); - } - writer.write(htmlFooter); - writer.close(); - } - catch (Exception e) - { - throw new ChartingException("Failed to create HTML summary file", e); - } - finally - { - if(writer != null) - { - try - { - writer.close(); - } - catch(IOException e) - { - throw new ChartingException("Failed to create HTML summary file", e); - } - } - } - } - - public void setOutputDirectory(final File chartDirectory) - { - _chartDirectory = chartDirectory; - LOGGER.info("Set chart directory: {}", chartDirectory); - } -} diff --git a/qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/chartbuilder/BaseChartBuilderTest.java b/qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/chartbuilder/BaseChartBuilderTest.java deleted file mode 100644 index c8a98aafa0..0000000000 --- a/qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/chartbuilder/BaseChartBuilderTest.java +++ /dev/null @@ -1,125 +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.charting.chartbuilder; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.List; - -import org.apache.qpid.disttest.charting.definition.ChartingDefinition; -import org.apache.qpid.disttest.charting.definition.SeriesDefinition; -import org.apache.qpid.disttest.charting.seriesbuilder.DatasetHolder; -import org.apache.qpid.disttest.charting.seriesbuilder.SeriesBuilder; -import org.apache.qpid.test.utils.QpidTestCase; -import org.jfree.chart.JFreeChart; -import org.jfree.chart.plot.CategoryPlot; -import org.jfree.chart.plot.Plot; -import org.jfree.chart.plot.PlotOrientation; -import org.jfree.chart.title.TextTitle; -import org.jfree.data.general.Dataset; - -public class BaseChartBuilderTest extends QpidTestCase -{ - private static final String CHART_TITLE = "CHART_TITLE"; - private static final String CHART_SUB_TITLE = "CHART_SUB_TITLE"; - private static final String X_TITLE = "X_TITLE"; - private static final String Y_TITLE = "Y_TITLE"; - - @SuppressWarnings("unchecked") - private List _seriesDefinitions = mock(List.class); - - private ChartingDefinition _chartingDefinition = mock(ChartingDefinition.class); - private SeriesStrokeAndPaintApplier _strokeAndPaintApplier = mock(SeriesStrokeAndPaintApplier.class); - private DatasetHolder _datasetHolder = mock(DatasetHolder.class); - private SeriesPainter _seriesPainter = mock(SeriesPainter.class); - - private SeriesBuilder _seriesBuilder = mock(SeriesBuilder.class); - - private JFreeChart _jFreeChart; - - @Override - protected void setUp() throws Exception - { - super.setUp(); - - Plot plot = new CategoryPlot(); - _jFreeChart = new JFreeChart(plot); - - when(_chartingDefinition.getChartTitle()).thenReturn(CHART_TITLE); - when(_chartingDefinition.getChartSubtitle()).thenReturn(CHART_SUB_TITLE); - when(_chartingDefinition.getXAxisTitle()).thenReturn(X_TITLE); - when(_chartingDefinition.getYAxisTitle()).thenReturn(Y_TITLE); - when(_chartingDefinition.getSeriesDefinitions()).thenReturn(_seriesDefinitions ); - } - - public void testBuildChart() - { - BaseChartBuilder chartBuilder = new ChartBuilder(_seriesBuilder, _strokeAndPaintApplier, _datasetHolder) - { - @Override - protected JFreeChart createChartImpl(String title, String xAxisTitle, String yAxisTitle, Dataset dataset, PlotOrientation plotOrientation, boolean showLegend, boolean showToolTips, boolean showUrls) - { - assertEquals(CHART_TITLE, title); - assertEquals(X_TITLE, xAxisTitle); - assertEquals(Y_TITLE, yAxisTitle); - - return _jFreeChart; - } - }; - - JFreeChart chart = chartBuilder.buildChart(_chartingDefinition); - - assertEquals(BaseChartBuilder.BLUE_GRADIENT, chart.getBackgroundPaint()); - assertEquals("The *second* subtitle of the generated chart should have the text from the chart definition", - CHART_SUB_TITLE, ((TextTitle)chart.getSubtitle(1)).getText()); - verify(_seriesPainter).applySeriesAppearance(_jFreeChart, _seriesDefinitions, _strokeAndPaintApplier); - } - - /** - * Extends BaseChartBuilder to allow us to plug in in mock dependencies - */ - private abstract class ChartBuilder extends BaseChartBuilder - { - private SeriesStrokeAndPaintApplier _seriesStrokeAndPaintApplier; - private DatasetHolder _datasetHolder; - - private ChartBuilder(SeriesBuilder seriesBuilder, SeriesStrokeAndPaintApplier seriesStrokeAndPaintApplier, DatasetHolder datasetHolder) - { - super(seriesBuilder); - _seriesStrokeAndPaintApplier = seriesStrokeAndPaintApplier; - _datasetHolder = datasetHolder; - setSeriesPainter(_seriesPainter); - } - - @Override - protected SeriesStrokeAndPaintApplier newStrokeAndPaintApplier() - { - return _seriesStrokeAndPaintApplier; - } - - @Override - protected DatasetHolder newDatasetHolder() - { - return _datasetHolder; - } - } -} diff --git a/qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/chartbuilder/ChartBuilderFactoryTest.java b/qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/chartbuilder/ChartBuilderFactoryTest.java deleted file mode 100644 index 14f81566a6..0000000000 --- a/qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/chartbuilder/ChartBuilderFactoryTest.java +++ /dev/null @@ -1,67 +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.charting.chartbuilder; - -import static org.mockito.Mockito.mock; - -import org.apache.qpid.disttest.charting.ChartType; -import org.apache.qpid.disttest.charting.seriesbuilder.SeriesBuilder; -import org.apache.qpid.test.utils.QpidTestCase; - -public class ChartBuilderFactoryTest extends QpidTestCase -{ - private SeriesBuilder _seriesBuilder = mock(SeriesBuilder.class); - - public void testLineChart() - { - ChartBuilder builder = ChartBuilderFactory.createChartBuilder(ChartType.LINE, _seriesBuilder); - assertTrue(builder instanceof LineChartBuilder); - } - - public void testLineChart3D() - { - ChartBuilder builder = ChartBuilderFactory.createChartBuilder(ChartType.LINE3D, _seriesBuilder); - assertTrue(builder instanceof LineChart3DBuilder); - } - - public void testBarChart() - { - ChartBuilder builder = ChartBuilderFactory.createChartBuilder(ChartType.BAR, _seriesBuilder); - assertTrue(builder instanceof BarChartBuilder); - } - - public void testBarChart3D() - { - ChartBuilder builder = ChartBuilderFactory.createChartBuilder(ChartType.BAR3D, _seriesBuilder); - assertTrue(builder instanceof BarChart3DBuilder); - } - - public void testXYLineChart() - { - ChartBuilder builder = ChartBuilderFactory.createChartBuilder(ChartType.XYLINE, _seriesBuilder); - assertTrue(builder instanceof XYLineChartBuilder); - } - - public void testTimeSeriesLineChart() - { - ChartBuilder builder = ChartBuilderFactory.createChartBuilder(ChartType.TIMELINE, _seriesBuilder); - assertTrue(builder instanceof TimeSeriesLineChartBuilder); - } -} diff --git a/qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/chartbuilder/ChartProductionTest.java b/qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/chartbuilder/ChartProductionTest.java deleted file mode 100644 index 08d39fd0ce..0000000000 --- a/qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/chartbuilder/ChartProductionTest.java +++ /dev/null @@ -1,238 +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.charting.chartbuilder; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.io.File; -import java.util.Collections; -import java.util.Date; -import java.util.Iterator; -import java.util.List; - -import org.jfree.chart.JFreeChart; -import org.jfree.chart.plot.XYPlot; -import org.jfree.chart.title.ShortTextTitle; -import org.jfree.data.general.Dataset; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.apache.qpid.disttest.charting.ChartType; -import org.apache.qpid.disttest.charting.definition.ChartingDefinition; -import org.apache.qpid.disttest.charting.definition.SeriesDefinition; -import org.apache.qpid.disttest.charting.seriesbuilder.DatasetHolder; -import org.apache.qpid.disttest.charting.seriesbuilder.SeriesBuilder; -import org.apache.qpid.disttest.charting.seriesbuilder.SeriesRow; -import org.apache.qpid.disttest.charting.writer.ChartWriter; -import org.apache.qpid.test.utils.QpidTestCase; -import org.apache.qpid.test.utils.TestFileUtils; - -/** - * Tests the production of the different chart types. To manually - * verify the generated output, set the system property {@link #RETAIN_TEST_CHARTS} - * to prevent the automatic deletion of the test chart directory. - */ -public class ChartProductionTest extends QpidTestCase -{ - private static final Logger _logger = LoggerFactory.getLogger(ChartProductionTest.class); - private static final String TEST_CHARTTITLE = "TEST_CHARTTITLE"; - private static final String TEST_CHARTSUBTITLE = "TEST_CHARTSUBTITLE"; - private static final String TEST_XAXIS = "TEST_XAXIS"; - private static final String TEST_YAXIS = "TEST_YAXIS"; - - private static final String TEST_SERIESLEGEND = "TEST_SERIESLEGEND"; - - private static final SeriesRow[] SIMPLE_SERIES_ROWS = new SeriesRow[] - { - new SeriesRow(1d, 1d), - new SeriesRow(2d, 2d), - new SeriesRow(3d, 3d), - new SeriesRow(4d, 4d), - new SeriesRow(5d, 5d), - new SeriesRow(6d, 6d), - }; - - private static final String RETAIN_TEST_CHARTS = "retainTestCharts"; - - private SeriesDefinition _seriesDefinition = mock(SeriesDefinition.class); - private ChartingDefinition _chartingDefinition = mock(ChartingDefinition.class); - private ChartWriter _writer = new ChartWriter(); - - @Override - protected void setUp() throws Exception - { - super.setUp(); - - when(_seriesDefinition.getSeriesLegend()).thenReturn(TEST_SERIESLEGEND); - when(_seriesDefinition.getStrokeWidth()).thenReturn(null); - when(_seriesDefinition.getSeriesColourName()).thenReturn(null); - - when(_chartingDefinition.getChartStemName()).thenReturn(getName()); - when(_chartingDefinition.getChartTitle()).thenReturn(TEST_CHARTTITLE); - when(_chartingDefinition.getChartSubtitle()).thenReturn(TEST_CHARTSUBTITLE); - when(_chartingDefinition.getXAxisTitle()).thenReturn(TEST_XAXIS); - when(_chartingDefinition.getYAxisTitle()).thenReturn(TEST_YAXIS); - when(_chartingDefinition.getSeriesDefinitions()).thenReturn(Collections.singletonList(_seriesDefinition)); - - File chartDir = TestFileUtils.createTestDirectory("charts", false); - if (!System.getProperties().containsKey(RETAIN_TEST_CHARTS)) - { - chartDir.deleteOnExit(); - } - else - { - _logger.info("Charting directory for manual observation " + chartDir); - } - - _writer.setOutputDirectory(chartDir); - } - - public void testBarChart() throws Exception - { - ChartBuilder builder = ChartBuilderFactory.createChartBuilder(ChartType.BAR, new SampleSeriesBuilder(SIMPLE_SERIES_ROWS)); - assertChartTitlesAndWriteToFile(builder); - } - - public void testBar3DChart() throws Exception - { - ChartBuilder builder = ChartBuilderFactory.createChartBuilder(ChartType.BAR3D, new SampleSeriesBuilder()); - assertChartTitlesAndWriteToFile(builder); - } - - public void testLineChart() throws Exception - { - ChartBuilder builder = ChartBuilderFactory.createChartBuilder(ChartType.LINE, new SampleSeriesBuilder()); - assertChartTitlesAndWriteToFile(builder); - } - - public void testLine3DChart() throws Exception - { - ChartBuilder builder = ChartBuilderFactory.createChartBuilder(ChartType.LINE3D, new SampleSeriesBuilder()); - assertChartTitlesAndWriteToFile(builder); - } - - public void testXYLineChart() throws Exception - { - ChartBuilder builder = ChartBuilderFactory.createChartBuilder(ChartType.XYLINE, new SampleSeriesBuilder()); - assertChartTitlesAndWriteToFile(builder); - } - - public void testXYLineChartWithColourAndWidth() throws Exception - { - when(_seriesDefinition.getStrokeWidth()).thenReturn(3); - when(_seriesDefinition.getSeriesColourName()).thenReturn("dark_orange"); - - ChartBuilder builder = ChartBuilderFactory.createChartBuilder(ChartType.XYLINE, new SampleSeriesBuilder()); - assertChartTitlesAndWriteToFile(builder); - } - - public void testTimeSeriesLineChart() throws Exception - { - SeriesRow[] timelineSeriesRows = new SeriesRow[] - { - new SeriesRow(new Date(1), 1d), - new SeriesRow(new Date(2), 2d), - new SeriesRow(new Date(3), 3d), - new SeriesRow(new Date(4), 4d), - new SeriesRow(new Date(5), 5d), - new SeriesRow(new Date(6), 6d), - }; - ChartBuilder builder = ChartBuilderFactory.createChartBuilder( - ChartType.TIMELINE, - new SampleSeriesBuilder(timelineSeriesRows)); - - assertChartTitlesAndWriteToFile(builder); - } - - public void testStatisticalBarChart() throws Exception - { - SeriesRow[] statisticalSeriesRows = new SeriesRow[] - { - new SeriesRow(1d, 1d, 0.5d), - new SeriesRow(2d, 2d, 0.4d), - new SeriesRow(4d, 4d, 0.3d), - new SeriesRow(5d, 5d, 0.2d), - new SeriesRow(6d, 6d, 0.1d) - }; - - ChartBuilder builder = ChartBuilderFactory.createChartBuilder( - ChartType.STATISTICAL_BAR, - new SampleSeriesBuilder(statisticalSeriesRows)); - - assertChartTitlesAndWriteToFile(builder); - } - - private void assertChartTitlesAndWriteToFile(ChartBuilder builder) - { - JFreeChart chart = builder.buildChart(_chartingDefinition); - assertEquals(TEST_CHARTTITLE, chart.getTitle().getText()); - assertEquals(TEST_CHARTSUBTITLE, ((ShortTextTitle)chart.getSubtitle(1)).getText()); - assertEquals(TEST_SERIESLEGEND, chart.getPlot().getLegendItems().get(0).getLabel()); - - if (chart.getPlot() instanceof XYPlot) - { - assertEquals(1, chart.getXYPlot().getDatasetCount()); - } - else - { - assertEquals(1, chart.getCategoryPlot().getDatasetCount()); - } - - _writer.writeChartToFileSystem(chart, _chartingDefinition); - } - - private class SampleSeriesBuilder implements SeriesBuilder - { - private DatasetHolder _datasetHolder; - private SeriesRow[] _sampleSeriesRows = SIMPLE_SERIES_ROWS; - - public SampleSeriesBuilder() - { - } - - public SampleSeriesBuilder(SeriesRow[] sampleSeriesRows) - { - _sampleSeriesRows = sampleSeriesRows; - } - - @Override - public Dataset build(List seriesDefinitions) - { - for (Iterator iterator = seriesDefinitions.iterator(); iterator.hasNext();) - { - SeriesDefinition seriesDefinition = iterator.next(); - _datasetHolder.beginSeries(seriesDefinition); - for(SeriesRow seriesRow : _sampleSeriesRows) - { - _datasetHolder.addDataPointToSeries(seriesDefinition, seriesRow); - } - _datasetHolder.endSeries(seriesDefinition); - } - return _datasetHolder.getPopulatedDataset(); - } - - @Override - public void setDatasetHolder(DatasetHolder dataPointCallback) - { - _datasetHolder = dataPointCallback; - } - } -} diff --git a/qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/chartbuilder/ColorFactoryTest.java b/qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/chartbuilder/ColorFactoryTest.java deleted file mode 100644 index 2656c780bb..0000000000 --- a/qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/chartbuilder/ColorFactoryTest.java +++ /dev/null @@ -1,42 +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.charting.chartbuilder; - -import java.awt.Color; - -import org.apache.qpid.test.utils.QpidTestCase; - -public class ColorFactoryTest extends QpidTestCase -{ - public void testBlue() - { - assertEquals(Color.blue, ColorFactory.toColour("blue")); - assertEquals(Color.blue, ColorFactory.toColour("BLUE")); - assertEquals(Color.blue, ColorFactory.toColour("Blue")); - } - - public void testDarkBlue() - { - assertEquals(Color.blue.darker(), ColorFactory.toColour("dark_blue")); - assertEquals(Color.blue.darker(), ColorFactory.toColour("DARK_BLUE")); - assertEquals(Color.blue.darker(), ColorFactory.toColour("Dark_Blue")); - } - -} \ No newline at end of file diff --git a/qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/chartbuilder/TimeSeriesBuilderCallbackTest.java b/qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/chartbuilder/TimeSeriesBuilderCallbackTest.java deleted file mode 100644 index 88e76e667c..0000000000 --- a/qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/chartbuilder/TimeSeriesBuilderCallbackTest.java +++ /dev/null @@ -1,91 +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.charting.chartbuilder; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.util.Calendar; -import java.util.Date; -import java.util.TimeZone; - -import org.apache.qpid.disttest.charting.definition.SeriesDefinition; -import org.apache.qpid.disttest.charting.seriesbuilder.SeriesRow; -import org.apache.qpid.test.utils.QpidTestCase; -import org.jfree.data.time.TimeSeries; -import org.jfree.data.time.TimeSeriesCollection; -import org.jfree.data.time.TimeSeriesDataItem; - -public class TimeSeriesBuilderCallbackTest extends QpidTestCase -{ - private static final String SERIES_LEGEND = "mySeriesLegend"; - - private static final int NUMBER_OF_DATA_POINTS = 3; - - private Date[] _dates; - private double[] _values; - - @Override - protected void setUp() throws Exception - { - super.setUp(); - Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT+00:00")); - - calendar.set(2013, Calendar.JANUARY, 1); - Date jan1 = calendar.getTime(); - - calendar.set(2013, Calendar.JANUARY, 2); - Date jan2 = calendar.getTime(); - - calendar.set(2013, Calendar.JANUARY, 3); - Date jan3 = calendar.getTime(); - - _dates = new Date[] {jan1, jan2, jan3}; - _values = new double[] {2.0, 4.0, 8.0}; - } - - - public void testAddPointToSeries() - { - TimeSeriesHolder timeSeriesHolder = new TimeSeriesHolder(); - - SeriesDefinition seriesDefinition = mock(SeriesDefinition.class); - when(seriesDefinition.getSeriesLegend()).thenReturn(SERIES_LEGEND); - - timeSeriesHolder.beginSeries(seriesDefinition); - - timeSeriesHolder.addDataPointToSeries(seriesDefinition, new SeriesRow(_dates[0], _values[0])); - timeSeriesHolder.addDataPointToSeries(seriesDefinition, new SeriesRow(_dates[1], _values[1])); - timeSeriesHolder.addDataPointToSeries(seriesDefinition, new SeriesRow(_dates[2], _values[2])); - - timeSeriesHolder.endSeries(seriesDefinition); - - TimeSeriesCollection timeSeriesCollection = (TimeSeriesCollection) timeSeriesHolder.getPopulatedDataset(); - - TimeSeries actualTimeSeries = timeSeriesCollection.getSeries(SERIES_LEGEND); - for(int i = 0; i < NUMBER_OF_DATA_POINTS; i++) - { - TimeSeriesDataItem dataItem0 = actualTimeSeries.getDataItem(i); - assertEquals(_dates[i].getTime(), dataItem0.getPeriod().getMiddleMillisecond()); - assertEquals(_values[i], dataItem0.getValue()); - } - } - -} diff --git a/qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/definition/ChartingDefinitionCreatorTest.java b/qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/definition/ChartingDefinitionCreatorTest.java deleted file mode 100644 index 47eee43002..0000000000 --- a/qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/definition/ChartingDefinitionCreatorTest.java +++ /dev/null @@ -1,159 +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.charting.definition; - -import static org.apache.qpid.disttest.charting.definition.ChartingDefinitionCreator.CHART_DESCRIPTION_KEY; -import static org.apache.qpid.disttest.charting.definition.ChartingDefinitionCreator.CHART_SUBTITLE_KEY; -import static org.apache.qpid.disttest.charting.definition.ChartingDefinitionCreator.CHART_TITLE_KEY; -import static org.apache.qpid.disttest.charting.definition.ChartingDefinitionCreator.CHART_TYPE_KEY; -import static org.apache.qpid.disttest.charting.definition.ChartingDefinitionCreator.XAXIS_TITLE_KEY; -import static org.apache.qpid.disttest.charting.definition.ChartingDefinitionCreator.YAXIS_TITLE_KEY; -import static org.apache.qpid.disttest.charting.definition.SeriesDefinitionCreator.SERIES_STATEMENT_KEY_FORMAT; - -import java.io.File; -import java.io.FileWriter; -import java.util.List; -import java.util.Properties; - -import org.apache.qpid.disttest.charting.ChartType; -import org.apache.qpid.disttest.charting.ChartingException; -import org.apache.qpid.test.utils.QpidTestCase; - -public class ChartingDefinitionCreatorTest extends QpidTestCase -{ - private static final String TEST_CHART_TITLE = "CHART_TITLE ${ChartingDefinitionSysProp}"; - private static final String TEST_CHART_SUBTITLE = "CHART_SUBTITLE"; - private static final String TEST_CHART_DESCRIPTION = "CHART_DESCRIPTION"; - private static final String TEST_XAXIS_TITLE = "XAXIS_TITLE"; - private static final String TEST_YAXIS_TITLE = "YAXIS_TITLE"; - private static final ChartType TEST_CHART_TYPE = ChartType.LINE; - - private static final String TEST_SERIES_SELECT_STATEMENT = "SERIES_SELECT_STATEMENT"; - - private static final String SYSTEM_PROPERTY_NAME = "ChartingDefinitionSysProp"; - - private ChartingDefinitionCreator _chartingDefinitionLoader = new ChartingDefinitionCreator(); - private File _testTempDir; - - @Override - protected void setUp() throws Exception - { - super.setUp(); - _testTempDir = createTestTemporaryDirectory(); - } - - public void testLoadTwoDefinitionsFromDirectory() throws Exception - { - createTestDefinitionWithin(_testTempDir); - createTestDefinitionWithin(_testTempDir); - - List definitions = _chartingDefinitionLoader.createFromFileOrDirectory(_testTempDir.getAbsolutePath()); - assertEquals(2, definitions.size()); - } - - public void testLoadOneDefinitionFromFile() throws Exception - { - File testDefFile = createTestDefinitionWithin(_testTempDir); - - List definitions = _chartingDefinitionLoader.createFromFileOrDirectory(testDefFile.getAbsolutePath()); - assertEquals(1, definitions.size()); - - ChartingDefinition definition1 = definitions.get(0); - assertEquals(TEST_CHART_TITLE, definition1.getChartTitle()); - } - - public void testDefinitionsProperties() throws Exception - { - setTestSystemProperty(SYSTEM_PROPERTY_NAME, "propValue"); - File testDefFile = createTestDefinitionWithin(_testTempDir); - - List definitions = _chartingDefinitionLoader.createFromFileOrDirectory(testDefFile.getAbsolutePath()); - assertEquals(1, definitions.size()); - - ChartingDefinition definition1 = definitions.get(0); - assertEquals("CHART_TITLE propValue", definition1.getChartTitle()); - assertEquals(TEST_CHART_SUBTITLE, definition1.getChartSubtitle()); - assertEquals(TEST_CHART_DESCRIPTION, definition1.getChartDescription()); - assertEquals(TEST_XAXIS_TITLE, definition1.getXAxisTitle()); - assertEquals(TEST_YAXIS_TITLE, definition1.getYAxisTitle()); - assertEquals(TEST_CHART_TYPE, definition1.getChartType()); - - String stemOnly = testDefFile.getName().replaceFirst("\\.chartdef", ""); - assertEquals(stemOnly, definition1.getChartStemName()); - - final List seriesDefinitions = definition1.getSeriesDefinitions(); - assertEquals(1, seriesDefinitions.size()); - SeriesDefinition seriesDefinition = seriesDefinitions.get(0); - assertEquals(TEST_SERIES_SELECT_STATEMENT, seriesDefinition.getSeriesStatement()); - } - - public void testDefinitionFileNotFound() throws Exception - { - File notFound = new File(_testTempDir,"notfound.chartdef"); - assertFalse(notFound.exists()); - - try - { - _chartingDefinitionLoader.createFromFileOrDirectory(notFound.getAbsolutePath()); - fail("Exception not thrown"); - } - catch(ChartingException ce) - { - // PASS - } - } - - private File createTestDefinitionWithin(File _testTempDir) throws Exception - { - final String testDefFileName = "test." + System.nanoTime() + ".chartdef"; - File chartDef = new File(_testTempDir, testDefFileName); - chartDef.createNewFile(); - - Properties props = new Properties(); - props.setProperty(CHART_TYPE_KEY, TEST_CHART_TYPE.name()); - props.setProperty(CHART_TITLE_KEY, TEST_CHART_TITLE); - props.setProperty(CHART_SUBTITLE_KEY, TEST_CHART_SUBTITLE); - props.setProperty(CHART_DESCRIPTION_KEY, TEST_CHART_DESCRIPTION); - props.setProperty(XAXIS_TITLE_KEY, TEST_XAXIS_TITLE); - props.setProperty(YAXIS_TITLE_KEY, TEST_YAXIS_TITLE); - - props.setProperty(String.format(SERIES_STATEMENT_KEY_FORMAT, 1), TEST_SERIES_SELECT_STATEMENT); - - final FileWriter writer = new FileWriter(chartDef); - try - { - props.store(writer, "Test chart definition file"); - } - finally - { - writer.close(); - } - - return chartDef; - } - - private File createTestTemporaryDirectory() throws Exception - { - File tmpDir = new File(System.getProperty("java.io.tmpdir"), "testdef" + System.nanoTime()); - tmpDir.mkdirs(); - tmpDir.deleteOnExit(); - return tmpDir; - } -} diff --git a/qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/definition/SeriesDefinitionCreatorTest.java b/qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/definition/SeriesDefinitionCreatorTest.java deleted file mode 100644 index e937e80108..0000000000 --- a/qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/definition/SeriesDefinitionCreatorTest.java +++ /dev/null @@ -1,130 +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.charting.definition; - -import static org.apache.qpid.disttest.charting.definition.SeriesDefinitionCreator.SERIES_COLOUR_NAME_FORMAT; -import static org.apache.qpid.disttest.charting.definition.SeriesDefinitionCreator.SERIES_DIRECTORY_KEY_FORMAT; -import static org.apache.qpid.disttest.charting.definition.SeriesDefinitionCreator.SERIES_LEGEND_KEY_FORMAT; -import static org.apache.qpid.disttest.charting.definition.SeriesDefinitionCreator.SERIES_STATEMENT_KEY_FORMAT; -import static org.apache.qpid.disttest.charting.definition.SeriesDefinitionCreator.SERIES_STROKE_WIDTH_FORMAT; - -import java.util.List; -import java.util.Properties; - -import org.apache.qpid.test.utils.QpidTestCase; - -public class SeriesDefinitionCreatorTest extends QpidTestCase -{ - private static final String SYSTEM_PROPERTY_NAME = "SeriesDefinitionProp"; - private static final String TEST_SERIES_1_SELECT_STATEMENT = "SERIES_1_SELECT_STATEMENT"; - private static final String TEST_SERIES_1_LEGEND = "SERIES_1_LEGEND"; - private static final String TEST_SERIES_1_LEGEND_WITH_SYSPROP = "SERIES_1_LEGEND ${SeriesDefinitionProp}"; - private static final String TEST_SERIES_1_DIR = "SERIES_1_DIR"; - private static final String TEST_SERIES_1_COLOUR_NAME = "seriesColourName"; - private static final Integer TEST_SERIES_1_STROKE_WIDTH = 1;; - - private static final String TEST_SERIES_1_DIR_WITH_SYSPROP = "${SeriesDefinitionProp}/mydir"; - - private static final String TEST_SERIES_2_SELECT_STATEMENT = "SERIES_2_SELECT_STATEMENT"; - private static final String TEST_SERIES_2_LEGEND = "SERIES_2_LEGEND"; - private static final String TEST_SERIES_2_DIR = "SERIES_2_DIR"; - - private Properties _properties = new Properties(); - - private SeriesDefinitionCreator _seriesDefinitionLoader = new SeriesDefinitionCreator(); - - @Override - protected void setUp() throws Exception - { - super.setUp(); - } - - public void testOneSeriesDefinition() throws Exception - { - createTestProperties(1, TEST_SERIES_1_SELECT_STATEMENT, TEST_SERIES_1_LEGEND, TEST_SERIES_1_DIR, TEST_SERIES_1_COLOUR_NAME, TEST_SERIES_1_STROKE_WIDTH); - - List definitions = _seriesDefinitionLoader.createFromProperties(_properties); - assertEquals(1, definitions.size()); - - SeriesDefinition definition = definitions.get(0); - assertEquals(TEST_SERIES_1_SELECT_STATEMENT, definition.getSeriesStatement()); - assertEquals(TEST_SERIES_1_LEGEND, definition.getSeriesLegend()); - assertEquals(TEST_SERIES_1_DIR, definition.getSeriesDirectory()); - assertEquals(TEST_SERIES_1_COLOUR_NAME, definition.getSeriesColourName()); - assertEquals(TEST_SERIES_1_STROKE_WIDTH, definition.getStrokeWidth()); - } - - public void testTwoSeriesDefinitions() throws Exception - { - createTestProperties(1, TEST_SERIES_1_SELECT_STATEMENT, TEST_SERIES_1_LEGEND, TEST_SERIES_1_DIR, TEST_SERIES_1_COLOUR_NAME, TEST_SERIES_1_STROKE_WIDTH); - createTestProperties(2, TEST_SERIES_2_SELECT_STATEMENT, TEST_SERIES_2_LEGEND, TEST_SERIES_2_DIR, null, null); - - List definitions = _seriesDefinitionLoader.createFromProperties(_properties); - assertEquals(2, definitions.size()); - - SeriesDefinition seriesDefinition1 = definitions.get(0); - assertEquals(TEST_SERIES_1_SELECT_STATEMENT, seriesDefinition1.getSeriesStatement()); - assertEquals(TEST_SERIES_1_LEGEND, seriesDefinition1.getSeriesLegend()); - assertEquals(TEST_SERIES_1_DIR, seriesDefinition1.getSeriesDirectory()); - - SeriesDefinition seriesDefinition2 = definitions.get(1); - assertEquals(TEST_SERIES_2_SELECT_STATEMENT, seriesDefinition2.getSeriesStatement()); - assertEquals(TEST_SERIES_2_LEGEND, seriesDefinition2.getSeriesLegend()); - assertEquals(TEST_SERIES_2_DIR, seriesDefinition2.getSeriesDirectory()); - } - - public void testNonSequentialSeriesDefinitionsIgnored() throws Exception - { - createTestProperties(1, TEST_SERIES_1_SELECT_STATEMENT, TEST_SERIES_1_LEGEND, TEST_SERIES_1_DIR, TEST_SERIES_1_COLOUR_NAME, TEST_SERIES_1_STROKE_WIDTH); - createTestProperties(3, TEST_SERIES_2_SELECT_STATEMENT, TEST_SERIES_2_LEGEND, TEST_SERIES_2_DIR, null, null); - - List definitions = _seriesDefinitionLoader.createFromProperties(_properties); - assertEquals(1, definitions.size()); - } - - public void testSeriesDirectoryAndNameSubstitution() throws Exception - { - setTestSystemProperty(SYSTEM_PROPERTY_NAME, "propValue"); - createTestProperties(1, TEST_SERIES_1_SELECT_STATEMENT, TEST_SERIES_1_LEGEND_WITH_SYSPROP, TEST_SERIES_1_DIR_WITH_SYSPROP, null, null); - - List definitions = _seriesDefinitionLoader.createFromProperties(_properties); - assertEquals(1, definitions.size()); - - SeriesDefinition seriesDefinition1 = definitions.get(0); - assertEquals("propValue/mydir", seriesDefinition1.getSeriesDirectory()); - assertEquals("SERIES_1_LEGEND propValue", seriesDefinition1.getSeriesLegend()); - } - - private void createTestProperties(int index, String selectStatement, String seriesLegend, String seriesDir, String seriesColourName, Integer seriesStrokeWidth) throws Exception - { - _properties.setProperty(String.format(SERIES_STATEMENT_KEY_FORMAT, index), selectStatement); - _properties.setProperty(String.format(SERIES_LEGEND_KEY_FORMAT, index), seriesLegend); - _properties.setProperty(String.format(SERIES_DIRECTORY_KEY_FORMAT, index), seriesDir); - if (seriesColourName != null) - { - _properties.setProperty(String.format(SERIES_COLOUR_NAME_FORMAT, index), seriesColourName); - } - if (seriesStrokeWidth != null) - { - _properties.setProperty(String.format(SERIES_STROKE_WIDTH_FORMAT, index), seriesStrokeWidth.toString()); - } - } - -} diff --git a/qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/seriesbuilder/JdbcSeriesBuilderTest.java b/qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/seriesbuilder/JdbcSeriesBuilderTest.java deleted file mode 100644 index b6b4dbe56b..0000000000 --- a/qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/seriesbuilder/JdbcSeriesBuilderTest.java +++ /dev/null @@ -1,103 +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.charting.seriesbuilder; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.PrintWriter; -import java.util.Collections; - -import org.apache.qpid.disttest.charting.definition.SeriesDefinition; -import org.apache.qpid.test.utils.QpidTestCase; - -public class JdbcSeriesBuilderTest extends QpidTestCase -{ - private static final String TEST_SERIES_1_SELECT_STATEMENT = "SELECT A, B FROM test"; - private static final String TEST_SERIES_1_LEGEND = "SERIES_1_LEGEND"; - private static final String TEST_SERIES1_COLOUR_NAME = "blue"; - private static final Integer TEST_SERIES1_STROKE_WIDTH = 3; - - private DatasetHolder _seriesWalkerCallback = mock(DatasetHolder.class); - - private File _testTempDir; - - @Override - protected void setUp() throws Exception - { - super.setUp(); - when(_seriesWalkerCallback.getNumberOfDimensions()).thenReturn(2); - _testTempDir = createTestTemporaryDirectory(); - createTestCsvIn(_testTempDir); - } - - public void testBuildOneSeries() throws Exception - { - SeriesDefinition seriesDefinition = createTestSeriesDefinition(); - - JdbcSeriesBuilder seriesBuilder = new JdbcSeriesBuilder("org.relique.jdbc.csv.CsvDriver", null); - - seriesBuilder.setDatasetHolder(_seriesWalkerCallback); - - seriesBuilder.build(Collections.singletonList(seriesDefinition)); - - verify(_seriesWalkerCallback).beginSeries(seriesDefinition); - verify(_seriesWalkerCallback).addDataPointToSeries(seriesDefinition, new SeriesRow("elephant", "2")); - verify(_seriesWalkerCallback).addDataPointToSeries(seriesDefinition, new SeriesRow("lion", "3")); - verify(_seriesWalkerCallback).addDataPointToSeries(seriesDefinition, new SeriesRow("tiger", "4")); - verify(_seriesWalkerCallback).endSeries(seriesDefinition); - } - - private void createTestCsvIn(File testDir) throws Exception - { - File csv = new File(_testTempDir, "test.csv"); - - PrintWriter csvWriter = new PrintWriter(new BufferedWriter(new FileWriter(csv))); - csvWriter.println("A,B"); - csvWriter.println("elephant,2"); - csvWriter.println("lion,3"); - csvWriter.println("tiger,4"); - csvWriter.close(); - } - - private SeriesDefinition createTestSeriesDefinition() - { - SeriesDefinition definition = new SeriesDefinition( - TEST_SERIES_1_SELECT_STATEMENT, - TEST_SERIES_1_LEGEND, - _testTempDir.getAbsolutePath(), - TEST_SERIES1_COLOUR_NAME, - TEST_SERIES1_STROKE_WIDTH); - return definition; - } - - private File createTestTemporaryDirectory() throws Exception - { - File tmpDir = new File(System.getProperty("java.io.tmpdir"), "testdef" + System.nanoTime()); - tmpDir.mkdirs(); - tmpDir.deleteOnExit(); - return tmpDir; - } - -} diff --git a/qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/seriesbuilder/JdbcUrlGeneratorTest.java b/qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/seriesbuilder/JdbcUrlGeneratorTest.java deleted file mode 100644 index d53d0ccfe1..0000000000 --- a/qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/seriesbuilder/JdbcUrlGeneratorTest.java +++ /dev/null @@ -1,85 +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.charting.seriesbuilder; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import org.apache.qpid.disttest.charting.definition.SeriesDefinition; -import org.apache.qpid.test.utils.QpidTestCase; - -public class JdbcUrlGeneratorTest extends QpidTestCase -{ - public void testGetJdbcUrlWithoutProvidingAUrlReturnsCsvUrlWithCorrectDirectory() - { - JdbcUrlGenerator jdbcUrlGenerator = new JdbcUrlGenerator(null); - SeriesDefinition seriesDefinition = mock(SeriesDefinition.class); - when(seriesDefinition.getSeriesDirectory()).thenReturn("mydir"); - - String jdbcUrl = jdbcUrlGenerator.getJdbcUrl(seriesDefinition); - - assertEquals("jdbc:relique:csv:mydir", jdbcUrl); - } - - public void testGetJdbcUrlReturnsProvidedUrl() - { - String urlTemplate = "urlTemplate"; - JdbcUrlGenerator jdbcUrlGenerator = new JdbcUrlGenerator(urlTemplate); - SeriesDefinition seriesDefinition = mock(SeriesDefinition.class); - - String jdbcUrl = jdbcUrlGenerator.getJdbcUrl(seriesDefinition); - - assertEquals(urlTemplate, jdbcUrl); - } - - public void testGetJdbcUrlThrowsExceptionIfUrlProvidedAndSeriesDirectorySpecified() - { - String urlTemplate = "urlTemplate"; - JdbcUrlGenerator jdbcUrlGenerator = new JdbcUrlGenerator(urlTemplate); - SeriesDefinition seriesDefinition = mock(SeriesDefinition.class); - when(seriesDefinition.getSeriesDirectory()).thenReturn("mydir"); - - try - { - jdbcUrlGenerator.getJdbcUrl(seriesDefinition); - fail("Expected exception not thrown"); - } - catch (IllegalArgumentException e) - { - // pass - } - } - - public void testGetJdbcUrlThrowsExceptionWithoutAProvidedUrlOrSeriesDirectory() - { - JdbcUrlGenerator jdbcUrlGenerator = new JdbcUrlGenerator(null); - SeriesDefinition seriesDefinition = mock(SeriesDefinition.class); - when(seriesDefinition.getSeriesDirectory()).thenReturn(null); - - try - { - jdbcUrlGenerator.getJdbcUrl(seriesDefinition); - fail("Expected exception not thrown"); - } - catch (IllegalArgumentException e) - { - // pass - } - } -} diff --git a/qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/seriesbuilder/SeriesRowTest.java b/qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/seriesbuilder/SeriesRowTest.java deleted file mode 100644 index 064971aa35..0000000000 --- a/qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/seriesbuilder/SeriesRowTest.java +++ /dev/null @@ -1,64 +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.charting.seriesbuilder; - -import org.apache.qpid.test.utils.QpidTestCase; - -public class SeriesRowTest extends QpidTestCase -{ - private static final Integer[] PAIR = new Integer[] {10, 11}; - - public void testValidSeriesRow() - { - assertEquals(11, SeriesRow.createValidSeriesRow(2, PAIR).dimension(1)); - } - - public void testValidSeriesRowThrowsExceptionIfArrayTooSmall() - { - try - { - SeriesRow.createValidSeriesRow(1, PAIR); - fail("Expected exception not thrown"); - } - catch(IllegalArgumentException e) - { - // pass - } - } - - public void testDimension() - { - SeriesRow seriesRow = new SeriesRow(10, 11); - assertEquals(10, seriesRow.dimension(0)); - assertEquals(11, seriesRow.dimension(1)); - } - - public void testDimensionAsString() - { - SeriesRow seriesRow = new SeriesRow(10); - assertEquals("10", seriesRow.dimensionAsString(0)); - } - - public void testDimensionAsDouble() - { - SeriesRow seriesRow = new SeriesRow(10.1); - assertEquals(10.1, seriesRow.dimensionAsDouble(0), 0.0); - } - -} diff --git a/qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/writer/ChartWriterTest.java b/qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/writer/ChartWriterTest.java deleted file mode 100644 index 9703c66e1f..0000000000 --- a/qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/writer/ChartWriterTest.java +++ /dev/null @@ -1,134 +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.charting.writer; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.io.File; -import java.io.FileWriter; -import java.io.InputStream; -import java.util.Scanner; - -import org.apache.qpid.disttest.charting.definition.ChartingDefinition; -import org.apache.qpid.test.utils.QpidTestCase; -import org.apache.qpid.test.utils.TestFileUtils; -import org.apache.qpid.util.FileUtils; -import org.jfree.chart.ChartFactory; -import org.jfree.chart.JFreeChart; -import org.jfree.data.general.DefaultPieDataset; - -public class ChartWriterTest extends QpidTestCase -{ - private JFreeChart _chart1; - private JFreeChart _chart2; - - private File _chartDir; - private ChartWriter _writer; - - @Override - public void setUp() - { - DefaultPieDataset dataset = new DefaultPieDataset(); - dataset.setValue("a", 1); - dataset.setValue("b", 2); - - _chart1 = ChartFactory.createPieChart("chart1", dataset, true, true, false); - _chart2 = ChartFactory.createPieChart("chart2", dataset, true, true, false); - - _chartDir = TestFileUtils.createTestDirectory(); - - _writer = new ChartWriter(); - _writer.setOutputDirectory(_chartDir); - } - - public void testWriteChartToFileSystem() - { - ChartingDefinition chartDef1 = mock(ChartingDefinition.class); - when(chartDef1.getChartStemName()).thenReturn("chart1"); - - File chart1File = new File(_chartDir, "chart1.png"); - assertFalse("chart1 png should not exist yet", chart1File.exists()); - - _writer.writeChartToFileSystem(_chart1, chartDef1); - - assertTrue("chart1 png does not exist", chart1File.exists()); - } - - public void testWriteHtmlSummaryToFileSystemOverwritingExistingFile() throws Exception - { - ChartingDefinition chartDef1 = mock(ChartingDefinition.class); - when(chartDef1.getChartStemName()).thenReturn("chart1"); - when(chartDef1.getChartDescription()).thenReturn("chart description1"); - - ChartingDefinition chartDef2 = mock(ChartingDefinition.class); - when(chartDef2.getChartStemName()).thenReturn("chart2"); - - File summaryFile = new File(_chartDir, ChartWriter.SUMMARY_FILE_NAME); - - writeDummyContentToSummaryFileToEnsureItGetsOverwritten(summaryFile); - - _writer.writeChartToFileSystem(_chart2, chartDef2); - _writer.writeChartToFileSystem(_chart1, chartDef1); - - _writer.writeHtmlSummaryToFileSystem("Performance Charts"); - - InputStream expectedSummaryFileInputStream = getClass().getResourceAsStream("expected-chart-summary.html"); - String expectedSummaryContent = new Scanner(expectedSummaryFileInputStream).useDelimiter("\\A").next(); - String actualSummaryContent = FileUtils.readFileAsString(summaryFile); - - assertEquals("HTML summary file has unexpected content", expectedSummaryContent, actualSummaryContent); - } - - public void testWriteHtmlSummaryToFileSystemDoesNothingIfLessThanTwoCharts() - { - ChartingDefinition chartDef1 = mock(ChartingDefinition.class); - when(chartDef1.getChartStemName()).thenReturn("chart1"); - when(chartDef1.getChartDescription()).thenReturn("chart description1"); - - File summaryFile = new File(_chartDir, ChartWriter.SUMMARY_FILE_NAME); - - _writer.writeChartToFileSystem(_chart1, chartDef1); - - _writer.writeHtmlSummaryToFileSystem("Performance Charts"); - - assertFalse("Only one chart generated so no summary file should have been written", - summaryFile.exists()); - } - - private void writeDummyContentToSummaryFileToEnsureItGetsOverwritten(File summaryFile) throws Exception - { - FileWriter writer = null; - try - { - writer = new FileWriter(summaryFile); - writer.write("dummy content"); - writer.close(); - } - finally - { - if (writer != null) - { - writer.close(); - } - } - } -} diff --git a/qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/writer/expected-chart-summary.html b/qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/writer/expected-chart-summary.html deleted file mode 100755 index e7dadcb05b..0000000000 --- a/qpid/java/perftests/visualisation-jfc/src/test/java/org/apache/qpid/disttest/charting/writer/expected-chart-summary.html +++ /dev/null @@ -1,21 +0,0 @@ - - - Performance Charts - - - - -
- - -
chart description1
-
-
- - -
- - \ No newline at end of file -- cgit v1.2.1