summaryrefslogtreecommitdiff
path: root/qpid/java/perftests/src/main
diff options
context:
space:
mode:
authorAlex Rudyy <orudyy@apache.org>2015-04-15 09:47:28 +0000
committerAlex Rudyy <orudyy@apache.org>2015-04-15 09:47:28 +0000
commit0a0baee45ebcff44635907d457c4ff6810b09c87 (patch)
tree8bfb0f9eddbc23cff88af69be80ab3ce7d47011c /qpid/java/perftests/src/main
parent54aa3d7070da16ce55c28ccad3f7d0871479e461 (diff)
downloadqpid-python-0a0baee45ebcff44635907d457c4ff6810b09c87.tar.gz
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
Diffstat (limited to 'qpid/java/perftests/src/main')
-rw-r--r--qpid/java/perftests/src/main/assembly/LICENSE233
-rw-r--r--qpid/java/perftests/src/main/assembly/NOTICE48
-rw-r--r--qpid/java/perftests/src/main/assembly/dependency-verification/DEPENDENCIES_REFERENCE60
-rw-r--r--qpid/java/perftests/src/main/assembly/qpid-perftests-bin.xml70
-rw-r--r--qpid/java/perftests/src/main/java/json2.js487
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/AbstractRunner.java74
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/ArgumentParser.java54
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/Benchmark.java290
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/ClientRunner.java98
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/ConfigFileHelper.java63
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/ControllerRunner.java212
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/DistributedTestConstants.java35
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/DistributedTestException.java66
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/Visitor.java76
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/Client.java228
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ClientCommandVisitor.java99
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ClientState.java25
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ConnectionLostListener.java26
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ConsumerParticipant.java283
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/MessageProvider.java218
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/Participant.java31
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ParticipantExecutor.java145
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ParticipantExecutorRegistry.java45
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ParticipantResultFactory.java118
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ProducerParticipant.java234
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/property/GeneratedPropertySupport.java68
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/property/GeneratedPropertyValue.java27
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/property/ListPropertyValue.java122
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/property/NumericGeneratedPropertySupport.java179
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/property/PropertyValue.java27
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/property/PropertyValueFactory.java46
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/property/RandomPropertyValue.java47
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/property/RangePropertyValue.java129
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/property/SimplePropertyValue.java79
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/utils/ExecutorWithLimits.java35
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/utils/ExecutorWithLimitsFactory.java49
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/utils/ExecutorWithNoLimits.java42
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/utils/ExecutorWithTimeLimit.java65
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/ClientRegistry.java127
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/CommandForClient.java46
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/CommandListener.java31
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/Controller.java231
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/ParticipatingClients.java94
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/ResultsForAllTests.java70
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/TestResult.java70
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/TestRunner.java348
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/TestRunnerFactory.java31
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/ClientConfig.java113
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/Config.java86
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/ConfigReader.java91
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/ConnectionConfig.java91
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/ConsumerConfig.java83
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/IterationValue.java86
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/JavaScriptConfigEvaluator.java83
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/MessageProviderConfig.java60
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/ParticipantConfig.java105
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/ProducerConfig.java121
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/QueueConfig.java66
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/SessionConfig.java114
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/TestConfig.java117
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/TestInstance.java102
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/db/ResultsDbWriter.java440
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/ClientJmsDelegate.java715
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/ControllerJmsDelegate.java274
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/ExistingQueueDrainer.java134
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/JmsMessageAdaptor.java124
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/NoOpQueueCreator.java38
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/QpidQueueCreator.java175
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/QueueCreator.java34
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/json/JsonHandler.java43
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/json/PropertyValueAdapter.java147
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/Command.java56
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CommandType.java39
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ConsumerParticipantResult.java185
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateConnectionCommand.java58
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateConsumerCommand.java107
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateMessageProviderCommand.java54
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateParticpantCommand.java114
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateProducerCommand.java106
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateResponderCommand.java28
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateSessionCommand.java62
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/NoOpCommand.java30
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/OutputAttribute.java35
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ParticipantAttribute.java111
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ParticipantAttributeExtractor.java89
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ParticipantResult.java322
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ProducerParticipantResult.java102
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/RegisterClientCommand.java43
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/Response.java80
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/StartTestCommand.java29
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/StopClientCommand.java28
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/TearDownTestCommand.java29
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/BenchmarkResultWriter.java68
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/ResultsCsvWriter.java115
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/ResultsWriter.java34
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/AggregatedTestResult.java97
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/Aggregator.java49
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/ITestResult.java34
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/ParticipantResultAggregator.java211
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/SeriesStatistics.java111
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/TestResultAggregator.java130
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/formatting/CSVFormatter.java91
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/formatting/CSVOrderParticipantResultComparator.java55
-rw-r--r--qpid/java/perftests/src/main/java/test-utils.js105
-rw-r--r--qpid/java/perftests/src/main/resources/Benchmark.js96
-rw-r--r--qpid/java/perftests/src/main/resources/perftests.properties20
106 files changed, 0 insertions, 11646 deletions
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 @@
-<?xml version='1.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.
-
--->
-<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
- <id>bin</id>
- <formats>
- <format>tar.gz</format>
- </formats>
- <baseDirectory>qpid-perftests/${project.version}</baseDirectory>
- <fileSets>
- <fileSet>
- <directory>${project.basedir}</directory>
- <outputDirectory>/</outputDirectory>
- <includes>
- <include>etc/</include>
- </includes>
- </fileSet>
- <fileSet>
- <directory>${basedir}/src/main/assembly/</directory>
- <outputDirectory>/</outputDirectory>
- <includes>
- <include>README.txt</include>
- <include>NOTICE</include>
- <include>LICENSE</include>
- </includes>
- <fileMode>0644</fileMode>
- <directoryMode>0755</directoryMode>
- </fileSet>
- </fileSets>
- <dependencySets>
- <dependencySet>
- <outputDirectory>/lib</outputDirectory>
- <useProjectArtifact>true</useProjectArtifact>
- <excludes>
- <!-- Exclude client artifacts, user provides appropriate version -->
- <exclude>org.apache.qpid:qpid-client</exclude>
- <exclude>org.apache.qpid:qpid-common</exclude>
- </excludes>
- </dependencySet>
- <dependencySet>
- <outputDirectory>/lib</outputDirectory>
- <useProjectArtifact>false</useProjectArtifact>
- <scope>provided</scope>
- <includes>
- <include>org.apache.geronimo.specs:geronimo-jms_1.1_spec</include>
- </includes>
- </dependencySet>
- </dependencySets>
-</assembly>
-
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 '&nbsp;'),
- 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<String,String> _cliOptions = new HashMap<String, String>();
- {
- 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<String,String> 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<String, String> 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 <name>=<value>: " + 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<String,String> _cliOptions = new HashMap<String, String>()
- {{
- 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 \"<classpath>\" -Dqpid.disttest.duration=<test duration in milliseconds> -Dqpid.disttest.messageSize=<message size in bytes> org.apache.qpid.disttest.Benchmark [-h] [report-message-totals=<false|true>] [jndi-config=<path/to/jndi.properties>] [test-config=<path/to/test/configuration>]");
- 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<String,String> 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<ResultsForAllTests> results = new ArrayList<ResultsForAllTests>();
-
- 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<String> files = configFileHelper.getTestConfigFiles(testConfigFile);
- List<TestConfig> tests = new ArrayList<TestConfig>();
- 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).
- * <p>
- * If testConfigPath is a directory, its .js and .json files are returned.
- * Otherwise, the returned list just contains testConfigPath.
- */
- public List<String> getTestConfigFiles(String testConfigPath)
- {
- final List<String> testConfigFile = new ArrayList<String>();
- 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<String> testConfigFiles = _configFileHelper.getTestConfigFiles(testConfigPath);
- createClientsIfNotDistributed(testConfigFiles);
-
- try
- {
- List<ResultsForAllTests> results = new ArrayList<ResultsForAllTests>();
-
- 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<String> 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
- * <pre>visit(SpecificClass)</pre> methods.
- */
-public abstract class Visitor
-{
-
- private static final String VISITOR_METHOD_NAME = "visit";
-
- public void visit(Object targetObject)
- {
- Class<? extends Object> targetObjectClass = targetObject.getClass();
- final Method method = findVisitMethodForTargetObjectClass(targetObjectClass);
- invokeVisitMethod(targetObject, method);
- }
-
- private Method findVisitMethodForTargetObjectClass(
- Class<? extends Object> 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<ClientState> _state;
- private ParticipantExecutorRegistry _participantRegistry = new ParticipantExecutorRegistry();
-
- public Client(final ClientJmsDelegate delegate) throws NamingException
- {
- _clientJmsDelegate = delegate;
- _state = new AtomicReference<ClientState>(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<Integer> _allConsumedPayloadSizes = new ConcurrentSkipListSet<Integer>();
- 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<Long> _messageLatencies;
-
- public ConsumerParticipant(final ClientJmsDelegate delegate, final CreateConsumerCommand command)
- {
- _jmsDelegate = delegate;
- _command = command;
- _resultFactory = new ParticipantResultFactory();
- if (command.isEvaluateLatency())
- {
- _messageLatencies = new ArrayList<Long>();
- }
- }
-
- @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<Integer> 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<String, PropertyValue> _messageProperties;
- private ConcurrentMap<Integer, Future<String>> _payloads;
-
- public MessageProvider(Map<String, PropertyValue> messageProperties)
- {
- _messageProperties = messageProperties;
- _payloads = new ConcurrentHashMap<Integer, Future<String>>();
- }
-
- 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<String, PropertyValue> 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<String> createTextFuture = new FutureTask<String>(new Callable<String>()
- {
- @Override
- public String call() throws Exception
- {
- return StringUtils.repeat("a", command.getMessageSize());
- }
- });
-
- Future<String> 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<ParticipantExecutor> _participantExecutors = Collections.synchronizedSet(new HashSet<ParticipantExecutor>());
-
- public void add(ParticipantExecutor participantExecutor)
- {
- _participantExecutors.add(participantExecutor);
- }
-
- public void clear()
- {
- _participantExecutors.clear();
- }
-
- public Collection<ParticipantExecutor> 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<Long> 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<Integer> allProducedPayloadSizes = new TreeSet<Integer>();
-
- _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<Message>()
- {
- @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<Integer> 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<PropertyValue> _items;
- private boolean _cyclic;
- private int _currentIndex;
-
- public ListPropertyValue()
- {
- super();
- _cyclic = true;
- _currentIndex = 0;
- _items = new ArrayList<PropertyValue>();
- }
-
- public synchronized void setItems(List<PropertyValue> items)
- {
- _items = new ArrayList<PropertyValue>(items);
- }
-
- public synchronized List<PropertyValue> 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> T execute(Callable<T> 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 <code>allowedTimeInMillis</code> milliseconds have elapsed beyond <code>startTime</code>.
- * If <code>allowedTimeInMillis</code> 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> T execute(Callable<T> _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> T execute(Callable<T> callback) throws CancellationException, Exception
- {
- final long timeRemaining = _endTime - System.currentTimeMillis();
- if (timeRemaining <= 0)
- {
- throw new CancellationException("Too little time remains to schedule callable");
- }
-
- List<Future<T>> 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<String> _registeredClientNames = new ConcurrentSkipListSet<String>();
-
- 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<String> 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<String> 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<String> 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<String> configuredClientNamesForTest, ClientRegistry clientRegistry)
- {
- BidiMap configuredToRegisteredNameMap = new DualHashBidiMap();
-
- TreeSet<String> registeredClients = new TreeSet<String>(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<String> 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<ITestResult> _results = new ArrayList<ITestResult>();
- private boolean _hasErrors;
-
- public List<ITestResult> 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<ParticipantResult> _participantResults = Collections.synchronizedSortedSet(
- new TreeSet<ParticipantResult>(ParticipantResult.PARTICIPANT_NAME_COMPARATOR));
-
- private boolean _hasErrors;
- private String _name;
-
- public TestResult(String name)
- {
- _name = name;
- }
-
- @Override
- public List<ParticipantResult> getParticipantResults()
- {
- List<ParticipantResult> list = new ArrayList<ParticipantResult>(_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<CommandType> _setOfResponsesToExpect = Collections.synchronizedSet(new HashSet<CommandType>());
-
- 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<QueueConfig> queues = _testInstance.getQueues();
- if (!queues.isEmpty())
- {
- _jmsDelegate.createQueues(queues);
- }
- }
-
- void sendTestSetupCommands()
- {
- List<CommandForClient> 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<QueueConfig> queues = _testInstance.getQueues();
- if (!queues.isEmpty())
- {
- _jmsDelegate.deleteQueues(queues);
- }
- }
-
- void sendCommandToParticipatingClients(final Command command)
- {
- Collection<String> 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<ConnectionConfig> _connections;
- private List<MessageProviderConfig> _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<ConnectionConfig> connections, List<MessageProviderConfig> messageProviders)
- {
- _name = name;
- _connections = connections;
- if (messageProviders == null)
- {
- _messageProviders = Collections.emptyList();
- }
- else
- {
- _messageProviders = messageProviders;
- }
- }
-
- public String getName()
- {
- return _name;
- }
-
- public List<ConnectionConfig> getConnections()
- {
- return Collections.unmodifiableList(_connections);
- }
-
- public List<CommandForClient> createCommands()
- {
- List<CommandForClient> commandsForClient = new ArrayList<CommandForClient>();
-
- for (MessageProviderConfig messageProvider : _messageProviders)
- {
- Command command = messageProvider.createCommand();
- commandsForClient.add(new CommandForClient(_name, command));
- }
- for (ConnectionConfig connection : _connections)
- {
- List<Command> 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<MessageProviderConfig> 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<TestConfig> _tests;
-
- public Config()
- {
- super();
- _tests = Collections.emptyList();
- }
-
- public Config(List<TestConfig> tests)
- {
- _tests = tests;
- }
-
- public Config(TestConfig... tests)
- {
- _tests = Arrays.asList(tests);
- }
-
- public List<TestInstance> getTests()
- {
- List<TestInstance> testInstances = new ArrayList<TestInstance>();
- for (TestConfig testConfig : _tests)
- {
- int iterationNumber = 0;
-
- List<IterationValue> 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<TestConfig> 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<SessionConfig> _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<SessionConfig> getSessions()
- {
- return Collections.unmodifiableList(_sessions);
- }
-
- public String getName()
- {
- return _name;
- }
-
- public List<Command> createCommands()
- {
- List<Command> commands = new ArrayList<Command>();
- 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<String, String> _iterationPropertyValuesWithUnderscores;
-
- public IterationValue(Map<String, String> iterationMap)
- {
- _iterationPropertyValuesWithUnderscores = iterationMap;
- }
-
- public IterationValue()
- {
- _iterationPropertyValuesWithUnderscores = Collections.emptyMap();
- }
-
- public Map<String, String> getIterationPropertyValuesWithUnderscores()
- {
- return _iterationPropertyValuesWithUnderscores;
- }
-
- public void applyToCommand(Command command)
- {
- try
- {
- Map<String, String> 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<String, String> getIterationPropertyValuesWithoutUnderscores()
- {
- Map<String, String> iterationPropertyValues = new HashMap<String, String>();
- 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<String, PropertyValue> _messageProperties;
-
- public MessageProviderConfig()
- {
- super();
- }
-
- public MessageProviderConfig(String name, Map<String, PropertyValue> messageProperties)
- {
- super();
- _name = name;
- _messageProperties = messageProperties;
- }
-
- public String getName()
- {
- return _name;
- }
-
- public Map<String, PropertyValue> 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<String, Object> _attributes;
-
- public QueueConfig()
- {
- super();
- _attributes = Collections.emptyMap();
- }
-
- public QueueConfig(String name, boolean durable, Map<String, Object> attributes)
- {
- this._name = name;
- this._durable = durable;
- this._attributes = attributes;
- }
-
- public String getName()
- {
- return _name;
- }
-
- public Map<String, Object> 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<ProducerConfig> EMPTY_PRODUCER_LIST = Collections.emptyList();
- private static final List<ConsumerConfig> EMPTY_CONSUMER_LIST = Collections.emptyList();
-
- private int _acknowledgeMode;
- private String _sessionName;
- private List<ProducerConfig> _producers;
- private List<ConsumerConfig> _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<ConsumerConfig> consumers, List<ProducerConfig> producers)
- {
- _sessionName = sessionName;
- _acknowledgeMode = acknowledgeMode;
- _consumers = consumers;
- _producers = producers;
- }
-
- public int getAcknowledgeMode()
- {
- return _acknowledgeMode;
- }
-
- public String getSessionName()
- {
- return _sessionName;
- }
-
- public List<ProducerConfig> getProducers()
- {
- return Collections.unmodifiableList(_producers);
- }
-
- public List<ConsumerConfig> getConsumers()
- {
- return Collections.unmodifiableList(_consumers);
- }
-
- public List<Command> createCommands(String connectionName)
- {
- List<Command> commands = new ArrayList<Command>();
- 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<ClientConfig> _clients;
-
- private final List<QueueConfig> _queues;
-
- private final List<Map<String, String>> _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<String> getClientNames()
- {
- List<String> clientNames = new ArrayList<String>();
- 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<CommandForClient> createCommands()
- {
- List<CommandForClient> commandsForClients = new ArrayList<CommandForClient>();
- for (ClientConfig client : _clients)
- {
- commandsForClients.addAll(client.createCommands());
- }
-
- return Collections.unmodifiableList(commandsForClients);
- }
-
- public List<QueueConfig> getQueues()
- {
- return Collections.unmodifiableList(_queues);
- }
-
- public String getName()
- {
- return _name;
- }
-
- public List<IterationValue> getIterationValues()
- {
- List<IterationValue> iterationValues = new ArrayList<IterationValue>();
- for (Map<String, String> iterationMap : _iterations)
- {
- iterationValues.add(new IterationValue(iterationMap));
- }
-
- return iterationValues;
- }
-
- public List<ClientConfig> 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<CommandForClient> createCommands()
- {
- List<CommandForClient> commands = _testConfig.createCommands();
- List<CommandForClient> newCommands = new ArrayList<CommandForClient>(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<QueueConfig> getQueues()
- {
- return _testConfig.getQueues();
- }
-
- public List<String> 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:
- * <ul>
- * <li>{@link #ResultsDbWriter(Context, String)}</li>
- * <li>{@link #createResultsTableIfNecessary()}</li>
- * <li>{@link #writeResults(ResultsForAllTests)} (usually multiple times)</li>
- * </ul>
- */
-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<String, Connection> _testConnections;
- private Map<String, Session> _testSessions;
- private Map<String, MessageProducer> _testProducers;
- private Map<String, MessageConsumer> _testConsumers;
- private Map<String, Session> _testSubscriptions;
- private Map<String, MessageProvider> _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<String, Connection>();
- _testSessions = new HashMap<String, Session>();
- _testProducers = new HashMap<String, MessageProducer>();
- _testConsumers = new HashMap<String, MessageConsumer>();
- _testSubscriptions = new HashMap<String, Session>();
- _testMessageProviders = new HashMap<String, MessageProvider>();
- _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<String, Connection> 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<String, Connection> 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<String, Destination> _clientNameToQueueMap = new ConcurrentHashMap<String, Destination>();
- private final Connection _connection;
- private final Destination _controllerQueue;
- private final Session _controllerQueueListenerSession;
- private final Session _commandSession;
- private QueueCreator _queueCreator;
-
- private List<CommandListener> _commandListeners = new CopyOnWriteArrayList<CommandListener>();
-
- 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<? extends QueueCreator> queueCreatorClass = (Class<? extends QueueCreator>) 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<QueueConfig> queues)
- {
- _queueCreator.createQueues(_connection, _commandSession, queues);
- }
-
- public void deleteQueues(List<QueueConfig> 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<QueueConfig> configs)
- {
- }
-
- @Override
- public void deleteQueues(Connection connection, Session session, List<QueueConfig> 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<? extends Command> 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<QueueConfig> configs)
- {
- }
-
- @Override
- public void deleteQueues(Connection connection, Session session, List<QueueConfig> 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<QueueConfig> configs)
- {
- AMQSession<?, ?> amqSession = (AMQSession<?, ?>)session;
- for (QueueConfig queueConfig : configs)
- {
- createQueue(amqSession, queueConfig);
- }
- }
-
- @Override
- public void deleteQueues(Connection connection, Session session, List<QueueConfig> 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<QueueConfig> configs);
- void deleteQueues(Connection connection, Session session, List<QueueConfig> 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 extends Command> T unmarshall(final String jsonParams, final Class<T> clazz)
- {
- return _gson.fromJson(jsonParams, clazz);
- }
-
- public <T extends Command> 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<PropertyValue>, JsonSerializer<PropertyValue>
-{
- 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<Object> result = new ArrayList<Object>(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<String, Object> result = new HashMap<String, Object>();
- for (Map.Entry<String, JsonElement> 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<Long> _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<Long> getMessageLatencies()
- {
- return _messageLatencies;
- }
-
- public void setMessageLatencies(Collection<Long> 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<String, PropertyValue> _messageProperties;
-
- public CreateMessageProviderCommand()
- {
- super(CommandType.CREATE_MESSAGE_PROVIDER);
- }
-
- public String getProviderName()
- {
- return _providerName;
- }
-
- public void setProviderName(String providerName)
- {
- this._providerName = providerName;
- }
-
- public Map<String, PropertyValue> getMessageProperties()
- {
- return _messageProperties;
- }
-
- public void setMessageProperties(Map<String, PropertyValue> 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<ParticipantAttribute, Object> getAttributes(Object targetObject)
- {
- Map<ParticipantAttribute, Object> attributes = new HashMap<ParticipantAttribute, Object>();
-
-
- 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<? super ParticipantResult> PARTICIPANT_NAME_COMPARATOR = new Comparator<ParticipantResult>()
- {
- @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<ParticipantAttribute, Object> 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<ResultsForAllTests> 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<ResultsForAllTests> 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<ResultsForAllTests> 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<ParticipantResult> getParticipantResults()
- {
- List<ParticipantResult> allParticipantResults = new ArrayList<ParticipantResult>(_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<ParticipantResult> 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<? extends ParticipantResult> _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<Integer> _encounteredPayloadSizes = new TreeSet<Integer>();
- private NavigableSet<Integer> _encounteredIterationNumbers = new TreeSet<Integer>();
- private NavigableSet<Integer> _encounteredBatchSizes = new TreeSet<Integer>();
- private NavigableSet<Integer> _encounteredAcknowledgeMode = new TreeSet<Integer>();
- private NavigableSet<Integer> _encounteredDeliveryModes = new TreeSet<Integer>();
- private NavigableSet<Boolean> _encounteredDurableSubscriptions = new TreeSet<Boolean>();
- private NavigableSet<Boolean> _encounteredTopics = new TreeSet<Boolean>();
- private NavigableSet<String> _encountedTestNames = new TreeSet<String>();
-
- private SeriesStatistics _latencyStatistics = new SeriesStatistics();
-
- public ParticipantResultAggregator(Class<? extends ParticipantResult> 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<Long> _series = new CopyOnWriteArrayList<Long>();
-
- public SeriesStatistics()
- {
- super();
- }
-
- public SeriesStatistics(Collection<Long> messageLatencies)
- {
- setMessageLatencies(messageLatencies);
- }
-
- public void addMessageLatencies(Collection<Long> messageLatencies)
- {
- if (messageLatencies != null)
- {
- _series.addAll(messageLatencies);
- }
- }
-
- public void setMessageLatencies(Collection<Long> 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<ResultsForAllTests> 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<ITestResult> testResults = results.getTestResults();
-
- for (ITestResult testResult : testResults)
- {
-
- List<ParticipantResult> participantResults = new ArrayList<ParticipantResult>(testResult.getParticipantResults());
- Collections.sort(participantResults, new CSVOrderParticipantResultComparator());
-
- for (ParticipantResult participantResult : participantResults)
- {
- Map<ParticipantAttribute, Object> attributes = participantResult.getAttributes();
- builder.append(row(attributes));
- }
- }
-
- return builder.toString();
- }
-
- /**
- * return a row, including a newline character at the end
- */
- private String row(Map<ParticipantAttribute, Object> attributeValueMap)
- {
- List<Object> attributeValues = new ArrayList<Object>();
- 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<String> displayNames = new ArrayList<String>();
- 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<ParticipantResult>
-{
- // TODO yuk
- private static final Map<Class<? extends ParticipantResult>, Integer> TYPE_CODES = new HashMap<Class<? extends ParticipantResult>, 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<len; i++)
- {
- json = arguments[i](json);
- }
- return json;
- }
- }
-
- if (typeof QPID.cloneJSON !== 'function') {
- QPID.cloneJSON = function (json)
- {
- return JSON.parse( JSON.stringify( json ));
- }
- }
-
-}());
-
diff --git a/qpid/java/perftests/src/main/resources/Benchmark.js b/qpid/java/perftests/src/main/resources/Benchmark.js
deleted file mode 100644
index e11cea8ad6..0000000000
--- a/qpid/java/perftests/src/main/resources/Benchmark.js
+++ /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.
- *
-*/
-var jsonObject = {
- _tests:[]
-};
-
-var duration = 30000;
-var queueName = "direct://amq.direct//benchmark?durable='true'";
-
-var numbersOfParticipants = [1, 2, 5, 10];
-
-for(participantIndex=0; participantIndex < numbersOfParticipants.length; participantIndex++)
-{
- var numberOfProducers = numbersOfParticipants[participantIndex];
- var numberOfConsumers = numbersOfParticipants[participantIndex];
- var test = {
- "_name": "" + numberOfProducers + " producer(s) and " + numberOfConsumers + " consumer(s), each on separate connections, persistent messaging with transactional sessions",
- "_queues":[
- {
- "_name": queueName,
- "_durable": true
- }
- ],
- "_clients":
- QPID.times(numberOfProducers,
- {
- "_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(numberOfConsumers,
- {
- "_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/src/main/resources/perftests.properties b/qpid/java/perftests/src/main/resources/perftests.properties
deleted file mode 100644
index d8823f9dc5..0000000000
--- a/qpid/java/perftests/src/main/resources/perftests.properties
+++ /dev/null
@@ -1,20 +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/test?brokerlist='tcp://localhost:5672'