summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Gemmell <robbie@apache.org>2012-04-04 16:15:04 +0000
committerRobert Gemmell <robbie@apache.org>2012-04-04 16:15:04 +0000
commitcd490267f429405a14e033089d244c9c52c48fe4 (patch)
tree90329a1f2967a8bb0e9692f1af0e57ff11c6d0ef
parent8ea49185740bea4d7260c883aed20f2b5be89a0b (diff)
downloadqpid-python-cd490267f429405a14e033089d244c9c52c48fe4.tar.gz
QPID-3929: remove old perftests + integrationtests + junit-toolkit modules and associated files
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1309476 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/java/bdbstore/build.xml2
-rwxr-xr-xqpid/java/bdbstore/etc/scripts/bdbtest.sh43
-rw-r--r--qpid/java/build.deps3
-rw-r--r--qpid/java/build.xml4
-rw-r--r--qpid/java/integrationtests/README.txt13
-rwxr-xr-xqpid/java/integrationtests/bin/interoptests.py180
-rw-r--r--qpid/java/integrationtests/build.xml28
-rw-r--r--qpid/java/integrationtests/docs/RunningSustainedTests.txt17
-rw-r--r--qpid/java/integrationtests/jar-with-dependencies.xml47
-rw-r--r--qpid/java/integrationtests/src/main/java/org/apache/qpid/interop/clienttestcases/TestCase1DummyRun.java135
-rw-r--r--qpid/java/integrationtests/src/main/java/org/apache/qpid/interop/clienttestcases/TestCase2BasicP2P.java209
-rw-r--r--qpid/java/integrationtests/src/main/java/org/apache/qpid/interop/clienttestcases/TestCase3BasicPubSub.java239
-rw-r--r--qpid/java/integrationtests/src/main/java/org/apache/qpid/interop/clienttestcases/TestCase4P2PMessageSize.java214
-rw-r--r--qpid/java/integrationtests/src/main/java/org/apache/qpid/interop/clienttestcases/TestCase5PubSubMessageSize.java243
-rw-r--r--qpid/java/integrationtests/src/main/java/org/apache/qpid/interop/testcases/InteropTestCase1DummyRun.java84
-rw-r--r--qpid/java/integrationtests/src/main/java/org/apache/qpid/interop/testcases/InteropTestCase2BasicP2P.java90
-rw-r--r--qpid/java/integrationtests/src/main/java/org/apache/qpid/interop/testcases/InteropTestCase3BasicPubSub.java88
-rw-r--r--qpid/java/integrationtests/src/main/java/org/apache/qpid/interop/testcases/InteropTestCase4P2PMessageSize.java193
-rw-r--r--qpid/java/integrationtests/src/main/java/org/apache/qpid/interop/testcases/InteropTestCase5PubSubMessageSize.java193
-rw-r--r--qpid/java/integrationtests/src/main/java/org/apache/qpid/sustained/SustainedClientTestCase.java906
-rw-r--r--qpid/java/integrationtests/src/main/java/org/apache/qpid/sustained/SustainedTestCase.java126
-rw-r--r--qpid/java/integrationtests/src/resources/sustained-log4j.xml69
-rw-r--r--qpid/java/junit-toolkit/build.xml26
-rw-r--r--qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/concurrency/DefaultThreadFactory.java48
-rw-r--r--qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/concurrency/PossibleDeadlockException.java46
-rw-r--r--qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/concurrency/TestRunnable.java239
-rw-r--r--qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/concurrency/ThreadTestCoordinator.java486
-rw-r--r--qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/concurrency/ThreadTestExample.java145
-rw-r--r--qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/concurrency/package.html28
-rw-r--r--qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/AsymptoticTestCase.java303
-rw-r--r--qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/AsymptoticTestDecorator.java173
-rw-r--r--qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/BaseThrottle.java98
-rw-r--r--qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/BatchedThrottle.java94
-rw-r--r--qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/DurationTestDecorator.java205
-rw-r--r--qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/InstrumentedTest.java66
-rw-r--r--qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/NullResultPrinter.java92
-rw-r--r--qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/ParameterVariationTestDecorator.java175
-rw-r--r--qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/ScaledTestDecorator.java391
-rw-r--r--qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/SetupTaskAware.java55
-rw-r--r--qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/SetupTaskHandler.java92
-rw-r--r--qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/ShutdownHookable.java42
-rw-r--r--qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/SleepThrottle.java81
-rw-r--r--qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/TKTestResult.java654
-rw-r--r--qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/TKTestRunner.java694
-rw-r--r--qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/TestRunnerImprovedErrorHandling.java131
-rw-r--r--qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/TestThreadAware.java54
-rw-r--r--qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/Throttle.java73
-rw-r--r--qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/TimingController.java198
-rw-r--r--qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/TimingControllerAware.java43
-rw-r--r--qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/WrappedSuiteTestDecorator.java134
-rw-r--r--qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/listeners/CSVTestListener.java572
-rw-r--r--qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/listeners/ConsoleTestListener.java274
-rw-r--r--qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/listeners/TKTestListener.java142
-rw-r--r--qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/listeners/XMLTestListener.java410
-rw-r--r--qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/listeners/package.html27
-rw-r--r--qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/package.html33
-rw-r--r--qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/util/CommandLineParser.java787
-rw-r--r--qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/util/ContextualProperties.java494
-rw-r--r--qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/util/MathUtils.java428
-rw-r--r--qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/util/ParsedProperties.java390
-rw-r--r--qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/util/SizeOf.java94
-rw-r--r--qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/util/StackQueue.java131
-rw-r--r--qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/util/TestContextProperties.java202
-rw-r--r--qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/util/TestUtils.java54
-rw-r--r--qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/util/package.html27
-rw-r--r--qpid/java/perftests/RunningPerformanceTests.txt141
-rwxr-xr-xqpid/java/perftests/bin/monitoring/monitor-broker.sh221
-rwxr-xr-xqpid/java/perftests/bin/monitoring/runTests.sh148
-rwxr-xr-xqpid/java/perftests/bin/monitoring/stop-monitored-broker.sh124
-rwxr-xr-xqpid/java/perftests/bin/processing/process.sh388
-rwxr-xr-xqpid/java/perftests/bin/processing/processAll.sh58
-rwxr-xr-xqpid/java/perftests/bin/processing/processTests.py850
-rwxr-xr-xqpid/java/perftests/bin/run_many.sh30
-rwxr-xr-xqpid/java/perftests/bin/topicListener.sh32
-rwxr-xr-xqpid/java/perftests/bin/topicPublisher.sh31
-rw-r--r--qpid/java/perftests/build.xml339
-rw-r--r--qpid/java/perftests/dist-zip.xml45
-rw-r--r--qpid/java/perftests/etc/jndi/activemq.properties20
-rw-r--r--qpid/java/perftests/etc/jndi/failovertest.properties19
-rw-r--r--qpid/java/perftests/etc/jndi/perftests.properties19
-rw-r--r--qpid/java/perftests/etc/jndi/swiftmq.properties20
-rw-r--r--qpid/java/perftests/etc/perftests.log4j46
-rwxr-xr-xqpid/java/perftests/etc/scripts/CTQ-Qpid-1.sh21
-rwxr-xr-xqpid/java/perftests/etc/scripts/CTQ-Qpid-2.sh21
-rwxr-xr-xqpid/java/perftests/etc/scripts/CTQ-Qpid-3.sh21
-rwxr-xr-xqpid/java/perftests/etc/scripts/CTQ-Qpid-4.sh21
-rwxr-xr-xqpid/java/perftests/etc/scripts/CTQ-Qpid-5.sh21
-rwxr-xr-xqpid/java/perftests/etc/scripts/CTQ-Qpid-6.sh21
-rwxr-xr-xqpid/java/perftests/etc/scripts/Connections.sh20
-rwxr-xr-xqpid/java/perftests/etc/scripts/JobQueue.sh20
-rwxr-xr-xqpid/java/perftests/etc/scripts/Latency.sh21
-rwxr-xr-xqpid/java/perftests/etc/scripts/MessageSize.sh20
-rwxr-xr-xqpid/java/perftests/etc/scripts/PT-Qpid-13.sh42
-rwxr-xr-xqpid/java/perftests/etc/scripts/PT-Qpid-14.sh41
-rwxr-xr-xqpid/java/perftests/etc/scripts/Reliability.sh20
-rwxr-xr-xqpid/java/perftests/etc/scripts/RunAll.sh23
-rwxr-xr-xqpid/java/perftests/etc/scripts/RunCore.sh22
-rw-r--r--qpid/java/perftests/etc/scripts/Test-ActiveMQ.sh32
-rw-r--r--qpid/java/perftests/etc/scripts/Test-SwiftMQ.sh30
-rwxr-xr-xqpid/java/perftests/etc/scripts/Throughput.sh20
-rwxr-xr-xqpid/java/perftests/etc/scripts/drainBroker.sh41
-rwxr-xr-xqpid/java/perftests/etc/scripts/extractResults.sh34
-rwxr-xr-xqpid/java/perftests/etc/scripts/extractThroughputResults.sh51
-rwxr-xr-xqpid/java/perftests/etc/scripts/fillBroker.sh41
-rwxr-xr-xqpid/java/perftests/etc/scripts/sendAndWaitClient.sh22
-rwxr-xr-xqpid/java/perftests/etc/scripts/testWithPreFill.sh41
-rw-r--r--qpid/java/perftests/generate-scripts74
-rw-r--r--qpid/java/perftests/jar-with-dependencies.xml91
-rw-r--r--qpid/java/perftests/scripts.xml328
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/client/message/TestMessageFactory.java117
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/config/AMQConnectionFactoryInitialiser.java47
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/config/AbstractConfig.java69
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/config/ConnectionFactoryInitialiser.java29
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/config/Connector.java43
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/config/ConnectorConfig.java28
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/config/JBossConnectionFactoryInitialiser.java112
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/oldtopic/Config.java243
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/oldtopic/Listener.java141
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/oldtopic/MessageFactory.java153
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/oldtopic/Publisher.java178
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/ping/PingAsyncTestPerf.java323
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/ping/PingClient.java112
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/ping/PingDurableClient.java452
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/ping/PingLatencyTestPerf.java311
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/ping/PingSendOnlyClient.java93
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/ping/PingTestPerf.java281
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongBouncer.java453
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java1818
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongTestPerf.java251
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/topic/Config.java326
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/topic/Listener.java303
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/topic/MessageFactory.java157
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/topic/Publisher.java186
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/topic/TopicWithSelectorsTransientVolumeTest.java344
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/topic/topicselectors.properties24
-rw-r--r--qpid/java/systests/build.xml2
-rwxr-xr-xqpid/java/systests/etc/bin/testclients.sh23
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/server/exchange/MessagingTestConfigProperties.java300
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/AMQPPublisher.java54
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/Assertion.java39
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/AssertionBase.java66
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/BrokerLifecycleAware.java70
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/CauseFailure.java42
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/CauseFailureUserPrompt.java63
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/Circuit.java109
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/CircuitEnd.java95
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/CircuitEndBase.java156
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/DropInTest.java51
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/ExceptionMonitor.java204
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/FrameworkBaseCase.java299
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/FrameworkTestContext.java48
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/LocalAMQPCircuitFactory.java173
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/LocalCircuitFactory.java320
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/MessageIdentityVector.java167
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/MessageMonitor.java104
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/MessagingTestConfigProperties.java684
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/NotApplicableAssertion.java112
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/Publisher.java74
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/Receiver.java92
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/TestCaseVector.java88
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/TestClientDetails.java86
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/TestUtils.java200
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/clocksynch/ClockSynchFailureException.java45
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/clocksynch/ClockSynchThread.java124
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/clocksynch/ClockSynchronizer.java69
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/clocksynch/LocalClockSynchronizer.java73
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/clocksynch/UDPClockReference.java169
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/clocksynch/UDPClockSynchronizer.java468
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedcircuit/DistributedCircuitImpl.java472
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedcircuit/DistributedPublisherImpl.java94
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedcircuit/DistributedReceiverImpl.java94
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedcircuit/TestClientCircuitEnd.java333
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/Coordinator.java546
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/DistributedTestDecorator.java164
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/FanOutTestDecorator.java241
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/InteropTestDecorator.java210
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/OptOutTestCase.java69
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/TestClient.java510
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/TestClientControlledTest.java107
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/listeners/XMLTestListener.java414
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/localcircuit/LocalAMQPPublisherImpl.java137
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/localcircuit/LocalCircuitImpl.java313
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/localcircuit/LocalPublisherImpl.java176
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/localcircuit/LocalReceiverImpl.java149
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/package.html43
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/BaseCircuitFactory.java136
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/CircuitFactory.java101
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/FanOutCircuitFactory.java200
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/InteropCircuitFactory.java154
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/unit/close/CloseBeforeAckTest.java140
190 files changed, 5 insertions, 31809 deletions
diff --git a/qpid/java/bdbstore/build.xml b/qpid/java/bdbstore/build.xml
index d2317350ff..7e55b41b28 100644
--- a/qpid/java/bdbstore/build.xml
+++ b/qpid/java/bdbstore/build.xml
@@ -18,7 +18,7 @@
-->
<project name="bdbstore" default="build">
<property name="module.depends" value="common broker" />
- <property name="module.test.depends" value="test client common/test broker/test management/common perftests systests" />
+ <property name="module.test.depends" value="test client common/test broker/test management/common systests" />
<property name="module.genpom" value="true"/>
<import file="../module.xml" />
diff --git a/qpid/java/bdbstore/etc/scripts/bdbtest.sh b/qpid/java/bdbstore/etc/scripts/bdbtest.sh
deleted file mode 100755
index 0ccfa3cb18..0000000000
--- a/qpid/java/bdbstore/etc/scripts/bdbtest.sh
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/bin/bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-if [ -z "$QPID_HOME" ]; then
- export QPID_HOME=$(dirname $(dirname $(readlink -f $0)))
- export PATH=${PATH}:${QPID_HOME}/bin
-fi
-
-# Parse arguements taking all - prefixed args as JAVA_OPTS
-for arg in "$@"; do
- if [[ $arg == -java:* ]]; then
- JAVA_OPTS="${JAVA_OPTS}-`echo $arg|cut -d ':' -f 2` "
- else
- ARGS="${ARGS}$arg "
- fi
-done
-
-VERSION=0.17
-
-# Set classpath to include Qpid jar with all required jars in manifest
-QPID_LIBS=$QPID_HOME/lib/qpid-all.jar:$QPID_HOME/lib/qpid-junit-toolkit-$VERSION.jar:$QPID_HOME/lib/junit-3.8.1.jar:$QPID_HOME/lib/log4j-1.2.12.jar:$QPID_HOME/lib/qpid-systests-$VERSION.jar:$QPID_HOME/lib/qpid-perftests-$VERSION.jar:$QPID_HOME/lib/slf4j-log4j12-1.6.1.jar
-
-# Set other variables used by the qpid-run script before calling
-export JAVA=java JAVA_MEM=-Xmx256m QPID_CLASSPATH=$QPID_LIBS
-
-. qpid-run -Dlog4j.configuration=perftests.log4j -Dbadger.level=warn -Damqj.test.logging.level=warn -Damqj.logging.level=warn ${JAVA_OPTS} org.apache.qpid.ping.PingDurableClient -o $QPID_WORK/results ${ARGS}
diff --git a/qpid/java/build.deps b/qpid/java/build.deps
index ec9eacb169..e60bc3ee93 100644
--- a/qpid/java/build.deps
+++ b/qpid/java/build.deps
@@ -59,8 +59,7 @@ broker.libs=${commons-cli} ${commons-logging} ${log4j} ${slf4j-log4j} \
broker-plugins.libs=${felix.libs} ${log4j} ${commons-configuration.libs}
-junit-toolkit.libs=${log4j} ${junit} ${slf4j-api} ${mockito-all}
-test.libs=${slf4j-log4j} ${junit-toolkit.libs}
+test.libs=${slf4j-log4j} ${log4j} ${junit} ${slf4j-api} ${mockito-all}
ibm-icu=lib/com.ibm.icu_3.8.1.v20080530.jar
ecl-core-jface=lib/org.eclipse.jface_3.4.1.M20080827-2000.jar
diff --git a/qpid/java/build.xml b/qpid/java/build.xml
index 36e34f4071..6728662d85 100644
--- a/qpid/java/build.xml
+++ b/qpid/java/build.xml
@@ -26,9 +26,9 @@
<findSubProjects name="client-plugins" dir="client-plugins"/>
<findSubProjects name="management" dir="management" excludes="common,example"/>
- <property name="modules.core" value="junit-toolkit common management/common broker client tools"/>
+ <property name="modules.core" value="common management/common broker client tools"/>
<property name="modules.examples" value="client/example management/example"/>
- <property name="modules.tests" value="systests perftests integrationtests"/>
+ <property name="modules.tests" value="systests"/>
<property name="modules.management" value="${management}"/>
<property name="modules.plugin" value="${broker-plugins} ${client-plugins}"/>
<property name="modules.opt" value=""/>
diff --git a/qpid/java/integrationtests/README.txt b/qpid/java/integrationtests/README.txt
deleted file mode 100644
index 00a21883a9..0000000000
--- a/qpid/java/integrationtests/README.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-This module contains integration tests, for testing a java client againt *any* broker
-implementation or against other clients. These tests must not rely on starting the
-Java broker in-vm but must depend on a broker being started independantly before running
-the tests in this module. By default tests in this module will expect the broker to be
-started on localhost on the default port, but this can be overridden by passing in a
-sys property to maven. Interop tests are in this module. Java broker specific tests that
-use an in-vm broker should go in the systests module.
-
-Don't set the tests in this module to run by default as part of the maven build, until
-there is a script to start and stop the broker; needed to fully automate these tests.
-Interop tests will always be run using a seperate script (not from maven) but it might
-be worthwile to script into the maven build starting of the Java broker, and running
-these tests against it. \ No newline at end of file
diff --git a/qpid/java/integrationtests/bin/interoptests.py b/qpid/java/integrationtests/bin/interoptests.py
deleted file mode 100755
index a883a22a5f..0000000000
--- a/qpid/java/integrationtests/bin/interoptests.py
+++ /dev/null
@@ -1,180 +0,0 @@
-#!/usr/bin/env python
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-import glob, os, subprocess
-from subprocess import Popen
-from optparse import OptionParser
-
-interop_cases = ["InteropTestCase1DummyRun", "InteropTestCase2BasicP2P", "InteropTestCase3BasicPubSub", "InteropTestCase4P2PMessageSize", "InteropTestCase5PubSubMessageSize"]
-
-interop_command = "java -cp %s org.apache.qpid.test.framework.distributedtesting.Coordinator --xml -e interop -o . -n interop org.apache.qpid.interop.testcases.%s"
-
-# TODO: read this from the ant properties file
-clientlibs = ["qpid-integrationtests-M4.jar",
- "qpid-junit-toolkit-M4.jar",
- "junit-3.8.1.jar",
- "qpid-systests-M4.jar",
- "qpid-junit-toolkit-M4.jar",
- "geronimo-jms_1.1_spec-1.0.jar",
- "log4j-1.2.12.jar"]
-
-def main():
- parser = OptionParser()
- parser.add_option("-t", "--testlib", dest="testlib", action="store",
- type="string",
- help="The directory containing the test classes to run")
- parser.add_option("-b", "--brokers", dest="brokers", action="store",
- type="string",
- help="The directory containing the unpacked brokers to test")
- parser.add_option("-j", "--java", dest="java", action="store",
- type="string",
- help="The directory containing the java client to test")
- parser.add_option("-d", "--dotnet", dest="dotnet", action="store",
- type="string",
- help="The directory containing the .Net client to test")
- parser.add_option("-c", "--cpp", dest="cpp", action="store",
- type="string",
- help="The directory containing the C++ client to test")
- (options, args) = parser.parse_args()
-
- # check available brokers
- if (options.brokers == None or
- not os.path.exists(options.brokers) or
- not os.path.isdir(options.brokers)):
- parser.error("Broker directory must be specified and must exist")
-
- # check available clients
- if (options.java == None or
- not os.path.exists(options.java) or
- not os.path.isdir(options.java)):
- parser.error("Java client directory must be specified and must exist")
-
- # check available tests
- if (options.testlib == None or
- not os.path.exists(options.testlib) or
- not os.path.isdir(options.testlib)):
- parser.error("Test directory must be specified and must exist")
-
- # check dotnet test client
- if (options.dotnet == None or
- not os.path.exists(options.dotnet) or
- not os.path.exists(options.dotnet+"/TestClient.exe")):
- parser.error(".Net test directory must be specified and must contain TestClient.exe")
-
- # check cpp test client
- if (options.cpp == None or
- not os.path.exists(options.cpp) or
- not os.path.exists(options.cpp+"/src/tests/interop_runner")):
- parser.error("C++ test directory must be specified and must contain test client")
-
- # Get list of available broker and client versions
- brokers = glob.glob(options.brokers+"/qpid-[0-9].[0-9].[0-9].[0-9]")
- java_clients = glob.glob(options.java+"/qpid-[0-9].[0-9].[0-9].[0-9]*")
-
- if (not len(brokers) > 0):
- parser.error("Broker directory did not contain any brokers!")
-
- if (not len(java_clients) > 0):
- parser.error("Broker directory did not contain any brokers!")
-
- for broker in brokers:
- for client in java_clients:
- test(options.testlib, broker, client, options.dotnet,
- options.cpp)
-
-def start_dotnet(dotnetpath):
- return Popen(["%s/TestClient.exe" % os.path.abspath(dotnetpath),
- "-bamqp://guest:guest@clientid/?brokerlist=\'tcp://localhost:5672\'"],
- stdin=subprocess.PIPE, stdout=subprocess.PIPE,
- stderr=subprocess.STDOUT)
-
-def start_java(javapath):
- # Setup classpath
- classpath = ""
- for lib in clientlibs:
- classpath = classpath + testlibdir+"/"+lib+";"
-
- classpath = classpath + javapath+"/lib/qpid-all.jar"
-
- # Add qpid common since the tests need that, classpath hatefulness
- classpath = classpath + ";"+testlibdir+"/qpid-common-M4.jar"
-
- return Popen(["java", "-cp","\""+classpath+"\"",
- "org.apache.qpid.test.framework.distributedtesting.TestClient"],
- stdin=subprocess.PIPE, stdout=subprocess.PIPE,
- stderr=subprocess.STDOUT)
-
-def start_cpp(cpppath):
- return Popen([cpppath+"tests/interop_runner"],
- stdin=subprocess.PIPE, stdout=subprocess.PIPE,
- stderr=subprocess.STDOUT)
-
-def run_tests():
- for testcase in interop_cases:
- cmd = " ".join(["java", "-cp","\""+classpath+"\"", "org.apache.qpid.test.framework.distributedtesting.Coordinator",
- "--xml", "-e", "interop", "-o", ".", "-n", "interop", ("org.apache.qpid.interop.testcases.%s" % testcase)])
- fd = os.popen(cmd, "r")
- output = fd.read()
- fd.close()
-
-def test(testlibdir, brokerpath, javapath, dotnetpath, cpppath):
- print ("Testing broker in %s\nclient in %s" % (brokerpath, javapath))
- print ("Logging too %s" % ("/tmp/qpid-interop-tests/%s-%s" %
- (os.path.basename(brokerpath), os.path.basename(javapath))))
- os.environ["QPID_HOME"] = brokerpath
- os.environ["QPID_WORK"] = ("/tmp/qpid-interop-tests/%s-%s" %
- (os.path.basename(brokerpath), os.path.basename(javapath)))
-
- brokerp, javacp, dotnetp, cppp, coordinatorp = (None, None, None, None, None)
-
- try:
- # Start broker
- brokerp = Popen(brokerpath+"/bin/qpid-server",
- stdin=subprocess.PIPE, stdout=subprocess.PIPE,
- stderr=subprocess.STDOUT)
- print ("Started broker, pid %s" % brokerp.pid)
-
- cppp = start_cpp(cpppath)
- print ("Started C++ client, pid %s" % cppp.pid)
-
- dotnetp = start_dotnet(dotnetpath)
- print ("Started .Net client, pid %s" % dotnetp.pid)
-
- javacp = start_java(javapath)
- print ("Started client, pid %s" % javacp.pid)
-
- run_tests()
-
- finally:
- # Shutdown broker and clients
- if javacp != None:
- os.kill(javacp.pid, 9)
- if dotnetp != None:
- os.kill(dotnetp.pid, 9)
- if coordinatorp != None:
- os.kill(coordinatorp.pid, 9)
- if brokerp != None:
- os.kill(brokerp.pid, 9)
-
- # Start coordinator
-
-
-if __name__ == "__main__":
- main()
diff --git a/qpid/java/integrationtests/build.xml b/qpid/java/integrationtests/build.xml
deleted file mode 100644
index ae870c5675..0000000000
--- a/qpid/java/integrationtests/build.xml
+++ /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.
- -
- -->
-<project name="Integration Tests" default="build">
-
- <property name="module.depends" value="systests client common common/test junit-toolkit"/>
- <property name="module.dist" value="false"/>
-
- <import file="../module.xml"/>
-
-</project>
diff --git a/qpid/java/integrationtests/docs/RunningSustainedTests.txt b/qpid/java/integrationtests/docs/RunningSustainedTests.txt
deleted file mode 100644
index db4405a32d..0000000000
--- a/qpid/java/integrationtests/docs/RunningSustainedTests.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-In addition to the integration tests the framework provided by this package also allows for
-sustained tests to be run. Currently avaible tests:
-- org.apache.qpid.sustained.SustainedClientTestCase : Pub Sub test to determine steady state throughput.
-
-
-Running Tests.
-
-Run the tests as per the integration tests.
-- Start a broker
-- Start at least one test client [java org.apache.qpid.interop.TestClient], ensuring unique naming.
-
-- Start the test coordinator with the 'fanout' engine, on the sustained test case [java org.apache.qpid.test.framework.distributedtesting.Coordinator]
-
-- Additional Test clients can be started and joined into the running test: [java org.apache.qpid.interop.TestClient -j]
-
-
-
diff --git a/qpid/java/integrationtests/jar-with-dependencies.xml b/qpid/java/integrationtests/jar-with-dependencies.xml
deleted file mode 100644
index 3e95e7ab22..0000000000
--- a/qpid/java/integrationtests/jar-with-dependencies.xml
+++ /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.
--->
-<!-- This is an assembly descriptor that produces a jar file that contains all the
- dependencies, fully expanded into a single jar, required to run the tests of
- a maven project.
- -->
-<assembly>
- <id>all-test-deps</id>
- <formats>
- <format>jar</format>
- </formats>
- <includeBaseDirectory>false</includeBaseDirectory>
- <dependencySets>
- <dependencySet>
- <outputDirectory></outputDirectory>
- <outputFileNameMapping></outputFileNameMapping>
- <unpack>true</unpack>
- <scope>test</scope>
- </dependencySet>
- </dependencySets>
- <fileSets>
- <fileSet>
- <directory>target/classes</directory>
- <outputDirectory></outputDirectory>
- </fileSet>
- <fileSet>
- <directory>target/test-classes</directory>
- <outputDirectory></outputDirectory>
- </fileSet>
- </fileSets>
-</assembly>
diff --git a/qpid/java/integrationtests/src/main/java/org/apache/qpid/interop/clienttestcases/TestCase1DummyRun.java b/qpid/java/integrationtests/src/main/java/org/apache/qpid/interop/clienttestcases/TestCase1DummyRun.java
deleted file mode 100644
index db17c7aacc..0000000000
--- a/qpid/java/integrationtests/src/main/java/org/apache/qpid/interop/clienttestcases/TestCase1DummyRun.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.interop.clienttestcases;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.test.framework.distributedtesting.TestClientControlledTest;
-
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.Session;
-
-/**
- * Implements tet case 1, dummy run. This test case sends no test messages, it exists to confirm that the test harness
- * is interacting with the coordinator correctly.
- *
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Supply the name of the test case that this implements.
- * <tr><td> Accept/Reject invites based on test parameters.
- * <tr><td> Adapt to assigned roles.
- * <tr><td> Perform test case actions.
- * <tr><td> Generate test reports.
- * </table>
- */
-public class TestCase1DummyRun implements TestClientControlledTest
-{
- /** Used for debugging. */
- private static final Logger log = Logger.getLogger(TestCase1DummyRun.class);
-
- /**
- * Should provide the name of the test case that this class implements. The exact names are defined in the
- * interop testing spec.
- *
- * @return The name of the test case that this implements.
- */
- public String getName()
- {
- log.debug("public String getName(): called");
-
- return "TC1_DummyRun";
- }
-
- /**
- * Determines whether the test invite that matched this test case is acceptable.
- *
- * @param inviteMessage The invitation to accept or reject.
- *
- * @return <tt>true</tt> to accept the invitation, <tt>false</tt> to reject it.
- *
- * @throws JMSException Any JMSException resulting from reading the message are allowed to fall through.
- */
- public boolean acceptInvite(Message inviteMessage) throws JMSException
- {
- log.debug("public boolean acceptInvite(Message inviteMessage): called");
-
- // Test parameters don't matter, accept all invites.
- return true;
- }
-
- /**
- * Assigns the role to be played by this test case. The test parameters are fully specified in the
- * assignment message. When this method return the test case will be ready to execute.
- *
- * @param role The role to be played; sender or receivers.
- * @param assignRoleMessage The role assingment message, contains the full test parameters.
- *
- * @throws JMSException Any JMSException resulting from reading the message are allowed to fall through.
- */
- public void assignRole(Roles role, Message assignRoleMessage) throws JMSException
- {
- log.debug("public void assignRole(Roles role, Message assignRoleMessage): called");
-
- // Do nothing, both roles are the same.
- }
-
- /**
- * Performs the test case actions. Returning from here, indicates that the sending role has completed its test.
- *
- * @param numMessages The number of test messages to send.
- */
- public void start(int numMessages)
- {
- log.debug("public void start(): called");
-
- // Do nothing.
- }
-
- /**
- * Gets a report on the actions performed by the test case in its assigned role.
- *
- * @param session The controlSession to create the report message in.
- *
- * @return The report message.
- *
- * @throws JMSException Any JMSExceptions resulting from creating the report are allowed to fall through.
- */
- public Message getReport(Session session) throws JMSException
- {
- log.debug("public Message getReport(Session controlSession): called");
-
- // Generate a dummy report, the coordinator expects a report but doesn't care what it is.
- return session.createTextMessage("Dummy Run, Ok.");
- }
-
- /**
- * Handles incoming test messages. Does nothing.
- *
- * @param message The incoming test message.
- */
- public void onMessage(Message message)
- {
- log.debug("public void onMessage(Message message = " + message + "): called");
-
- // Ignore any messages.
- }
-}
diff --git a/qpid/java/integrationtests/src/main/java/org/apache/qpid/interop/clienttestcases/TestCase2BasicP2P.java b/qpid/java/integrationtests/src/main/java/org/apache/qpid/interop/clienttestcases/TestCase2BasicP2P.java
deleted file mode 100644
index 36d3cce7f7..0000000000
--- a/qpid/java/integrationtests/src/main/java/org/apache/qpid/interop/clienttestcases/TestCase2BasicP2P.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.interop.clienttestcases;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.test.framework.TestUtils;
-import org.apache.qpid.test.framework.distributedtesting.TestClient;
-import org.apache.qpid.test.framework.distributedtesting.TestClientControlledTest;
-
-import javax.jms.*;
-
-/**
- * Implements test case 2, basic P2P. Sends/received a specified number of messages to a specified route on the
- * default direct exchange. Produces reports on the actual number of messages sent/received.
- *
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Supply the name of the test case that this implements.
- * <tr><td> Accept/Reject invites based on test parameters.
- * <tr><td> Adapt to assigned roles.
- * <tr><td> Send required number of test messages.
- * <tr><td> Generate test reports.
- * </table>
- */
-public class TestCase2BasicP2P implements TestClientControlledTest, MessageListener
-{
- /** Used for debugging. */
- private static final Logger log = Logger.getLogger(TestCase2BasicP2P.class);
-
- /** Holds the count of test messages received. */
- private int messageCount;
-
- /** The role to be played by the test. */
- private Roles role;
-
- /** The number of test messages to send. */
- private int numMessages;
-
- /** The connection to send the test messages on. */
- private Connection connection;
-
- /** The controlSession to send the test messages on. */
- private Session session;
-
- /** The producer to send the test messages with. */
- MessageProducer producer;
-
- /**
- * Should provide the name of the test case that this class implements. The exact names are defined in the
- * interop testing spec.
- *
- * @return The name of the test case that this implements.
- */
- public String getName()
- {
- log.debug("public String getName(): called");
-
- return "TC2_BasicP2P";
- }
-
- /**
- * Determines whether the test invite that matched this test case is acceptable.
- *
- * @param inviteMessage The invitation to accept or reject.
- *
- * @return <tt>true</tt> to accept the invitation, <tt>false</tt> to reject it.
- *
- * @throws JMSException Any JMSException resulting from reading the message are allowed to fall through.
- */
- public boolean acceptInvite(Message inviteMessage) throws JMSException
- {
- log.debug("public boolean acceptInvite(Message inviteMessage = " + inviteMessage + "): called");
-
- // All invites are acceptable.
- return true;
- }
-
- /**
- * Assigns the role to be played by this test case. The test parameters are fully specified in the
- * assignment message. When this method return the test case will be ready to execute.
- *
- * @param role The role to be played; sender or receivers.
- *
- * @param assignRoleMessage The role assingment message, contains the full test parameters.
- *
- * @throws JMSException Any JMSException resulting from reading the message are allowed to fall through.
- */
- public void assignRole(Roles role, Message assignRoleMessage) throws JMSException
- {
- log.debug("public void assignRole(Roles role = " + role + ", Message assignRoleMessage = " + assignRoleMessage
- + "): called");
-
- // Reset the message count for a new test.
- messageCount = 0;
-
- // Take note of the role to be played.
- this.role = role;
-
- // Create a new connection to pass the test messages on.
- connection = TestUtils.createConnection(TestClient.testContextProperties);
- session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- // Extract and retain the test parameters.
- numMessages = assignRoleMessage.getIntProperty("P2P_NUM_MESSAGES");
- Destination sendDestination = session.createQueue(assignRoleMessage.getStringProperty("P2P_QUEUE_AND_KEY_NAME"));
-
- log.debug("numMessages = " + numMessages);
- log.debug("sendDestination = " + sendDestination);
- log.debug("role = " + role);
-
- switch (role)
- {
- // Check if the sender role is being assigned, and set up a message producer if so.
- case SENDER:
- producer = session.createProducer(sendDestination);
- break;
-
- // Otherwise the receivers role is being assigned, so set this up to listen for messages.
- case RECEIVER:
- MessageConsumer consumer = session.createConsumer(sendDestination);
- consumer.setMessageListener(this);
- break;
- }
-
- connection.start();
- }
-
- /**
- * Performs the test case actions. Returning from here, indicates that the sending role has completed its test.
- *
- * @param numMessages The number of test messages to send.
- *
- * @throws JMSException Any JMSException resulting from reading the message are allowed to fall through.
- */
- public void start(int numMessages) throws JMSException
- {
- log.debug("public void start(): called");
-
- // Check that the sender role is being performed.
- if (role.equals(Roles.SENDER))
- {
- Message testMessage = session.createTextMessage("test");
-
- for (int i = 0; i < this.numMessages; i++)
- {
- producer.send(testMessage);
-
- // Increment the message count.
- messageCount++;
- }
- }
- }
-
- /**
- * Gets a report on the actions performed by the test case in its assigned role.
- *
- * @param session The controlSession to create the report message in.
- *
- * @return The report message.
- *
- * @throws JMSException Any JMSExceptions resulting from creating the report are allowed to fall through.
- */
- public Message getReport(Session session) throws JMSException
- {
- log.debug("public Message getReport(Session controlSession): called");
-
- // Close the test connection.
- connection.close();
-
- // Generate a report message containing the count of the number of messages passed.
- Message report = session.createMessage();
- report.setStringProperty("CONTROL_TYPE", "REPORT");
- report.setIntProperty("MESSAGE_COUNT", messageCount);
-
- return report;
- }
-
- /**
- * Counts incoming test messages.
- *
- * @param message The incoming test message.
- */
- public void onMessage(Message message)
- {
- log.debug("public void onMessage(Message message = " + message + "): called");
-
- // Increment the message count.
- messageCount++;
- }
-}
diff --git a/qpid/java/integrationtests/src/main/java/org/apache/qpid/interop/clienttestcases/TestCase3BasicPubSub.java b/qpid/java/integrationtests/src/main/java/org/apache/qpid/interop/clienttestcases/TestCase3BasicPubSub.java
deleted file mode 100644
index 205472716b..0000000000
--- a/qpid/java/integrationtests/src/main/java/org/apache/qpid/interop/clienttestcases/TestCase3BasicPubSub.java
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.interop.clienttestcases;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.test.framework.TestUtils;
-import org.apache.qpid.test.framework.distributedtesting.TestClient;
-import org.apache.qpid.test.framework.distributedtesting.TestClientControlledTest;
-
-import javax.jms.*;
-
-/**
- * Implements test case 3, basic pub/sub. Sends/received a specified number of messages to a specified route on the
- * default topic exchange, using the specified number of receivers connections. Produces reports on the actual number of
- * messages sent/received.
- *
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Supply the name of the test case that this implements.
- * <tr><td> Accept/Reject invites based on test parameters.
- * <tr><td> Adapt to assigned roles.
- * <tr><td> Send required number of test messages using pub/sub.
- * <tr><td> Generate test reports.
- * </table>
- */
-public class TestCase3BasicPubSub implements TestClientControlledTest, MessageListener
-{
- /** Used for debugging. */
- private static final Logger log = Logger.getLogger(TestCase3BasicPubSub.class);
-
- /** Holds the count of test messages received. */
- private int messageCount;
-
- /** The role to be played by the test. */
- private Roles role;
-
- /** The number of test messages to send. */
- private int numMessages;
-
- /** The connections to send/receive the test messages on. */
- private Connection[] connection;
-
- /** The sessions to send/receive the test messages on. */
- private Session[] session;
-
- /** The producer to send the test messages with. */
- MessageProducer producer;
-
- /**
- * Should provide the name of the test case that this class implements. The exact names are defined in the
- * interop testing spec.
- *
- * @return The name of the test case that this implements.
- */
- public String getName()
- {
- log.debug("public String getName(): called");
-
- return "TC3_BasicPubSub";
- }
-
- /**
- * Determines whether the test invite that matched this test case is acceptable.
- *
- * @param inviteMessage The invitation to accept or reject.
- *
- * @return <tt>true</tt> to accept the invitation, <tt>false</tt> to reject it.
- *
- * @throws javax.jms.JMSException Any JMSException resulting from reading the message are allowed to fall through.
- */
- public boolean acceptInvite(Message inviteMessage) throws JMSException
- {
- log.debug("public boolean acceptInvite(Message inviteMessage = " + inviteMessage + "): called");
-
- // All invites are acceptable.
- return true;
- }
-
- /**
- * Assigns the role to be played by this test case. The test parameters are fully specified in the
- * assignment message. When this method return the test case will be ready to execute.
- *
- * @param role The role to be played; sender or receivers.
- *
- * @param assignRoleMessage The role assingment message, contains the full test parameters.
- *
- * @throws JMSException Any JMSException resulting from reading the message are allowed to fall through.
- */
- public void assignRole(Roles role, Message assignRoleMessage) throws JMSException
- {
- log.debug("public void assignRole(Roles role = " + role + ", Message assignRoleMessage = " + assignRoleMessage
- + "): called");
-
- // Reset the message count for a new test.
- messageCount = 0;
-
- // Take note of the role to be played.
- this.role = role;
-
- // Extract and retain the test parameters.
- numMessages = assignRoleMessage.getIntProperty("PUBSUB_NUM_MESSAGES");
- int numReceivers = assignRoleMessage.getIntProperty("PUBSUB_NUM_RECEIVERS");
- String sendKey = assignRoleMessage.getStringProperty("PUBSUB_KEY");
-
- log.debug("numMessages = " + numMessages);
- log.debug("numReceivers = " + numReceivers);
- log.debug("sendKey = " + sendKey);
- log.debug("role = " + role);
-
- switch (role)
- {
- // Check if the sender role is being assigned, and set up a single message producer if so.
- case SENDER:
- // Create a new connection to pass the test messages on.
- connection = new Connection[1];
- session = new Session[1];
-
- connection[0] = TestUtils.createConnection(TestClient.testContextProperties);
- session[0] = connection[0].createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- // Extract and retain the test parameters.
- Destination sendDestination = session[0].createTopic(sendKey);
-
- producer = session[0].createProducer(sendDestination);
- break;
-
- // Otherwise the receivers role is being assigned, so set this up to listen for messages on the required number
- // of receivers connections.
- case RECEIVER:
- // Create the required number of receivers connections.
- connection = new Connection[numReceivers];
- session = new Session[numReceivers];
-
- for (int i = 0; i < numReceivers; i++)
- {
- connection[i] = TestUtils.createConnection(TestClient.testContextProperties);
- session[i] = connection[i].createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- sendDestination = session[i].createTopic(sendKey);
-
- MessageConsumer consumer = session[i].createConsumer(sendDestination);
- consumer.setMessageListener(this);
- }
-
- break;
- }
-
- // Start all the connection dispatcher threads running.
- for (Connection conn : connection)
- {
- conn.start();
- }
- }
-
- /**
- * Performs the test case actions. Returning from here, indicates that the sending role has completed its test.
- *
- * @param numMessages The number of test messages to send.
- *
- * @throws JMSException Any JMSException resulting from reading the message are allowed to fall through.
- */
- public void start(int numMessages) throws JMSException
- {
- log.debug("public void start(): called");
-
- // Check that the sender role is being performed.
- if (role.equals(Roles.SENDER))
- {
- Message testMessage = session[0].createTextMessage("test");
-
- for (int i = 0; i < this.numMessages; i++)
- {
- producer.send(testMessage);
-
- // Increment the message count.
- messageCount++;
- }
- }
- }
-
- /**
- * Gets a report on the actions performed by the test case in its assigned role.
- *
- * @param session The controlSession to create the report message in.
- *
- * @return The report message.
- *
- * @throws JMSException Any JMSExceptions resulting from creating the report are allowed to fall through.
- */
- public Message getReport(Session session) throws JMSException
- {
- log.debug("public Message getReport(Session controlSession): called");
-
- // Close the test connections.
- for (Connection conn : connection)
- {
- conn.close();
- }
-
- // Generate a report message containing the count of the number of messages passed.
- Message report = session.createMessage();
- report.setStringProperty("CONTROL_TYPE", "REPORT");
- report.setIntProperty("MESSAGE_COUNT", messageCount);
-
- return report;
- }
-
- /**
- * Counts incoming test messages.
- *
- * @param message The incoming test message.
- */
- public void onMessage(Message message)
- {
- log.debug("public void onMessage(Message message = " + message + "): called");
-
- // Increment the message count.
- messageCount++;
- }
-}
diff --git a/qpid/java/integrationtests/src/main/java/org/apache/qpid/interop/clienttestcases/TestCase4P2PMessageSize.java b/qpid/java/integrationtests/src/main/java/org/apache/qpid/interop/clienttestcases/TestCase4P2PMessageSize.java
deleted file mode 100644
index 3730233264..0000000000
--- a/qpid/java/integrationtests/src/main/java/org/apache/qpid/interop/clienttestcases/TestCase4P2PMessageSize.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.interop.clienttestcases;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.test.framework.TestUtils;
-import org.apache.qpid.test.framework.distributedtesting.TestClient;
-import org.apache.qpid.test.framework.distributedtesting.TestClientControlledTest;
-
-import javax.jms.*;
-
-/**
- * Implements test case 4, P2P messages with message size. Sends/received a specified number of messages to a specified
- * route on the default direct exchange, of a specified size. Produces reports on the actual number of messages
- * sent/received.
- *
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Supply the name of the test case that this implements.
- * <tr><td> Accept/Reject invites based on test parameters.
- * <tr><td> Adapt to assigned roles.
- * <tr><td> Send required number of test messages.
- * <tr><td> Generate test reports.
- * </table>
- */
-public class TestCase4P2PMessageSize implements TestClientControlledTest, MessageListener
-{
- /** Used for debugging. */
- private static final Logger log = Logger.getLogger(TestCase4P2PMessageSize.class);
-
- /** Holds the count of test messages received. */
- private int messageCount;
-
- /** The role to be played by the test. */
- private Roles role;
-
- /** The number of test messages to send. */
- private int numMessages;
-
- /** The size of the test messages to send. */
- private int messageSize;
-
- /** The connection to send the test messages on. */
- private Connection connection;
-
- /** The controlSession to send the test messages on. */
- private Session session;
-
- /** The producer to send the test messages with. */
- MessageProducer producer;
-
- /**
- * Should provide the name of the test case that this class implements. The exact names are defined in the
- * interop testing spec.
- *
- * @return The name of the test case that this implements.
- */
- public String getName()
- {
- log.debug("public String getName(): called");
-
- return "TC4_P2PMessageSize";
- }
-
- /**
- * Determines whether the test invite that matched this test case is acceptable.
- *
- * @param inviteMessage The invitation to accept or reject.
- *
- * @return <tt>true</tt> to accept the invitation, <tt>false</tt> to reject it.
- *
- * @throws JMSException Any JMSException resulting from reading the message are allowed to fall through.
- */
- public boolean acceptInvite(Message inviteMessage) throws JMSException
- {
- log.debug("public boolean acceptInvite(Message inviteMessage = " + inviteMessage + "): called");
-
- // All invites are acceptable.
- return true;
- }
-
- /**
- * Assigns the role to be played by this test case. The test parameters are fully specified in the
- * assignment message. When this method return the test case will be ready to execute.
- *
- * @param role The role to be played; sender or receivers.
- *
- * @param assignRoleMessage The role assingment message, contains the full test parameters.
- *
- * @throws JMSException Any JMSException resulting from reading the message are allowed to fall through.
- */
- public void assignRole(Roles role, Message assignRoleMessage) throws JMSException
- {
- log.debug("public void assignRole(Roles role = " + role + ", Message assignRoleMessage = " + assignRoleMessage
- + "): called");
-
- // Reset the message count for a new test.
- messageCount = 0;
-
- // Take note of the role to be played.
- this.role = role;
-
- // Create a new connection to pass the test messages on.
- connection = TestUtils.createConnection(TestClient.testContextProperties);
- session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- // Extract and retain the test parameters.
- numMessages = assignRoleMessage.getIntProperty("P2P_NUM_MESSAGES");
- messageSize = assignRoleMessage.getIntProperty("messageSize");
- Destination sendDestination = session.createQueue(assignRoleMessage.getStringProperty("P2P_QUEUE_AND_KEY_NAME"));
-
- log.debug("numMessages = " + numMessages);
- log.debug("sendDestination = " + sendDestination);
- log.debug("role = " + role);
-
- switch (role)
- {
- // Check if the sender role is being assigned, and set up a message producer if so.
- case SENDER:
- producer = session.createProducer(sendDestination);
- break;
-
- // Otherwise the receivers role is being assigned, so set this up to listen for messages.
- case RECEIVER:
- MessageConsumer consumer = session.createConsumer(sendDestination);
- consumer.setMessageListener(this);
- break;
- }
-
- connection.start();
- }
-
- /**
- * Performs the test case actions. Returning from here, indicates that the sending role has completed its test.
- *
- * @param numMessages The number of test messages to send.
- *
- * @throws JMSException Any JMSException resulting from reading the message are allowed to fall through.
- */
- public void start(int numMessages) throws JMSException
- {
- log.debug("public void start(): called");
-
- // Check that the sender role is being performed.
- if (role.equals(Roles.SENDER))
- {
- Message testMessage = TestUtils.createTestMessageOfSize(session, messageSize);
-
- for (int i = 0; i < this.numMessages; i++)
- {
- producer.send(testMessage);
-
- // Increment the message count.
- messageCount++;
- }
- }
- }
-
- /**
- * Gets a report on the actions performed by the test case in its assigned role.
- *
- * @param session The controlSession to create the report message in.
- *
- * @return The report message.
- *
- * @throws JMSException Any JMSExceptions resulting from creating the report are allowed to fall through.
- */
- public Message getReport(Session session) throws JMSException
- {
- log.debug("public Message getReport(Session controlSession): called");
-
- // Close the test connection.
- connection.close();
-
- // Generate a report message containing the count of the number of messages passed.
- Message report = session.createMessage();
- report.setStringProperty("CONTROL_TYPE", "REPORT");
- report.setIntProperty("MESSAGE_COUNT", messageCount);
-
- return report;
- }
-
- /**
- * Counts incoming test messages.
- *
- * @param message The incoming test message.
- */
- public void onMessage(Message message)
- {
- log.debug("public void onMessage(Message message = " + message + "): called");
-
- // Increment the message count.
- messageCount++;
- }
-}
diff --git a/qpid/java/integrationtests/src/main/java/org/apache/qpid/interop/clienttestcases/TestCase5PubSubMessageSize.java b/qpid/java/integrationtests/src/main/java/org/apache/qpid/interop/clienttestcases/TestCase5PubSubMessageSize.java
deleted file mode 100644
index f601712bc9..0000000000
--- a/qpid/java/integrationtests/src/main/java/org/apache/qpid/interop/clienttestcases/TestCase5PubSubMessageSize.java
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.interop.clienttestcases;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.test.framework.TestUtils;
-import org.apache.qpid.test.framework.distributedtesting.TestClient;
-import org.apache.qpid.test.framework.distributedtesting.TestClientControlledTest;
-
-import javax.jms.*;
-
-/**
- * Implements test case 5, pub/sub with message size. Sends/received a specified number of messages to a specified route
- * on the default topic exchange, using the specified number of receivers connections, and the specified message size.
- * Produces reports on the actual number of messages sent/received.
- *
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Supply the name of the test case that this implements.
- * <tr><td> Accept/Reject invites based on test parameters.
- * <tr><td> Adapt to assigned roles.
- * <tr><td> Send required number of test messages using pub/sub.
- * <tr><td> Generate test reports.
- * </table>
- */
-public class TestCase5PubSubMessageSize implements TestClientControlledTest, MessageListener
-{
- /** Used for debugging. */
- private static final Logger log = Logger.getLogger(TestCase5PubSubMessageSize.class);
-
- /** Holds the count of test messages received. */
- private int messageCount;
-
- /** The role to be played by the test. */
- private Roles role;
-
- /** The number of test messages to send. */
- private int numMessages;
-
- /** The size of the test messages to send. */
- private int messageSize;
-
- /** The connections to send/receive the test messages on. */
- private Connection[] connection;
-
- /** The sessions to send/receive the test messages on. */
- private Session[] session;
-
- /** The producer to send the test messages with. */
- MessageProducer producer;
-
- /**
- * Should provide the name of the test case that this class implements. The exact names are defined in the
- * interop testing spec.
- *
- * @return The name of the test case that this implements.
- */
- public String getName()
- {
- log.debug("public String getName(): called");
-
- return "TC5_PubSubMessageSize";
- }
-
- /**
- * Determines whether the test invite that matched this test case is acceptable.
- *
- * @param inviteMessage The invitation to accept or reject.
- *
- * @return <tt>true</tt> to accept the invitation, <tt>false</tt> to reject it.
- *
- * @throws javax.jms.JMSException Any JMSException resulting from reading the message are allowed to fall through.
- */
- public boolean acceptInvite(Message inviteMessage) throws JMSException
- {
- log.debug("public boolean acceptInvite(Message inviteMessage = " + inviteMessage + "): called");
-
- // All invites are acceptable.
- return true;
- }
-
- /**
- * Assigns the role to be played by this test case. The test parameters are fully specified in the
- * assignment message. When this method return the test case will be ready to execute.
- *
- * @param role The role to be played; sender or receivers.
- *
- * @param assignRoleMessage The role assingment message, contains the full test parameters.
- *
- * @throws javax.jms.JMSException Any JMSException resulting from reading the message are allowed to fall through.
- */
- public void assignRole(Roles role, Message assignRoleMessage) throws JMSException
- {
- log.debug("public void assignRole(Roles role = " + role + ", Message assignRoleMessage = " + assignRoleMessage
- + "): called");
-
- // Reset the message count for a new test.
- messageCount = 0;
-
- // Take note of the role to be played.
- this.role = role;
-
- // Extract and retain the test parameters.
- numMessages = assignRoleMessage.getIntProperty("PUBSUB_NUM_MESSAGES");
- messageSize = assignRoleMessage.getIntProperty("messageSize");
- int numReceivers = assignRoleMessage.getIntProperty("PUBSUB_NUM_RECEIVERS");
- String sendKey = assignRoleMessage.getStringProperty("PUBSUB_KEY");
-
- log.debug("numMessages = " + numMessages);
- log.debug("numReceivers = " + numReceivers);
- log.debug("sendKey = " + sendKey);
- log.debug("role = " + role);
-
- switch (role)
- {
- // Check if the sender role is being assigned, and set up a single message producer if so.
- case SENDER:
- // Create a new connection to pass the test messages on.
- connection = new Connection[1];
- session = new Session[1];
-
- connection[0] = TestUtils.createConnection(TestClient.testContextProperties);
- session[0] = connection[0].createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- // Extract and retain the test parameters.
- Destination sendDestination = session[0].createTopic(sendKey);
-
- producer = session[0].createProducer(sendDestination);
- break;
-
- // Otherwise the receivers role is being assigned, so set this up to listen for messages on the required number
- // of receivers connections.
- case RECEIVER:
- // Create the required number of receivers connections.
- connection = new Connection[numReceivers];
- session = new Session[numReceivers];
-
- for (int i = 0; i < numReceivers; i++)
- {
- connection[i] = TestUtils.createConnection(TestClient.testContextProperties);
- session[i] = connection[i].createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- sendDestination = session[i].createTopic(sendKey);
-
- MessageConsumer consumer = session[i].createConsumer(sendDestination);
- consumer.setMessageListener(this);
- }
-
- break;
- }
-
- // Start all the connection dispatcher threads running.
- for (Connection conn : connection)
- {
- conn.start();
- }
- }
-
- /**
- * Performs the test case actions. Returning from here, indicates that the sending role has completed its test.
- *
- * @param numMessages The number of test messages to send.
- *
- * @throws JMSException Any JMSException resulting from reading the message are allowed to fall through.
- */
- public void start(int numMessages) throws JMSException
- {
- log.debug("public void start(): called");
-
- // Check that the sender role is being performed.
- if (role.equals(Roles.SENDER))
- {
- Message testMessage = TestUtils.createTestMessageOfSize(session[0], messageSize);
-
- for (int i = 0; i < this.numMessages; i++)
- {
- producer.send(testMessage);
-
- // Increment the message count.
- messageCount++;
- }
- }
- }
-
- /**
- * Gets a report on the actions performed by the test case in its assigned role.
- *
- * @param session The controlSession to create the report message in.
- *
- * @return The report message.
- *
- * @throws javax.jms.JMSException Any JMSExceptions resulting from creating the report are allowed to fall through.
- */
- public Message getReport(Session session) throws JMSException
- {
- log.debug("public Message getReport(Session controlSession): called");
-
- // Close the test connections.
- for (Connection conn : connection)
- {
- conn.close();
- }
-
- // Generate a report message containing the count of the number of messages passed.
- Message report = session.createMessage();
- report.setStringProperty("CONTROL_TYPE", "REPORT");
- report.setIntProperty("MESSAGE_COUNT", messageCount);
-
- return report;
- }
-
- /**
- * Counts incoming test messages.
- *
- * @param message The incoming test message.
- */
- public void onMessage(Message message)
- {
- log.debug("public void onMessage(Message message = " + message + "): called");
-
- // Increment the message count.
- messageCount++;
- }
-}
diff --git a/qpid/java/integrationtests/src/main/java/org/apache/qpid/interop/testcases/InteropTestCase1DummyRun.java b/qpid/java/integrationtests/src/main/java/org/apache/qpid/interop/testcases/InteropTestCase1DummyRun.java
deleted file mode 100644
index a2e4a00aa6..0000000000
--- a/qpid/java/integrationtests/src/main/java/org/apache/qpid/interop/testcases/InteropTestCase1DummyRun.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.interop.testcases;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.test.framework.FrameworkBaseCase;
-
-import java.util.Properties;
-
-/**
- * Coordinates test case 1, from the interop test specification. This test connects up the sender and receivers roles,
- * and gets some dummy test reports from them, in order to check that the test framework itself is operational.
- *
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Exercises the interop testing framework without actually sending any test messages.
- * <td> {@link FrameworkBaseCase}
- * </table>
- */
-public class InteropTestCase1DummyRun extends FrameworkBaseCase
-{
- /** Used for debugging. */
- private static final Logger log = Logger.getLogger(InteropTestCase1DummyRun.class);
-
- /**
- * Creates a new coordinating test case with the specified name.
- *
- * @param name The test case name.
- */
- public InteropTestCase1DummyRun(String name)
- {
- super(name);
- }
-
- /**
- * Performs the basic P2P test case, "Test Case 2" in the specification.
- *
- * @throws Exception Any exceptions are allowed to fall through and fail the test.
- */
- public void testDummyRun() throws Exception
- {
- log.debug("public void testDummyRun(): called");
-
- Properties testConfig = new Properties();
- testConfig.put("TEST_NAME", "TC1_DummyRun");
-
- /*Message[] reports =*/ getCircuitFactory().sequenceTest(null, null, testConfig);
-
- // Compare sender and receivers reports.
- // Assert.assertEquals("Expected to get 2 dummy reports.", 2, reports.length);
- }
-
- /**
- * Should provide a translation from the junit method name of a test to its test case name as defined in the
- * interop testing specification. For example the method "testP2P" might map onto the interop test case name
- * "TC2_BasicP2P".
- *
- * @param methodName The name of the JUnit test method.
- * @return The name of the corresponding interop test case.
- */
- public String getTestCaseNameForTestMethod(String methodName)
- {
- return "TC1_DummyRun";
- }
-}
diff --git a/qpid/java/integrationtests/src/main/java/org/apache/qpid/interop/testcases/InteropTestCase2BasicP2P.java b/qpid/java/integrationtests/src/main/java/org/apache/qpid/interop/testcases/InteropTestCase2BasicP2P.java
deleted file mode 100644
index 6d6515f1fd..0000000000
--- a/qpid/java/integrationtests/src/main/java/org/apache/qpid/interop/testcases/InteropTestCase2BasicP2P.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.interop.testcases;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.test.framework.FrameworkBaseCase;
-
-import java.util.Properties;
-
-/**
- * Implements test case 2, from the interop test specification. This test sets up the TC2_BasicP2P test for 50
- * messages. It checks that the sender and receivers reports both indicate that all the test messages were transmitted
- * successfully.
- *
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Setup p2p test parameters and compare with test output. <td> {@link FrameworkBaseCase}
- * </table>
- */
-public class InteropTestCase2BasicP2P extends FrameworkBaseCase
-{
- /** Used for debugging. */
- private static final Logger log = Logger.getLogger(InteropTestCase2BasicP2P.class);
-
- /**
- * Creates a new coordinating test case with the specified name.
- *
- * @param name The test case name.
- */
- public InteropTestCase2BasicP2P(String name)
- {
- super(name);
- }
-
- /**
- * Performs the basic P2P test case, "Test Case 2" in the specification.
- *
- * @throws Exception Any exceptions are allowed to fall through and fail the test.
- */
- public void testBasicP2P() throws Exception
- {
- log.debug("public void testBasicP2P(): called");
-
- Properties testConfig = new Properties();
- testConfig.setProperty("TEST_NAME", "TC2_BasicP2P");
- testConfig.setProperty("P2P_QUEUE_AND_KEY_NAME", "tc2queue");
- testConfig.put("P2P_NUM_MESSAGES", 50);
-
- /*Message[] reports =*/ getCircuitFactory().sequenceTest(null, null, testConfig);
-
- // Compare sender and receivers reports.
- /*int messagesSent = reports[0].getIntProperty("MESSAGE_COUNT");
- int messagesReceived = reports[1].getIntProperty("MESSAGE_COUNT");
-
- Assert.assertEquals("The requested number of messages were not sent.", 50, messagesSent);
- Assert.assertEquals("Sender and receivers messages sent did not match up.", messagesSent, messagesReceived);*/
- }
-
- /**
- * Should provide a translation from the junit method name of a test to its test case name as defined in the
- * interop testing specification. For example the method "testP2P" might map onto the interop test case name
- * "TC2_BasicP2P".
- *
- * @param methodName The name of the JUnit test method.
- * @return The name of the corresponding interop test case.
- */
- public String getTestCaseNameForTestMethod(String methodName)
- {
- return "TC2_BasicP2P";
- }
-}
diff --git a/qpid/java/integrationtests/src/main/java/org/apache/qpid/interop/testcases/InteropTestCase3BasicPubSub.java b/qpid/java/integrationtests/src/main/java/org/apache/qpid/interop/testcases/InteropTestCase3BasicPubSub.java
deleted file mode 100644
index 2faca91e73..0000000000
--- a/qpid/java/integrationtests/src/main/java/org/apache/qpid/interop/testcases/InteropTestCase3BasicPubSub.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.interop.testcases;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.test.framework.FrameworkBaseCase;
-
-import java.util.Properties;
-
-/**
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Setup pub/sub test parameters and compare with test output. <td> {@link FrameworkBaseCase}
- * </table>
- */
-public class InteropTestCase3BasicPubSub extends FrameworkBaseCase
-{
- /** Used for debugging. */
- private static final Logger log = Logger.getLogger(InteropTestCase3BasicPubSub.class);
-
- /**
- * Creates a new coordinating test case with the specified name.
- *
- * @param name The test case name.
- */
- public InteropTestCase3BasicPubSub(String name)
- {
- super(name);
- }
-
- /**
- * Performs the basic P2P test case, "Test Case 2" in the specification.
- *
- * @throws Exception Any exceptions are allowed to fall through and fail the test.
- */
- public void testBasicPubSub() throws Exception
- {
- log.debug("public void testBasicPubSub(): called");
-
- Properties testConfig = new Properties();
- testConfig.put("TEST_NAME", "TC3_BasicPubSub");
- testConfig.put("PUBSUB_KEY", "tc3route");
- testConfig.put("PUBSUB_NUM_MESSAGES", 10);
- testConfig.put("PUBSUB_NUM_RECEIVERS", 5);
-
- /*Message[] reports =*/ getCircuitFactory().sequenceTest(null, null, testConfig);
-
- // Compare sender and receivers reports.
- /*int messagesSent = reports[0].getIntProperty("MESSAGE_COUNT");
- int messagesReceived = reports[1].getIntProperty("MESSAGE_COUNT");
-
- Assert.assertEquals("The requested number of messages were not sent.", 10, messagesSent);
- Assert.assertEquals("Received messages did not match up to num sent * num receivers.", messagesSent * 5,
- messagesReceived);*/
- }
-
- /**
- * Should provide a translation from the junit method name of a test to its test case name as defined in the
- * interop testing specification. For example the method "testP2P" might map onto the interop test case name
- * "TC2_BasicP2P".
- *
- * @param methodName The name of the JUnit test method.
- * @return The name of the corresponding interop test case.
- */
- public String getTestCaseNameForTestMethod(String methodName)
- {
- return "TC3_BasicPubSub";
- }
-}
diff --git a/qpid/java/integrationtests/src/main/java/org/apache/qpid/interop/testcases/InteropTestCase4P2PMessageSize.java b/qpid/java/integrationtests/src/main/java/org/apache/qpid/interop/testcases/InteropTestCase4P2PMessageSize.java
deleted file mode 100644
index 2d64f2b805..0000000000
--- a/qpid/java/integrationtests/src/main/java/org/apache/qpid/interop/testcases/InteropTestCase4P2PMessageSize.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.interop.testcases;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.test.framework.FrameworkBaseCase;
-
-import java.util.Properties;
-
-/**
- * Implements test case 4, from the interop test specification. This test sets up the TC2_P2PMessageSize test for 50
- * messages, and a variety of message sizes. It checks that the sender and receivers reports both indicate that all
- * the test messages were transmitted successfully.
- *
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Setup p2p test parameters and compare with test output. <td> {@link FrameworkBaseCase}
- * </table>
- */
-public class InteropTestCase4P2PMessageSize extends FrameworkBaseCase
-{
- /** Used for debugging. */
- private static final Logger log = Logger.getLogger(InteropTestCase4P2PMessageSize.class);
-
- /**
- * Creates a new coordinating test case with the specified name.
- *
- * @param name The test case name.
- */
- public InteropTestCase4P2PMessageSize(String name)
- {
- super(name);
- }
-
- /**
- * Performs the P2P message test case, "Test Case 4" in the specification, for messages 0K in size.
- *
- * @throws Exception Any exceptions are allowed to fall through and fail the test.
- */
- public void testP2PMessageSize0K() throws Exception
- {
- runTestForMessagesOfSize(0);
- }
-
- /**
- * Performs the P2P message test case, "Test Case 4" in the specification, for messages 63K in size.
- *
- * @throws Exception Any exceptions are allowed to fall through and fail the test.
- */
- public void testP2PMessageSize63K() throws Exception
- {
- runTestForMessagesOfSize(63 * 1024);
- }
-
- /**
- * Performs the P2P message test case, "Test Case 4" in the specification, for messages 64K in size.
- *
- * @throws Exception Any exceptions are allowed to fall through and fail the test.
- */
- public void testP2PMessageSize64K() throws Exception
- {
- runTestForMessagesOfSize(64 * 1024);
- }
-
- /**
- * Performs the P2P message test case, "Test Case 4" in the specification, for messages 65K in size.
- *
- * @throws Exception Any exceptions are allowed to fall through and fail the test.
- */
- public void testP2PMessageSize65K() throws Exception
- {
- runTestForMessagesOfSize(65 * 1024);
- }
-
- /**
- * Performs the P2P message test case, "Test Case 4" in the specification, for messages 127K in size.
- *
- * @throws Exception Any exceptions are allowed to fall through and fail the test.
- */
- public void testP2PMessageSize127K() throws Exception
- {
- runTestForMessagesOfSize(127 * 1024);
- }
-
- /**
- * Performs the P2P message test case, "Test Case 4" in the specification, for messages 128K in size.
- *
- * @throws Exception Any exceptions are allowed to fall through and fail the test.
- */
- public void testP2PMessageSize128K() throws Exception
- {
- runTestForMessagesOfSize(128 * 1024);
- }
-
- /**
- * Performs the P2P message test case, "Test Case 4" in the specification, for messages 129K in size.
- *
- * @throws Exception Any exceptions are allowed to fall through and fail the test.
- */
- public void testP2PMessageSize129K() throws Exception
- {
- runTestForMessagesOfSize(129 * 1024);
- }
-
- /**
- * Performs the P2P message test case, "Test Case 4" in the specification, for messages 255K in size.
- *
- * @throws Exception Any exceptions are allowed to fall through and fail the test.
- */
- public void testP2PMessageSize255K() throws Exception
- {
- runTestForMessagesOfSize(255 * 1024);
- }
-
- /**
- * Performs the P2P message test case, "Test Case 4" in the specification, for messages 256K in size.
- *
- * @throws Exception Any exceptions are allowed to fall through and fail the test.
- */
- public void testP2PMessageSize256K() throws Exception
- {
- runTestForMessagesOfSize(256 * 1024);
- }
-
- /**
- * Performs the P2P message test case, "Test Case 4" in the specification, for messages 257K in size.
- *
- * @throws Exception Any exceptions are allowed to fall through and fail the test.
- */
- public void testP2PMessageSize257K() throws Exception
- {
- runTestForMessagesOfSize(257 * 1024);
- }
-
- /**
- * Sends 50 test messages of the specified size, and asserts that all were received.
- *
- * @param size The size of the messages to send in bytes.
- */
- private void runTestForMessagesOfSize(int size)
- {
- Properties testConfig = new Properties();
- testConfig.setProperty("TEST_NAME", "TC4_P2PMessageSize");
- testConfig.setProperty("P2P_QUEUE_AND_KEY_NAME", "tc2queue");
- testConfig.put("P2P_NUM_MESSAGES", 50);
- testConfig.put("messageSize", size);
-
- /*Message[] reports =*/
- getCircuitFactory().sequenceTest(null, null, testConfig);
-
- // Compare sender and receivers reports.
- /*
- int messagesSent = reports[0].getIntProperty("MESSAGE_COUNT");
- int messagesReceived = reports[1].getIntProperty("MESSAGE_COUNT");
-
- Assert.assertEquals("The requested number of messages were not sent.", 50, messagesSent);
- Assert.assertEquals("Sender and receivers messages sent did not match up.", messagesSent, messagesReceived);
- */
- }
-
- /**
- * Should provide a translation from the junit method name of a test to its test case name as defined in the
- * interop testing specification. For example the method "testP2P" might map onto the interop test case name
- * "TC2_BasicP2P".
- *
- * @param methodName The name of the JUnit test method.
- *
- * @return The name of the corresponding interop test case.
- */
- public String getTestCaseNameForTestMethod(String methodName)
- {
- return "TC4_P2PMessageSize";
- }
-}
diff --git a/qpid/java/integrationtests/src/main/java/org/apache/qpid/interop/testcases/InteropTestCase5PubSubMessageSize.java b/qpid/java/integrationtests/src/main/java/org/apache/qpid/interop/testcases/InteropTestCase5PubSubMessageSize.java
deleted file mode 100644
index 23d33fc115..0000000000
--- a/qpid/java/integrationtests/src/main/java/org/apache/qpid/interop/testcases/InteropTestCase5PubSubMessageSize.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.interop.testcases;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.test.framework.FrameworkBaseCase;
-
-import java.util.Properties;
-
-/**
- * Implements test case 5, from the interop test specification. This test sets up the TC2_PubSubMessageSize test for 10
- * messages, sent to 5 consumers, and a variety of message sizes. It checks that the sender and receivers reports both
- * indicate that all the test messages were transmitted successfully.
- *
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Setup pub/sub test parameters and compare with test output. <td> {@link FrameworkBaseCase}
- * </table>
- */
-public class InteropTestCase5PubSubMessageSize extends FrameworkBaseCase
-{
- /** Used for debugging. */
- private static final Logger log = Logger.getLogger(InteropTestCase5PubSubMessageSize.class);
-
- /**
- * Creates a new coordinating test case with the specified name.
- *
- * @param name The test case name.
- */
- public InteropTestCase5PubSubMessageSize(String name)
- {
- super(name);
- }
-
- /**
- * Performs the P2P message test case, "Test Case 4" in the specification, for messages 0K in size.
- *
- * @throws Exception Any exceptions are allowed to fall through and fail the test.
- */
- public void testPubSubMessageSize0K() throws Exception
- {
- runTestForMessagesOfSize(0);
- }
-
- /**
- * Performs the P2P message test case, "Test Case 4" in the specification, for messages 63K in size.
- *
- * @throws Exception Any exceptions are allowed to fall through and fail the test.
- */
- public void testPubSubMessageSize63K() throws Exception
- {
- runTestForMessagesOfSize(63 * 1024);
- }
-
- /**
- * Performs the P2P message test case, "Test Case 4" in the specification, for messages 64K in size.
- *
- * @throws Exception Any exceptions are allowed to fall through and fail the test.
- */
- public void testPubSubMessageSize64K() throws Exception
- {
- runTestForMessagesOfSize(64 * 1024);
- }
-
- /**
- * Performs the P2P message test case, "Test Case 4" in the specification, for messages 65K in size.
- *
- * @throws Exception Any exceptions are allowed to fall through and fail the test.
- */
- public void testPubSubMessageSize65K() throws Exception
- {
- runTestForMessagesOfSize(65 * 1024);
- }
-
- /**
- * Performs the P2P message test case, "Test Case 4" in the specification, for messages 127K in size.
- *
- * @throws Exception Any exceptions are allowed to fall through and fail the test.
- */
- public void testPubSubMessageSize127K() throws Exception
- {
- runTestForMessagesOfSize(127 * 1024);
- }
-
- /**
- * Performs the P2P message test case, "Test Case 4" in the specification, for messages 128K in size.
- *
- * @throws Exception Any exceptions are allowed to fall through and fail the test.
- */
- public void testPubSubMessageSize128K() throws Exception
- {
- runTestForMessagesOfSize(128 * 1024);
- }
-
- /**
- * Performs the P2P message test case, "Test Case 4" in the specification, for messages 129K in size.
- *
- * @throws Exception Any exceptions are allowed to fall through and fail the test.
- */
- public void testPubSubMessageSize129K() throws Exception
- {
- runTestForMessagesOfSize(129 * 1024);
- }
-
- /**
- * Performs the P2P message test case, "Test Case 4" in the specification, for messages 255K in size.
- *
- * @throws Exception Any exceptions are allowed to fall through and fail the test.
- */
- public void testPubSubMessageSize255K() throws Exception
- {
- runTestForMessagesOfSize(255 * 1024);
- }
-
- /**
- * Performs the P2P message test case, "Test Case 4" in the specification, for messages 256K in size.
- *
- * @throws Exception Any exceptions are allowed to fall through and fail the test.
- */
- public void testPubSubMessageSize256K() throws Exception
- {
- runTestForMessagesOfSize(256 * 1024);
- }
-
- /**
- * Performs the P2P message test case, "Test Case 4" in the specification, for messages 257K in size.
- *
- * @throws Exception Any exceptions are allowed to fall through and fail the test.
- */
- public void testPubSubMessageSize257K() throws Exception
- {
- runTestForMessagesOfSize(257 * 1024);
- }
-
- /**
- * Sends 50 test messages of the specified size, and asserts that all were received.
- *
- * @param size The size of the messages to send in bytes.
- */
- private void runTestForMessagesOfSize(int size)
- {
- Properties testConfig = new Properties();
- testConfig.put("TEST_NAME", "TC5_PubSubMessageSize");
- testConfig.put("PUBSUB_KEY", "tc3route");
- testConfig.put("PUBSUB_NUM_MESSAGES", 10);
- testConfig.put("PUBSUB_NUM_RECEIVERS", 5);
- testConfig.put("messageSize", size);
-
- /*Message[] reports =*/
- getCircuitFactory().sequenceTest(null, null, testConfig);
-
- // Compare sender and receivers reports.
- /*
- int messagesSent = reports[0].getIntProperty("MESSAGE_COUNT");
- int messagesReceived = reports[1].getIntProperty("MESSAGE_COUNT");
-
- Assert.assertEquals("The requested number of messages were not sent.", 50, messagesSent);
- Assert.assertEquals("Sender and receivers messages sent did not match up.", messagesSent, messagesReceived);
- */
- }
-
- /**
- * Should provide a translation from the junit method name of a test to its test case name as defined in the
- * interop testing specification. For example the method "testP2P" might map onto the interop test case name
- * "TC2_BasicP2P".
- *
- * @param methodName The name of the JUnit test method.
- * @return The name of the corresponding interop test case.
- */
- public String getTestCaseNameForTestMethod(String methodName)
- {
- return "TC5_PubSubMessageSize";
- }
-}
diff --git a/qpid/java/integrationtests/src/main/java/org/apache/qpid/sustained/SustainedClientTestCase.java b/qpid/java/integrationtests/src/main/java/org/apache/qpid/sustained/SustainedClientTestCase.java
deleted file mode 100644
index 63e2c75509..0000000000
--- a/qpid/java/integrationtests/src/main/java/org/apache/qpid/sustained/SustainedClientTestCase.java
+++ /dev/null
@@ -1,906 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.sustained;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.client.AMQNoConsumersException;
-import org.apache.qpid.client.AMQNoRouteException;
-import org.apache.qpid.test.framework.distributedtesting.TestClient;
-import org.apache.qpid.interop.clienttestcases.TestCase3BasicPubSub;
-import org.apache.qpid.test.framework.TestUtils;
-
-import javax.jms.Connection;
-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.Session;
-import javax.jms.TextMessage;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.concurrent.CountDownLatch;
-
-/**
- * Implements test case 3, basic pub/sub. Sends/received a specified number of messages to a specified route on the
- * default topic exchange, using the specified number of receivers connections. Produces reports on the actual number of
- * messages sent/received.
- *
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Supply the name of the test case that this implements.
- * <tr><td> Accept/Reject invites based on test parameters.
- * <tr><td> Adapt to assigned roles.
- * <tr><td> Send required number of test messages using pub/sub. <tr><td> Generate test reports.
- * </table>
- */
-public class SustainedClientTestCase extends TestCase3BasicPubSub implements ExceptionListener, MessageListener
-{
- /** Used for debugging. */
- private static final Logger log = Logger.getLogger(SustainedClientTestCase.class);
-
- /** Used to log to the console. */
- private static final Logger console = Logger.getLogger("SustainedTest");
-
- /** The role to be played by the test. */
- private Roles role;
-
- /** The number of receivers connection to use. */
- private int numReceivers;
-
- /** The routing key to send them to on the default direct exchange. */
- private Destination sendDestination;
-
- /** The routing key to send updates to on the default direct exchange. */
- private Destination sendUpdateDestination;
-
- /** The connections to send/receive the test messages on. */
- private Connection[] connection;
-
- /** The sessions to send/receive the test messages on. */
- private Session[] session;
-
- /** The producer to send the test messages with. */
- MessageProducer producer;
-
- /** Adapter that adjusts the send rate based on the updates from clients. */
- SustainedRateAdapter _rateAdapter;
-
- /** */
- int _batchSize;
-
- private static final long TEN_MILLI_SEC = 10000000;
- private static final int DEBUG_LOG_UPATE_INTERVAL = 10;
- private static final int LOG_UPATE_INTERVAL = 10;
- private static final boolean SLEEP_PER_MESSAGE = Boolean.getBoolean("sleepPerMessage");
-
- /**
- * Should provide the name of the test case that this class implements. The exact names are defined in the interop
- * testing spec.
- *
- * @return The name of the test case that this implements.
- */
- public String getName()
- {
- log.debug("public String getName(): called");
-
- return "Perf_SustainedPubSub";
- }
-
- /**
- * Assigns the role to be played by this test case. The test parameters are fully specified in the assignment
- * message. When this method return the test case will be ready to execute.
- *
- * @param role The role to be played; sender or receivers.
- * @param assignRoleMessage The role assingment message, contains the full test parameters.
- *
- * @throws JMSException Any JMSException resulting from reading the message are allowed to fall through.
- */
- public void assignRole(Roles role, Message assignRoleMessage) throws JMSException
- {
- log.debug("public void assignRole(Roles role = " + role + ", Message assignRoleMessage = " + assignRoleMessage
- + "): called");
-
- // Take note of the role to be played.
- this.role = role;
-
- // Extract and retain the test parameters.
- numReceivers = assignRoleMessage.getIntProperty("SUSTAINED_NUM_RECEIVERS");
- _batchSize = assignRoleMessage.getIntProperty("SUSTAINED_UPDATE_INTERVAL");
- String sendKey = assignRoleMessage.getStringProperty("SUSTAINED_KEY");
- String sendUpdateKey = assignRoleMessage.getStringProperty("SUSTAINED_UPDATE_KEY");
- int ackMode = assignRoleMessage.getIntProperty("ACKNOWLEDGE_MODE");
- String clientName = assignRoleMessage.getStringProperty("CLIENT_NAME");
-
- if (log.isDebugEnabled())
- {
- log.debug("numReceivers = " + numReceivers);
- log.debug("_batchSize = " + _batchSize);
- log.debug("ackMode = " + ackMode);
- log.debug("sendKey = " + sendKey);
- log.debug("sendUpdateKey = " + sendUpdateKey);
- log.debug("role = " + role);
- }
-
- switch (role)
- {
- // Check if the sender role is being assigned, and set up a single message producer if so.
- case SENDER:
- console.info("Creating Sender");
- // Create a new connection to pass the test messages on.
- connection = new Connection[1];
- session = new Session[1];
-
- connection[0] = TestUtils.createConnection(TestClient.testContextProperties);
- session[0] = connection[0].createSession(false, ackMode);
-
- // Extract and retain the test parameters.
- sendDestination = session[0].createTopic(sendKey);
-
- connection[0].setExceptionListener(this);
-
- producer = session[0].createProducer(sendDestination);
-
- sendUpdateDestination = session[0].createTopic(sendUpdateKey);
- MessageConsumer updateConsumer = session[0].createConsumer(sendUpdateDestination);
-
- _rateAdapter = new SustainedRateAdapter(this);
- updateConsumer.setMessageListener(_rateAdapter);
-
- break;
-
- // Otherwise the receivers role is being assigned, so set this up to listen for messages on the required number
- // of receivers connections.
- case RECEIVER:
- console.info("Creating Receiver");
- // Create the required number of receivers connections.
- connection = new Connection[numReceivers];
- session = new Session[numReceivers];
-
- for (int i = 0; i < numReceivers; i++)
- {
- connection[i] = TestUtils.createConnection(TestClient.testContextProperties);
- session[i] = connection[i].createSession(false, ackMode);
-
- sendDestination = session[i].createTopic(sendKey);
-
- sendUpdateDestination = session[i].createTopic(sendUpdateKey);
-
- MessageConsumer consumer = session[i].createConsumer(sendDestination);
-
- consumer.setMessageListener(new SustainedListener(clientName + "-" + i, _batchSize, session[i],
- sendUpdateDestination));
- }
-
- break;
- }
-
- // Start all the connection dispatcher threads running.
- for (int i = 0; i < connection.length; i++)
- {
- connection[i].start();
- }
- }
-
- /** Performs the test case actions.
- * @param numMessages*/
- public void start(int numMessages) throws JMSException
- {
- log.debug("public void start(): called");
-
- // Check that the sender role is being performed.
- switch (role)
- {
- // Check if the sender role is being assigned, and set up a single message producer if so.
- case SENDER:
- _rateAdapter.run();
- break;
- case RECEIVER:
-
- }
-
- // return from here when you have finished the test.. this will signal the controller and
- }
-
- public void terminate() throws JMSException, InterruptedException
- {
- if (_rateAdapter != null)
- {
- _rateAdapter.stop();
- }
- }
-
- /**
- * Gets a report on the actions performed by the test case in its assigned role.
- *
- * @param session The controlSession to create the report message in.
- *
- * @return The report message.
- *
- * @throws JMSException Any JMSExceptions resulting from creating the report are allowed to fall through.
- */
- public Message getReport(Session session) throws JMSException
- {
- log.debug("public Message getReport(Session controlSession): called");
-
- // Close the test connections.
- for (int i = 0; i < connection.length; i++)
- {
- connection[i].close();
- }
-
- Message report = session.createMessage();
- report.setStringProperty("CONTROL_TYPE", "REPORT");
-
- return report;
- }
-
- public void onException(JMSException jmsException)
- {
- Exception linked = jmsException.getLinkedException();
-
- if (linked != null)
- {
- if (log.isDebugEnabled())
- {
- log.debug("Linked Exception:" + linked);
- }
-
- if ((linked instanceof AMQNoRouteException) || (linked instanceof AMQNoConsumersException))
- {
- if (log.isDebugEnabled())
- {
- if (linked instanceof AMQNoConsumersException)
- {
- log.warn("No clients currently available for message:"
- + ((AMQNoConsumersException) linked).getUndeliveredMessage());
- }
- else
- {
- log.warn("No route for message");
- }
- }
-
- // Tell the rate adapter that there are no clients ready yet
- _rateAdapter.NO_CLIENTS = true;
- }
- }
- else
- {
- log.warn("Exception:" + linked);
- }
- }
-
- /**
- * Inner class that listens for messages and sends a report for the time taken between receiving the 'start' and
- * 'end' messages.
- */
- class SustainedListener implements MessageListener
- {
- /** Number of messages received */
- private long _received = 0;
- /** The number of messages in the batch */
- private int _batchSize = 0;
- /** Record of the when the 'start' messagse was sen */
- private Long _startTime;
- /** Message producer to use to send reports */
- MessageProducer _updater;
- /** Session to create the report message on */
- Session _session;
- /** Record of the client ID used for this SustainedListnener */
- String _client;
-
- /**
- * Main Constructor
- *
- * @param clientname The _client id used to identify this connection.
- * @param batchSize The number of messages that are to be sent per batch. Note: This is not used to
- * control the interval between sending reports.
- * @param session The controlSession used for communication.
- * @param sendDestination The destination that update reports should be sent to.
- *
- * @throws JMSException My occur if creatingthe Producer fails
- */
- public SustainedListener(String clientname, int batchSize, Session session, Destination sendDestination)
- throws JMSException
- {
- _batchSize = batchSize;
- _client = clientname;
- _session = session;
- _updater = session.createProducer(sendDestination);
- }
-
- public void onMessage(Message message)
- {
- if (log.isDebugEnabled())
- {
- log.debug("Message " + _received + "received in listener");
- }
-
- if (message instanceof TextMessage)
- {
- try
- {
- _received++;
- if (((TextMessage) message).getText().equals("start"))
- {
- log.debug("Starting Batch");
- _startTime = System.nanoTime();
- }
- else if (((TextMessage) message).getText().equals("end"))
- {
- if (_startTime != null)
- {
- long currentTime = System.nanoTime();
- sendStatus(currentTime - _startTime, _received, message.getIntProperty("BATCH"));
- log.debug("End Batch");
- }
- }
- }
- catch (JMSException e)
- {
- // ignore error
- }
- }
-
- }
-
- /**
- * sendStatus creates and sends the report back to the publisher
- *
- * @param time taken for the the last batch
- * @param received Total number of messages received.
- * @param batchNumber the batch number
- * @throws JMSException if an error occurs during the send
- */
- private void sendStatus(long time, long received, int batchNumber) throws JMSException
- {
- Message updateMessage = _session.createTextMessage("update");
- updateMessage.setStringProperty("CLIENT_ID", ":" + _client);
- updateMessage.setStringProperty("CONTROL_TYPE", "UPDATE");
- updateMessage.setLongProperty("RECEIVED", received);
- updateMessage.setIntProperty("BATCH", batchNumber);
- updateMessage.setLongProperty("DURATION", time);
-
- if (log.isInfoEnabled())
- {
- log.info("**** SENDING [" + batchNumber + "]**** " + "CLIENT_ID:" + _client + " RECEIVED:" + received
- + " BATCH:" + batchNumber + " DURATION:" + time);
- }
-
- // Output on the main console.info the details of this batch
- if ((batchNumber % 10) == 0)
- {
- console.info("Sending Report [" + batchNumber + "] " + "CLIENT_ID:" + _client + " RECEIVED:" + received
- + " BATCH:" + batchNumber + " DURATION:" + time);
- }
-
- _updater.send(updateMessage);
- }
- }
-
- /**
- * This class is used here to adjust the _delay value which in turn is used to control the number of messages/second
- * that are sent through the test system.
- *
- * By keeping a record of the messages recevied and the average time taken to process the batch size can be
- * calculated and so the delay can be adjusted to maintain that rate.
- *
- * Given that delays of < 10ms can be rounded up the delay is only used between messages if the _delay > 10ms * no
- * messages in the batch. Otherwise the delay is used at the end of the batch.
- */
- class SustainedRateAdapter implements MessageListener, Runnable
- {
- private SustainedClientTestCase _client;
- private long _batchVariance = Integer.getInteger("batchVariance", 3); // no. batches to allow drifting
- private long _timeVariance = TEN_MILLI_SEC * 5; // no. nanos between send and report delay (10ms)
- private volatile long _delay; // in nanos
- private long _sent;
- private Map<String, Long> _slowClients = new HashMap<String, Long>();
- private static final long PAUSE_SLEEP = TEN_MILLI_SEC / 1000; // 10 ms
- private static final long NO_CLIENT_SLEEP = 1000; // 1s
- private volatile boolean NO_CLIENTS = true;
- private int _delayShifting;
- private final int REPORTS_WITHOUT_CHANGE = Integer.getInteger("stableReportCount", 5);
- private boolean _warmedup = false;
- private static final long EXPECTED_TIME_PER_BATCH = 100000L;
- private int _warmUpBatches = Integer.getInteger("warmUpBatches", 10);
-
- SustainedRateAdapter(SustainedClientTestCase client)
- {
- _client = client;
- }
-
- public void onMessage(Message message)
- {
- if (log.isDebugEnabled())
- {
- log.debug("SustainedRateAdapter onMessage(Message message = " + message + "): called");
- }
-
- try
- {
- String controlType = message.getStringProperty("CONTROL_TYPE");
-
- // Check if the message is a test invite.
- if ("UPDATE".equals(controlType))
- {
- NO_CLIENTS = false;
- long duration = message.getLongProperty("DURATION");
- long totalReceived = message.getLongProperty("RECEIVED");
- String client = message.getStringProperty("CLIENT_ID");
- int batchNumber = message.getIntProperty("BATCH");
-
- if (log.isInfoEnabled() && ((batchNumber % DEBUG_LOG_UPATE_INTERVAL) == 0))
- {
- log.info("Update Report: CLIENT_ID:" + client + " RECEIVED:" + totalReceived + " Recevied BATCH:"
- + batchNumber + " DURATION:" + duration);
- }
-
- recordSlow(client, totalReceived, batchNumber);
-
- adjustDelay(client, batchNumber, duration);
-
- // Warm up completes when:
- // we haven't warmed up
- // and the number of batches sent to each client is at least half of the required warmup batches
- if (!_warmedup && (batchNumber >= _warmUpBatches))
- {
- _warmedup = true;
- _warmup.countDown();
-
- }
- }
- }
- catch (JMSException e)
- {
- //
- }
- }
-
- CountDownLatch _warmup = new CountDownLatch(1);
-
- int _numBatches = 10000;
-
- // long[] _timings = new long[_numBatches];
- private boolean _running = true;
-
- public void run()
- {
- console.info("Warming up");
-
- doBatch(_warmUpBatches);
-
- try
- {
- // wait for warmup to complete.
- _warmup.await();
-
- // set delay to the average length of the batches
- _delay = _totalDuration / _warmUpBatches / delays.size();
-
- console.info("Warmup complete delay set : " + _delay + " based on _totalDuration: " + _totalDuration
- + " over no. batches: " + _warmUpBatches + " with client count: " + delays.size());
-
- _totalDuration = 0L;
- _totalReceived = 0L;
- _sent = 0L;
- }
- catch (InterruptedException e)
- {
- //
- }
-
- doBatch(_numBatches);
-
- }
-
- private void doBatch(int batchSize) // long[] timings,
- {
- TextMessage testMessage = null;
- try
- {
- testMessage = _client.session[0].createTextMessage("start");
-
- for (int batch = 0; batch <= batchSize; batch++)
- // while (_running)
- {
- long start = System.nanoTime();
-
- testMessage.setText("start");
- testMessage.setIntProperty("BATCH", batch);
-
- _client.producer.send(testMessage);
- _rateAdapter.sentMessage();
-
- testMessage.setText("test");
- // start at 2 so start and end count as part of batch
- for (int m = 2; m < _batchSize; m++)
- {
- _client.producer.send(testMessage);
- _rateAdapter.sentMessage();
- }
-
- testMessage.setText("end");
- _client.producer.send(testMessage);
- _rateAdapter.sentMessage();
-
- long end = System.nanoTime();
-
- long sendtime = end - start;
-
- if (log.isDebugEnabled())
- {
- log.info("Sent batch[" + batch + "](" + _batchSize + ") in " + sendtime); // timings[batch]);
- }
-
- if ((batch % LOG_UPATE_INTERVAL) == 0)
- {
- console.info("Sent Batch[" + batch + "](" + _batchSize + ")" + status());
- }
-
- _rateAdapter.sleepBatch();
-
- }
- }
- catch (JMSException e)
- {
- console.error("Runner ended");
- }
- }
-
- private String status()
- {
- return " TotalDuration: " + _totalDuration + " for " + delays.size() + " consumers" + " Delay is " + _delay
- + " resulting in "
- + ((_delay > (TEN_MILLI_SEC * _batchSize)) ? ((_delay / _batchSize) + "/msg") : (_delay + "/batch"));
- }
-
- private void sleepBatch()
- {
- if (checkForSlowClients())
- { // if there werwe slow clients we have already slept so don't sleep anymore again.
- return;
- }
-
- if (!SLEEP_PER_MESSAGE)
- {
- // per batch sleep.. if sleep is to small to spread over the batch.
- if (_delay <= (TEN_MILLI_SEC * _batchSize))
- {
- sleepLong(_delay);
- }
- else
- {
- log.info("Not sleeping _delay > ten*batch is:" + _delay);
- }
- }
- }
-
- public void stop()
- {
- _running = false;
- }
-
- Map<String, Long> delays = new HashMap<String, Long>();
- Long _totalReceived = 0L;
- Long _totalDuration = 0L;
- int _skipUpdate = 0;
-
- /**
- * Adjust the delay for sending messages based on this update from the client
- *
- * @param client The client that send this update
- * @param duration The time taken for the last batch of messagse
- * @param batchNumber The reported batchnumber from the client
- */
- private void adjustDelay(String client, int batchNumber, long duration)
- {
- // Retrieve the current total time taken for this client.
- Long currentTime = delays.get(client);
-
- // Add the new duration time to this client
- if (currentTime == null)
- {
- currentTime = duration;
- }
- else
- {
- currentTime += duration;
- }
-
- delays.put(client, currentTime);
-
- long batchesSent = _sent / _batchSize;
-
- // ensure we don't divide by zero
- if (batchesSent == 0)
- {
- batchesSent = 1L;
- }
-
- _totalReceived += _batchSize;
- _totalDuration += duration;
-
- // calculate average duration accross clients per batch
- long averageDuration = _totalDuration / delays.size() / batchesSent;
-
- // calculate the difference between current send delay and average report delay
- long diff = (duration) - averageDuration;
-
- if (log.isInfoEnabled() && ((batchNumber % DEBUG_LOG_UPATE_INTERVAL) == 0))
- {
- log.info("TotalDuration:" + _totalDuration + " for " + delays.size() + " consumers." + " on batch: "
- + batchesSent + " received batch: " + batchNumber + " Batch Duration: " + duration + " Average: "
- + averageDuration + " so diff: " + diff + " for : " + client + " Delay is " + _delay + " resulting in "
- + ((_delay > (TEN_MILLI_SEC * _batchSize)) ? ((_delay / _batchSize) + "/msg") : (_delay + "/batch")));
- }
-
- // if the averageDuration differs from the current by more than the specified variane then adjust delay.
- if (Math.abs(diff) > _timeVariance)
- {
-
- // if the the _delay is larger than the required duration to send report
- // speed up
- if (diff > TEN_MILLI_SEC)
- {
- _delay -= TEN_MILLI_SEC;
-
- if (_delay < 0)
- {
- _delay = 0;
- log.info("Reset _delay to 0");
- delayStable();
- }
- else
- {
- delayChanged();
- }
-
- }
- else if (diff < 0) // diff < 0 diff cannot be 0 as it is > _timeVariance
- {
- // the report took longer
- _delay += TEN_MILLI_SEC;
- delayChanged();
- }
- }
- else
- {
- delayStable();
- }
-
- // If we have a consumer that is behind with the batches.
- if ((batchesSent - batchNumber) > _batchVariance)
- {
- log.debug("Increasing _delay as sending more than receiving");
-
- _delay += 2 * TEN_MILLI_SEC;
- delayChanged();
- }
-
- }
-
- /** Reset the number of iterations before we say the delay has stabilised. */
- private void delayChanged()
- {
- _delayShifting = REPORTS_WITHOUT_CHANGE;
- }
-
- /**
- * Record the fact that delay has stabilised If delay has stablised for REPORTS_WITHOUT_CHANGE then it will
- * output Delay stabilised
- */
- private void delayStable()
- {
- _delayShifting--;
-
- if (_delayShifting < 0)
- {
- _delayShifting = 0;
- console.debug("Delay stabilised:" + _delay);
- }
- }
-
- /**
- * Checks that the client has received enough messages. If the client has fallen behind then they are put in the
- * _slowClients lists which will increase the delay.
- *
- * @param client The client identifier to check
- * @param received the number of messages received by that client
- * @param batchNumber
- */
- private void recordSlow(String client, long received, int batchNumber)
- {
- if (Math.abs(batchNumber - (_sent / _batchSize)) > _batchVariance)
- {
- _slowClients.put(client, received);
- }
- else
- {
- _slowClients.remove(client);
- }
- }
-
- /** Incrment the number of sent messages and then sleep, if required. */
- public void sentMessage()
- {
-
- _sent++;
-
- if (_delay > (TEN_MILLI_SEC * _batchSize))
- {
- long batchDelay = _delay / _batchSize;
- // less than 10ms sleep doesn't always work.
- // _delay is in nano seconds
- // if (batchDelay < (TEN_MILLI_SEC))
- // {
- // sleep(0, (int) batchDelay);
- // }
- // else
- {
- // if (batchDelay < 30000000000L)
- {
- sleepLong(batchDelay);
- }
- }
- }
- else
- {
- if (SLEEP_PER_MESSAGE && (_delay > 0))
- {
- sleepLong(_delay / _batchSize);
- }
- }
- }
-
- /**
- * Check at the end of each batch and pause sending messages to allow slow clients to catch up.
- *
- * @return true if there were slow clients that caught up.
- */
- private boolean checkForSlowClients()
- {
- // This will allways be true as we are running this at the end of each batchSize
- // if (_sent % _batchSize == 0)
- {
- // Cause test to pause when we have slow
- if (!_slowClients.isEmpty() || NO_CLIENTS)
- {
-
- while (!_slowClients.isEmpty())
- {
- if (log.isInfoEnabled() && ((_sent / _batchSize % DEBUG_LOG_UPATE_INTERVAL) == 0))
- {
- String clients = "";
- Iterator it = _slowClients.keySet().iterator();
- while (it.hasNext())
- {
- clients += it.next();
- if (it.hasNext())
- {
- clients += ", ";
- }
- }
-
- log.info("Pausing for slow clients:" + clients);
- }
-
- if (console.isDebugEnabled() && ((_sent / _batchSize % LOG_UPATE_INTERVAL) == 0))
- {
- console.debug(_slowClients.size() + " slow clients.");
- }
-
- sleep(PAUSE_SLEEP);
- }
-
- if (NO_CLIENTS)
- {
- sleep(NO_CLIENT_SLEEP);
- }
-
- log.debug("Continuing");
-
- return true;
- }
- else
- {
- if ((_sent / _batchSize % LOG_UPATE_INTERVAL) == 0)
- {
- console.info("Total Delay :" + _delay + " "
- + ((_delayShifting == 0) ? "Stablised" : ("Not Stablised(" + _delayShifting + ")")));
- }
- }
-
- }
-
- return false;
- }
-
- /**
- * Sleep normally takes micro-seconds this allows the use of a nano-second value.
- *
- * @param delay nanoseconds to sleep for.
- */
- private void sleepLong(long delay)
- {
- sleep(delay / 1000000, (int) (delay % 1000000));
- }
-
- /**
- * Sleep for the specified micro-seconds.
- * @param sleep microseconds to sleep for.
- */
- private void sleep(long sleep)
- {
- sleep(sleep, 0);
- }
-
- /**
- * Perform the sleep , swallowing any InteruptException.
- *
- * NOTE: If a sleep request is > 10s then reset only sleep for 5s
- *
- * @param milli to sleep for
- * @param nano sub miliseconds to sleep for
- */
- private void sleep(long milli, int nano)
- {
- try
- {
- log.debug("Sleep:" + milli + ":" + nano);
- if (milli > 10000)
- {
-
- if (_delay == milli)
- {
- _totalDuration = _totalReceived / _batchSize * EXPECTED_TIME_PER_BATCH;
- log.error("Sleeping for more than 10 seconds adjusted to 5s!:" + (milli / 1000)
- + "s. Reset _totalDuration:" + _totalDuration);
- }
- else
- {
- log.error("Sleeping for more than 10 seconds adjusted to 5s!:" + (milli / 1000) + "s");
- }
-
- milli = 5000;
- }
-
- Thread.sleep(milli, nano);
- }
- catch (InterruptedException e)
- {
- //
- }
- }
-
- public void setClient(SustainedClientTestCase client)
- {
- _client = client;
- }
- }
-
-}
diff --git a/qpid/java/integrationtests/src/main/java/org/apache/qpid/sustained/SustainedTestCase.java b/qpid/java/integrationtests/src/main/java/org/apache/qpid/sustained/SustainedTestCase.java
deleted file mode 100644
index 0077b4727a..0000000000
--- a/qpid/java/integrationtests/src/main/java/org/apache/qpid/sustained/SustainedTestCase.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.sustained;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.client.AMQSession;
-import org.apache.qpid.test.framework.DropInTest;
-import org.apache.qpid.test.framework.FrameworkBaseCase;
-
-import javax.jms.JMSException;
-import javax.jms.Message;
-
-import java.util.Properties;
-
-/**
- * SustainedTestCase is a {@link FrameworkBaseCase} that runs the "Perf_SustainedPubSub" test case. This consists of one
- * test client sending, and several receiving, and attempts to find the highest rate at which messages can be broadcast
- * to the receivers. It is also a {@link DropInTest} to which more test clients may be added during a test run.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td>
- * </table>
- */
-public class SustainedTestCase extends FrameworkBaseCase implements DropInTest
-{
- /** Used for debugging. */
- Logger log = Logger.getLogger(SustainedTestCase.class);
-
- /** Holds the root name of the topic on which to send the test messages. */
- private static final String SUSTAINED_KEY = "Perf_SustainedPubSub";
-
- /**
- * Creates a new coordinating test case with the specified name.
- *
- * @param name The test case name.
- */
- public SustainedTestCase(String name)
- {
- super(name);
- }
-
- /**
- * Performs a single test run of the sustained test.
- *
- * @throws Exception Any exceptions are allowed to fall through and fail the test.
- */
- public void testBasicPubSub() throws Exception
- {
- log.debug("public void testSinglePubSubCycle(): called");
-
- Properties testConfig = new Properties();
- testConfig.put("TEST_NAME", "Perf_SustainedPubSub");
- testConfig.put("SUSTAINED_KEY", SUSTAINED_KEY);
- testConfig.put("SUSTAINED_NUM_RECEIVERS", Integer.getInteger("numReceives", 2));
- testConfig.put("SUSTAINED_UPDATE_INTERVAL", Integer.getInteger("batchSize", 1000));
- testConfig.put("SUSTAINED_UPDATE_KEY", SUSTAINED_KEY + ".UPDATE");
- testConfig.put("ACKNOWLEDGE_MODE", Integer.getInteger("ackMode", AMQSession.AUTO_ACKNOWLEDGE));
-
- log.info("Created Config: " + testConfig.entrySet().toArray());
-
- getCircuitFactory().sequenceTest(null, null, testConfig);
- }
-
- /**
- * Accepts a late joining client into this test case. The client will be enlisted with a control message
- * with the 'CONTROL_TYPE' field set to the value 'LATEJOIN'. It should also provide values for the fields:
- *
- * <p/><table>
- * <tr><td> CLIENT_NAME <td> A unique name for the new client.
- * <tr><td> CLIENT_PRIVATE_CONTROL_KEY <td> The key for the route on which the client receives its control messages.
- * </table>
- *
- * @param message The late joiners join message.
- *
- * @throws JMSException Any JMS Exception are allowed to fall through, indicating that the join failed.
- */
- public void lateJoin(Message message) throws JMSException
- {
- throw new RuntimeException("Not implemented.");
- /*
- // Extract the joining clients details from its join request message.
- TestClientDetails clientDetails = new TestClientDetails();
- clientDetails.clientName = message.getStringProperty("CLIENT_NAME");
- clientDetails.privateControlKey = message.getStringProperty("CLIENT_PRIVATE_CONTROL_KEY");
-
- // Register the joining client, but do block for confirmation as cannot do a synchronous receivers during this
- // method call, as it may have been called from an 'onMessage' method.
- assignReceiverRole(clientDetails, new Properties(), false);
- */
- }
-
- /**
- * Should provide a translation from the junit method name of a test to its test case name as known to the test
- * clients that will run the test. The purpose of this is to convert the JUnit method name into the correct test
- * case name to place into the test invite. For example the method "testP2P" might map onto the interop test case
- * name "TC2_BasicP2P".
- *
- * @param methodName The name of the JUnit test method.
- *
- * @return The name of the corresponding interop test case.
- */
- public String getTestCaseNameForTestMethod(String methodName)
- {
- return "Perf_SustainedPubSub";
- }
-}
diff --git a/qpid/java/integrationtests/src/resources/sustained-log4j.xml b/qpid/java/integrationtests/src/resources/sustained-log4j.xml
deleted file mode 100644
index c5ab3137bf..0000000000
--- a/qpid/java/integrationtests/src/resources/sustained-log4j.xml
+++ /dev/null
@@ -1,69 +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.
- -
- -->
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
-
-
- <appender name="FileAppender" class="org.apache.log4j.FileAppender">
- <param name="File" value="${QPID_WORK}/log/${logprefix}qpid${logsuffix}.log"/>
- <param name="Append" value="false"/>
-
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
- </layout>
- </appender>
-
- <appender name="STDOUT" class="org.apache.log4j.ConsoleAppender">
-
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%d %-5p (%F:%L) - %m%n"/>
- <!--param name="ConversionPattern" value="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/-->
- </layout>
- </appender>
-
- <category name="SustainedTest">
- <priority value="${sustained.level}"/>
- </category>
-
- <category name="org.apache">
- <priority value="warn"/>
- </category>
-
- <category name="org.apache.qpid.interop">
- <priority value="${interop.logging.level}"/>
- </category>
-
-
- <category name="org.apache.qpid.sustained">
- <priority value="${amqj.logging.level}"/>
- </category>
-
- <!--category name="org.apache.qpid.server.txn">
- <priority value="debug"/>
- </category>-->
-
- <root>
- <priority value="all"/>
- <appender-ref ref="STDOUT"/>
- <!--appender-ref ref="ArchivingFileAppender"/-->
- </root>
-</log4j:configuration>
diff --git a/qpid/java/junit-toolkit/build.xml b/qpid/java/junit-toolkit/build.xml
deleted file mode 100644
index a2f352c4b7..0000000000
--- a/qpid/java/junit-toolkit/build.xml
+++ /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.
- -
- -->
-<project name="Junit Toolkit" default="build">
- <property name="module.src" value="src/main"/>
-
- <import file="../module.xml"/>
-
-</project>
diff --git a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/concurrency/DefaultThreadFactory.java b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/concurrency/DefaultThreadFactory.java
deleted file mode 100644
index 8fb0a6a90e..0000000000
--- a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/concurrency/DefaultThreadFactory.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.junit.concurrency;
-
-import java.util.concurrent.ThreadFactory;
-
-/**
- * Implements a default thread factory.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Create default threads with no specialization.
- * </table>
- *
- * @author Rupert Smith
- */
-public class DefaultThreadFactory implements ThreadFactory
-{
- /**
- * Constructs a new <tt>Thread</tt>.
- *
- * @param r A runnable to be executed by new thread instance.
- *
- * @return The constructed thread.
- */
- public Thread newThread(Runnable r)
- {
- return new Thread(r);
- }
-}
diff --git a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/concurrency/PossibleDeadlockException.java b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/concurrency/PossibleDeadlockException.java
deleted file mode 100644
index 3bbfc2d502..0000000000
--- a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/concurrency/PossibleDeadlockException.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.junit.concurrency;
-
-/**
- * PossibleDeadlockException is used to signal that two test threads being executed by a {@link ThreadTestCoordinator}
- * may be in a state of deadlock because they are mutually blocking each other or one is waiting on the other and the
- * other has been blocked elsewhere for longer than a specified timeout.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Signal a possible state of deadlock between coordinated test threads.
- * </table>
- *
- * @author Rupert Smith
- */
-public class PossibleDeadlockException extends RuntimeException
-{
- /**
- * Create a new possible deadlock execption.
- *
- * @param message The exception message.
- */
- public PossibleDeadlockException(String message)
- {
- super(message);
- }
-}
diff --git a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/concurrency/TestRunnable.java b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/concurrency/TestRunnable.java
deleted file mode 100644
index 02e776a4ea..0000000000
--- a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/concurrency/TestRunnable.java
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.junit.concurrency;
-
-/**
- * TestRunnable is an extension of java.util.Runnable that adds some features to make it easier to coordinate the
- * activities of threads in such a way as to expose bugs in multi threaded code.
- *
- * <p/>Sometimes several threads will run in a particular order so that a bug is not revealed. Other times the ordering
- * of the threads will expose a bug. Such bugs can be hard to replicate as the exact execution ordering of threads is not
- * usually controlled. This class adds some methods that allow threads to synchronize other threads, either allowing them
- * to run, or waiting for them to allow this thread to run. It also provides convenience methods to gather error messages
- * and exceptions from threads, which will often be reported in unit testing code.
- *
- * <p/>Coordination between threads is handled by the {@link ThreadTestCoordinator}. It is called through the convenience
- * methods {@link #allow} and {@link #waitFor}. Threads to be coordinated must be set up with the coordinator and assigned
- * integer ids. It is then possible to call the coordinator with an array of thread ids requesting that those threads
- * be allowed to continue, or to wait until one of them allows this thread to continue. The otherwise non-deterministic
- * execution order of threads can be controlled into a carefully determined sequence using these methods in order
- * to reproduce race conditions, dead locks, live locks, dirty reads, phantom reads, non repeatable reads and so on.
- *
- * <p/>When waiting for another thread to give a signal to continue it is sometimes the case that the other thread has
- * become blocked by the code under test. For example in testing for a dirty read (for example in database code),
- * thread 1 lets thread 2 perform a write but not commit it, then thread 2 lets thread 1 run and attempt to perform a
- * dirty read on its uncommitted write. Transaction synchronization code being tested against the possibility of a dirty
- * write may make use of snapshots in which case both threads should be able to read and write without blocking. It may
- * make use of explicit keys in which case thread 2 may become blocked on its write attempt because thread 1 holds a
- * read lock and it must wait until thread 1 completes its transaction before it can acquire this lock. The
- * {@link #waitFor} method accepts a boolean parameter to indicate that threads being blocked (other than on the
- * coordinator) can be interpreted the same as if the thread explicitly allows the thread calling waitFor to continue.
- * Using this technique a dirty read test could be written that works against either the snapshot or the locking
- * implementation, allowing both approaches to pass the test yet arranging for multiple threads to run against the
- * implementation in such a way that a potential dirty read bug is exposed.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Wait for another thread to allow this one to continue.
- * <tr><td> Allow another thread to continue.
- * <tr><td> Accumulate error messages.
- * <tr><td> Record exceptions from thread run.
- * <tr><td> Maintain link to thread coordinator.
- * <tr><td> Explicitly mark a thread with an integer id.
- * <tr><td> Maintian a flag to indicate whether or not this thread is waiting on the coordinator.
- * </table>
- *
- * @todo The allow then waitFor operations are very often used as a pair. So create a method allowAndWait that combines
- * them into a single method call.
- *
- * @author Rupert Smith
- */
-public abstract class TestRunnable implements Runnable
-{
- /** Holds a reference to the thread coordinator. */
- private ThreadTestCoordinator coordinator;
-
- /** Holds the explicit integer id of this thread. */
- private int id;
-
- /** Used to indicate that this thread is waiting on the coordinator and not elsewhere. */
- private boolean waitingOnCoordinator = false;
-
- /** Used to accumulate error messsages. */
- private String errorMessage = "";
-
- /** Holds the Java thread object that this is running under. */
- private Thread thisThread;
-
- /** Used to hold any exceptions resulting from the run method. */
- private Exception runException = null;
-
- /**
- * Implementations override this to perform coordinated thread sequencing.
- *
- * @throws Exception Any exception raised by the implementation will be caught by the default {@link #run()}
- * implementation for later querying by the {@link #getException()} method.
- */
- public abstract void runWithExceptions() throws Exception;
-
- /**
- * Provides a default implementation of the run method that allows exceptions to be thrown and keeps a record
- * of those exceptions. Defers to the {@link #runWithExceptions()} method to provide the thread body implementation
- * and catches any exceptions thrown by it.
- */
- public void run()
- {
- try
- {
- runWithExceptions();
- }
- catch (Exception e)
- {
- this.runException = e;
- }
- }
-
- /**
- * Attempt to consume an allow event from one of the specified threads and blocks until such an event occurrs.
- *
- * @param threads The set of threads that can allow this one to continue.
- * @param otherWaitIsAllow If set to <tt>true</tt> if the threads being waited on are blocked other than on
- * the coordinator itself then this is to be interpreted as allowing this thread to
- * continue.
- *
- * @return If the <tt>otherWaitIsAllow</tt> flag is set, then <tt>true</tt> is returned when the thread being waited on is found
- * to be blocked outside of the thread test coordinator. <tt>false</tt> under all other conditions.
- */
- protected boolean waitFor(int[] threads, boolean otherWaitIsAllow)
- {
- return coordinator.consumeAllowEvent(threads, otherWaitIsAllow, id, this);
- }
-
- /**
- * Produces allow events on each of the specified threads.
- *
- * @param threads The set of threads that are to be allowed to continue.
- */
- protected void allow(int[] threads)
- {
- coordinator.produceAllowEvents(threads, id, this);
- }
-
- /**
- * Keeps the error message for later reporting by the coordinator.
- *
- * @param message The error message to keep.
- */
- protected void addErrorMessage(String message)
- {
- errorMessage += message;
- }
-
- /**
- * Sets the coordinator for this thread.
- *
- * @param coordinator The coordinator for this thread.
- */
- void setCoordinator(ThreadTestCoordinator coordinator)
- {
- this.coordinator = coordinator;
- }
-
- /**
- * Reports whether or not this thread is waiting on the coordinator.
- *
- * @return <tt>If this thread is waiting on the coordinator.
- */
- boolean isWaitingOnCoordinator()
- {
- return waitingOnCoordinator;
- }
-
- /**
- * Sets the value of the waiting on coordinator flag.
- *
- * @param waiting The value of the waiting on coordinator flag.
- */
- void setWaitingOnCoordinator(boolean waiting)
- {
- waitingOnCoordinator = waiting;
- }
-
- /**
- * Sets up the explicit int id for this thread.
- *
- * @param id The integer id.
- */
- void setId(int id)
- {
- this.id = id;
- }
-
- /**
- * Reports any accumulated error messages.
- *
- * @return Any accumulated error messages.
- */
- String getErrorMessage()
- {
- return errorMessage;
- }
-
- /**
- * Reports any exception thrown by the {@link #runWithExceptions} method.
- *
- * @return Any exception thrown by the {@link #runWithExceptions} method.
- */
- Exception getException()
- {
- return runException;
- }
-
- /**
- * Sets the Java thread under which this runs.
- *
- * @param thread The Java thread under which this runs.
- */
- void setThread(Thread thread)
- {
- thisThread = thread;
- }
-
- /**
- * Gets the Java thread under which this runs.
- *
- * @return The Java thread under which this runs.
- */
- Thread getThread()
- {
- return thisThread;
- }
-
- /**
- * Provides a string summary of this test threads status.
- *
- * @return Summarizes this threads status.
- */
- public String toString()
- {
- return "id = " + id + ", waitingOnCoordinator = " + waitingOnCoordinator;
- }
-}
diff --git a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/concurrency/ThreadTestCoordinator.java b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/concurrency/ThreadTestCoordinator.java
deleted file mode 100644
index 3cf8543656..0000000000
--- a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/concurrency/ThreadTestCoordinator.java
+++ /dev/null
@@ -1,486 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.junit.concurrency;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.concurrent.ThreadFactory;
-
-/**
- * ThreadTestCoordinator provides an array of binary latches that allows threads to wait for other threads or to send
- * them a signal that allows them to continue running or to wait for another thread to signal them. The binary latch
- * array is always a square array, allowing one latch from and to every thread. Upon accepting an allow signal from one
- * sender the latches for all senders for a are cleared. This class is always used in conjunction with
- * {@link TestRunnable} for writing concurrent test code that coordinates multi-threaded activity in order to reproduce
- * concurrency bugs.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Accept test threads to coordinate.
- * <tr><td> Allow test threads to send 'allow to continue' signals.
- * <tr><td> Allow test threads to wait on this coordinator for 'allow to continue' signals.
- * <tr><td> Report error messages from test threads.
- * <tr><td> Report exceptions from test threads.
- * <tr><td> Provide method to wait until all test threads have completed.
- * </table>
- *
- * @todo This code was hacked together as a bit of an experiment, because I wasn't sure if this idea would work. It has
- * proved extremely usefull. Some documentation for this needs to be written to explain it better.
- *
- * @todo Consider how deadlock detection will be handled. If all threads are blocking on the coordinator, waiting for
- * each other, they are deadlocked and there is something wrong with the test code that put them in that
- * situation. If they are all blocked elsewhere, they may be deadlocked, or could just be waiting on some
- * external event. A timeout should be used. Timeout is already implemented, just need to sanity check how
- * this is working and document it.
- *
- * @todo Consider how livelock detection could be implemented? LockFree data structures might cause live locks. I
- * guess a longish timeout is the only thing that can be done for that.
- *
- * @todo Only course grained synchronous at the method class level can be obtained. This is because test code can
- * only insert synchronization points between method calls it makes. So this code will not be usefull for
- * checking sequences of events within methods, unless the code under test is explicitly instrumented for it.
- * It might be possible to instrument code by using labels, and then use the debugger/profiler interface to
- * put breakpoints on the labels and use them as synchronization points. Not perfect, but at the unused labels
- * can be left in the code, without altering its behaviour.
- *
- * @author Rupert Smith
- */
-public class ThreadTestCoordinator
-{
- /** Used for logging. */
- private static final Logger log = LoggerFactory.getLogger(ThreadTestCoordinator.class);
-
- /** Keeps track of the test threads by their ids. */
- private TestRunnable[] testThreads; // = new TestRunnable[2];
-
- /** An explicit thread monitor for the coordinator. Threads wait on the coordinator whilst waiting for events. */
- private final Object coordinatorLock = new Object();
-
- /** A set of monitors for each test thread. */
- private Object[] locks;
-
- /** The binary latch array, this is always a square array allowing one event from and to every thread. */
- private boolean[][] allowEvents;
-
- /** Keeps track of the number of threads being coordinated. */
- private int threadCount = 0;
-
- /** Accumulates any exceptions resulting from the threads run methods. */
- private Collection<Exception> exceptions = new ArrayList<Exception>();
-
- /**
- * Holds the deadlock timeout after which threads are given a runtime exception to signal that a potential
- * deadlock may be happening.
- */
- private long deadlockTimeout = 1000 * 1000000;
-
- /** Holds the factory to create test thread with. */
- private ThreadFactory threadFactory;
-
- /**
- * Creates a new test thread coordinator. The number of threads to run must be specified here.
- *
- * @param numThreads The number of threads to run.
- */
- public ThreadTestCoordinator(int numThreads)
- {
- this.threadCount = numThreads;
-
- // Create an array big enough to hold all the test threads.
- testThreads = new TestRunnable[threadCount];
-
- // Use the default thread factory, as none specified.
- threadFactory = new DefaultThreadFactory();
- }
-
- /**
- * Creates a new test thread coordinator with a specific thread factory. The number of threads to run must be
- * specified here.
- *
- * @param numThreads The number of threads to run.
- * @param threadFactory The factory to use to create the test threads.
- */
- public ThreadTestCoordinator(int numThreads, ThreadFactory threadFactory)
- {
- this.threadCount = numThreads;
-
- // Create an array big enough to hold all the test threads.
- testThreads = new TestRunnable[threadCount];
-
- // Use the specified thread factory.
- this.threadFactory = threadFactory;
- }
-
- /**
- * Adds a thread to this coordinator and assigns an id to it. The ids must be numbered sequentially from 0 and
- * it is up to the caller to do this.
- *
- * @param runnable The test thread.
- * @param id The explicit id to assign to the test thread.
- */
- public void addTestThread(TestRunnable runnable, int id)
- {
- testThreads[id] = runnable;
- runnable.setCoordinator(this);
- runnable.setId(id);
- }
-
- /**
- * Starts all the coordinated threads running.
- */
- public void run()
- {
- // Create the monitors for each thread.
- locks = new Object[threadCount];
-
- // Create an appropriately sized event queue to allow one event from and to each thread.
- allowEvents = new boolean[threadCount][threadCount];
-
- // Initialize the monitors and clear the event queues.
- for (int i = 0; i < locks.length; i++)
- {
- locks[i] = new Object();
-
- for (int j = 0; j < locks.length; j++)
- {
- allowEvents[i][j] = false;
- }
- }
-
- // Start all the threads running.
- for (TestRunnable nextRunnable : testThreads)
- {
- // Create a Java thread for the test thread.
- Thread newThread = threadFactory.newThread(nextRunnable);
- nextRunnable.setThread(newThread);
-
- // Start it running.
- newThread.start();
- }
- }
-
- /**
- * Waits until all the test threads have completed and returns any accumulated error messages from them. Any
- * exceptions thrown by their run methods are also kept at this point.
- *
- * @return The accumulated error messages from all the threads concatenated together.
- */
- public String joinAndRetrieveMessages()
- {
- // Create an empty error message.
- String errorMessage = "";
-
- // Join all the test threads.
- for (TestRunnable r : testThreads)
- {
- Thread t = r.getThread();
-
- try
- {
- t.join();
- }
- catch (InterruptedException e)
- { }
-
- // Add any accumulated error messages to the return value.
- errorMessage += r.getErrorMessage();
-
- // Keep any exceptions resulting from the threads run method.
- Exception e = r.getException();
-
- if (e != null)
- {
- exceptions.add(e);
- }
- }
-
- return errorMessage;
- }
-
- /**
- * Reports any accumulated exceptions from the test threads run methods. This method must be called after
- * {@link #joinAndRetrieveMessages}.
- *
- * @return Any accumulated exceptions from the test threads run methods. This method must be called after
- */
- public Collection<Exception> getExceptions()
- {
- return exceptions;
- }
-
- /**
- * Sets a timeout to break out of potential deadlocks. If all threads are waiting for other threads to send
- * them continue events for longer than this timeout then the threads are all terminated.
- *
- * @param millis The minimum time to allow to pass before breaking out of any potential deadlocks.
- *
- * @todo This has not been implemented yet. If a potential deadlock happens then the joinAndRetrieveMessages
- * method should throw a PotentialDeadlockException.
- */
- public void setDeadlockTimeout(long millis)
- {
- deadlockTimeout = millis * 1000000;
- }
-
- /**
- * Creates a set of 'allow to continue' events on the event queues of the specified threads.
- *
- * @param threads The set of threads to allow to continue.
- * @param callerId The explicit id of the calling test thread.
- * @param caller The calling test thread.
- */
- void produceAllowEvents(int[] threads, int callerId, TestRunnable caller)
- {
- // Generate some debugging messages. Very usefull to know how thread synchronization is progressing.
- String message = "Thread " + callerId + " is allowing threads [ ";
-
- for (int j = 0; j < threads.length; j++)
- {
- message += threads[j] + ((j < (threads.length - 1)) ? ", " : "");
- }
-
- message += " ] to continue.";
- log.debug(message);
-
- // For each allow event, synchronize on the threads lock then set the event flag to true.
- for (int id : threads)
- {
- // Set the waiting on coordinator flag to true in case the coordinator tries to test this thread for
- // being blocked at this time.
- caller.setWaitingOnCoordinator(true);
-
- synchronized (locks[id])
- {
- // Release the wating on coordinator flag now that this thread is running again.
- caller.setWaitingOnCoordinator(false);
-
- // Send the allow to continue event to the receiving thread.
- allowEvents[id][callerId] = true;
- }
- }
-
- // Wake up any threads waiting on the coordinator lock to recheck their event queues.
- // Set the waiting on coordinator flag to true in case the coordinator tries to test this thread for
- // being blocked at this time.
- caller.setWaitingOnCoordinator(true);
-
- synchronized (coordinatorLock)
- {
- // Release the wating on coordinator flag now that this thread is running again.
- caller.setWaitingOnCoordinator(false);
- coordinatorLock.notifyAll();
- }
- }
-
- /**
- * Consumes an 'allow to continue' from one of the specified threads or waits until one is available or in some
- * cases if one of the specified threads is blocked elsewhere to accept that as an 'allow to continue' event.
- *
- * @param threads The set of threads to accept an allow to continue event from.
- * @param otherWaitIsAllow Whether or not to accept threads being blocked elsewhere as permission to continue.
- * @param callerId The explicit id of the calling test thread.
- * @param caller The calling test thread.
- *
- * @return If the <tt>otherWaitIsAllow</tt> flag is set, then <tt>true</tt> is returned when the thread being waited on is found
- * to be blocked outside of the thread test coordinator. <tt>false</tt> under all other conditions.
- */
- boolean consumeAllowEvent(int[] threads, boolean otherWaitIsAllow, int callerId, TestRunnable caller)
- {
- // Generate some debugging messages. Very usefull to know how thread synchronization is progressing.
- String message = "Thread " + callerId + " is requesting threads [ ";
-
- // Record the time at which this method was called. Will be used for breaking out of potential deadlocks.
- long startTime = System.nanoTime();
-
- for (int j = 0; j < threads.length; j++)
- {
- message += threads[j] + ((j < (threads.length - 1)) ? ", " : "");
- }
-
- message += " ] to allow it to continue.";
- log.debug(message);
-
- // Loop until an allow to continue event is received.
- while (true)
- {
- // Look at all the allowing thread to see if one has created an event for consumption.
- for (int allowerId : threads)
- {
- // Get the threads lock for the event to consume.
- // Set the waiting on coordinator flag to true in case the coordinator tries to test this thread for
- // being blocked at this time.
- caller.setWaitingOnCoordinator(true);
-
- synchronized (locks[callerId])
- {
- // Release the wating on coordinator flag now that this thread is running again.
- caller.setWaitingOnCoordinator(false);
-
- // Check if there is an event on the queue from the allowing thread to this one.
- if (allowEvents[callerId][allowerId])
- {
- log.debug("Found an allow event, thread " + allowerId + ", is allowing thread " + callerId
- + ", to continue.");
-
- // Consume all the allow events for this thread.
- /*for (int i = 0; i < allowEvents[callerId].length; i++)
- {
- allowEvents[callerId][i] = false;
- }*/
-
- // Consume just the event from the allower to the consumer, leaving other pending allow events alone.
- allowEvents[callerId][allowerId] = false;
-
- return false;
- }
- }
- }
-
- // If waiting elsewhere is to be interpreted as an 'allow to continue' event, then look at the thread status
- // for the threads being waited on to see if any are blocked on other resources.
- if (otherWaitIsAllow)
- {
- log.debug("Other wait is to be interpreted as an allow event.");
-
- // Look at all the potential allower threads.
- for (int allowerId : threads)
- {
- // Get the Java thread state for the allowing thread.
- Thread threadToTest = testThreads[allowerId].getThread();
- Thread.State state = threadToTest.getState();
-
- // Check if the thread is blocked and so a potential candidate for releasing this one.
- if ((state == Thread.State.BLOCKED) || (state == Thread.State.WAITING)
- || (state == Thread.State.TIMED_WAITING))
- {
- log.debug("Found an allower thread, id = " + allowerId + ", that is blocked or wating.");
-
- // Check that the allower thread is not waiting on the coordinator lock or any of the
- // individual thread locks. It must be waiting or blocked on another monitor.
- TestRunnable allowingRunnable = testThreads[allowerId];
- boolean isWaitingOnCoordinator = allowingRunnable.isWaitingOnCoordinator();
-
- if (!isWaitingOnCoordinator)
- {
- log.debug("The allower thread, id = " + allowerId
- + ", is blocked or waiting other than on the coordinator.");
-
- // Get the threads lock for the event to consume.
- caller.setWaitingOnCoordinator(true);
-
- synchronized (locks[callerId])
- {
- caller.setWaitingOnCoordinator(false);
-
- // Consume all the allow events for this thread.
- for (int i = 0; i < allowEvents[callerId].length; i++)
- {
- allowEvents[callerId][i] = false;
- }
-
- return true;
- }
- }
- else
- {
- log.debug("The waiting allower thread, " + allowerId
- + ", is waiting on the coordinator so does not allow thread " + callerId + " to continue.");
- }
- }
- }
- }
-
- // Keep waiting until an 'allow to continue' event can be consumed.
- try
- {
- // Set the waiting on coordinator flag to true in case the coordinator tries to test this thread for
- // being blocked at this time.
- caller.setWaitingOnCoordinator(true);
-
- synchronized (coordinatorLock)
- {
- // Release the wating on coordinator flag now that this thread is running again.
- caller.setWaitingOnCoordinator(false);
-
- log.debug("Thread " + callerId + " is waiting on coordinator lock for more allow events.");
-
- // Set the waiting on coordinator flag to true in case the coordinator tries to test this thread for
- // being blocked at this time.
- caller.setWaitingOnCoordinator(true);
- coordinatorLock.wait(10);
- }
- }
- catch (InterruptedException e)
- { }
-
- // Release the waiting on coordinator flag now that this thread is running again.
- caller.setWaitingOnCoordinator(false);
-
- // Check if this thread has been waiting for longer than the deadlock timeout and raise a possible
- // deadlock exception if so.
- long waitTime = System.nanoTime() - startTime;
- log.debug("Thread " + callerId + " has been waiting for " + (waitTime / 1000000) + " milliseconds.");
-
- if (waitTime > deadlockTimeout)
- {
- // Throw a possible deadlock exception.
- throw new PossibleDeadlockException("Possible deadlock due to timeout with state:\n" + this);
- }
-
- log.debug("Thread " + callerId + " has woken up, was waiting for more allow events to become available.");
- }
- }
-
- /**
- * Pretty prints the state of the thread test coordinator, for debugging purposes.
- *
- * @return Pretty printed state of the thread test coordinator.
- */
- public String toString()
- {
- String result = "[";
-
- for (int i = 0; i < allowEvents.length; i++)
- {
- for (int j = 0; j < allowEvents[i].length; j++)
- {
- result += allowEvents[i][j];
-
- result += (j < (allowEvents[i].length - 1)) ? ", " : "";
- }
-
- result += (i < (allowEvents.length - 1)) ? ",\n " : "";
- }
-
- result += "]";
-
- for (int i = 0; i < testThreads.length; i++)
- {
- result += "thread[" + i + "] = " + testThreads[i].toString();
- }
-
- return result;
- }
-
-}
diff --git a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/concurrency/ThreadTestExample.java b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/concurrency/ThreadTestExample.java
deleted file mode 100644
index b9865f2e22..0000000000
--- a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/concurrency/ThreadTestExample.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.junit.concurrency;
-
-import org.apache.log4j.Logger;
-
-/**
- * An example to illustrate the use of the {@link ThreadTestCoordinator} and {@link TestRunnable}s.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Demo multi-threaded testing.
- * </table>
- *
- * @author Rupert Smith
- */
-public class ThreadTestExample
-{
- /** Used for logging. */
- private static final Logger log = Logger.getLogger(ThreadTestExample.class);
-
- /** Test thread 1. */
- TestRunnable testThread1 =
- new TestRunnable()
- {
- public void runWithExceptions() throws Exception
- {
- log.debug("public void run(): called");
- log.info("in testThread0, block 1");
-
- // Wait for t2 to allow t1 to continue.
- allow(new int[] { 1 });
- waitFor(new int[] { 1 }, false);
-
- log.info("in testThread0, block 2");
-
- // Wait for t2 to allow t1 to continue. T2 is allowed to be blocked elsewhere than giving explicit
- // permission to allow t1 to continue.
- allow(new int[] { 1 });
- waitFor(new int[] { 1 }, true);
-
- log.info("in testThread0, block 3");
-
- // Release thread 2 from waiting on the shared lock.
- synchronized (sharedLock)
- {
- sharedLock.notifyAll();
- }
-
- allow(new int[] { 1 });
- }
- };
-
- /** A shared lock between the test threads. */
- final Object sharedLock = new Object();
-
- /** Test thread 2. */
- TestRunnable testThread2 =
- new TestRunnable()
- {
- public void runWithExceptions() throws Exception
- {
- log.debug("public void run(): called");
- log.info("in testThread1, block 1");
-
- // Wait for t1 to allow t2 to continue.
- allow(new int[] { 0 });
- waitFor(new int[] { 0 }, false);
-
- log.info("in testThread1, block 2");
-
- // Wait on another resource. T1 should accept this as permission to continue.
- try
- {
- synchronized (sharedLock)
- {
- log.debug("in testThread1, waiting on shared lock.");
- sharedLock.wait();
- }
- }
- catch (InterruptedException e)
- {
- // Bail-out with a runtime if this happens.
- throw new RuntimeException("Interrupted whilst waiting for shared lock.", e);
- }
-
- log.info("in testThread1, finished waiting on shared lock.");
-
- // allow(new int[] { 0 });
-
- // Wait for t1 to allow t2 to continue.
- waitFor(new int[] { 0 }, false);
-
- log.info("in testThread1, block 3");
-
- allow(new int[] { 0 });
- }
- };
-
- /**
- * Executes the test threads with coordination.
- *
- * @param args Ignored.
- */
- public void main(String[] args)
- {
- ThreadTestCoordinator tt = new ThreadTestCoordinator(2);
-
- tt.addTestThread(testThread1, 0);
- tt.addTestThread(testThread2, 1);
- tt.setDeadlockTimeout(500);
- tt.run();
-
- String errorMessage = tt.joinAndRetrieveMessages();
-
- // Print any error messages or exceptions.
- log.info(errorMessage);
-
- if (!tt.getExceptions().isEmpty())
- {
- for (Exception e : tt.getExceptions())
- {
- log.warn("Exception thrown during test thread: ", e);
- }
- }
- }
-}
diff --git a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/concurrency/package.html b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/concurrency/package.html
deleted file mode 100644
index 904fd0fd05..0000000000
--- a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/concurrency/package.html
+++ /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.
-
--->
-
-<html>
-<body>
-Contains code to assist in testing concurrency issues using coordinated threads to present code under test with
-oportunities to expose concurrency bugs. Some example concurrency bugs that may be tested using these techniques are
-race conditions, dead locks, live locks, dirty reads, phantom reads, non repeatable reads and so on.
-</body>
-</html>
diff --git a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/AsymptoticTestCase.java b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/AsymptoticTestCase.java
deleted file mode 100644
index 58a7f60f3c..0000000000
--- a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/AsymptoticTestCase.java
+++ /dev/null
@@ -1,303 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.junit.extensions;
-
-import junit.framework.TestCase;
-
-import org.apache.log4j.Logger;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-
-/**
- * AsymptoticTestCase is an extension of TestCase for writing unit tests to analyze asymptotic time and space behaviour.
- *
- * <p>ParameterizedTestCases allow tests to be defined which have test methods that take a single int argument. Normal
- * JUnit test methods do not take any arguments. This int argument can be interpreted in any way by the test but it is
- * intended to denote the 'size' of the test to be run. For example, when testing the performance of a data structure
- * for different numbers of data elements held in the data structure the int parameter should be interpreted as the
- * number of elements. Test timings for different numbers of elements can then be captured and the asymptotic behaviour
- * of the data structure with respect to time analyzed. Any non-parameterized tests defined in extensions of this class
- * will also be run.
- *
- * <p>TestCases derived from this class may also define tear down methods to clean up their memory usage. This is
- * intended to be used in conjunction with memory listeners that report the amount of memory a test uses. The idea is
- * to write a test that allocates memory in the main test method in such a way that it leaves that memory still
- * allocated at the end of the test. The amount of memory used can then be measured before calling the tear down method
- * to clean it up. In the data structure example above, a test will allocate as many elements as are requested by the
- * int parameter and deallocate them in the tear down method. In this way memory readings for different numbers of
- * elements can be captured and the asymptotic behaviour of the data structure with respect to space analyzed.
- *
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Store the current int parameter value. <td> {@link TKTestResult} and see {@link AsymptoticTestDecorator} too.
- * <tr><td> Invoke parameterized test methods.
- * </table>
- *
- * @todo If possible try to move the code that invokes the test and setup/teardown methods into {@link TKTestResult} or
- * {@link AsymptoticTestDecorator} rather than this class. This would mean that tests don't have to extend this
- * class to do time and space performance analysis, these methods could be added to any JUnit TestCase class
- * instead. This would be an improvement because existing unit tests wouldn't have to extend a different class to
- * work with this extension, and also tests that extend other junit extension classes could have parameterized
- * and tear down methods too.
- *
- * @author Rupert Smith
- */
-public class AsymptoticTestCase extends TestCase implements InstrumentedTest
-{
- /** Used for logging. */
- private static final Logger log = Logger.getLogger(AsymptoticTestCase.class);
-
- /** The name of the test case. */
- private String testCaseName;
-
- /** Thread local for holding measurements on a per thread basis. */
- ThreadLocal<TestMeasurements> threadLocalMeasurement =
- new ThreadLocal<TestMeasurements>()
- {
- /**
- * Sets up a default set test measurements (zeroed, apart from the size param which defaults to 1).
- *
- * @return A set of default test measurements.
- */
- protected synchronized TestMeasurements initialValue()
- {
- return new TestMeasurements();
- }
- };
-
- /**
- * Constructs a test case with the given name.
- *
- * @param name The name of the test.
- */
- public AsymptoticTestCase(String name)
- {
- super(name);
-
- log.debug("public AsymptoticTestCase(String " + name + "): called");
- testCaseName = name;
- }
-
- /**
- * Gets the current value of the integer parameter to be passed to the parameterized test.
- *
- * @return The current value of the integer parameter.
- */
- public int getN()
- {
- log.debug("public int getN(): called");
- int n = threadLocalMeasurement.get().n;
-
- log.debug("return: " + n);
-
- return n;
- }
-
- /**
- * Sets the current value of the integer parameter to be passed to the parameterized test.
- *
- * @param n The new current value of the integer parameter.
- */
- public void setN(int n)
- {
- log.debug("public void setN(int " + n + "): called");
- threadLocalMeasurement.get().n = n;
- }
-
- /**
- * Reports how long the test took to run.
- *
- * @return The time in milliseconds that the test took to run.
- */
- public long getTestTime()
- {
- log.debug("public long getTestTime(): called");
- long startTime = threadLocalMeasurement.get().startTime;
- long endTime = threadLocalMeasurement.get().endTime;
- long testTime = endTime - startTime;
-
- log.debug("return: " + testTime);
-
- return testTime;
- }
-
- /**
- * Reports the memory usage at the start of the test.
- *
- * @return The memory usage at the start of the test.
- */
- public long getTestStartMemory()
- {
- // log.debug("public long getTestStartMemory(): called");
- long startMem = threadLocalMeasurement.get().startMem;
-
- // log.debug("return: " + startMem);
-
- return startMem;
- }
-
- /**
- * Reports the memory usage at the end of the test.
- *
- * @return The memory usage at the end of the test.
- */
- public long getTestEndMemory()
- {
- // log.debug("public long getTestEndMemory(): called");
- long endMem = threadLocalMeasurement.get().endMem;
-
- // log.debug("return: " + endMem);
- return endMem;
- }
-
- /**
- * Resets the instrumentation values to zero, and nulls any references to held measurements so that the memory
- * can be reclaimed.
- */
- public void reset()
- {
- log.debug("public void reset(): called");
- threadLocalMeasurement.remove();
- }
-
- /**
- * Runs the test method for this test case.
- *
- * @throws Throwable Any Throwables from the test methods invoked are allowed to fall through.
- */
- protected void runTest() throws Throwable
- {
- log.debug("protected void runTest(): called");
-
- // Check that a test name has been set. This is used to define which method to run.
- assertNotNull(testCaseName);
- log.debug("testCaseName = " + testCaseName);
-
- // Try to get the method with matching name.
- Method runMethod = null;
- boolean isParameterized = false;
-
- // Check if a parameterized test method is available.
- try
- {
- // Use getMethod to get all public inherited methods. getDeclaredMethods returns all
- // methods of this class but excludes the inherited ones.
- runMethod = getClass().getMethod(testCaseName, int.class);
- isParameterized = true;
- }
- catch (NoSuchMethodException e)
- {
- // log.debug("Parameterized method \"" + testCaseName + "\" not found.");
- // Set run method to null (it already will be but...) to indicate that no parameterized method
- // version could be found.
- runMethod = null;
- }
-
- // If no parameterized method is available, try and get the unparameterized method.
- if (runMethod == null)
- {
- try
- {
- runMethod = getClass().getMethod(testCaseName);
- isParameterized = false;
-
- }
- catch (NoSuchMethodException e)
- {
- fail("Method \"" + testCaseName + "\" not found.");
- }
- }
-
- // Check that the method is publicly accessable.
- if (!Modifier.isPublic(runMethod.getModifiers()))
- {
- fail("Method \"" + testCaseName + "\" should be public.");
- }
-
- // Try to execute the method, passing it the current int parameter value. Allow any invocation exceptions or
- // resulting exceptions from the method to fall through.
- try
- {
- Integer paramN = getN();
- log.debug("paramN = " + paramN);
-
- // Calculate parameters for parameterized tests so new does not get called during memory measurement.
- Object[] params = new Object[] { paramN };
-
- // Take the test start memory and start time.
- threadLocalMeasurement.get().startMem = 0; // SizeOf.getUsedMemory();
-
- threadLocalMeasurement.get().startTime = System.nanoTime();
-
- if (isParameterized)
- {
- runMethod.invoke(this, params);
- }
- else
- {
- runMethod.invoke(this);
- }
- }
- catch (InvocationTargetException e)
- {
- e.fillInStackTrace();
- throw e.getTargetException();
- }
- catch (IllegalAccessException e)
- {
- e.fillInStackTrace();
- throw e;
- }
- finally
- {
- // Take the test end memory and end time and calculate how long it took to run.
- long endTime = System.nanoTime();
- threadLocalMeasurement.get().endTime = endTime;
- log.debug("startTime = " + threadLocalMeasurement.get().startTime + ", endTime = " + endTime + ", testTime = "
- + getTestTime());
-
- threadLocalMeasurement.get().endMem = 0; // SizeOf.getUsedMemory();
- }
- }
-
- /**
- * The test parameters, encapsulated as a unit for attaching on a per thread basis.
- */
- private static class TestMeasurements
- {
- /** Holds the current value of the integer parameter to run tests on. */
- public int n = 1;
-
- /** Holds the test start memory. */
- public long startTime = 0;
-
- /** Holds the test end memory. */
- public long endTime = 0;
-
- /** Holds the test start memory. */
- public long startMem = 0;
-
- /** Holds the test end memory. */
- public long endMem = 0;
- }
-}
diff --git a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/AsymptoticTestDecorator.java b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/AsymptoticTestDecorator.java
deleted file mode 100644
index 8869d25be3..0000000000
--- a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/AsymptoticTestDecorator.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.junit.extensions;
-
-import junit.framework.TestResult;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.junit.extensions.util.MathUtils;
-
-/**
- * A Decorator that runs a test repeatedly on an increasing int parameter, or for a fixed number of repeats. If both
- * a set of integer parameters and a repeat count are specified, then each test is run for the repeat count at each
- * integer parameter.
- *
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Repeat a test for each of a set of integer parameters. <td> {@link TKTestResult}
- * <tr><td> Repeat a test multiple times.
- * <tr><td>
- * </table>
- *
- * @author Rupert Smith
- */
-public class AsymptoticTestDecorator extends WrappedSuiteTestDecorator
-{
- /** Used for logging. */
- private static final Logger log = Logger.getLogger(AsymptoticTestDecorator.class);
-
- /** The int size parameters to run the test with. */
- private int[] params;
-
- /** The number of times the whole test should be repeated. */
- private int repeat;
-
- /**
- * Creates an asymptotic test decorator that wraps a test with repeats and a set of integer 'size' paramters
- * to call the test with.
- *
- * @param test The test to wrap.
- * @param params The integer 'size' parameters.
- * @param repeat The number of times to repeat the test.
- */
- public AsymptoticTestDecorator(WrappedSuiteTestDecorator test, int[] params, int repeat)
- {
- super(test);
-
- log.debug("public AsymptoticTestDecorator(Test \"" + test + "\", int[] "
- + ((params == null) ? null : MathUtils.printArray(params)) + ", int " + repeat + "): called");
-
- this.params = params;
- this.repeat = repeat;
- }
-
- /**
- * Creates a new AsymptoticTestDecorator object.
- *
- * @param test The test to decorate.
- * @param start The starting asymptotic integer parameter value.
- * @param end The ending asymptotic integer parameter value.
- * @param step The increment size to move from the start to end values by.
- * @param repeat The number of times to repeat the test at each step of the cycle.
- */
- public AsymptoticTestDecorator(WrappedSuiteTestDecorator test, int start, int end, int step, int repeat)
- {
- super(test);
-
- if (start < 0)
- {
- throw new IllegalArgumentException("Start must be >= 0");
- }
-
- if (end < start)
- {
- throw new IllegalArgumentException("End must be >= start");
- }
-
- if (step < 1)
- {
- throw new IllegalArgumentException("Step must be >= 1");
- }
-
- if (repeat < 1)
- {
- throw new IllegalArgumentException("Repeat must be >= 1");
- }
-
- // Generate the sequence.
- params = new int[((end - start) / step) + 1];
- int i = 0;
- for (int n = start; n <= end; n += step)
- {
- params[i++] = n;
- }
-
- this.repeat = repeat;
- }
-
- /**
- * Runs the test repeatedly for each value of the int parameter specified and for the correct number of test
- * repeats.
- *
- * @param result The test result object that the tests will indicate their results to. This is also used
- * to pass the int parameter from this class to the decorated test class.
- */
- public void run(TestResult result)
- {
- log.debug("public void run(TestResult result): called");
-
- if (!(result instanceof TKTestResult))
- {
- throw new IllegalArgumentException("AsymptoticTestDecorator only works with TKTestResult");
- }
-
- // Cast the test result into a TKTestResult to place the current parameter into.
- TKTestResult tkResult = (TKTestResult) result;
-
- log.debug("params = " + ((params == null) ? null : MathUtils.printArray(params)));
- log.debug("repeat = " + repeat);
-
- if(params != null)
- {
- for (int n : params)
- {
- for (int j = 0; j < repeat; j++)
- {
- log.debug("n = " + n);
-
- // Set the integer parameter in the TKTestResult to be passed to the tests.
- tkResult.setN(n);
-
- if (tkResult.shouldStop())
- {
- log.debug("tkResult.shouldStop = " + true);
-
- break;
- }
-
- log.debug("Calling super#run");
- super.run(tkResult);
- }
- }
- }
- }
-
- /**
- * Prints out the name of this test with the string "(parameterized)" appended onto it for debugging purposes.
- *
- * @return The name of this test with the string "(parameterized)" appended onto it.
- */
- public String toString()
- {
- return super.toString() + "(parameterized)";
- }
-}
diff --git a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/BaseThrottle.java b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/BaseThrottle.java
deleted file mode 100644
index 61d5746421..0000000000
--- a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/BaseThrottle.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.junit.extensions;
-
-/**
- * Provides a base implementation of the non-waiting throttle checking method, using the system nano timer.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Check against a throttle speed without waiting.
- * </table>
- *
- * @author Rupert Smith
- */
-public abstract class BaseThrottle implements Throttle
-{
- /** Holds the length of a single cycle in nano seconds. */
- protected long cycleTimeNanos;
-
- /** Holds the time of the last succesfull call to the check method. */
- private long lastCheckTimeNanos;
-
- /** Flag used to detect the first call to the {@link #checkThrottle()} method. */
- boolean firstCheckCall = true;
-
- /**
- * Flag used to detect the first call to the {@link #throttle()} method. Zero or negative start time cannot be
- * relied on to detect this as System.nanoTime can return zero or negative values.
- */
- boolean firstCall = true;
-
- /**
- * Specifies the throttling rate in operations per second. This must be called with with a value, the inverse
- * of which is a measurement in nano seconds, such that the number of nano seconds do not overflow a long integer.
- * The value must also be larger than zero.
- *
- * @param hertz The throttling rate in cycles per second.
- */
- public void setRate(float hertz)
- {
- // Check that the argument is above zero.
- if (hertz <= 0.0f)
- {
- throw new IllegalArgumentException("The throttle rate must be above zero.");
- }
-
- // Calculate the cycle time.
- cycleTimeNanos = (long) (1000000000f / hertz);
-
- // Reset the first pass flag.
- firstCall = false;
- firstCheckCall = false;
- }
-
- /**
- * Checks but does not enforce the throttle rate. When this method is called, it checks if a length of time greater
- * than that equal to the inverse of the throttling rate has passed since it was last called and returned <tt>true</tt>
- *
- * @return <tt>true</tt> if a length of time greater than that equal to the inverse of the throttling rate has
- * passed since this method was last called and returned <tt>true</tt>, <tt>false</tt> otherwise. The very
- * first time this method is called on a throttle, it returns <tt>true</tt> as the base case to the above
- * self-referential definition.
- */
- public boolean checkThrottle()
- {
- long now = System.nanoTime();
-
- if ((now > (cycleTimeNanos + lastCheckTimeNanos)) || firstCheckCall)
- {
- firstCheckCall = false;
- lastCheckTimeNanos = now;
-
- return true;
- }
- else
- {
- return false;
- }
- }
-}
diff --git a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/BatchedThrottle.java b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/BatchedThrottle.java
deleted file mode 100644
index 241e7aa2b7..0000000000
--- a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/BatchedThrottle.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.junit.extensions;
-
-/**
- * BatchedThrottle is a {@link SleepThrottle} that uses batching to achieve much higher throttling rates than a sleep
- * throttle can. Sleep throttle has difficulties once the rate gets above a few hundred hertz, because the JVM cannot
- * generate timed pauses that are that short. BatchedThrottle gets around this by only inserting pauses once every so
- * many calls to the {@link #throttle()} method, and using a sleep throttle run at a lower rate. The rate for the sleep
- * throttle is chosen so that it remains under 100hz. The final throttling rate of this throttle is equal to the batch
- * size times the rate of the underlying sleep throttle.
- *
- * <p/>The batching calculation involves taking the log to the base 100 of the desired rate and rounding this to
- * an integer. The batch size is always an exact power of 100 because of the rounding. The rate for an underlying
- * sleep throttle is then chosen appropriately.
- *
- * <p/>In practice, the accuracy of a BacthedThrottle skews off but can sometimes even be reasonable up to ten thousand
- * hertz compared with 100 Hz for a {@link SleepThrottle}.
- *
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Accept throttling rate in operations per second.
- * <tr><td> Inject short pauses, occasionaly, to fill out processing cycles to a specified rate.
- * <tr><td> Check against a throttle speed without waiting.
- * </table>
- *
- * @todo Should always round the log base 100 down to the nearest integer?
- *
- * @author Rupert Smith
- */
-public class BatchedThrottle extends BaseThrottle
-{
- /** Holds the batch size. */
- int batchSize;
-
- /** The call count within the current batch. */
- long callCount;
-
- /** Holds a sleep throttle configured to run at the batched rate. */
- private Throttle batchRateThrottle = new SleepThrottle();
-
- /**
- * Specifies the throttling rate in operations per second.
- *
- * @param hertz The throttling rate in cycles per second.
- */
- public void setRate(float hertz)
- {
- // Pass the rate unaltered down to the base implementation, for the check method.
- super.setRate(hertz);
-
- // Log base 10 over 2 is used here to get a feel for what power of 100 the total rate is.
- // As the total rate goes up the powers of 100 the batch size goes up by powers of 100 to keep the
- // throttle rate in the range 1 to 100.
- int x = (int) (Math.log10(hertz) / 2);
- batchSize = (int) Math.pow(100, x);
- float throttleRate = hertz / batchSize;
-
- // Reset the call count.
- callCount = 0;
-
- // Set the sleep throttle wrapped implementation at a rate within its abilities.
- batchRateThrottle.setRate(throttleRate);
- }
-
- /**
- * Throttle calls to this method to the rate specified by the {@link #setRate(float)} method.
- */
- public void throttle()
- {
- if ((callCount++ % batchSize) == 0)
- {
- batchRateThrottle.throttle();
- }
- }
-}
diff --git a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/DurationTestDecorator.java b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/DurationTestDecorator.java
deleted file mode 100644
index e99fcce752..0000000000
--- a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/DurationTestDecorator.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.junit.extensions;
-
-import junit.framework.Test;
-import junit.framework.TestResult;
-
-import org.apache.log4j.Logger;
-
-import java.util.Timer;
-import java.util.TimerTask;
-
-/**
- * A test decorator that runs a test repeatedly until a specified length of time has passed.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Repeatedly run a test for a fixed length of time.
- * </table>
- *
- * @todo The count of the number of tests run is an important number to keep. Also num passed/error/failed is also
- * important to record. What to do with these numbers? They are already logged to the test listeners.
- *
- * @todo The duration test runner wraps on top of size, repeat or thread wrappers, need a way for it to tell
- * TKTestResult when the duration is up, so that it can terminate any repeats in progress. It should end
- * as soon as possible once the test method exits.
- *
- * @author Rupert Smith
- */
-public class DurationTestDecorator extends WrappedSuiteTestDecorator implements ShutdownHookable
-{
- /** Used for logging. */
- private static final Logger log = Logger.getLogger(DurationTestDecorator.class);
-
- /** The test to run. */
- private Test test;
-
- /** The length of time to run the test for. */
- private long duration;
-
- /** Flag set by the shutdown hook. This decorator will not start any new tests when this is set. */
- private boolean shutdown = false;
-
- /**
- * Creates an active test with default multiplier (1).
- *
- * @param test The target test.
- */
- public DurationTestDecorator(WrappedSuiteTestDecorator test)
- {
- super(test);
- this.test = test;
- }
-
- /**
- * Creates active test with default multiplier (1).
- *
- * @param test The target test.
- * @param duration The duration in milliseconds.
- */
- public DurationTestDecorator(WrappedSuiteTestDecorator test, long duration)
- {
- super(test);
-
- // log.debug("public DurationTestDecorator(Test \"" + test + "\", long " + duration + "): called");
-
- this.test = test;
- this.duration = duration;
- }
-
- /**
- * Runs the test repeatedly for the fixed duration.
- *
- * @param testResult The the results object to monitor the test results with.
- */
- public void run(TestResult testResult)
- {
- log.debug("public void run(TestResult testResult): called");
-
-// Removing the durationTimer as this addition prevents this TestDecorator being wrapped with a Scaled Test Decorator.
- // This change will cause the tests to run for at least the specified duration
- // If we need the test to stop much closer to the specified duration then we need to
- // ensure that the solution doesn't prevent this Decorator being wrapped with other Decorators.
-
-// // Cast the test result to expose it as a TKTestResult if the test is running under the TKTestRunner.
-// TKTestResult tkTestResult = null;
-//
-// if (testResult instanceof TKTestResult)
-// {
-// tkTestResult = (TKTestResult) testResult;
-// }
-//
-// // If running under the TKTestRunner, set up a timer to notify the test framework when the test reaches its
-// // completion time.
-// Timer durationTimer = null;
-//
-// if (tkTestResult != null)
-// {
-// log.debug("Creating duration timer.");
-//
-// durationTimer = new Timer();
-// durationTimer.schedule(new DurationTimerTask((TKTestResult) testResult), duration);
-// }
-
-
- // Work out when the test should end.
- long now = System.nanoTime();
- long end = (duration * 1000000) + now;
-
- // Run the test until the duration times out or the shutdown flag is set. The test method may not exit until
- // interrupted in some cases, in which case the timer will do the interrupting.
- while ((now < end) && !shutdown)
- {
- test.run(testResult);
-
- now = System.nanoTime();
- }
-
-// // Clean up any timer that was used.
-// if (durationTimer != null)
-// {
-// log.debug("Cancelling duration timer.");
-//
-// durationTimer.cancel();
-// }
- }
-
- /**
- * Supplies the shutdown hook. This shutdown hook does not call {@link TKTestResult#shutdownNow()} because the
- * {@link ScaledTestDecorator} already takes care of that.
- *
- * @return The shut down hook.
- */
- public Thread getShutdownHook()
- {
- return new Thread(new Runnable()
- {
- public void run()
- {
- // log.debug("DurationTestDecorator::ShutdownHook: called");
-
- // Set the shutdown flag so that no new tests are started.
- shutdown = true;
- }
- });
- }
-
-// /**
-// * DurationTimerTask is a timer task that is configured, upon expiry of its timer, to invoke
-// * {@link TKTestResult#shutdownNow()}, for the test result object on which it is set. It also sets
-// * the {@link DurationTestDecorator#shutdown} flag to indicate that no new tests should be run.
-// *
-// * <p/>The test loop implemented by DurationTestDecorator checks that the duration has not expired, on each
-// * test case that it runs. However, it is possible to write test cases that never return until explicitly
-// * interrupted by the test framework. This timer task exists to notify the test framework
-// */
-// private class DurationTimerTask extends TimerTask
-// {
-// /** Used for debugging purposes. */
-// private final Logger log = Logger.getLogger(DurationTimerTask.class);
-//
-// /** Holds the test result for the test to which a duration limit is being applied. */
-// TKTestResult testResult;
-//
-// /**
-// * Creates a duration limit timer which will notify the specified test result when the duration has
-// * expired.
-// *
-// * @param testResult The test result to notify upon expiry of the test duration.
-// */
-// public DurationTimerTask(TKTestResult testResult)
-// {
-// this.testResult = testResult;
-// }
-//
-// /**
-// * The action to be performed by this timer task.
-// */
-// public void run()
-// {
-// log.debug("public void run(): called");
-//
-// shutdown = true;
-// testResult.shutdownNow();
-// }
-// }
-}
diff --git a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/InstrumentedTest.java b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/InstrumentedTest.java
deleted file mode 100644
index 0804757dce..0000000000
--- a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/InstrumentedTest.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.junit.extensions;
-
-import junit.framework.Test;
-
-/**
- * An InstrumentedTest is one which can supply some additional instrumentation on top of the pass/fail/error behaviour
- * of normal junit tests. Tests implementing this interface must additionally supply information about how long they
- * took to run and how much memory they used.
- *
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities
- * <tr><td> Report test run time.
- * <tr><td> Report test memory usage.
- * </table>
- *
- * @author Rupert Smith
- */
-public interface InstrumentedTest extends Test
-{
- /**
- * Reports how long the test took to run.
- *
- * @return The time in milliseconds that the test took to run.
- */
- public long getTestTime();
-
- /**
- * Reports the memory usage at the start of the test.
- *
- * @return The memory usage at the start of the test.
- */
- public long getTestStartMemory();
-
- /**
- * Reports the memory usage at the end of the test.
- *
- * @return The memory usage at the end of the test.
- */
- public long getTestEndMemory();
-
- /**
- * Resets the instrumentation values to zero, and nulls any references to held measurements so that the memory
- * can be reclaimed.
- */
- public void reset();
-}
diff --git a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/NullResultPrinter.java b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/NullResultPrinter.java
deleted file mode 100644
index 6727f6f152..0000000000
--- a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/NullResultPrinter.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.junit.extensions;
-
-import junit.framework.AssertionFailedError;
-import junit.framework.Test;
-
-import junit.textui.ResultPrinter;
-
-import java.io.PrintStream;
-
-/**
- * A ResultPrinter that prints nothing. This exists, in order to provide a replacement to JUnit's ResultPrinter, which
- * is refered to directly by JUnit code, rather that as an abstracted TestListener. JUnit's text ui TestRunner must
- * have a ResultPrinter. This provides an implementation of it that prints nothing, so that a better mechanism can
- * be used for providing feedback to the console instead.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td>
- * </table>
- *
- * @todo See todo in TKTestRunner about completely replacing the test ui runner. Doing things like this in order to
- * extend JUnit is not nice, and there needs to be a better way to do it. Delete this class and use a listener
- * instead.
- *
- * @author Rupert Smith
- */
-public class NullResultPrinter extends ResultPrinter
-{
- /**
- * Builds a fake ResultPrinter that prints nothing.
- *
- * @param writer The writer to send output to.
- */
- public NullResultPrinter(PrintStream writer)
- {
- super(writer);
- }
-
- /**
- * Does nothing.
- *
- * @param test Ignored.
- * @param t Ignored.
- */
- public void addError(Test test, Throwable t)
- { }
-
- /**
- * Does nothing.
- *
- * @param test Ignored.
- * @param t Ignored.
- */
- public void addFailure(Test test, AssertionFailedError t)
- { }
-
- /**
- * Does nothing.
- *
- * @param test Ignored.
- */
- public void endTest(Test test)
- { }
-
- /**
- * Does nothing.
- *
- * @param test Ignored.
- */
- public void startTest(Test test)
- { }
-}
diff --git a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/ParameterVariationTestDecorator.java b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/ParameterVariationTestDecorator.java
deleted file mode 100644
index 7da4667928..0000000000
--- a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/ParameterVariationTestDecorator.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.junit.extensions;
-
-import junit.framework.TestResult;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.junit.extensions.util.MathUtils;
-
-/**
- * ParameterVariationTestDecorator is a test decorator that runs a test repeatedly under all permutations of its
- * test parameters.
- *
- * a set of integer parameters and a repeat count are specified, then each test is run for the repeat count at each
- * integer parameter.
- *
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Repeat a test for each of a set of integer parameters. <td> {@link org.apache.qpid.junit.extensions.TKTestResult}
- * <tr><td> Repeat a test multiple times.
- * <tr><td>
- * </table>
- *
- * @author Rupert Smith
- */
-public class ParameterVariationTestDecorator extends WrappedSuiteTestDecorator
-{
- /** Used for logging. */
- private static final Logger log = Logger.getLogger(ParameterVariationTestDecorator.class);
-
- /** The int size parameters to run the test with. */
- private int[] params;
-
- /** The number of times the whole test should be repeated. */
- private int repeat;
-
- /**
- * Creates an asymptotic test decorator that wraps a test with repeats and a set of integer 'size' paramters
- * to call the test with.
- *
- * @param test The test to wrap.
- * @param params The integer 'size' parameters.
- * @param repeat The number of times to repeat the test.
- */
- public ParameterVariationTestDecorator(WrappedSuiteTestDecorator test, int[] params, int repeat)
- {
- super(test);
-
- log.debug("public AsymptoticTestDecorator(Test \"" + test + "\", int[] "
- + ((params == null) ? null : MathUtils.printArray(params)) + ", int " + repeat + "): called");
-
- this.params = params;
- this.repeat = repeat;
- }
-
- /**
- * Creates a new AsymptoticTestDecorator object.
- *
- * @param test The test to decorate.
- * @param start The starting asymptotic integer parameter value.
- * @param end The ending asymptotic integer parameter value.
- * @param step The increment size to move from the start to end values by.
- * @param repeat The number of times to repeat the test at each step of the cycle.
- */
- public ParameterVariationTestDecorator(WrappedSuiteTestDecorator test, int start, int end, int step, int repeat)
- {
- super(test);
-
- if (start < 0)
- {
- throw new IllegalArgumentException("Start must be >= 0");
- }
-
- if (end < start)
- {
- throw new IllegalArgumentException("End must be >= start");
- }
-
- if (step < 1)
- {
- throw new IllegalArgumentException("Step must be >= 1");
- }
-
- if (repeat < 1)
- {
- throw new IllegalArgumentException("Repeat must be >= 1");
- }
-
- // Generate the sequence.
- params = new int[((end - start) / step) + 1];
- int i = 0;
- for (int n = start; n <= end; n += step)
- {
- params[i++] = n;
- }
-
- this.repeat = repeat;
- }
-
- /**
- * Runs the test repeatedly for each value of the int parameter specified and for the correct number of test
- * repeats.
- *
- * @param result The test result object that the tests will indicate their results to. This is also used
- * to pass the int parameter from this class to the decorated test class.
- */
- public void run(TestResult result)
- {
- log.debug("public void run(TestResult result): called");
-
- if (!(result instanceof TKTestResult))
- {
- throw new IllegalArgumentException("AsymptoticTestDecorator only works with TKTestResult");
- }
-
- // Cast the test result into a TKTestResult to place the current parameter into.
- TKTestResult tkResult = (TKTestResult) result;
-
- log.debug("params = " + ((params == null) ? null : MathUtils.printArray(params)));
- log.debug("repeat = " + repeat);
-
- if(params != null)
- {
- for (int n : params)
- {
- for (int j = 0; j < repeat; j++)
- {
- log.debug("n = " + n);
-
- // Set the integer parameter in the TKTestResult to be passed to the tests.
- tkResult.setN(n);
-
- if (tkResult.shouldStop())
- {
- log.debug("tkResult.shouldStop = " + true);
-
- break;
- }
-
- log.debug("Calling super#run");
- super.run(tkResult);
- }
- }
- }
- }
-
- /**
- * Prints out the name of this test with the string "(parameterized)" appended onto it for debugging purposes.
- *
- * @return The name of this test with the string "(parameterized)" appended onto it.
- */
- public String toString()
- {
- return super.toString() + "(parameterized)";
- }
-}
diff --git a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/ScaledTestDecorator.java b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/ScaledTestDecorator.java
deleted file mode 100644
index 93e2a3c855..0000000000
--- a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/ScaledTestDecorator.java
+++ /dev/null
@@ -1,391 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.junit.extensions;
-
-import junit.framework.Test;
-import junit.framework.TestResult;
-
-import java.util.concurrent.BrokenBarrierException;
-import java.util.concurrent.CyclicBarrier;
-
-/**
- * A test decorator that runs a test many times simultaneously in many threads.
- *
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Clone a test run into many threads and run them simultaneously.
- * <tr><td> Inform the test results of the start and end of each concurrent test batch. <td> {@link TKTestResult}
- * <tr><td> Inform the test results of the concurrency level. <td> {@link TKTestResult}
- * </table>
- *
- * @author Rupert Smith
- */
-public class ScaledTestDecorator extends WrappedSuiteTestDecorator implements ShutdownHookable // TestDecorator
-{
- /** Used for logging. */
- // private static final Logger log = Logger.getLogger(ScaledTestDecorator.class);
-
- /** Determines how long to wait for tests to cleanly exit on shutdown. */
- private static final long SHUTDOWN_PAUSE = 3000;
-
- /**
- * The stress levels or numbers of simultaneous threads to run the test in. The test is repeated at each of
- * the concurrency levels specified here. Defaults to 1 thread.
- */
- private int[] threads = new int[] { 1 };
-
- /** Used to hold the number of tests currently being run in parallel. */
- private int concurrencyLevel;
-
- /** The test to run. */
- private WrappedSuiteTestDecorator test;
-
- /**
- * Used to hold the current {@link TKTestResult} for the tests currently being run. This is made available so that
- * the shutdown hook can ask it to cleanly end the current tests in the event of a shutdown.
- */
- private TKTestResult currentTestResult;
-
- /** Flag set by the shutdown hook. This decorator will not start any new tests when this is set. */
- private boolean shutdown = false;
-
- /**
- * Creates an active test with default multiplier (1).
- *
- * @param test The target test.
- */
- public ScaledTestDecorator(WrappedSuiteTestDecorator test)
- {
- super(test);
- this.test = test;
- }
-
- /**
- * Creates a concurrently scaled test with the specified number of threads.
- *
- * @param test The target test.
- * @param numThreads The stress level.
- */
- public ScaledTestDecorator(WrappedSuiteTestDecorator test, int numThreads)
- {
- this(test, new int[] { numThreads });
- }
-
- /**
- * Creates a concurrently scaled test with the specified thread levels, the test is repeated at each level.
- *
- * @param test The target test.
- * @param threads The concurrency levels.
- */
- public ScaledTestDecorator(WrappedSuiteTestDecorator test, int[] threads)
- {
- super(test);
-
- /*log.debug("public ScaledTestDecorator(WrappedSuiteTestDecorator test = \"" + test + "\", int[] threads = "
- + MathUtils.printArray(threads) + "): called");*/
-
- this.test = test;
- this.threads = threads;
- }
-
- /**
- * Runs the test simultaneously in at the specified concurrency levels.
- *
- * @param testResult The results object to monitor the test results with.
- */
- public void run(TestResult testResult)
- {
- // log.debug("public void run(TestResult testResult = " + testResult + "): called");
-
- // Loop through all of the specified concurrent levels for the test, provided shutdown has not been called.
- for (int i = 0; (i < threads.length) && !shutdown; i++)
- {
- // Get the number of threads for this run.
- int numThreads = threads[i];
-
- // Create test thread handlers for all the threads.
- TestThreadHandler[] threadHandlers = new TestThreadHandler[numThreads];
-
- // Create a cyclic barrier for the test threads to synch their setups and teardowns on.
- CyclicBarrier barrier = new CyclicBarrier(numThreads);
-
- // Set up the test thread handlers to output results to the same test results object.
- for (int j = 0; j < numThreads; j++)
- {
- threadHandlers[j] = new TestThreadHandler(testResult, test, barrier);
- }
-
- // Ensure the concurrency level statistic is set up correctly.
- concurrencyLevel = numThreads;
-
- // Begin batch.
- if (testResult instanceof TKTestResult)
- {
- TKTestResult tkResult = (TKTestResult) testResult;
- // tkResult.notifyStartBatch();
- tkResult.setConcurrencyLevel(numThreads);
-
- // Set the test result for the currently running tests, so that the shutdown hook can call it if necessary.
- currentTestResult = tkResult;
- }
-
- // Run all the tests and wait for them all to finish.
- executeAndWaitForRunnables(threadHandlers);
-
- // Clear the test result for the currently running tests.
- currentTestResult = null;
-
- // End batch.
- if (testResult instanceof TKTestResult)
- {
- TKTestResult tkResult = (TKTestResult) testResult;
- tkResult.notifyEndBatch();
- }
-
- // Clear up all the test threads, they hold references to their associated TestResult object and Test object,
- // which may prevent them from being garbage collected as the TestResult and Test objects are long lived.
- for (int j = 0; j < numThreads; j++)
- {
- threadHandlers[j].testResult = null;
- threadHandlers[j].test = null;
- threadHandlers[j] = null;
- }
- }
- }
-
- /**
- * Reports the number of tests that the scaled decorator is currently running concurrently.
- *
- * @return The number of tests that the scaled decorator is currently running concurrently.
- */
- public int getConcurrencyLevel()
- {
- return concurrencyLevel;
- }
-
- /**
- * Executes all of the specifed runnable using the thread pool and waits for them all to complete.
- *
- * @param runnables The set of runnables to execute concurrently.
- */
- private void executeAndWaitForRunnables(Runnable[] runnables)
- {
- int numThreads = runnables.length;
-
- // Used to keep track of the test threads in order to know when they have all completed.
- Thread[] threads = new Thread[numThreads];
-
- // Create all the test threads.
- for (int j = 0; j < numThreads; j++)
- {
- threads[j] = new Thread(runnables[j]);
- }
-
- // Start all the test threads.
- for (int j = 0; j < numThreads; j++)
- {
- threads[j].start();
- }
-
- // Wait for all the test threads to complete.
- for (int j = 0; j < numThreads; j++)
- {
- try
- {
- threads[j].join();
- }
- catch (InterruptedException e)
- {
- // Restore the interrupted state of the thread.
- Thread.currentThread().interrupt();
- }
- }
- }
-
- /**
- * Supplies the shut-down hook.
- *
- * @return The shut-down hook.
- */
- public Thread getShutdownHook()
- {
- return new Thread(new Runnable()
- {
- public void run()
- {
- // log.debug("ScaledTestDecorator::ShutdownHook: called");
-
- // Set the shutdown flag so that no new tests are started.
- shutdown = true;
-
- // Check if tests are currently running, and ask them to complete as soon as possible. Allow
- // a short pause for this to happen.
- TKTestResult testResult = currentTestResult;
-
- if (testResult != null)
- {
- // log.debug("There is a test result currently running tests, asking it to terminate ASAP.");
- testResult.shutdownNow();
-
- try
- {
- Thread.sleep(SHUTDOWN_PAUSE);
- }
- catch (InterruptedException e)
- {
- // Restore the interrupted state of the thread.
- Thread.currentThread().interrupt();
- }
- }
- }
- });
- }
-
- /**
- * Prints a string summarizing this test decorator, mainly for debugging purposes.
- *
- * @return String representation for debugging purposes.
- */
- public String toString()
- {
- return "ScaledTestDecorator: [ test = " + test + ", concurrencyLevel = " + concurrencyLevel + " ]";
- }
-
- /**
- * TestThreadHandler is a runnable used to execute a test in. This is static to avoid implicit 'this' reference to
- * the longer lived ScaledTestDecorator class. The scaled test decorator may execute many repeats but creates fresh
- * handlers for each one. It re-uses the threads in a pool but does not re-use these handlers.
- */
- private static class TestThreadHandler implements Runnable
- {
- /** The test result object for the test to be run with. */
- TestResult testResult;
-
- /** The test to run. */
- WrappedSuiteTestDecorator test;
-
- /** Holds the cyclic barrier to synchronize on the end of the setups and before the tear downs. */
- CyclicBarrier barrier;
-
- /**
- * Creates a new TestThreadHandler object.
- *
- * @param testResult The test result object for the test to be run with.
- * @param test The test to run in a sperate thread.
- * @param barrier The barrier implementation to use to synchronize per-thread setup completion and test
- * completion before moving on through the setup, test, teardown phases. The barrier should
- * be configured for the number of test threads.
- */
- TestThreadHandler(TestResult testResult, WrappedSuiteTestDecorator test, CyclicBarrier barrier)
- {
- this.testResult = testResult;
- this.test = test;
- this.barrier = barrier;
- }
-
- /**
- * Runs the test associated with this pool.
- */
- public void run()
- {
- try
- {
- // Call setup on all underlying tests in the suite that are thread aware.
- for (Test childTest : test.getAllUnderlyingTests())
- {
- // Check that the test is concurrency aware, so provides a setup method to call.
- if (childTest instanceof TestThreadAware)
- {
- // Call the tests per thread setup.
- TestThreadAware setupTest = (TestThreadAware) childTest;
- setupTest.threadSetUp();
- }
- }
-
- // Wait until all test threads have completed their setups.
- barrier.await();
-
-
- // Call setup on all underlying tests in the suite that are thread aware.
- for (Test childTest : test.getAllUnderlyingTests())
- {
- // Check that the test is concurrency aware, so provides a setup method to call.
- if (childTest instanceof TestThreadAware)
- {
- // Call the tests post thread setup.
- TestThreadAware setupTest = (TestThreadAware) childTest;
- setupTest.postThreadSetUp();
- }
- }
-
- // Wait until all test threads have completed their prefill.
- barrier.await();
-
- // Start timing the test batch, only after thread setups have completed.
- if (testResult instanceof TKTestResult)
- {
- ((TKTestResult) testResult).notifyStartBatch();
- }
-
- // Run the tests.
- test.run(testResult);
-
- // Wait unitl all test threads have completed their tests.
- barrier.await();
-
- // Call tear down on all underlying tests in the suite that are thread aware.
- for (Test childTest : test.getAllUnderlyingTests())
- {
- // Check that the test is concurrency aware, so provides a teardown method to call.
- if (childTest instanceof TestThreadAware)
- {
- // Call the tests per thread tear down.
- TestThreadAware setupTest = (TestThreadAware) childTest;
- setupTest.threadTearDown();
- }
- }
- }
- catch (InterruptedException e)
- {
- // Restore the interrupted state of the thread.
- Thread.currentThread().interrupt();
- }
- catch (BrokenBarrierException e)
- {
- // Set the interrupted state on the thread. The BrokenBarrierException may be caused where one thread
- // waiting for the barrier is interrupted, causing the remaining threads correctly waiting on the
- // barrier to fail. This condition is expected during test interruptions, and the response to it is to
- // interrupt all the other threads running in the same scaled test.
- Thread.currentThread().interrupt();
- }
- }
-
- /**
- * Prints the name of the test for debugging purposes.
- *
- * @return The name of the test.
- */
- public String toString()
- {
- return "ScaledTestDecorator: [test = \"" + test + "\"]";
- }
- }
-}
diff --git a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/SetupTaskAware.java b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/SetupTaskAware.java
deleted file mode 100644
index e462145d7d..0000000000
--- a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/SetupTaskAware.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.junit.extensions;
-
-/**
- * SetupTaskAware is an interface that tests that can accept injectable setup tasks may implement. Typically this
- * is used by configurable decorator stack to inject setup tasks into tests. It is then up to the test case to run
- * the tasks in the setup or threadSetup methods as it chooses.
- *
- * <p/>Set up tasks should be chained so that they are executed in the order that they are applied. Tear down tasks
- * should be chained so that they are executed in the reverse order to which they are applied. That way the set up and
- * tear down tasks act as a 'task' stack, with nested setups and tear downs.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities.
- * <tr><td> Handle injection of set up tasks.
- * <tr><td> Handle injection of tear down tasks.
- * </table>
- *
- * @author Rupert Smith
- */
-public interface SetupTaskAware
-{
- /**
- * Adds the specified task to the tests setup.
- *
- * @param task The task to add to the tests setup.
- */
- public void chainSetupTask(Runnable task);
-
- /**
- * Adds the specified task to the tests tear down.
- *
- * @param task The task to add to the tests tear down.
- */
- public void chainTearDownTask(Runnable task);
-}
diff --git a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/SetupTaskHandler.java b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/SetupTaskHandler.java
deleted file mode 100644
index 631f4dcdf0..0000000000
--- a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/SetupTaskHandler.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.junit.extensions;
-
-import org.apache.qpid.junit.extensions.util.StackQueue;
-
-import java.util.LinkedList;
-import java.util.Queue;
-
-/**
- * SetupTaskHandler implements a task stack. It can be used, by delegation, as a base implementation for tests that want
- * to have configurable setup/teardown task stacks. Typically it is up to the test implementation to decide whether the
- * stack is executed in the setup/teardown methods or in the threadSetup/threadTeaddown methods.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Handle injection of set up tasks.
- * <tr><td> Handle injection of tear down tasks.
- * <tr><td> Run set up tasks in chain order.
- * <tr><td> Run tear down tasks in reverse chain order.
- * </table>
- *
- * @author Rupert Smith
- */
-public class SetupTaskHandler implements SetupTaskAware
-{
- /** Holds the set up tasks. */
- private Queue<Runnable> setups = new LinkedList<Runnable>();
-
- /** Holds the tear down tasks. */
- private Queue<Runnable> teardowns = new StackQueue<Runnable>();
-
- /**
- * Adds the specified task to the tests setup.
- *
- * @param task The task to add to the tests setup.
- */
- public void chainSetupTask(Runnable task)
- {
- setups.offer(task);
- }
-
- /**
- * Adds the specified task to the tests tear down.
- *
- * @param task The task to add to the tests tear down.
- */
- public void chainTearDownTask(Runnable task)
- {
- teardowns.offer(task);
- }
-
- /**
- * Runs the set up tasks in the order that they way chained.
- */
- public void runSetupTasks()
- {
- while (!setups.isEmpty())
- {
- setups.remove().run();
- }
- }
-
- /**
- * Runs the tear down tasks in the reverse of the order in which they were chained.
- */
- public void runTearDownTasks()
- {
- while (!teardowns.isEmpty())
- {
- teardowns.remove().run();
- }
- }
-}
diff --git a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/ShutdownHookable.java b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/ShutdownHookable.java
deleted file mode 100644
index dc6aa3c291..0000000000
--- a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/ShutdownHookable.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.junit.extensions;
-
-/**
- * Defines an interface that classes which supply shutdown hooks implement. Code that creates these classes can check
- * if they supply a shutdown hook and register these hooks when the obejct are created.
- *
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities
- * <tr><td> Supply a shutdown hook.
- * </table>
- *
- * @author Rupert Smith
- */
-public interface ShutdownHookable
-{
- /**
- * Supplies the shutdown hook.
- *
- * @return The shut down hook.
- */
- public Thread getShutdownHook();
-}
diff --git a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/SleepThrottle.java b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/SleepThrottle.java
deleted file mode 100644
index 2dc4c0e272..0000000000
--- a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/SleepThrottle.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.junit.extensions;
-
-/**
- * SleepThrottle is a Throttle implementation that generates short pauses using the thread sleep methods. As the pauses
- * get shorter, this technique gets more innacurate. In practice, around 100 Hz is the cap rate for accuracy.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Accept throttling rate in operations per second.
- * <tr><td> Inject short pauses to fill out processing cycles to a specified rate.
- * <tr><td> Check against a throttle speed without waiting.
- * </table>
- *
- * @author Rupert Smith
- */
-public class SleepThrottle extends BaseThrottle implements Throttle
-{
- /** Holds the time of the last call to the throttle method in nano seconds. */
- private long lastTimeNanos;
-
- /**
- * This method can only be called at the rate set by the {@link #setRate} method, if it is called faster than this
- * it will inject short pauses to restrict the call rate to that rate.
- */
- public void throttle()
- {
- // Get the current time in nanos.
- long currentTimeNanos = System.nanoTime();
-
- // Don't introduce any pause on the first call.
- if (!firstCall)
- {
- // Check if there is any time left in the cycle since the last call to this method and introduce a short pause
- // to fill that time if there is.
- long remainingTimeNanos = cycleTimeNanos - (currentTimeNanos - lastTimeNanos);
-
- if (remainingTimeNanos > 0)
- {
- long milliPause = remainingTimeNanos / 1000000;
- int nanoPause = (int) (remainingTimeNanos % 1000000);
-
- try
- {
- Thread.sleep(milliPause, nanoPause);
- }
- catch (InterruptedException e)
- {
- // Restore the interrupted thread, in-case the caller is checking for it.
- Thread.currentThread().interrupt();
- }
- }
- }
- else
- {
- firstCall = false;
- }
-
- // Update the last time stamp.
- lastTimeNanos = System.nanoTime();
- }
-}
diff --git a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/TKTestResult.java b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/TKTestResult.java
deleted file mode 100644
index 5ce56a690e..0000000000
--- a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/TKTestResult.java
+++ /dev/null
@@ -1,654 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.junit.extensions;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestResult;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.junit.extensions.listeners.TKTestListener;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Properties;
-
-/**
- * TKTestResult extends TestResult in order to calculate test timings, to pass the variable integer parameter for
- * parameterized test cases to those test cases and to introduce an optional delay before test starts. Interested
- * {@link TKTestListener}s may be attached to this and will be informed of all relevant test statistics.
- *
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Calculate test timings.
- * <tr><td> Inform timing listeners of timings.
- * <tr><td> Inform memory listeners of memory readings.
- * <tr><td> Inform parameters listeners of parameters.
- * <tr><td> Pass the integer parameter to parameterized test cases.
- * <tr><td> Provide verbose test information on test start and end.
- * </table>
- *
- * @todo Move the verbose test information on test start/end into a test listener instead. It confuses the intention
- * of this class. Could also move the delay into a listener but that seems less appropriate as it would be a
- * side-effecting listener. Delay and timing calculation are fundamental enough to this class.
- *
- * @todo The need for this class to act as a place-holder for the integer parameter for parameterized test cases is
- * because this behaviour has been factored out into a test decorator class, see {@link AsymptoticTestDecorator}.
- * The {@link AsymptoticTestDecorator#run} method takes a TestResult as an argument and cannot easily get to the
- * {@link AsymptoticTestCase} class other than through this class. The option of using this class as a place hold
- * for this value was chosen. Alternatively this class could provide a method for decorators to access the
- * underlying test case through and then leave the setting of this parameter to the decorator which is a more
- * natural home for this behaviour. It would also provide a more general framework for decorators.
- *
- * @todo The memory usage may need to be moved in closer to the test method invocation so that as little code as possible
- * exists between it and the test or the results may be obscured. In fact it certainly does as the teardown method
- * is getting called first. Wouldn't be a bad idea to move the timing code in closer too.
- *
- * @todo Get rid of the delay logic. Will be replaced by throttle control.
- *
- * @author Rupert Smith
- */
-public class TKTestResult extends TestResult
-{
- /** Used for logging. */
- private static final Logger log = Logger.getLogger(TKTestResult.class);
-
- /** The delay between two tests. */
- private int delay = 0;
-
- /**
- * This flag indicates that the #completeTest method of the timing controller has been called. Once this has
- * been called once, the end test event for the whole test method should be ignored because tests have taken
- * charge of outputing their own timings.
- */
- private boolean completeTestUsed = false;
-
- /**
- * Thread locals to hold test start time for non-instrumented tests. (Instrumented tests hold their own
- * measurement data).
- */
- // private Hashtable threadStartTimeMap = new Hashtable();
- private ThreadLocal<ThreadLocalSettings> threadLocals = new ThreadLocal<ThreadLocalSettings>();
-
- /** Used to hold the current integer parameter to pass to parameterized tests. This defaults to 1. */
- private int n = 1;
-
- /** The timing listeners. */
- private Collection<TKTestListener> tkListeners;
-
- /** The test case name. */
- private String testCaseName;
-
- /** Used to hold the current concurrency level, set by the {@link ScaledTestDecorator}. */
- private int concurrencyLevel = 1;
-
- /** Flag used to indicate that this test result should attempt to complete its current tests as soon as possible. */
- private boolean shutdownNow = false;
-
- /** Holds the parametes that the test is run with. */
- private Properties testParameters;
-
- /**
- * Creates a new TKTestResult object.
- *
- * @param delay A delay in milliseconds to introduce before every test start.
- * @param testCaseName The name of the test case that this is the TestResult object for.
- */
- public TKTestResult(int delay, String testCaseName)
- {
- super();
-
- /*log.debug("public TKTestResult(PrintStream writer, int " + delay + ", boolean " + verbose + ", String "
- + testCaseName + "): called");*/
-
- // Keep all the parameters that this is created with.
- this.delay = delay;
- this.testCaseName = testCaseName;
- }
-
- /**
- * Callback method use to inform this test result that a test will be started. Waits for the configured delay time
- * if one has been set, starts the timer, then delegates to the super class implementation.
- *
- * @param test The test to be started.
- */
- public void startTest(Test test)
- {
- // log.debug("public void startTest(Test test): called");
-
- // If a delay time has been specified then wait for that length of time.
- if (this.delay > 0)
- {
- try
- {
- Thread.sleep(delay);
- }
- catch (InterruptedException e)
- {
- // Ignore, but restore the interrupted flag.
- Thread.currentThread().interrupt();
- }
- }
-
- // Create the thread local settings for the test.
- ThreadLocalSettings threadLocalSettings = new ThreadLocalSettings();
- threadLocals.set(threadLocalSettings);
-
- // Record the test start time against this thread for calculating the test timing. (Consider using ThreadLocal
- // instead?)
- Long startTime = System.nanoTime();
- threadLocalSettings.startTime = startTime;
- // log.debug("startTime = " + startTime);
-
- // Check if the test is timing controller aware, in which case set up a new timing controller and hold it
- // in the thread local settings.
- if (test instanceof TimingControllerAware)
- {
- TimingControllerAware controllerAware = (TimingControllerAware) test;
- TimingControllerImpl controller =
- new TimingControllerImpl(this, test, startTime, Thread.currentThread().getId());
- controllerAware.setTimingController(controller);
-
- threadLocalSettings.timingController = controller;
- }
-
- // Delegate to the super method to notify test event listeners.
- super.startTest(test);
- }
-
- /**
- * Callback method use to inform this result that a test was completed. This calculates how long the test took
- * to run, then delegates to the super class implementation.
- *
- * @param test The test that has ended.
- */
- public void endTest(Test test)
- {
- // log.debug("public void endTest(Test test): called");
-
- long runTime = 0;
-
- // Recover the thread local settings.
- ThreadLocalSettings threadLocalSettings = threadLocals.get();
-
- // Check if the test is an instrumented test and get the timing information from the instrumentation as this
- // will be more accurate.
- if (test instanceof InstrumentedTest)
- {
- InstrumentedTest iTest = (InstrumentedTest) test;
-
- // Calculate the test run time.
- runTime = iTest.getTestTime();
- // log.debug("runTime = " + runTime);
-
- // Calculate the test memory usage.
- long startMem = iTest.getTestStartMemory();
- long endMem = iTest.getTestEndMemory();
-
- // log.debug("startMem = " + startMem);
- // log.debug("endMem = " + endMem);
-
- // Inform any memory listeners of the test memory.
- if (tkListeners != null)
- {
- for (TKTestListener memoryListener : tkListeners)
- {
- memoryListener.memoryUsed(test, startMem, endMem, null);
- }
- }
- }
- else
- {
- // Calculate the test run time.
- long endTime = System.nanoTime();
- Long startTime = threadLocalSettings.startTime;
- runTime = endTime - startTime;
- // log.debug("runTime = " + runTime);
-
- threadLocals.remove();
- }
-
- // Output end test stats. This is only done when the tests have not used the timing controller to output
- // mutiple timings.
- if (!completeTestUsed)
- {
- // Check if the test is an asymptotic test case and get its int parameter if so.
- if (test instanceof AsymptoticTestCase)
- {
- AsymptoticTestCase pTest = (AsymptoticTestCase) test;
-
- // Set the parameter.
- int paramValue = pTest.getN();
-
- // Inform any parameter listeners of the test parameter.
- if (tkListeners != null)
- {
- for (TKTestListener parameterListener : tkListeners)
- {
- parameterListener.parameterValue(test, paramValue, null);
- }
- }
- }
-
- // Inform any timing listeners of the test timing and concurrency level.
- if (tkListeners != null)
- {
- for (TKTestListener tkListener : tkListeners)
- {
- TKTestListener next = tkListener;
-
- next.timing(test, runTime, null);
- next.concurrencyLevel(test, concurrencyLevel, null);
- }
- }
-
- // Call the super method to notify test event listeners of the end event.
- super.endTest(test);
- }
- }
-
- /**
- * Gets the integer parameter to pass to parameterized test cases.
- *
- * @return The value of the integer parameter.
- */
- public int getN()
- {
- return n;
- }
-
- /**
- * Sets the integer parameter to pass to parameterized test cases.
- *
- * @param n The new value of the integer parameter.
- */
- public void setN(int n)
- {
- // log.debug("public void setN(int " + n + "): called");
-
- this.n = n;
- }
-
- /**
- * Adds a timing listener to pass all timing events to.
- *
- * @param listener The timing listener to register.
- */
- public void addTKTestListener(TKTestListener listener)
- {
- // Create the collection to hold the timing listeners if it does not already exist.
- if (tkListeners == null)
- {
- tkListeners = new ArrayList<TKTestListener>();
- }
-
- // Keep the new timing listener.
- tkListeners.add(listener);
- }
-
- /**
- * Called by the test runner to notify this that a new test batch is being begun. This method forwards this
- * notification to all batch listeners.
- */
- public void notifyStartBatch()
- {
- if (tkListeners != null)
- {
- for (TKTestListener batchListener : tkListeners)
- {
- batchListener.startBatch();
- }
- }
- }
-
- /**
- * Called by the test runner to notify this that the current test batch has been ended. This method forwards this
- * notification to all batch listener.
- */
- public void notifyEndBatch()
- {
- // log.debug("public void notifyEndBatch(): called");
-
- if (tkListeners != null)
- {
- for (TKTestListener batchListener : tkListeners)
- {
- batchListener.endBatch(testParameters);
- }
- }
- }
-
- /**
- * Called by the test runner to notify this of the properties that the test is using.
- *
- * @param properties The tests set/read properties.
- */
- public void notifyTestProperties(Properties properties)
- {
- // log.debug("public void notifyTestProperties(Properties properties): called");
-
- this.testParameters = properties;
-
- /*
- if (tkListeners != null)
- {
- for (TKTestListener batchListener : tkListeners)
- {
- batchListener.properties(properties);
- }
- }
- */
- }
-
- /**
- * Intercepts the execution of a test case to pass the variable integer parameter to a test if it is a parameterized
- * test case.
- *
- * @param test The test to run.
- */
- protected void run(final TestCase test)
- {
- // log.debug("protected void run(final TestCase test): called");
-
- // Check if the test case is a parameterized test and set its integer parameter if so.
- if (test instanceof AsymptoticTestCase)
- {
- AsymptoticTestCase pTest = (AsymptoticTestCase) test;
-
- // Set up the integer parameter.
- pTest.setN(n);
- }
-
- // Delegate to the super method to run the test.
- super.run(test);
- }
-
- /**
- * Helper method that generats a String of verbose information about a test. This includes the thread name, test
- * class name and test method name.
- *
- * @param test The test to generate the info string for.
- *
- * @return Returns a string with the thread name, test class name and test method name.
- */
- protected String getTestInfo(Test test)
- {
- // log.debug("protected String getTestInfo(Test test): called");
-
- return "[" + Thread.currentThread().getName() + "@" + test.getClass().getName() + "."
- + ((test instanceof TestCase) ? ((TestCase) test).getName() : "") + "]";
- }
-
- /**
- * Sets the concurrency level to pass into the test result.
- *
- * @param concurrencyLevel The concurrency level the tests are running out.
- */
- public void setConcurrencyLevel(int concurrencyLevel)
- {
- this.concurrencyLevel = concurrencyLevel;
- }
-
- /**
- * Tells this test result that it should stop running tests. Once this method has been called this test result
- * will not start any new tests, and any tests that use the timing controller will be passed interrupted exceptions,
- * to indicate that they should end immediately. Usually the caller of this method will introduce a short wait
- * to allow an opporunity for running tests to complete, before forcing the shutdown of the JVM.
- */
- public void shutdownNow()
- {
- log.debug("public void shutdownNow(): called on " + this);
-
- shutdownNow = true;
- }
-
- /**
- * Prints a string summary of this class, mainly for debugging purposes.
- *
- * @return A string summary of this class, mainly for debugging purposes.
- */
- public String toString()
- {
- return "TKTestResult@" + Integer.toString(hashCode(), 16) + ": [ testCaseName = " + testCaseName + ", n = " + n
- + ", tkListeners = " + tkListeners + " ]";
- }
-
- /**
- * Holds things that need to be kept on a per thread basis for each test invocation, such as the test start
- * time and its timing controller.
- */
- private static class ThreadLocalSettings
- {
- /** Holds the test start time. */
- Long startTime;
-
- /** Holds the test threads timing controller. */
- TimingController timingController;
- }
-
- /**
- * Provides an implementation of the {@link TimingController} interface that timing aware tests can use to call
- * back to reset timers, and register additional test timings.
- */
- private static class TimingControllerImpl implements TimingController
- {
- /** Holds an explicit reference to the test TKTestResult that created this. */
- TKTestResult testResult;
-
- /** Holds a reference to the test that this is the timing controller for. */
- Test test;
-
- /** Holds the start time for this timing controller. This gets reset to now on each completed test. */
- long startTime;
-
- /**
- * Holds the thread id of the thread that started the test, so that this controller may be called from other
- * threads but still identify itself correctly to {@link TKTestListener}s as being associated with the
- * thread that called the test method.
- */
- long threadId;
-
- /**
- * Creates a timing controller on a specified TKTestResult and a test.
- *
- * @param testResult The TKTestResult that this controller interacts with.
- * @param test The test that this is the timing controller for.
- * @param startTime The test start time in nanoseconds.
- * @param threadId The thread id of the thread that is calling the test method.
- */
- public TimingControllerImpl(TKTestResult testResult, Test test, long startTime, long threadId)
- {
- this.testResult = testResult;
- this.test = test;
- this.startTime = startTime;
- this.threadId = threadId;
- }
-
- /**
- * Gets the timing controller associated with the current test thread. Tests that use timing controller should
- * always get the timing controller from this method in the same thread that called the setUp, tearDown or test
- * method. The controller returned by this method may be called from any thread because it remembers the thread
- * id of the original test thread.
- *
- * @return The timing controller associated with the current test thread.
- */
- public TimingController getControllerForCurrentThread()
- {
- // Recover the thread local settings and extract the timing controller from them.
- ThreadLocalSettings threadLocalSettings = testResult.threadLocals.get();
-
- return threadLocalSettings.timingController;
- }
-
- /**
- * Not implemented yet.
- *
- * @return Nothing.
- */
- public long suspend()
- {
- throw new RuntimeException("Method not implemented.");
- }
-
- /**
- * Not implemented yet.
- *
- * @return Nothing.
- */
- public long resume()
- {
- throw new RuntimeException("Method not implemented.");
- }
-
- /**
- * Resets the timer start time to now.
- *
- * @return The new value of the start time.
- */
- public long restart()
- {
- startTime = System.nanoTime();
-
- return startTime;
- }
-
- /**
- * Register an additional pass/fail for the current test. The test result is assumed to apply to a test of
- * 'size' parmeter 1. Use the {@link #completeTest(boolean, int)} method to register timings with parameters.
- *
- * @param testPassed Whether or not this timing is for a test pass or fail.
- *
- * @throws InterruptedException If the test runner decides that testing should stop it throws this exception to
- * indicate to the test method that it should stop immediately.
- */
- public void completeTest(boolean testPassed) throws InterruptedException
- {
- completeTest(testPassed, 1);
- }
-
- /**
- * Register an additional pass/fail for the current test. The test result is applies to a test of the specified
- * 'size' parmeter.
- *
- * @param testPassed Whether or not this timing is for a test pass or fail.
- * @param param The test parameter size for parameterized tests.
- *
- * @throws InterruptedException If the test runner decides that testing should stop it throws this exception to
- * indicate to the test method that it should stop immediately.
- */
- public void completeTest(boolean testPassed, int param) throws InterruptedException
- {
- completeTest(testPassed, param, null, null);
- }
-
- /**
- * Register an additional pass/fail for the current test. The test result is applies to a test of the specified
- * 'size' parmeter and allows the caller to sepecify the timing to log.
- *
- * @param testPassed Whether or not this timing is for a test pass or fail.
- * @param param The test parameter size for parameterized tests.
- * @param timeNanos The time in nano-seconds to log the test result with.
- *
- * A null value for timeNanos is a request to this method that it should
- * calculate the time for the given test run.
- *
- * @throws InterruptedException If the test runner decides that testing should stop it throws this exception to
- * indicate to the test method that it should stop immediately.
- */
- public void completeTest(boolean testPassed, int param, Long timeNanos) throws InterruptedException
- {
- completeTest(testPassed, param, timeNanos, null);
- }
-
- /**
- * Register an additional pass/fail for the current test. The test result is applies to a test of the specified
- * 'size' parmeter and allows the caller to sepecify the timing to log.
- *
- * @param testPassed Whether or not this timing is for a test pass or fail.
- * @param param The test parameter size for parameterized tests.
- * @param timeNanos The time in nano seconds to log the test result with.
- *
- * A null value for timeNanos is a request to this method that it should
- * calculate the time for the given test run.
- * A null value for timeNanos2 means this test does not provide a second
- * timing value so a '-' is printed in the log.
- *
- *
- * @throws InterruptedException If the test runner decides that testing should stop it throws this exception to
- * indicate to the test method that it should stop immediately.
- */
- public void completeTest(boolean testPassed, int param, Long timeNanos, Long time2Nanos) throws InterruptedException
- {
- log.debug("public void completeTest(boolean testPassed, int param, long timeNanos): called");
- log.debug("testResult = " + testResult);
-
- /*log.debug("public long completeTest(boolean testPassed = " + testPassed + ", int param = " + param
- + "): called");*/
-
- // Calculate the test run time.
- long endTime = System.nanoTime();
- long runTime = endTime - startTime;
- startTime = endTime;
-
- //
- if (timeNanos != null)
- {
- runTime = timeNanos;
- }
-
- // Tell the test result that completeTest has been used, so to not register end test events for the whole
- // test method.
- testResult.completeTestUsed = true;
-
- // Inform any timing listeners of the test timings and parameters and send an end test notification using
- // the thread id of the thread that started the test.
- if (testResult.tkListeners != null)
- {
- for (TKTestListener listener : testResult.tkListeners)
- {
- listener.reset(test, threadId);
- listener.timing(test, runTime, threadId);
- listener.timing2(test, time2Nanos, threadId);
- listener.parameterValue(test, param, threadId);
- listener.concurrencyLevel(test, testResult.concurrencyLevel, threadId);
-
- if (!testPassed)
- {
- listener.addFailure(test, null, threadId);
- }
-
- listener.endTest(test, threadId);
- }
- }
-
- // log.debug("testResult.shutdownNow = " + testResult.shutdownNow);
-
- // Check if the test runner has been asked to shutdown and raise an interuppted exception if so.
- if (testResult.shutdownNow)
- {
- // log.debug("The shutdown flag is set.");
-
- throw new InterruptedException("Attempting clean shutdown by suspending current test.");
- }
- }
- }
-}
diff --git a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/TKTestRunner.java b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/TKTestRunner.java
deleted file mode 100644
index 671d33feed..0000000000
--- a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/TKTestRunner.java
+++ /dev/null
@@ -1,694 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.junit.extensions;
-
-import junit.framework.Test;
-import junit.framework.TestResult;
-import junit.framework.TestSuite;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.junit.extensions.listeners.CSVTestListener;
-import org.apache.qpid.junit.extensions.listeners.ConsoleTestListener;
-import org.apache.qpid.junit.extensions.listeners.XMLTestListener;
-import org.apache.qpid.junit.extensions.util.CommandLineParser;
-import org.apache.qpid.junit.extensions.util.MathUtils;
-import org.apache.qpid.junit.extensions.util.ParsedProperties;
-import org.apache.qpid.junit.extensions.util.TestContextProperties;
-
-import java.io.*;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * TKTestRunner extends {@link junit.textui.TestRunner} with the ability to run tests multiple times, to execute a test
- * simultaneously using many threads, to put a delay between test runs and adds support for tests that take integer
- * parameters that can be 'stepped' through on multiple test runs. These features can be accessed by using this class
- * as an entry point and passing command line arguments to specify which features to use:
- *
- * <pre>
- * -w ms The number of milliseconds between invocations of test cases.
- * -c pattern The number of tests to run concurrently.
- * -r num The number of times to repeat each test.
- * -d duration The length of time to run the tests for.
- * -t name The name of the test case to execute.
- * -s pattern The size parameter to run tests with.
- * -o dir The name of the directory to output test timings to.
- * --csv Output test results in CSV format.
- * --xml Output test results in XML format.
- * </pre>
- *
- * <p/>This command line may also have trailing 'name=value' parameters added to it. All of these values are added
- * to the test context properties and passed to the test, which can access them by name.
- *
- * <p/>The pattern arguments are of the form [lowest(: ...)(: highest)](:sample=s)(:exp), where round brackets
- * enclose optional values. Using this pattern form it is possible to specify a single value, a range of values divided
- * into s samples, a range of values divided into s samples but distributed exponentially, or a fixed set of samples.
- *
- * <p/>The duration arguments are of the form (dD)(hH)(mM)(sS), where round brackets enclose optional values. At least
- * one of the optional values must be present.
- *
- * <p/>When specifying optional test parameters on the command line, in 'name=value' format, it is also possible to use
- * the format 'name=[value1:value2:value3:...]', to specify multiple values for a parameter. All permutations of all
- * parameters with multiple values will be created and tested. If the values are numerical, it is also possible to use
- * the sequence generation patterns instead of fully specifying all of the values.
- *
- * <p/>Here are some examples:
- *
- * <p/><table>
- * <tr><td><pre> -c [10:20:30:40:50] </pre><td> Runs the test with 10,20,...,50 threads.
- * <tr><td><pre> -s [1:100]:samples=10 </pre>
- * <td> Runs the test with ten different size parameters evenly spaced between 1 and 100.
- * <tr><td><pre> -s [1:1000000]:samples=10:exp </pre>
- * <td> Runs the test with ten different size parameters exponentially spaced between 1 and 1000000.
- * <tr><td><pre> -r 10 </pre><td> Runs each test ten times.
- * <tr><td><pre> -d 10H </pre><td> Runs the test repeatedly for 10 hours.
- * <tr><td><pre> -d 1M, -r 10 </pre>
- * <td> Runs the test repeatedly for 1 minute but only takes a timing sample every 10 test runs.
- * <tr><td><pre> -r 10, -c [1:5:10:50], -s [100:1000:10000] </pre>
- * <td> Runs 12 test cycles (4 concurrency samples * 3 size sample), with 10 repeats each. In total the test
- * will be run 199 times (3 + 15 + 30 + 150)
- * <tr><td><pre> cache=true </pre><td> Passes the 'cache' parameter with value 'true' to the test.
- * <tr><td><pre> cache=[true:false] </pre><td> Runs the test with the 'cache' parameter set to 'true' and 'false'.
- * <tr><td><pre> cacheSize=[1000:1000000],samples=4,exp </pre>
- * <td> Runs the test with the 'cache' parameter set to a series of exponentially increasing sizes.
- * </table>
- *
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Create the test configuration specified by the command line parameters.
- * </table>
- *
- * @todo Verify that the output directory exists or can be created.
- *
- * @todo Verify that the specific named test case to execute exists.
- *
- * @todo Drop the delay parameter as it is being replaced by throttling.
- *
- * @todo Completely replace the test ui test runner, instead of having TKTestRunner inherit from it, its just not
- * good code to extend.
- *
- * @author Rupert Smith
- */
-public class TKTestRunner extends TestRunnerImprovedErrorHandling
-{
- /** Used for debugging. */
- private static final Logger log = Logger.getLogger(TKTestRunner.class);
-
- /** Used for displaying information on the console. */
- // private static final Logger console = Logger.getLogger("CONSOLE." + TKTestRunner.class.getName());
-
- /** Used for generating the timestamp when naming output files. */
- protected static final DateFormat TIME_STAMP_FORMAT = new SimpleDateFormat("yyyy-MM-dd-HH.mm.ss");
-
- /** Number of times to rerun the test. */
- protected Integer repetitions = 1;
-
- /** The length of time to run the tests for. */
- protected Long duration;
-
- /** Number of threads running the tests. */
- protected int[] threads;
-
- /** Delay in ms to wait between two test cases. */
- protected int delay = 0;
-
- /** The parameter values to pass to parameterized tests. */
- protected int[] params;
-
- /** Name of the single test case to execute. */
- protected String testCaseName = null;
-
- /** Name of the test class. */
- protected String testClassName = null;
-
- /** Name of the test run. */
- protected String testRunName = null;
-
- /** Directory to output XML reports into, if specified. */
- protected String reportDir = null;
-
- /** Flag that indicates the CSV results listener should be used to output results. */
- protected boolean csvResults;
-
- /** Flag that indiciates the XML results listener should be used to output results. */
- protected boolean xmlResults;
-
- /**
- * Holds the name of the class of the test currently being run. Ideally passed into the {@link #createTestResult}
- * method, but as the signature is already fixed for this, the current value gets pushed here as a member variable.
- */
- protected String currentTestClassName;
-
- /** Holds the test results object, which is reponsible for instrumenting tests/threads to record results. */
- protected TKTestResult result;
-
- /** Holds a list of factories for instantiating optional user specified test decorators. */
- protected List<TestDecoratorFactory> decoratorFactories;
-
- /**
- * Constructs a TKTestRunner using System.out for all the output.
- *
- * @param repetitions The number of times to repeat the test, or test batch size.
- * @param duration The length of time to run the tests for. -1 means no duration has been set.
- * @param threads The concurrency levels to ramp up to.
- * @param delay A delay in milliseconds between test runs.
- * @param params The sets of 'size' parameters to pass to test.
- * @param testCaseName The name of the test case to run.
- * @param reportDir The directory to output the test results to.
- * @param runName The name of the test run; used to name the output file.
- * @param csvResults <tt>true</tt> if the CSV results listener should be attached.
- * @param xmlResults <tt>true</tt> if the XML results listener should be attached.
- * @param decoratorFactories List of factories for user specified decorators.
- */
- public TKTestRunner(Integer repetitions, Long duration, int[] threads, int delay, int[] params, String testCaseName,
- String reportDir, String runName, boolean csvResults, boolean xmlResults,
- List<TestDecoratorFactory> decoratorFactories)
- {
- super(new NullResultPrinter(System.out));
-
- log.debug("public TKTestRunner(): called");
-
- // Keep all the test parameters.
- this.repetitions = repetitions;
- this.duration = duration;
- this.threads = threads;
- this.delay = delay;
- this.params = params;
- this.testCaseName = testCaseName;
- this.reportDir = reportDir;
- this.testRunName = runName;
- this.csvResults = csvResults;
- this.xmlResults = xmlResults;
- this.decoratorFactories = decoratorFactories;
- }
-
- /**
- * The entry point for the toolkit test runner.
- *
- * @param args The command line arguments.
- */
- public static void main(String[] args)
- {
- // Use the command line parser to evaluate the command line.
- CommandLineParser commandLine =
- new CommandLineParser(
- new String[][]
- {
- { "w", "The number of milliseconds between invocations of test cases.", "ms", "false" },
- { "c", "The number of tests to run concurrently.", "num", "false", MathUtils.SEQUENCE_REGEXP },
- { "r", "The number of times to repeat each test.", "num", "false" },
- { "d", "The length of time to run the tests for.", "duration", "false", MathUtils.DURATION_REGEXP },
- { "f", "The maximum rate to call the tests at.", "frequency", "false", "^([1-9][0-9]*)/([1-9][0-9]*)$" },
- { "s", "The size parameter to run tests with.", "size", "false", MathUtils.SEQUENCE_REGEXP },
- { "t", "The name of the test case to execute.", "name", "false" },
- { "o", "The name of the directory to output test timings to.", "dir", "false" },
- { "n", "A name for this test run, used to name the output file.", "name", "true" },
- {
- "X:decorators", "A list of additional test decorators to wrap the tests in.",
- "\"class.name[:class.name]*\"", "false"
- },
- { "1", "Test class.", "class", "true" },
- { "-csv", "Output test results in CSV format.", null, "false" },
- { "-xml", "Output test results in XML format.", null, "false" }
- });
-
- // Capture the command line arguments or display errors and correct usage and then exit.
- ParsedProperties options = null;
-
- try
- {
- options = new ParsedProperties(commandLine.parseCommandLine(args));
- }
- catch (IllegalArgumentException e)
- {
- System.out.println(commandLine.getErrors());
- System.out.println(commandLine.getUsage());
- System.exit(FAILURE_EXIT);
- }
-
- // Extract the command line options.
- Integer delay = options.getPropertyAsInteger("w");
- String threadsString = options.getProperty("c");
- Integer repetitions = options.getPropertyAsInteger("r");
- String durationString = options.getProperty("d");
- String paramsString = options.getProperty("s");
- String testCaseName = options.getProperty("t");
- String reportDir = options.getProperty("o");
- String testRunName = options.getProperty("n");
- String decorators = options.getProperty("X:decorators");
- String testClassName = options.getProperty("1");
- boolean csvResults = options.getPropertyAsBoolean("-csv");
- boolean xmlResults = options.getPropertyAsBoolean("-xml");
-
- int[] threads = (threadsString == null) ? null : MathUtils.parseSequence(threadsString);
- int[] params = (paramsString == null) ? null : MathUtils.parseSequence(paramsString);
- Long duration = (durationString == null) ? null : MathUtils.parseDuration(durationString);
-
- // The test run name defaults to the test class name unless a value was specified for it.
- testRunName = (testRunName == null) ? testClassName : testRunName;
-
- // Add all the command line options and trailing settings to test context properties. Tests may pick up
- // overridden values from there, and these values will be logged in the test results, for analysis and
- // to make tests repeatable.
- commandLine.addTrailingPairsToProperties(TestContextProperties.getInstance());
- commandLine.addOptionsToProperties(TestContextProperties.getInstance());
-
- // Create and start the test runner.
- try
- {
- // Create a list of test decorator factories for use specified decorators to be applied.
- List<TestDecoratorFactory> decoratorFactories = parseDecorators(decorators);
-
- TKTestRunner testRunner =
- new TKTestRunner(repetitions, duration, threads, (delay == null) ? 0 : delay, params, testCaseName,
- reportDir, testRunName, csvResults, xmlResults, decoratorFactories);
-
- TestResult testResult = testRunner.start(testClassName);
-
- if (!testResult.wasSuccessful())
- {
- System.exit(FAILURE_EXIT);
- }
- }
- catch (Exception e)
- {
- System.err.println(e.getMessage());
- e.printStackTrace(new PrintStream(System.err));
- System.exit(EXCEPTION_EXIT);
- }
- }
-
- /**
- * Parses a list of test decorators, in the form "class.name[:class.name]*", and creates factories for those
- * TestDecorator classes , and returns a list of the factories. This list of factories will be in the same
- * order as specified in the string. The factories can be used to succesively wrap tests in layers of
- * decorators, as decorators themselves implement the 'Test' interface.
- *
- * <p/>If the string fails to parse, or if any of the decorators specified in it are cannot be loaded, or are not
- * TestDecorators, a runtime exception with a suitable error message will be thrown. The factories themselves
- * throw runtimes if the constructor method calls on the decorators fail.
- *
- * @param decorators The decorators list to be parsed.
- *
- * @return A list of instantiated decorators.
- */
- protected static List<TestDecoratorFactory> parseDecorators(String decorators)
- {
- List<TestDecoratorFactory> result = new LinkedList<TestDecoratorFactory>();
- String toParse = decorators;
-
- // Check that the decorators string is not null or empty, returning an empty list of decorator factories it
- // it is.
- if ((decorators == null) || "".equals(decorators))
- {
- return result;
- }
-
- // Strip any leading and trailing quotes from the string.
- if (toParse.charAt(0) == '\"')
- {
- toParse = toParse.substring(1, toParse.length() - 1);
- }
-
- if (toParse.charAt(toParse.length() - 1) == '\"')
- {
- toParse = toParse.substring(0, toParse.length() - 2);
- }
-
- // Instantiate all decorators.
- for (String decoratorClassName : toParse.split(":"))
- {
- try
- {
- Class decoratorClass = Class.forName(decoratorClassName);
- final Constructor decoratorConstructor = decoratorClass.getConstructor(WrappedSuiteTestDecorator.class);
-
- // Check that the decorator is an instance of WrappedSuiteTestDecorator.
- if (!WrappedSuiteTestDecorator.class.isAssignableFrom(decoratorClass))
- {
- throw new RuntimeException("The decorator class " + decoratorClassName
- + " is not a sub-class of WrappedSuiteTestDecorator, which it needs to be.");
- }
-
- result.add(new TestDecoratorFactory()
- {
- public WrappedSuiteTestDecorator decorateTest(Test test)
- {
- try
- {
- return (WrappedSuiteTestDecorator) decoratorConstructor.newInstance(test);
- }
- catch (InstantiationException e)
- {
- throw new RuntimeException(
- "The decorator class " + decoratorConstructor.getDeclaringClass().getName()
- + " cannot be instantiated.", e);
- }
- catch (IllegalAccessException e)
- {
- throw new RuntimeException(
- "The decorator class " + decoratorConstructor.getDeclaringClass().getName()
- + " does not have a publicly accessable constructor.", e);
- }
- catch (InvocationTargetException e)
- {
- throw new RuntimeException(
- "The decorator class " + decoratorConstructor.getDeclaringClass().getName()
- + " cannot be invoked.", e);
- }
- }
- });
- }
- catch (ClassNotFoundException e)
- {
- throw new RuntimeException("The decorator class " + decoratorClassName + " could not be found.", e);
- }
- catch (NoSuchMethodException e)
- {
- throw new RuntimeException("The decorator class " + decoratorClassName
- + " does not have a constructor that accepts a single 'WrappedSuiteTestDecorator' argument.", e);
- }
- }
-
- return result;
- }
-
- /**
- * TestDecoratorFactory is a factory for creating test decorators from tests.
- */
- protected interface TestDecoratorFactory
- {
- /**
- * Decorates the specified test with a new decorator.
- *
- * @param test The test to decorate.
- *
- * @return The decorated test.
- */
- public WrappedSuiteTestDecorator decorateTest(Test test);
- }
-
- /**
- * Runs a test or suite of tests, using the super class implemenation. This method wraps the test to be run
- * in any test decorators needed to add in the configured toolkits enhanced junit functionality.
- *
- * @param test The test to run.
- * @param wait Undocumented. Nothing in the JUnit javadocs to say what this is for.
- *
- * @return The results of the test run.
- */
- public TestResult doRun(Test test, boolean wait)
- {
- log.debug("public TestResult doRun(Test \"" + test + "\", boolean " + wait + "): called");
-
- // Wrap the tests in decorators for duration, scaling, repetition, parameterization etc.
- WrappedSuiteTestDecorator targetTest = decorateTests(test);
-
- // Delegate to the super method to run the decorated tests.
- log.debug("About to call super.doRun");
-
- TestResult result = super.doRun(targetTest, wait);
- log.debug("super.doRun returned.");
-
- /*if (result instanceof TKTestResult)
- {
- TKTestResult tkResult = (TKTestResult) result;
-
- tkResult.notifyEndBatch();
- }*/
-
- return result;
- }
-
- /**
- * Applies test decorators to the tests for parameterization, duration, scaling and repetition.
- *
- * @param test The test to decorat.
- *
- * @return The decorated test.
- */
- protected WrappedSuiteTestDecorator decorateTests(Test test)
- {
- log.debug("params = " + ((params == null) ? null : MathUtils.printArray(params)));
- log.debug("repetitions = " + repetitions);
- log.debug("threads = " + ((threads == null) ? null : MathUtils.printArray(threads)));
- log.debug("duration = " + duration);
-
- // Wrap all tests in the test suite with WrappedSuiteTestDecorators. This is quite ugly and a bit baffling,
- // but the reason it is done is because the JUnit implementation of TestDecorator has some bugs in it.
- WrappedSuiteTestDecorator targetTest = null;
-
- if (test instanceof TestSuite)
- {
- log.debug("targetTest is a TestSuite");
-
- TestSuite suite = (TestSuite) test;
-
- int numTests = suite.countTestCases();
- log.debug("There are " + numTests + " in the suite.");
-
- for (int i = 0; i < numTests; i++)
- {
- Test nextTest = suite.testAt(i);
- log.debug("suite.testAt(" + i + ") = " + nextTest);
-
- if (nextTest instanceof TimingControllerAware)
- {
- log.debug("nextTest is TimingControllerAware");
- }
-
- if (nextTest instanceof TestThreadAware)
- {
- log.debug("nextTest is TestThreadAware");
- }
- }
-
- targetTest = new WrappedSuiteTestDecorator(suite);
- log.debug("Wrapped with a WrappedSuiteTestDecorator.");
- }
- // If the test has already been wrapped, no need to do it again.
- else if (test instanceof WrappedSuiteTestDecorator)
- {
- targetTest = (WrappedSuiteTestDecorator) test;
- }
-
- // If size parameter values have been set, then wrap the test in an asymptotic test decorator.
- if (params != null)
- {
- targetTest = new AsymptoticTestDecorator(targetTest, params, (repetitions == null) ? 1 : repetitions);
- log.debug("Wrapped with asymptotic test decorator.");
- log.debug("targetTest = " + targetTest);
- }
-
- // If no size parameters are set but the repitions parameter is, then wrap the test in an asymptotic test decorator.
- else if ((repetitions != null) && (repetitions > 1))
- {
- targetTest = new AsymptoticTestDecorator(targetTest, new int[] { 1 }, repetitions);
- log.debug("Wrapped with asymptotic test decorator.");
- log.debug("targetTest = " + targetTest);
- }
-
- // Apply any optional user specified decorators.
- targetTest = applyOptionalUserDecorators(targetTest);
-
- // If a test run duration has been set then wrap the test in a duration test decorator. This will wrap on
- // top of size, repeat or concurrency wrappings already applied.
- if (duration != null)
- {
- DurationTestDecorator durationTest = new DurationTestDecorator(targetTest, duration);
- targetTest = durationTest;
-
- log.debug("Wrapped with duration test decorator.");
- log.debug("targetTest = " + targetTest);
-
- registerShutdownHook(durationTest);
- }
-
- // ParameterVariationTestDecorator...
-
- // If a test thread concurrency level is set then wrap the test in a scaled test decorator. This will wrap on
- // top of size scaling or repetition wrappings.
- ScaledTestDecorator scaledDecorator;
-
- if ((threads != null) && ((threads.length > 1) || (MathUtils.maxInArray(threads) > 1)))
- {
- scaledDecorator = new ScaledTestDecorator(targetTest, threads);
- targetTest = scaledDecorator;
- log.debug("Wrapped with scaled test decorator.");
- log.debug("targetTest = " + targetTest);
- }
- else
- {
- scaledDecorator = new ScaledTestDecorator(targetTest, new int[] { 1 });
- targetTest = scaledDecorator;
- log.debug("Wrapped with scaled test decorator with default of 1 thread.");
- log.debug("targetTest = " + targetTest);
- }
-
- // Register the scaled test decorators shutdown hook.
- registerShutdownHook(scaledDecorator);
-
- return targetTest;
- }
-
- /**
- * If there were any user specified test decorators on the command line, this method instantiates them and wraps
- * the test in them, from inner-most to outer-most in the order in which the decorators were supplied on the
- * command line.
- *
- * @param targetTest The test to wrap.
- *
- * @return A wrapped test.
- */
- protected WrappedSuiteTestDecorator applyOptionalUserDecorators(WrappedSuiteTestDecorator targetTest)
- {
- // If there are user defined test decorators apply them in order now.
- for (TestDecoratorFactory factory : decoratorFactories)
- {
- targetTest = factory.decorateTest(targetTest);
- }
-
- return targetTest;
- }
-
- /**
- * Creates the TestResult object to be used for test runs. See {@link TKTestResult} for more information and the
- * enhanced test result class that this uses.
- *
- * @return An instance of the enhanced test result object, {@link TKTestResult}.
- */
- protected TestResult createTestResult()
- {
- log.debug("protected TestResult createTestResult(): called");
-
- TKTestResult result = new TKTestResult(delay, testCaseName);
-
- // Check if a directory to output reports to has been specified and attach test listeners if so.
- if (reportDir != null)
- {
- // Create the report directory if it does not already exist.
- File reportDirFile = new File(reportDir);
-
- if (!reportDirFile.exists())
- {
- reportDirFile.mkdir();
- }
-
- // Create the results file (make the name of this configurable as a command line parameter).
- Writer timingsWriter;
-
- // Always set up a console feedback listener.
- ConsoleTestListener feedbackListener = new ConsoleTestListener();
- result.addListener(feedbackListener);
- result.addTKTestListener(feedbackListener);
-
- // Set up an XML results listener to output the timings to the results file, if requested on the command line.
- if (xmlResults)
- {
- try
- {
- File timingsFile = new File(reportDirFile, "TEST-" + currentTestClassName + ".xml");
- timingsWriter = new BufferedWriter(new FileWriter(timingsFile), 20000);
- }
- catch (IOException e)
- {
- throw new RuntimeException("Unable to create the log file to write test results to: " + e, e);
- }
-
- XMLTestListener listener = new XMLTestListener(timingsWriter, currentTestClassName);
- result.addListener(listener);
- result.addTKTestListener(listener);
-
- registerShutdownHook(listener);
- }
-
- // Set up an CSV results listener to output the timings to the results file, if requested on the command line.
- if (csvResults)
- {
- try
- {
- File timingsFile =
- new File(reportDirFile, testRunName + "-" + TIME_STAMP_FORMAT.format(new Date()) + "-timings.csv");
- timingsWriter = new BufferedWriter(new FileWriter(timingsFile), 20000);
- }
- catch (IOException e)
- {
- throw new RuntimeException("Unable to create the log file to write test results to: " + e, e);
- }
-
- CSVTestListener listener = new CSVTestListener(timingsWriter);
- result.addListener(listener);
- result.addTKTestListener(listener);
-
- // Register the results listeners shutdown hook to flush its data if the test framework is shutdown
- // prematurely.
- registerShutdownHook(listener);
- }
-
- // Register the results listeners shutdown hook to flush its data if the test framework is shutdown
- // prematurely.
- // registerShutdownHook(listener);
-
- // Record the start time of the batch.
- // result.notifyStartBatch();
-
- // At this point in time the test class has been instantiated, giving it an opportunity to read its parameters.
- // Inform any test listers of the test properties.
- result.notifyTestProperties(TestContextProperties.getAccessedProps());
- }
-
- return result;
- }
-
- /**
- * Registers the shutdown hook of a {@link ShutdownHookable}.
- *
- * @param hookable The hookable to register.
- */
- protected void registerShutdownHook(ShutdownHookable hookable)
- {
- Runtime.getRuntime().addShutdownHook(hookable.getShutdownHook());
- }
-
- /**
- * Initializes the test runner with the provided command line arguments and and starts the test run.
- *
- * @param testClassName The fully qualified name of the test class to run.
- *
- * @return The test results.
- *
- * @throws Exception Any exceptions from running the tests are allowed to fall through.
- */
- protected TestResult start(String testClassName) throws Exception
- {
- // Record the current test class, so that the test results can be output to a file incorporating this name.
- this.currentTestClassName = testClassName;
-
- // Delegate to the super method to run the tests.
- return super.start(new String[] { testClassName });
- }
-}
diff --git a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/TestRunnerImprovedErrorHandling.java b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/TestRunnerImprovedErrorHandling.java
deleted file mode 100644
index c68405bd06..0000000000
--- a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/TestRunnerImprovedErrorHandling.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.junit.extensions;
-
-import junit.framework.Test;
-import junit.framework.TestResult;
-
-import junit.runner.Version;
-
-import junit.textui.ResultPrinter;
-import junit.textui.TestRunner;
-
-import org.apache.log4j.Logger;
-
-import java.io.PrintStream;
-
-/**
- * The {@link junit.textui.TestRunner} does not provide very good error handling. It does not wrap exceptions and
- * does not print out stack traces, losing valuable error tracing information. This class overrides methods in it
- * in order to improve their error handling. The {@link TKTestRunner} is then built on top of this.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * </table>
- *
- * @author Rupert Smith
- */
-public class TestRunnerImprovedErrorHandling extends TestRunner
-{
- /** Used for logging. */
- Logger log = Logger.getLogger(TestRunnerImprovedErrorHandling.class);
-
- /**
- * Delegates to the super constructor.
- */
- public TestRunnerImprovedErrorHandling()
- {
- super();
- }
-
- /**
- * Delegates to the super constructor.
- *
- * @param printStream The location to write test results to.
- */
- public TestRunnerImprovedErrorHandling(PrintStream printStream)
- {
- super(printStream);
- }
-
- /**
- * Delegates to the super constructor.
- *
- * @param resultPrinter The location to write test results to.
- */
- public TestRunnerImprovedErrorHandling(ResultPrinter resultPrinter)
- {
- super(resultPrinter);
- }
-
- /**
- * Starts a test run. Analyzes the command line arguments
- * and runs the given test suite.
- *
- * @param args The command line arguments.
- *
- * @return The test results.
- *
- * @throws Exception Any exceptions falling through the tests are wrapped in Exception and rethrown.
- */
- public TestResult start(String[] args) throws Exception
- {
- String testCase = "";
- boolean wait = false;
-
- for (int i = 0; i < args.length; i++)
- {
- if (args[i].equals("-wait"))
- {
- wait = true;
- }
- else if (args[i].equals("-c"))
- {
- testCase = extractClassName(args[++i]);
- }
- else if (args[i].equals("-v"))
- {
- System.err.println("JUnit " + Version.id() + " by Kent Beck and Erich Gamma");
- }
- else
- {
- testCase = args[i];
- }
- }
-
- if (testCase.equals(""))
- {
- throw new Exception("Usage: TestRunner [-wait] testCaseName, where name is the name of the TestCase class");
- }
-
- try
- {
- Test suite = getTest(testCase);
-
- return doRun(suite, wait);
- }
- catch (Exception e)
- {
- log.warn("Got exception whilst creating and running test suite.", e);
- throw new Exception("Could not create and run the test suite.", e);
- }
- }
-}
diff --git a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/TestThreadAware.java b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/TestThreadAware.java
deleted file mode 100644
index 94dcf5499b..0000000000
--- a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/TestThreadAware.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.junit.extensions;
-
-/**
- * This interface can be implemented by tests that want to know if they are being run concurrently. It provides
- * lifecycle notification events to tell the test implementation when test threads are being created and destroyed.
- * This can assist tests in creating and destroying resources that exist over the life of a test thread. A single
- * test thread can excute the same test many times, and often it is convenient to keep resources, for example network
- * connections, open over many test calls.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities
- * <tr><td> Set up per thread test fixtures.
- * <tr><td> Clean up per thread test fixtures.
- * </table>
- *
- * @author Rupert Smith
- */
-public interface TestThreadAware
-{
- /**
- * Called when a test thread is created.
- */
- public void threadSetUp();
-
- /**
- * Called after all threads have completed their setup.
- */
- public void postThreadSetUp();
-
- /**
- * Called when a test thread is destroyed.
- */
- public void threadTearDown();
-}
diff --git a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/Throttle.java b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/Throttle.java
deleted file mode 100644
index 1ea8e8e2be..0000000000
--- a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/Throttle.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.junit.extensions;
-
-/**
- * Throttle is an interface that supplies a {@link #throttle} method, that can only be called at the rate specified
- * in a call to the {@link #setRate} method. This can be used to restict processing to run at a certain number
- * of operations per second.
- *
- * <p/>Throttle also supplies a method to check the throttle rate, without waiting. This could be used to update a user
- * interface every time an event occurs, but only up to a maximum rate. For example, as elements are added to a list,
- * a count of elements is updated for the user to see, but only up to a maximum rate of ten updates a second, as updating
- * faster than that slows the processing of element-by-element additions to the list unnecessarily.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities
- * <tr><td> Accept throttling rate in operations per second.
- * <tr><td> Inject short pauses to fill-out processing cycles to a specified rate.
- * <tr><td> Check against a throttle speed without waiting.
- * </table>
- *
- * @author Rupert Smith
- */
-public interface Throttle
-{
- /**
- * Specifies the throttling rate in operations per second. This must be called with with a value, the inverse
- * of which is a measurement in nano seconds, such that the number of nano seconds do not overflow a long integer.
- * The value must also be larger than zero.
- *
- * @param hertz The throttling rate in cycles per second.
- */
- public void setRate(float hertz);
-
- /**
- * This method can only be called at the rate set by the {@link #setRate} method, if it is called faster than this
- * it will inject short pauses to restrict the call rate to that rate.
- *
- * <p/>If the thread executing this method is interrupted, it must ensure that the threads interrupt thread
- * remains set upon exit from the method. This method does not expose InterruptedException, to indicate interruption
- * of the throttle during a timed wait. It may be changed so that it does.
- */
- public void throttle();
-
- /**
- * Checks but does not enforce the throttle rate. When this method is called, it checks if a length of time greater
- * than that equal to the inverse of the throttling rate has passed since it was last called and returned <tt>true</tt>
- *
- * @return <tt>true</tt> if a length of time greater than that equal to the inverse of the throttling rate has
- * passed since this method was last called and returned <tt>true</tt>, <tt>false</tt> otherwise. The very
- * first time this method is called on a throttle, it returns <tt>true</tt> as the base case to the above
- * self-referential definition.
- */
- public boolean checkThrottle();
-}
diff --git a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/TimingController.java b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/TimingController.java
deleted file mode 100644
index 27e43a10a4..0000000000
--- a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/TimingController.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.junit.extensions;
-
-/**
- * A TimingController is a interface that a test that is aware of the fact that it is being timed can use to manage
- * the timer. Using this interface tests can suspend and resume test timers. This is usefull if you want to exclude
- * some expensive preparation from being timed as part of a test. In general when timing tests to measure the
- * performance of code, you should try to set up data in the #setUp where possible, or as static members in the test
- * class. This is not always convenient, this interface gives you a way to suspend and resume, or event completely
- * restart test timers, to get accurate measurements.
- *
- * <p/>The interface can also be used to register multiple test pass/fails and timings from a single test method.
- * In some cases it is easier to write tests in this way. For example a concurrent and asynchronous test may make
- * many asynchronous requests and then wait for replies to all its requests. Writing such a test with one send/reply
- * per test method and trying to scale up using many threads will quickly run into limitations if more than about
- * 100 asynchronous calls need to be made at once. A better way to write such a test is as a single method that sends
- * many (perhaps thousands or millions) and waits for replies in two threads, one for send, one for replies. It can
- * then log pass/fails and timings on each individual reply as they come back in, even though the test has been written
- * to send thousands of requests per test method in order to do volume testing.
- *
- * <p/>If when the {@link #completeTest(boolean)} is called, the test runner decides that testing should stop (perhaps
- * because a duration test has expired), it throws an InterruptedException to indicate that the test method should stop
- * immediately. The test method can do this by allowing this exception to fall through, if no other clean-up handling
- * is necessary, or it can simply return as soon as it possibly can. The test runner will still call the tearDown
- * method in the usual way when this happens.
- *
- * <p/>Below are some examples of how this can be used. Not how checking that the timing controller is really available
- * rather than assuming it is, means that the test can run as an ordinary JUnit test under the default test runners. In
- * general code should be written to take advantage of the extended capabilities of junit toolkit, without assuming they
- * are going to be run under its test runner.
- *
- * <pre>
- * public class MyTest extends TestCase implements TimingControllerAware {
- * ...
- *
- * timingUtils = this.getTimingController();
- *
- * // Do expensive data preparation here...
- *
- * if (timingUtils != null)
- * timingUtils.restart();
- * </pre>
- *
- * <pre>
- * public class MyTest extends TestCase implements TimingControllerAware {
- * ...
- *
- * public void myVolumeTest(int size) {
- *
- * timingUtils = this.getTimingController();
- *
- * boolean stopNow = false;
- *
- * // In Sender thread.
- * for(int i = 0; !stopNow && i < size; i++)
- * // Send request i.
- * ...
- *
- * // In Receiver thread.
- * onReceive(Object o) {
- * try {
- * // Check o is as expected.
- * if (....)
- * {
- * if (timingUtils != null)
- * timingUtils.completeTest(true);
- * }
- * else
- * {
- * if (timingUtils != null)
- * timingUtils.completeTest(false);
- * }
- * } catch (InterruptedException e) {
- * stopNow = true;
- * return;
- * }
- * }
- * </pre>
- *
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities
- * <tr><td> Allow test timers to be suspended, restarted or reset.
- * <tr><td> Allow tests to register multiple pass/fails and timings.
- * </table>
- *
- * @author Rupert Smith
- */
-public interface TimingController
-{
- /**
- * Gets the timing controller associated with the current test thread. Tests that use timing controller should
- * always get the timing controller from this method in the same thread that called the setUp, tearDown or test
- * method. The controller returned by this method may be called from any thread because it remembers the thread
- * id of the original test thread.
- *
- * @return The timing controller associated with the current test thread.
- */
- public TimingController getControllerForCurrentThread();
-
- /**
- * Suspends the test timer.
- *
- * @return The current time in nanoseconds.
- */
- public long suspend();
-
- /**
- * Allows the test timer to continue running after a suspend.
- *
- * @return The current time in nanoseconds.
- */
- public long resume();
-
- /**
- * Completely restarts the test timer from zero.
- *
- * @return The current time in nanoseconds.
- */
- public long restart();
-
- /**
- * Register an additional pass/fail for the current test. The test result is assumed to apply to a test of
- * 'size' parmeter 1. Use the {@link #completeTest(boolean, int)} method to register timings with parameters.
- *
- * @param testPassed Whether or not this timing is for a test pass or fail.
- *
- * @throws InterruptedException If the test runner decides that testing should stop it throws this exception to
- * indicate to the test method that it should stop immediately.
- */
- public void completeTest(boolean testPassed) throws InterruptedException;
-
- /**
- * Register an additional pass/fail for the current test. The test result is applies to a test of the specified
- * 'size' parmeter.
- *
- * @param testPassed Whether or not this timing is for a test pass or fail.
- * @param param The test parameter size for parameterized tests.
- *
- * @throws InterruptedException If the test runner decides that testing should stop it throws this exception to
- * indicate to the test method that it should stop immediately.
- */
- public void completeTest(boolean testPassed, int param) throws InterruptedException;
-
- /**
- * Register an additional pass/fail for the current test. The test result is applies to a test of the specified
- * 'size' parmeter and allows the caller to sepecify the timing to log.
- *
- * @param testPassed Whether or not this timing is for a test pass or fail.
- * @param param The test parameter size for parameterized tests.
- * @param timeNanos The time in nano seconds to log the test result with.
- *
- * A null value for timeNanos is a request to this method that it should
- * calculate the time for the given test run.
- *
- *
- * @throws InterruptedException If the test runner decides that testing should stop it throws this exception to
- * indicate to the test method that it should stop immediately.
- */
- public void completeTest(boolean testPassed, int param, Long timeNanos) throws InterruptedException;
-
- /**
- * Register an additional pass/fail for the current test. The test result is applies to a test of the specified
- * 'size' parmeter and allows the caller to sepecify the timing to log.
- *
- * @param testPassed Whether or not this timing is for a test pass or fail.
- * @param param The test parameter size for parameterized tests.
- * @param timeNanos The time in nano seconds to log the test result with.
- *
- * A null value for timeNanos is a request to this method that it should
- * calculate the time for the given test run.
- * A null value for timeNanos2 means this test does not provide a second
- * timing value so a '-' is printed in the log.
- *
- *
- * @throws InterruptedException If the test runner decides that testing should stop it throws this exception to
- * indicate to the test method that it should stop immediately.
- */
- public void completeTest(boolean testPassed, int param, Long timeNanos, Long time2Nanos) throws InterruptedException;
-}
diff --git a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/TimingControllerAware.java b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/TimingControllerAware.java
deleted file mode 100644
index 11db87e073..0000000000
--- a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/TimingControllerAware.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.junit.extensions;
-
-/**
- * TimingControllerAware is an interface that tests that manipulate the timing controller should implement. It enables
- * the TK test runner to set the test up with a handle on the timing controller which the test can use to call back
- * to the test runner to manage the timers.
- *
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities
- * <tr><td> Provide timing controller insertion point for tests.
- * </table>
- *
- * @author Rupert Smith
- */
-public interface TimingControllerAware
-{
- /**
- * Used by test runners that can supply a {@link TimingController} to set the controller on an aware test.
- *
- * @param controller The timing controller.
- */
- public void setTimingController(TimingController controller);
-}
diff --git a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/WrappedSuiteTestDecorator.java b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/WrappedSuiteTestDecorator.java
deleted file mode 100644
index d5690fc24a..0000000000
--- a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/WrappedSuiteTestDecorator.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.junit.extensions;
-
-import junit.extensions.TestDecorator;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.apache.log4j.Logger;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-/**
- * WrappedSuiteTestDecorator is a test decorator that wraps a test suite, or another wrapped suite, but provides the
- * same functionality for the {@link junit.extensions.TestDecorator#countTestCases()} and {@link TestSuite#testAt(int)}
- * methods as the underlying suite. It returns the values that these methods provide, to enable classes using decorated
- * tests to drill down to the underlying tests in the suite. That is to say that it indexes and reports the number of
- * distinct tests in the suite, not the number of test runs that would result from, for example, wrapping the suite in a
- * repeating decorator.
- *
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities
- * <tr><td> Provide access to the underlying tests in a suite.
- * </table>
- *
- * @author Rupert Smith
- */
-public class WrappedSuiteTestDecorator extends TestDecorator
-{
- /** Used for logging. */
- private static Logger log = Logger.getLogger(WrappedSuiteTestDecorator.class);
-
- /** Holds the test suite that this supplies access to. */
- protected Test suite;
-
- /**
- * Creates a wrappred suite test decorator from a test suite.
- *
- * @param suite The test suite.
- */
- public WrappedSuiteTestDecorator(TestSuite suite)
- {
- super(suite);
- this.suite = suite;
- }
-
- /**
- * Creates a wrapped suite test decorator from another one.
- *
- * @param suite The test suite.
- */
- public WrappedSuiteTestDecorator(WrappedSuiteTestDecorator suite)
- {
- super(suite);
- this.suite = suite;
- }
-
- /**
- * Returns the test count of the wrapped suite.
- *
- * @return The test count of the wrapped suite.
- */
- public int countTestCases()
- {
- return suite.countTestCases();
- }
-
- /**
- * Gets the ith test from the test suite.
- *
- * @param i The index of the test within the suite to get.
- *
- * @return The test with the specified index.
- */
- public Test testAt(int i)
- {
- log.debug("public Test testAt(int i = " + i + "): called");
-
- if (suite instanceof WrappedSuiteTestDecorator)
- {
- return ((WrappedSuiteTestDecorator) suite).testAt(i);
- }
- else if (suite instanceof TestSuite)
- {
- return ((TestSuite) suite).testAt(i);
- }
-
- // This should never happen.
- return null;
- }
-
- /**
- * Gets all the tests from the underlying test suite.
- *
- * @return All the tests from the underlying test suite.
- */
- public Collection<Test> getAllUnderlyingTests()
- {
- log.debug("public Collection<Test> getAllUnderlyingTests(): called");
-
- List<Test> tests = new ArrayList<Test>();
-
- int numTests = countTestCases();
- log.debug("numTests = " + numTests);
-
- for (int i = 0; i < numTests; i++)
- {
- tests.add(testAt(i));
- }
-
- return tests;
- }
-}
diff --git a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/listeners/CSVTestListener.java b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/listeners/CSVTestListener.java
deleted file mode 100644
index 40841189a3..0000000000
--- a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/listeners/CSVTestListener.java
+++ /dev/null
@@ -1,572 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.junit.extensions.listeners;
-
-import junit.framework.AssertionFailedError;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestListener;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.junit.extensions.ShutdownHookable;
-import org.apache.qpid.junit.extensions.util.TestContextProperties;
-
-import java.io.IOException;
-import java.io.Writer;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import java.util.TreeSet;
-
-/**
- * CSVTestListener is both a test listener, a timings listener, a memory listener and a parameter listener. It listens for test completion events and
- * then writes out all the data that it has listened to into a '.csv' (comma seperated values) file.
- *
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Listen to test events; start, end, fail, error.
- * <tr><td> Listen to test timings.
- * <tr><td> Listen to test memory usage.
- * <tr><td> Listen to parameterized test parameters.
- * <tr><td> Output all test data to a CSV file.
- * </table>
- *
- * @author Rupert Smith
- *
- * @todo Write an XML output class. Write a transform to convert it into an HTML page with timings as graphs.
- */
-public class CSVTestListener implements TestListener, TKTestListener, ShutdownHookable
-{
- /** Used for logging. */
- private static final Logger log = Logger.getLogger(CSVTestListener.class);
-
- /** The timings file writer. */
- private Writer timingsWriter;
-
- /**
- * Map for holding results on a per thread basis as they come in. A ThreadLocal is not used as sometimes an
- * explicit thread id must be used, where notifications come from different threads than the ones that called
- * the test method.
- */
- Map<Long, TestResult> threadLocalResults = Collections.synchronizedMap(new HashMap<Long, TestResult>());
-
- /** Used to record the start time of a complete test run, for outputing statistics at the end of the test run. */
- private long batchStartTime;
-
- /** Used to record the number of errors accross a complete test run. */
- private int numError;
-
- /** Used to record the number of failures accross a complete test run. */
- private int numFailed;
-
- /** Used to record the number of passes accross a complete test run. */
- private int numPassed;
-
- /** Used to record the total tests run accross a complete test run. Always equal to passes + errors + fails. */
- private int totalTests;
-
- /** Used to recrod the current concurrency level for the test batch. */
- private int concurrencyLevel;
-
- /**
- * Used to record the total 'size' of the tests run, this is the number run times the average value of the test
- * size parameters.
- */
- private int totalSize;
-
- /**
- * Used to record the summation of all of the individual test timings. Note that total time and summed time
- * are unlikely to be in agreement, exception for a single threaded test (with no setup time). Total time is
- * the time taken to run all the tests, summed time is the added up time that each individual test took. So if
- * two tests run in parallel and take one second each, total time will be one seconds, summed time will be two
- * seconds.
- */
- private long summedTime;
-
- /**
- * Used to record the summation of all of the second test timing information.
- * One use of the second timing would be to provide latency as well as test timing.
- */
- private long summedTime2;
-
- /** Flag to indicate when batch has been started but not ended to ensure end batch stats are output only once. */
- private boolean batchStarted = false;
-
- /**
- * Creates a new CSVTestListener object.
- *
- * @param writer A writer where this CSV listener should write out its output to.
- */
- public CSVTestListener(Writer writer)
- {
- // log.debug("public CSVTestListener(Writer writer): called");
-
- // Keep the writer.
- this.timingsWriter = writer;
- }
-
- /**
- * Resets the test results to the default state of time zero, memory usage zero, test passed.
- *
- * @param test The test to resest any results for.
- * @param threadId Optional thread id if not calling from thread that started the test method. May be null.
- */
- public void reset(Test test, Long threadId)
- {
- // log.debug("public void reset(Test test = \"" + test + "\", Long threadId = " + threadId + "): called");
-
- TestResult r =
- (threadId == null) ? threadLocalResults.get(Thread.currentThread().getId()) : threadLocalResults.get(threadId);
-
- r.testTime = 0L;
- r.testTime2 = null;
- r.testStartMem = 0L;
- r.testEndMem = 0L;
- r.testState = "Pass";
- r.testParam = 0;
- }
-
- /**
- * Called when a test results in an error.
- *
- * @param test The test which is in error.
- * @param t Any Throwable raised by the test in error.
- */
- public void addError(Test test, Throwable t)
- {
- // log.debug("public void addError(Test test, Throwable t): called");
-
- TestResult r = threadLocalResults.get(Thread.currentThread().getId());
- r.testState = "Error";
- }
-
- /**
- * Called when a test results in a failure.
- *
- * @param test The test which failed.
- * @param t The AssertionFailedError that encapsulates the test failure.
- */
- public void addFailure(Test test, AssertionFailedError t)
- {
- // log.debug("public void addFailure(Test \"" + test + "\", AssertionFailedError t): called");
-
- TestResult r = threadLocalResults.get(Thread.currentThread().getId());
- r.testState = "Failure";
- }
-
- /**
- * Called when a test completes to mark it as a test fail. This method should be used when registering a
- * failure from a different thread than the one that started the test.
- *
- * @param test The test which failed.
- * @param e The assertion that failed the test.
- * @param threadId Optional thread id if not calling from thread that started the test method. May be null.
- */
- public void addFailure(Test test, AssertionFailedError e, Long threadId)
- {
- // log.debug("public void addFailure(Test test = \"" + test + "\", AssertionFailedError e, Long threadId = " + threadId
- // + "): called");
-
- TestResult r =
- (threadId == null) ? threadLocalResults.get(Thread.currentThread().getId()) : threadLocalResults.get(threadId);
-
- r.testState = "Failure";
- }
-
- /**
- * Called when a test completes. Success, failure and errors.
- *
- * @param test The test which completed.
- */
- public void endTest(Test test)
- {
- // log.debug("public void endTest(Test \"" + test + "\"): called");
-
- TestResult r = threadLocalResults.get(Thread.currentThread().getId());
-
- writeTestResults(r, test);
-
- // Clear all the test results for the thread.
- threadLocalResults.remove(Thread.currentThread().getId());
- }
-
- /**
- * Called when a test starts.
- *
- * @param test The test wich has started.
- */
- public void startTest(Test test)
- {
- // log.debug("public void startTest(Test \"" + test + "\"): called");
-
- // Initialize the thread local test results.
- threadLocalResults.put(Thread.currentThread().getId(), new TestResult());
- }
-
- /**
- * Should be called every time a test completes with the run time of that test.
- *
- * @param test The name of the test.
- * @param nanos The run time of the test in nanoseconds.
- * @param threadId Optional thread id if not calling from thread that started the test method. May be null.
- */
- public void timing(Test test, long nanos, Long threadId)
- {
- // log.debug("public void timing(String \"" + test + "\", long " + nanos + "): called");
-
- TestResult r =
- (threadId == null) ? threadLocalResults.get(Thread.currentThread().getId()) : threadLocalResults.get(threadId);
-
- r.testTime = nanos;
- summedTime += nanos;
- }
-
- /**
- * Optionally called every time a test completes with the second timing test.
- *
- * @param test The name of the test.
- * @param nanos The second timing information of the test in nanoseconds.
- * @param threadId Optional thread id if not calling from thread that started the test method. May be null.
- */
- public void timing2(Test test, Long nanos, Long threadId)
- {
- TestResult r =
- (threadId == null) ? threadLocalResults.get(Thread.currentThread().getId()) : threadLocalResults.get(threadId);
-
-
- if (nanos != null)
- {
- r.testTime2 = nanos;
- summedTime2 += nanos;
- }
- }
-
- /**
- * Should be called every time a test completed with the amount of memory used before and after the test was run.
- *
- * @param test The test which memory was measured for.
- * @param memStart The total JVM memory used before the test was run.
- * @param memEnd The total JVM memory used after the test was run.
- * @param threadId Optional thread id if not calling from thread that started the test method. May be null.
- */
- public void memoryUsed(Test test, long memStart, long memEnd, Long threadId)
- {
- // log.debug("public void memoryUsed(Test \"" + test + "\", long " + memStart + ", long " + memEnd + ", Long "
- // + threadId + "): called");
-
- TestResult r =
- (threadId == null) ? threadLocalResults.get(Thread.currentThread().getId()) : threadLocalResults.get(threadId);
-
- r.testStartMem = memStart;
- r.testEndMem = memEnd;
- }
-
- /**
- * Should be called every time a parameterized test completed with the int value of its test parameter.
- *
- * @param test The test which memory was measured for.
- * @param parameter The int parameter value.
- * @param threadId Optional thread id if not calling from thread that started the test method. May be null.
- */
- public void parameterValue(Test test, int parameter, Long threadId)
- {
- // log.debug("public void parameterValue(Test test = \"" + test + "\", int parameter = " + parameter + "): called");
-
- TestResult r =
- (threadId == null) ? threadLocalResults.get(Thread.currentThread().getId()) : threadLocalResults.get(threadId);
-
- r.testParam = parameter;
- totalSize += parameter;
- }
-
- /**
- * Should be called every time a test completes with the current number of test threads running. This should not
- * change within a test batch, therefore it is safe to take this as a batch level property value too.
- *
- * @param test The test for which the measurement is being generated.
- * @param threads The number of tests being run concurrently.
- * @param threadId Optional thread id if not calling from thread that started the test method. May be null.
- */
- public void concurrencyLevel(Test test, int threads, Long threadId)
- {
- // log.debug("public void concurrencyLevel(Test test = \"" + test + "\", int threads = " + threads + "): called");
-
- TestResult r =
- (threadId == null) ? threadLocalResults.get(Thread.currentThread().getId()) : threadLocalResults.get(threadId);
-
- r.testConcurrency = threads;
- concurrencyLevel = threads;
-
- }
-
- /**
- * Called when a test completes. Success, failure and errors. This method should be used when registering an
- * end test from a different thread than the one that started the test.
- *
- * @param test The test which completed.
- * @param threadId Optional thread id if not calling from thread that started the test method. May be null.
- */
- public void endTest(Test test, Long threadId)
- {
- // log.debug("public void endTest(Test test = \"" + test + "\", Long threadId " + threadId + "): called");
-
- TestResult r =
- (threadId == null) ? threadLocalResults.get(Thread.currentThread().getId()) : threadLocalResults.get(threadId);
-
- writeTestResults(r, test);
- }
-
- /**
- * Takes a time stamp for the beginning of the batch and resets stats counted for the batch.
- */
- public synchronized void startBatch()
- {
- numError = 0;
- numFailed = 0;
- numPassed = 0;
- totalTests = 0;
- totalSize = 0;
- batchStartTime = System.nanoTime();
- summedTime = 0;
- summedTime2 = 0;
- batchStarted = true;
-
- // Write out the column headers for the batch.
- writeColumnHeaders();
- }
-
- /**
- * Takes a time stamp for the end of the batch to calculate the total run time.
- * Write this and other stats out to the tail of the csv file.
- *
- * @param parameters The optional test parameters, may be null.
- */
- public synchronized void endBatch(Properties parameters)
- {
- boolean noParams = (parameters == null) || (parameters.size() == 0);
-
- // Check that a batch has been started but not ended.
- if (batchStarted)
- {
- long batchEndTime = System.nanoTime();
- float totalTimeMillis = ((float) (batchEndTime - batchStartTime)) / 1000000f;
- float summedTimeMillis = ((float) summedTime) / 1000000f;
- float summedTime2Millis = ((float) summedTime2) / 1000000f;
-
-
- // Write the stats for the batch out.
- try
- {
- synchronized (this.getClass())
- {
- timingsWriter.write("Total Tests:, " + totalTests + ", ");
- timingsWriter.write("Total Passed:, " + numPassed + ", ");
- timingsWriter.write("Total Failed:, " + numFailed + ", ");
- timingsWriter.write("Total Error:, " + numError + ", ");
- timingsWriter.write("Total Size:, " + totalSize + ", ");
- timingsWriter.write("Summed Time:, " + summedTimeMillis + ", ");
- timingsWriter.write("Summed Custom Time:, " + summedTime2Millis + ", ");
- timingsWriter.write("Concurrency Level:, " + concurrencyLevel + ", ");
- timingsWriter.write("Total Time:, " + totalTimeMillis + ", ");
- timingsWriter.write("Average Custom Time:, " + ((summedTime2Millis/ (float) totalTests)) + ", ");
- timingsWriter.write("Test Throughput:, " + (((float) totalTests) / totalTimeMillis) + ", ");
- timingsWriter.write("Test * Size Throughput:, " + (((float) totalSize) / totalTimeMillis)
- + (noParams ? "\n\n" : ", "));
-
- // Write out the test parameters if there are any specified.
- if (!noParams)
- {
- properties(parameters);
- }
-
- timingsWriter.flush();
- }
- }
- catch (IOException e)
- {
- throw new RuntimeException("Unable to write out end batch statistics: " + e, e);
- }
- }
-
- // Reset the batch started flag to ensure stats are only output once.
- batchStarted = false;
- }
-
- /**
- * Notifies listeners of the tests read/set properties.
- *
- * @param properties The tests read/set properties.
- */
- public void properties(Properties properties)
- {
- // log.debug("public void properties(Properties properties): called");
-
- // Write the properties out to the results file.
- try
- {
- synchronized (this.getClass())
- {
- Set keySet = new TreeSet(properties.keySet());
-
- // timingsWriter.write("\n");
-
- for (Object key : keySet)
- {
- timingsWriter.write(key + " = , " + properties.getProperty((String) key) + ", ");
- }
-
- timingsWriter.write("\n\n");
- // timingsWriter.flush();
- }
- }
- catch (IOException e)
- {
- throw new RuntimeException("Unable to write out test parameters: " + e, e);
- }
-
- // Write out the column headers after the properties.
- // writeColumnHeaders();
- }
-
- /**
- * Writes out and flushes the column headers for raw test data.
- */
- private void writeColumnHeaders()
- {
- // Write the column headers for the CSV file. Any IO exceptions are ignored.
- try
- {
- timingsWriter.write("Class, ");
- timingsWriter.write("Method, ");
- timingsWriter.write("Thread, ");
- timingsWriter.write("Test Outcome, ");
- timingsWriter.write("Time (milliseconds), ");
- timingsWriter.write("Custom Time (milliseconds), ");
- timingsWriter.write("Memory Used (bytes), ");
- timingsWriter.write("Concurrency level, ");
- timingsWriter.write("Test Size\n");
-
- timingsWriter.flush();
- }
- catch (IOException e)
- {
- throw new RuntimeException("Unable to write out column headers: " + e, e);
- }
- }
-
- /**
- * Writes out the test results for the specified test. This outputs a single line of results to the csv file.
- *
- * @param r The test results to write out.
- * @param test The test to write them out for.
- */
- private void writeTestResults(TestResult r, Test test)
- {
- // Update the running stats for this batch.
- if ("Error".equals(r.testState))
- {
- numError++;
- }
- else if ("Failure".equals(r.testState))
- {
- numFailed++;
- }
- else if ("Pass".equals(r.testState))
- {
- numPassed++;
- }
-
- totalTests++;
-
- // Write the test name and thread information plus all instrumenation a line of the CSV ouput. Any IO
- // exceptions are ignored.
- try
- {
- synchronized (this.getClass())
- {
- timingsWriter.write(test.getClass().getName() + ", ");
- timingsWriter.write(((test instanceof TestCase) ? ((TestCase) test).getName() : "") + ", ");
- timingsWriter.write(Thread.currentThread().getName() + ", ");
- timingsWriter.write(r.testState + ", ");
- timingsWriter.write((((float) r.testTime) / 1000000f) + ", ");
-
- timingsWriter.write(r.testTime2 == null ? "- , " :
- (((float) r.testTime2) / 1000000f) + ", ");
- timingsWriter.write((r.testEndMem - r.testStartMem) + ", ");
- timingsWriter.write(r.testConcurrency + ", ");
- timingsWriter.write(r.testParam + "\n");
- }
- }
- catch (IOException e)
- {
- throw new RuntimeException("Unable to write out test results: " + e, e);
- }
- }
-
- /**
- * Supplies the shutdown hook. This attempts to flush the results in the event of the test runner being prematurely
- * suspended before the end of the current test batch.
- *
- * @return The shut down hook.
- */
- public Thread getShutdownHook()
- {
- return new Thread(new Runnable()
- {
- public void run()
- {
- log.debug("CSVTestListener::ShutdownHook: called");
-
- // Complete the current test batch stats.
- endBatch(TestContextProperties.getInstance());
- }
- });
- }
-
- /** Captures test results packaged into a single object, so that it can be set up as a thread local. */
- private static class TestResult
- {
- /** Used to hold the test timing. */
- public long testTime;
-
- /** Use to hold the second timing information. */
- public Long testTime2;
-
- /** Used to hold the test start memory usage. */
- public long testStartMem;
-
- /** Used to hold the test end memory usage. */
- public long testEndMem;
-
- /** Used to hold the test pass/fail/error state. */
- public String testState = "Pass";
-
- /** Used to hold the test parameter value. */
- public int testParam;
-
- /** Used to hold the concurrency level under which the test was run. */
- public int testConcurrency;
-
- }
-}
diff --git a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/listeners/ConsoleTestListener.java b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/listeners/ConsoleTestListener.java
deleted file mode 100644
index 276fec328e..0000000000
--- a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/listeners/ConsoleTestListener.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.junit.extensions.listeners;
-
-import junit.framework.AssertionFailedError;
-import junit.framework.Test;
-import junit.framework.TestListener;
-
-import org.apache.qpid.junit.extensions.SleepThrottle;
-import org.apache.qpid.junit.extensions.Throttle;
-
-import java.util.Properties;
-
-/**
- * ConsoleTestListener provides feedback to the console, as test timings are taken, by drawing a '.', or an 'E', or an
- * 'F', for each test that passes, is in error or fails. It does this for every test result registered with the framework,
- * not just on the completion of each test method as the JUnit one does. It also uses a throttle to cap the rate of
- * dot drawing, as exessively high rates can degrade test performance without providing much usefull feedback to the user.
- * Unlike the JUnit dot drawing feedback, this one will correctly wrap lines when tests are run concurrently (the
- * rate capping ensures that this does not become a hot-spot for thread contention).
- *
- * <p/>Where rate capping causes the conflation of multiple requested dots into a single dot, the dot that is actually
- * drawn will be the worst result within the conflation period, that is, error is worse than fail which is worse than pass.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Draw dots as each test result completes, at a capped rate.
- * </table>
- *
- * @author Rupert Smith
- */
-public class ConsoleTestListener implements TestListener, TKTestListener
-{
- /** Used to indicate a test pass. */
- private static final int PASS = 1;
-
- /** Used to indicate a test failure. */
- private static final int FAIL = 2;
-
- /** Used to indicate a test error. */
- private static final int ERROR = 3;
-
- /** Defines the maximum number of columns of dots to print. */
- private static final int MAX_COLUMNS = 80;
-
- /** Used to throttle the dot writing rate. */
- Throttle throttle;
-
- /** Tracks the worst test result so far, when the throttled print method must conflate results due to throttling. */
- private int conflatedResult = 0;
-
- /** Tracks the column count as dots are printed, so that newlines can be inserted at the right margin. */
- private int columnCount = 0;
-
- /** Used as a monitor on the print method criticial section, to ensure that line ends always happen in the right place. */
- private final Object printMonitor = new Object();
-
- /**
- * Creates a dot drawing feedback test listener, set by default to 80 columns at 80 dots per second capped rate.
- */
- public ConsoleTestListener()
- {
- throttle = new SleepThrottle();
- throttle.setRate(80f);
- }
-
- /**
- * Prints dots at a capped rate, conflating the requested type of dot to draw if this method is called at a rate
- * higher than the capped rate. The conflation works by always printing the worst result that occurs within the
- * conflation period, that is, error is worse than fail which is worse than a pass.
- *
- * @param result The type of dot to draw, {@link #PASS}, {@link #FAIL} or {@link #ERROR}.
- */
- private void throttledPrint(int result)
- {
- conflatedResult = (result > conflatedResult) ? result : conflatedResult;
-
- if (throttle.checkThrottle())
- {
- synchronized (printMonitor)
- {
- switch (conflatedResult)
- {
- default:
- case PASS:
- System.out.print('.');
- break;
-
- case FAIL:
- System.out.print('F');
- break;
-
- case ERROR:
- System.out.print('E');
- break;
- }
-
- columnCount = (columnCount >= MAX_COLUMNS) ? 0 : (columnCount + 1);
-
- if (columnCount == 0)
- {
- System.out.print('\n');
- }
-
- conflatedResult = 0;
- }
- }
- }
-
- /**
- * An error occurred.
- *
- * @param test The test in error. Ignored.
- * @param t The error that the test threw. Ignored.
- */
- public void addError(Test test, Throwable t)
- {
- throttledPrint(ERROR);
- }
-
- /**
- * A failure occurred.
- *
- * @param test The test that failed. Ignored.
- * @param t The assertion failure that the test threw. Ignored.
- */
- public void addFailure(Test test, AssertionFailedError t)
- {
- throttledPrint(FAIL);
- }
-
- /**
- * A test ended.
- *
- * @param test The test that ended. Ignored.
- */
- public void endTest(Test test)
- {
- throttledPrint(PASS);
- }
-
- /**
- * A test started.
- *
- * @param test The test that started. Ignored.
- */
- public void startTest(Test test)
- { }
-
- /**
- * Resets the test results to the default state of time zero, memory usage zero, parameter zero, test passed.
- *
- * @param test The test to resest any results for.
- * @param threadId Optional thread id if not calling from thread that started the test method. May be null.
- */
- public void reset(Test test, Long threadId)
- { }
-
- /**
- * Should be called every time a test completes with the run time of that test.
- *
- * @param test The name of the test.
- * @param nanos The run time of the test in nanoseconds.
- * @param threadId Optional thread id if not calling from thread that started the test method. May be null.
- */
- public void timing(Test test, long nanos, Long threadId)
- { }
-
- /**
- * Optionally called every time a test completes with the second timing test.
- *
- * @param test The name of the test.
- * @param nanos The second timing information of the test in nanoseconds.
- * @param threadId Optional thread id if not calling from thread that started the test method. May be null.
- */
- public void timing2(Test test, Long nanos, Long threadId)
- { }
-
- /**
- * Should be called every time a test completed with the amount of memory used before and after the test was run.
- *
- * @param test The test which memory was measured for.
- * @param memStart The total JVM memory used before the test was run.
- * @param memEnd The total JVM memory used after the test was run.
- * @param threadId Optional thread id if not calling from thread that started the test method. May be null.
- */
- public void memoryUsed(Test test, long memStart, long memEnd, Long threadId)
- { }
-
- /**
- * Should be called every time a parameterized test completed with the int value of its test parameter.
- *
- * @param test The test which memory was measured for.
- * @param parameter The int parameter value.
- * @param threadId Optional thread id if not calling from thread that started the test method. May be null.
- */
- public void parameterValue(Test test, int parameter, Long threadId)
- { }
-
- /**
- * Should be called every time a test completes with the current number of test threads running.
- *
- * @param test The test for which the measurement is being generated.
- * @param threads The number of tests being run concurrently.
- * @param threadId Optional thread id if not calling from thread that started the test method. May be null.
- */
- public void concurrencyLevel(Test test, int threads, Long threadId)
- { }
-
- /**
- * Called when a test completes. Success, failure and errors. This method should be used when registering an
- * end test from a different thread than the one that started the test.
- *
- * @param test The test which completed.
- * @param threadId Optional thread id if not calling from thread that started the test method. May be null.
- */
- public void endTest(Test test, Long threadId)
- {
- throttledPrint(PASS);
- }
-
- /**
- * Called when a test completes to mark it as a test fail. This method should be used when registering a
- * failure from a different thread than the one that started the test.
- *
- * @param test The test which failed.
- * @param e The assertion that failed the test.
- * @param threadId Optional thread id if not calling from thread that started the test method. May be null.
- */
- public void addFailure(Test test, AssertionFailedError e, Long threadId)
- {
- throttledPrint(FAIL);
- }
-
- /**
- * Notifies listeners of the start of a complete run of tests.
- */
- public void startBatch()
- { }
-
- /**
- * Notifies listeners of the end of a complete run of tests.
- *
- * @param parameters The optional test parameters to log out with the batch results.
- */
- public void endBatch(Properties parameters)
- { }
-
- /**
- * Notifies listeners of the tests read/set properties.
- *
- * @param properties The tests read/set properties.
- */
- public void properties(Properties properties)
- { }
-}
diff --git a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/listeners/TKTestListener.java b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/listeners/TKTestListener.java
deleted file mode 100644
index 63b042db10..0000000000
--- a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/listeners/TKTestListener.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.junit.extensions.listeners;
-
-import junit.framework.AssertionFailedError;
-import junit.framework.Test;
-import junit.framework.TestListener;
-
-import java.util.Properties;
-
-/**
- * TKTestListener is a listener interface for listeners that want to be informed of the run times of tests, the memory
- * usage of tests, the 'size' parameters of parameterized tests and the begin and end events of complete test runs.
- * {@link org.apache.qpid.junit.extensions.TKTestResult} is an example of a test result class that listeners
- * interested in these events can be attached to.
- *
- * The {@link #timing(junit.framework.Test, long, Long)}, {@link #memoryUsed(junit.framework.Test, long, long, Long)},
- * {@link #parameterValue(junit.framework.Test, int, Long)} and {@link #endTest(junit.framework.Test, Long)} methods
- * all accept on optional thread id parameter.
- *
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities
- * <tr><td> Listen to test timings.
- * <tr><td> Listen to test memory usages.
- * <tr><td> Listen to parameterized test parameters.
- * </table>
- *
- * @author Rupert Smith
- */
-public interface TKTestListener extends TestListener
-{
- /**
- * Resets the test results to the default state of time zero, memory usage zero, parameter zero, test passed.
- *
- * @param test The test to resest any results for.
- * @param threadId Optional thread id if not calling from thread that started the test method. May be null.
- */
- public void reset(Test test, Long threadId);
-
- /**
- * Should be called every time a test completes with the run time of that test.
- *
- * @param test The name of the test.
- * @param nanos The run time of the test in nanoseconds.
- * @param threadId Optional thread id if not calling from thread that started the test method. May be null.
- */
- public void timing(Test test, long nanos, Long threadId);
-
-
- /**
- * Optionally called every time a test completes with the second timing test.
- *
- * @param test The name of the test.
- * @param nanos The second timing information of the test in nanoseconds.
- * @param threadId Optional thread id if not calling from thread that started the test method. May be null.
- */
- public void timing2(Test test, Long nanos, Long threadId);
-
- /**
- * Should be called every time a test completed with the amount of memory used before and after the test was run.
- *
- * @param test The test which memory was measured for.
- * @param memStart The total JVM memory used before the test was run.
- * @param memEnd The total JVM memory used after the test was run.
- * @param threadId Optional thread id if not calling from thread that started the test method. May be null.
- */
- public void memoryUsed(Test test, long memStart, long memEnd, Long threadId);
-
- /**
- * Should be called every time a parameterized test completed with the int value of its test parameter.
- *
- * @param test The test which memory was measured for.
- * @param parameter The int parameter value.
- * @param threadId Optional thread id if not calling from thread that started the test method. May be null.
- */
- public void parameterValue(Test test, int parameter, Long threadId);
-
- /**
- * Should be called every time a test completes with the current number of test threads running.
- *
- * @param test The test for which the measurement is being generated.
- * @param threads The number of tests being run concurrently.
- * @param threadId Optional thread id if not calling from thread that started the test method. May be null.
- */
- public void concurrencyLevel(Test test, int threads, Long threadId);
-
- /**
- * Called when a test completes. Success, failure and errors. This method should be used when registering an
- * end test from a different thread than the one that started the test.
- *
- * @param test The test which completed.
- * @param threadId Optional thread id if not calling from thread that started the test method. May be null.
- */
- public void endTest(Test test, Long threadId);
-
- /**
- * Called when a test completes to mark it as a test fail. This method should be used when registering a
- * failure from a different thread than the one that started the test.
- *
- * @param test The test which failed.
- * @param e The assertion that failed the test.
- * @param threadId Optional thread id if not calling from thread that started the test method. May be null.
- */
- public void addFailure(Test test, AssertionFailedError e, Long threadId);
-
- /**
- * Notifies listeners of the start of a complete run of tests.
- */
- public void startBatch();
-
- /**
- * Notifies listeners of the end of a complete run of tests.
- *
- * @param parameters The optional test parameters to log out with the batch results.
- */
- public void endBatch(Properties parameters);
-
- /**
- * Notifies listeners of the tests read/set properties.
- *
- * @param properties The tests read/set properties.
- */
- public void properties(Properties properties);
-}
diff --git a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/listeners/XMLTestListener.java b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/listeners/XMLTestListener.java
deleted file mode 100644
index 003bd0cecc..0000000000
--- a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/listeners/XMLTestListener.java
+++ /dev/null
@@ -1,410 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.junit.extensions.listeners;
-
-import junit.framework.AssertionFailedError;
-import junit.framework.Test;
-import junit.framework.TestCase;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.junit.extensions.ShutdownHookable;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.Writer;
-import java.util.*;
-
-/**
- * Listens for test results for a named test and outputs these in the standard JUnit XML format to the specified
- * writer.
- *
- * <p/>The API for this listener accepts notifications about different aspects of a tests results through different
- * methods, so some assumption needs to be made as to which test result a notification refers to. For example
- * {@link #startTest} will be called, then possibly {@link #timing} will be called, even though the test instance is
- * passed in both cases, it is not enough to distinguish a particular run of the test, as the test case instance may
- * be being shared between multiple threads, or being run a repeated number of times, and can therfore be re-used
- * between calls. The listeners make the assumption that, for every test, a unique thread will call {@link #startTest}
- * and {@link #endTest} to delimit each test. All calls to set test parameters, timings, state and so on, will occur
- * between the start and end and will be given with the same thread id as the start and end, so the thread id provides
- * a unqiue value to identify a particular test run against.
- *
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Listen to test lifecycle notifications.
- * <tr><td> Listen to test errors and failures.
- * <tr><td> Listen to test timings.
- * <tr><td> Listen to test memory usages.
- * <tr><td> Listen to parameterized test parameters.
- * <tr><th> Responsibilities
- * </table>
- *
- * @todo Merge this class with CSV test listener, making the collection of results common to both, and only factoring
- * out the results printing code into sub-classes. Provide a simple XML results formatter with the same format as
- * the ant XML formatter, and a more structured one for outputing results with timings and summaries from
- * performance tests.
- *
- * @author Rupert Smith
- */
-public class XMLTestListener implements TKTestListener, ShutdownHookable
-{
- /** Used for debugging. */
- private static final Logger log = Logger.getLogger(XMLTestListener.class);
-
- /** The results file writer. */
- protected Writer writer;
-
- /** Holds the results for individual tests. */
- // protected Map<Result, Result> results = new LinkedHashMap<Result, Result>();
- // protected List<Result> results = new ArrayList<Result>();
-
- /**
- * Map for holding results on a per thread basis as they come in. A ThreadLocal is not used as sometimes an
- * explicit thread id must be used, where notifications come from different threads than the ones that called
- * the test method.
- */
- private Map<Long, Result> threadLocalResults = Collections.synchronizedMap(new LinkedHashMap<Long, Result>());
-
- /**
- * Holds results for tests that have ended. Transferring these results here from the per-thread results map, means
- * that the thread id is freed for the thread to generate more results.
- */
- private List<Result> results = new ArrayList<Result>();
-
- /** Holds the overall error count. */
- private int errors = 0;
-
- /** Holds the overall failure count. */
- private int failures = 0;
-
- /** Holds the overall tests run count. */
- private int runs = 0;
-
- /** Holds the name of the class that tests are being run for. */
- private String testClassName;
-
- /**
- * Creates a new XML results output listener that writes to the specified location.
- *
- * @param writer The location to write results to.
- * @param testClassName The name of the test class to include in the test results.
- */
- public XMLTestListener(Writer writer, String testClassName)
- {
- log.debug("public XMLTestListener(Writer writer, String testClassName = " + testClassName + "): called");
-
- this.writer = writer;
- this.testClassName = testClassName;
- }
-
- /**
- * Resets the test results to the default state of time zero, memory usage zero, parameter zero, test passed.
- *
- * @param test The test to resest any results for.
- * @param threadId Optional thread id if not calling from thread that started the test method. May be null.
- */
- public void reset(Test test, Long threadId)
- {
- log.debug("public void reset(Test test = " + test + ", Long threadId = " + threadId + "): called");
-
- XMLTestListener.Result r =
- (threadId == null) ? threadLocalResults.get(Thread.currentThread().getId()) : threadLocalResults.get(threadId);
-
- r.error = null;
- r.failure = null;
-
- }
-
- /**
- * Notification that a test started.
- *
- * @param test The test that started.
- */
- public void startTest(Test test)
- {
- log.debug("public void startTest(Test test = " + test + "): called");
-
- Result newResult = new Result(test.getClass().getName(), ((TestCase) test).getName());
-
- // Initialize the thread local test results.
- threadLocalResults.put(Thread.currentThread().getId(), newResult);
- runs++;
- }
-
- /**
- * Should be called every time a test completes with the run time of that test.
- *
- * @param test The name of the test.
- * @param nanos The run time of the test in nanoseconds.
- * @param threadId Optional thread id if not calling from thread that started the test method. May be null.
- */
- public void timing(Test test, long nanos, Long threadId)
- { }
-
- /**
- * Optionally called every time a test completes with the second timing test.
- *
- * @param test The name of the test.
- * @param nanos The second timing information of the test in nanoseconds.
- * @param threadId Optional thread id if not calling from thread that started the test method. May be null.
- */
- public void timing2(Test test, Long nanos, Long threadId)
- { }
-
- /**
- * Should be called every time a test completed with the amount of memory used before and after the test was run.
- *
- * @param test The test which memory was measured for.
- * @param memStart The total JVM memory used before the test was run.
- * @param memEnd The total JVM memory used after the test was run.
- * @param threadId Optional thread id if not calling from thread that started the test method. May be null.
- */
- public void memoryUsed(Test test, long memStart, long memEnd, Long threadId)
- { }
-
- /**
- * Should be called every time a parameterized test completed with the int value of its test parameter.
- *
- * @param test The test which memory was measured for.
- * @param parameter The int parameter value.
- * @param threadId Optional thread id if not calling from thread that started the test method. May be null.
- */
- public void parameterValue(Test test, int parameter, Long threadId)
- { }
-
- /**
- * Should be called every time a test completes with the current number of test threads running.
- *
- * @param test The test for which the measurement is being generated.
- * @param threads The number of tests being run concurrently.
- * @param threadId Optional thread id if not calling from thread that started the test method. May be null.
- */
- public void concurrencyLevel(Test test, int threads, Long threadId)
- { }
-
- /**
- * Notifies listeners of the tests read/set properties.
- *
- * @param properties The tests read/set properties.
- */
- public void properties(Properties properties)
- { }
-
- /**
- * Notification that a test ended.
- *
- * @param test The test that ended.
- */
- public void endTest(Test test)
- {
- log.debug("public void endTest(Test test = " + test + "): called");
-
- // Move complete test results into the completed tests list.
- Result r = threadLocalResults.get(Thread.currentThread().getId());
- results.add(r);
-
- // Clear all the test results for the thread.
- threadLocalResults.remove(Thread.currentThread().getId());
- }
-
- /**
- * Called when a test completes. Success, failure and errors. This method should be used when registering an
- * end test from a different thread than the one that started the test.
- *
- * @param test The test which completed.
- * @param threadId Optional thread id if not calling from thread that started the test method. May be null.
- */
- public void endTest(Test test, Long threadId)
- {
- log.debug("public void endTest(Test test = " + test + ", Long threadId = " + threadId + "): called");
-
- // Move complete test results into the completed tests list.
- Result r =
- (threadId == null) ? threadLocalResults.get(Thread.currentThread().getId()) : threadLocalResults.get(threadId);
- results.add(r);
-
- // Clear all the test results for the thread.
- threadLocalResults.remove(Thread.currentThread().getId());
- }
-
- /**
- * An error occurred.
- *
- * @param test The test in which the error occurred.
- * @param t The throwable that resulted from the error.
- */
- public void addError(Test test, Throwable t)
- {
- log.debug("public void addError(Test test = " + test + ", Throwable t = " + t + "): called");
-
- Result r = threadLocalResults.get(Thread.currentThread().getId());
- r.error = t;
- errors++;
- }
-
- /**
- * A failure occurred.
- *
- * @param test The test in which the failure occurred.
- * @param t The JUnit assertions that led to the failure.
- */
- public void addFailure(Test test, AssertionFailedError t)
- {
- log.debug("public void addFailure(Test test = " + test + ", AssertionFailedError t = " + t + "): called");
-
- Result r = threadLocalResults.get(Thread.currentThread().getId());
- r.failure = t;
- failures++;
- }
-
- /**
- * Called when a test completes to mark it as a test fail. This method should be used when registering a
- * failure from a different thread than the one that started the test.
- *
- * @param test The test which failed.
- * @param e The assertion that failed the test.
- * @param threadId Optional thread id if not calling from thread that started the test method. May be null.
- */
- public void addFailure(Test test, AssertionFailedError e, Long threadId)
- {
- log.debug("public void addFailure(Test test, AssertionFailedError e, Long threadId): called");
-
- Result r =
- (threadId == null) ? threadLocalResults.get(Thread.currentThread().getId()) : threadLocalResults.get(threadId);
- r.failure = e;
- failures++;
- }
-
- /**
- * Notifies listeners of the start of a complete run of tests.
- */
- public void startBatch()
- {
- log.debug("public void startBatch(): called");
-
- // Reset all results counts.
- threadLocalResults = Collections.synchronizedMap(new HashMap<Long, Result>());
- errors = 0;
- failures = 0;
- runs = 0;
-
- // Write out the file header.
- try
- {
- writer.write("<?xml version=\"1.0\" ?>\n");
- }
- catch (IOException e)
- {
- throw new RuntimeException("Unable to write the test results.", e);
- }
- }
-
- /**
- * Notifies listeners of the end of a complete run of tests.
- *
- * @param parameters The optional test parameters to log out with the batch results.
- */
- public void endBatch(Properties parameters)
- {
- log.debug("public void endBatch(Properties parameters = " + parameters + "): called");
-
- // Write out the results.
- try
- {
- // writer.write("<?xml version=\"1.0\" ?>\n");
- writer.write("<testsuite errors=\"" + errors + "\" failures=\"" + failures + "\" tests=\"" + runs + "\" name=\""
- + testClassName + "\">\n");
-
- for (Result result : results)
- {
- writer.write(" <testcase classname=\"" + result.testClass + "\" name=\"" + result.testName + "\">\n");
-
- if (result.error != null)
- {
- writer.write(" <error type=\"" + result.error.getClass() + "\">");
- result.error.printStackTrace(new PrintWriter(writer));
- writer.write(" </error>");
- }
- else if (result.failure != null)
- {
- writer.write(" <failure type=\"" + result.failure.getClass() + "\">");
- result.failure.printStackTrace(new PrintWriter(writer));
- writer.write(" </failure>");
- }
-
- writer.write(" </testcase>\n");
- }
-
- writer.write("</testsuite>\n");
- writer.flush();
- }
- catch (IOException e)
- {
- throw new RuntimeException("Unable to write the test results.", e);
- }
- }
-
- /**
- * Supplies the shutdown hook.
- *
- * @return The shut down hook.
- */
- public Thread getShutdownHook()
- {
- return new Thread(new Runnable()
- {
- public void run()
- {
- log.debug("XMLTestListener::ShutdownHook: called");
- }
- });
- }
-
- /**
- * Used to capture the results of a particular test run.
- */
- protected static class Result
- {
- /** Holds the name of the test class. */
- public String testClass;
-
- /** Holds the name of the test method. */
- public String testName;
-
- /** Holds the exception that caused error in this test. */
- public Throwable error;
-
- /** Holds the assertion exception that caused failure in this test. */
- public AssertionFailedError failure;
-
- /**
- * Creates a placeholder for the results of a test.
- *
- * @param testClass The test class.
- * @param testName The name of the test that was run.
- */
- public Result(String testClass, String testName)
- {
- this.testClass = testClass;
- this.testName = testName;
- }
- }
-}
diff --git a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/listeners/package.html b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/listeners/package.html
deleted file mode 100644
index 15acc02ab1..0000000000
--- a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/listeners/package.html
+++ /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.
-
--->
-
-<html>
-<body>
-Listners for test statistics are defined in this package. At the moment there is only one listener which writes all test
-statistics out to a CSV (comma seperated values) file which can be loaded by most spread sheets.
-</body>
-</html>
diff --git a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/package.html b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/package.html
deleted file mode 100644
index 4cab8d936a..0000000000
--- a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/package.html
+++ /dev/null
@@ -1,33 +0,0 @@
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-
-<html>
-<body>
-Basic JUnit is enahanced with test runners to run tests repeatedly, simultaneously in many threads and with increasing
-test sizes for asymptotic performance measurements. There are features to measure the time and amount of memory that
-tests use as well as to record the asymptotic test size parameters. There are some utilities to write these test
-statistics to various file formats too and these can be found in the listeners package.
-
-</p>The main test runner class is TKTestRunner which can be called with command line parameters to specify how tests
-should be run.
-
-</body>
-</html>
diff --git a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/util/CommandLineParser.java b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/util/CommandLineParser.java
deleted file mode 100644
index f158090e96..0000000000
--- a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/util/CommandLineParser.java
+++ /dev/null
@@ -1,787 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.junit.extensions.util;
-
-import java.text.CharacterIterator;
-import java.text.StringCharacterIterator;
-import java.util.*;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * CommandLineParser provides a utility for specifying the format of a command line and parsing command lines to ensure
- * that they fit their specified format. A command line is made up of flags and options, both may be refered to as
- * options. A flag is an option that does not take an argument (specifying it means it has the value 'true' and not
- * specifying it means it has the value 'false'). Options must take arguments but they can be set up with defaults so
- * that they take a default value when not set. Options may be mandatory in wich case it is an error not to specify
- * them on the command line. Flags are never mandatory because they are implicitly set to false when not specified.
- *
- * <p/>Some examples command line are:
- *
- * <ul>
- * <li>This one has two options that expect arguments:
- * <pre>
- * cruisecontrol -configfile cruisecontrol.xml -port 9000
- * </pre>
- * <li>This has one no-arg flag and two 'free' arguments:
- * <pre>
- * zip -r project.zip project/*
- * </pre>
- * <li>This one concatenates multiple flags into a single block with only one '-':
- * <pre>
- * jar -tvf mytar.tar
- * </pre>
- *
- * <p/>The parsing rules are:
- *
- * <ol>
- * <li>Flags may be combined after a single '-' because they never take arguments. Normally such flags are single letter
- * flags but this is only a convention and not enforced. Flags of more than one letter are usually specified on their own.
- * <li>Options expecting arguments must always be on their own.
- * <li>The argument to an option may be seperated from it by whitespace or appended directly onto the option.
- * <li>The argument to an option may never begin with a '-' character.
- * <li>All other arguments not beginning with a '-' character are free arguments that do not belong to any option.
- * <li>The second or later of a set of duplicate or repeated flags override earlier ones.
- * <li>Options are matched up to the shortest matching option. This is because of the possibility of having no space
- * between an option and its argument. This rules out the possibility of using two options where one is an opening
- * substring of the other. For example, the options "foo" and "foobar" cannot be used on the same command line because
- * it is not possible to distinguish the argument "-foobar" from being the "foobar" option or the "foo" option with
- * the "bar" argument.
- * </ol>
- *
- * <p/>By default, unknown options are simply ignored if specified on the command line. This behaviour may be changed
- * so that the parser reports all unknowns as errors by using the {@link #setErrorsOnUnknowns} method.
- *
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Accept a command line specification.
- * <tr><td> Parse a command line into properties, validating it against its specification.
- * <tr><td> Report all errors between a command line and its specification.
- * <tr><td> Provide a formatted usage string for a command line.
- * <tr><td> Provide a formatted options in force string for a command line.
- * <tr><td> Allow errors on unknowns behaviour to be turned on or off.
- * </table>
- *
- * @author Rupert Smith
- */
-public class CommandLineParser
-{
- /**
- * Holds a mapping from command line option names to detailed information about those options.
- * Use of a tree map ensures that the options are easy to print in alphabetical order as a usage string.
- * An alternative might be to use a LinkedHashMap to print them in the order they are specified.
- */
- private Map<String, CommandLineOption> optionMap = new TreeMap<String, CommandLineOption>();
-
- /** Holds a list of parsing errors. */
- private List<String> parsingErrors = new ArrayList<String>();
-
- /** Holds the regular head matcher to match command line options with. */
- private Matcher optionMatcher = null;
-
- /** Holds the parsed command line properties after parsing. */
- private Properties parsedProperties = null;
-
- /** Holds any trailing name=value pairs specified in the free arguments. */
- private Properties trailingProperties = null;
-
- /** Flag used to indicate that errors should be created for unknown options. False by default. */
- private boolean errorsOnUnknowns = false;
-
- /**
- * Creates a command line options parser from a command line specification. This is passed to this constructor
- * as an array of arrays of strings. Each array of strings specifies the command line for a single option. A static
- * array may therefore easily be used to configure the command line parser in a single method call with an easily
- * readable format.
- *
- * <p/>Each array of strings must be 2, 3, 4 or 5 elements long. If any of the last three elements are missing they
- * are assumed to be null. The elements specify the following parameters:
- * <ol>
- * <li>The name of the option without the leading '-'. For example, "file". To specify the format of the 'free'
- * arguments use the option names "1", "2", ... and so on.
- * <li>The option comment. A line of text describing the usage of the option. For example, "The file to be processed."
- * <li>The options argument. This is a very short description of the argument to the option, often a single word
- * or a reminder as to the arguments format. When this element is null the option is a flag and does not
- * accept any arguments. For example, "filename" or "(unix | windows)" or null. The actual text specified
- * is only used to print in the usage message to remind the user of the usage of the option.
- * <li>The mandatory flag. When set to "true" an option must always be specified. Any other value, including null,
- * means that the option is mandatory. Flags are always mandatory (see class javadoc for explanation of why) so
- * this is ignored for flags.
- * <li>A regular head describing the format that the argument must take. Ignored if null.
- * </ol>
- * <p/>An example call to this constructor is:
- *
- * <pre>
- * CommandLineParser commandLine = new CommandLineParser(
- * new String[][] {{"file", "The file to be processed. ", "filename", "true"},
- * {"dir", "Directory to store results in. Current dir used if not set.", "out dir"},
- * {"os", "Operating system EOL format to use.", "(windows | unix)", null, "windows\|unix"},
- * {"v", "Verbose mode. Prints information about the processing as it goes."},
- * {"1", "The processing command to run.", "command", "true", "add\|remove\|list"}});
- * </pre>
- *
- * @param config The configuration as an array of arrays of strings.
- */
- public CommandLineParser(String[][] config)
- {
- // Loop through all the command line option specifications creating details for each in the options map.
- for (String[] nextOptionSpec : config)
- {
- addOption(nextOptionSpec[0], nextOptionSpec[1], (nextOptionSpec.length > 2) ? nextOptionSpec[2] : null,
- (nextOptionSpec.length > 3) && ("true".equals(nextOptionSpec[3])),
- (nextOptionSpec.length > 4) ? nextOptionSpec[4] : null);
- }
- }
-
- /**
- * Extracts all name=value pairs from the command line, sets them all as system properties and also returns
- * a map of properties containing them.
- *
- * @param args The command line.
- * @param commandLine The command line parser.
- * @param properties The properties object to inject all parsed properties into (optional may be <tt>null</tt>).
- *
- * @return A set of properties containing all name=value pairs from the command line.
- */
- public static Properties processCommandLine(String[] args, CommandLineParser commandLine, Properties properties)
- {
- // Capture the command line arguments or display errors and correct usage and then exit.
- Properties options = null;
-
- try
- {
- options = commandLine.parseCommandLine(args);
-
- // Add all the command line options and trailing settings to properties if the optional properties object
- // to copy them into has been set.
- if (properties != null)
- {
- commandLine.addTrailingPairsToProperties(properties);
- commandLine.addOptionsToProperties(properties);
- }
- }
- catch (IllegalArgumentException e)
- {
- System.out.println(commandLine.getErrors());
- System.out.println(commandLine.getUsage());
- System.exit(1);
- }
-
- return options;
- }
-
- /**
- * Lists all the parsing errors from the most recent parsing in a string.
- *
- * @return All the parsing errors from the most recent parsing.
- */
- public String getErrors()
- {
- // Return the empty string if there are no errors.
- if (parsingErrors.isEmpty())
- {
- return "";
- }
-
- // Concatenate all the parsing errors together.
- String result = "";
-
- for (String s : parsingErrors)
- {
- result += s;
- }
-
- return result;
- }
-
- /**
- * Lists the properties set from the most recent parsing or an empty string if no parsing has been done yet.
- *
- * @return The properties set from the most recent parsing or an empty string if no parsing has been done yet.
- */
- public String getOptionsInForce()
- {
- // Check if there are no properties to report and return and empty string if so.
- if (parsedProperties == null)
- {
- return "";
- }
-
- // List all the properties.
- String result = "Options in force:\n";
-
- for (Map.Entry<Object, Object> property : parsedProperties.entrySet())
- {
- result += property.getKey() + " = " + property.getValue() + "\n";
- }
-
- return result;
- }
-
- /**
- * Generates a usage string consisting of the name of each option and each options argument description and
- * comment.
- *
- * @return A usage string for all the options.
- */
- public String getUsage()
- {
- String result = "Options:\n";
-
- int optionWidth = 0;
- int argumentWidth = 0;
-
- // Calculate the column widths required for aligned layout.
- for (CommandLineOption optionInfo : optionMap.values())
- {
- int oWidth = optionInfo.option.length();
- int aWidth = (optionInfo.argument != null) ? (optionInfo.argument.length()) : 0;
-
- optionWidth = (oWidth > optionWidth) ? oWidth : optionWidth;
- argumentWidth = (aWidth > argumentWidth) ? aWidth : argumentWidth;
- }
-
- // Print usage on each of the command line options.
- for (CommandLineOption optionInfo : optionMap.values())
- {
- String argString = ((optionInfo.argument != null) ? (optionInfo.argument) : "");
- String optionString = optionInfo.option;
-
- argString = rightPad(argString, " ", argumentWidth);
- optionString = rightPad(optionString, " ", optionWidth);
-
- result += "-" + optionString + " " + argString + " " + optionInfo.comment + "\n";
- }
-
- return result;
- }
-
- /**
- * Right pads a string with a given string to a given size. This method will repeat the padder string as many
- * times as is necessary until the exact specified size is reached. If the specified size is less than the size
- * of the original string then the original string is returned unchanged.
- *
- * <pre>
- * Example1 - original string "cat", padder string "white", size 8 gives "catwhite".
- * Example2 - original string "cat", padder string "white", size 15 gives "catwhitewhitewh".
- * Example3 - original string "cat", padder string "white", size 2 gives "cat".
- * </pre>
- *
- * @param stringToPad The original string.
- * @param padder The string to pad onto the original string.
- * @param size The required size of the new string.
- *
- * @return The newly padded string.
- */
- public static String rightPad(String stringToPad, String padder, int size)
- {
- if (padder.length() == 0)
- {
- return stringToPad;
- }
-
- StringBuffer strb = new StringBuffer(stringToPad);
- StringCharacterIterator sci = new StringCharacterIterator(padder);
-
- while (strb.length() < size)
- {
- for (char ch = sci.first(); ch != CharacterIterator.DONE; ch = sci.next())
- {
- if (strb.length() < size)
- {
- strb.append(String.valueOf(ch));
- }
- }
- }
-
- return strb.toString();
- }
-
- /**
- * Control the behaviour of the errors on unkowns reporting. When turned on this reports all unkowns options
- * as errors. When turned off, all unknowns are simply ignored.
- *
- * @param errors The setting of the errors on unkown flag. True to turn it on.
- */
- public void setErrorsOnUnknowns(boolean errors)
- {
- errorsOnUnknowns = errors;
- }
-
- /**
- * Parses a set of command line arguments into a set of properties, keyed by the argument flag. The free arguments
- * are keyed by integers as strings starting at "1" and then "2", ... and so on.
- *
- * <p/>See the class level comment for a description of the parsing rules.
- *
- * @param args The command line arguments.
- *
- * @return The arguments as a set of properties.
- *
- * @throws IllegalArgumentException If the command line cannot be parsed against its specification. If this exception
- * is thrown a call to {@link #getErrors} will provide a diagnostic of the command
- * line errors.
- */
- public Properties parseCommandLine(String[] args) throws IllegalArgumentException
- {
- Properties options = new Properties();
-
- // Used to keep count of the current 'free' argument.
- int free = 1;
-
- // Used to indicate that the most recently parsed option is expecting arguments.
- boolean expectingArgs = false;
-
- // The option that is expecting arguments from the next element of the command line.
- String optionExpectingArgs = null;
-
- // Used to indicate that the most recently parsed option is a duplicate and should be ignored.
- // boolean ignore = false;
-
- // Create the regular head matcher for the command line options.
- String regexp = "^(";
- int optionsAdded = 0;
-
- for (Iterator<String> i = optionMap.keySet().iterator(); i.hasNext();)
- {
- String nextOption = i.next();
-
- // Check that the option is not a free argument definition.
- boolean notFree = false;
-
- try
- {
- Integer.parseInt(nextOption);
- }
- catch (NumberFormatException e)
- {
- notFree = true;
- }
-
- // Add the option to the regular head matcher if it is not a free argument definition.
- if (notFree)
- {
- regexp += nextOption + (i.hasNext() ? "|" : "");
- optionsAdded++;
- }
- }
-
- // There has to be more that one option in the regular head or else the compiler complains that the close
- // cannot be nullable if the '?' token is used to make the matched option string optional.
- regexp += ")" + ((optionsAdded > 0) ? "?" : "") + "(.*)";
- Pattern pattern = Pattern.compile(regexp);
-
- // Loop through all the command line arguments.
- for (String arg1 : args)
- {
- // Check if the next command line argument begins with a '-' character and is therefore the start of
- // an option.
- if (arg1.startsWith("-"))
- {
- // Extract the value of the option without the leading '-'.
- String arg = arg1.substring(1);
-
- // Match up to the longest matching option.
- optionMatcher = pattern.matcher(arg);
- optionMatcher.matches();
-
- String matchedOption = optionMatcher.group(1);
-
- // Match any argument directly appended onto the longest matching option.
- String matchedArg = optionMatcher.group(2);
-
- // Check that a known option was matched.
- if ((matchedOption != null) && !"".equals(matchedOption))
- {
- // Get the command line option information for the matched option.
- CommandLineOption optionInfo = optionMap.get(matchedOption);
-
- // Check if this option is expecting arguments.
- if (optionInfo.expectsArgs)
- {
- // The option is expecting arguments so swallow the next command line argument as an
- // argument to this option.
- expectingArgs = true;
- optionExpectingArgs = matchedOption;
-
- // In the mean time set this options argument to the empty string in case no argument is ever
- // supplied.
- // options.put(matchedOption, "");
- }
-
- // Check if the option was matched on its own and is a flag in which case set that flag.
- if ("".equals(matchedArg) && !optionInfo.expectsArgs)
- {
- options.put(matchedOption, "true");
- }
- // The option was matched as a substring with its argument appended to it or is a flag that is
- // condensed together with other flags.
- else if (!"".equals(matchedArg))
- {
- // Check if the option is a flag and therefore is allowed to be condensed together
- // with other flags.
- if (!optionInfo.expectsArgs)
- {
- // Set the first matched flag.
- options.put(matchedOption, "true");
-
- // Repeat the longest matching process on the remainder but ensure that the remainder
- // consists only of flags as only flags may be condensed together in this fashion.
- do
- {
- // Match the remainder against the options.
- optionMatcher = pattern.matcher(matchedArg);
- optionMatcher.matches();
-
- matchedOption = optionMatcher.group(1);
- matchedArg = optionMatcher.group(2);
-
- // Check that an option was matched.
- if (matchedOption != null)
- {
- // Get the command line option information for the next matched option.
- optionInfo = optionMap.get(matchedOption);
-
- // Ensure that the next option is a flag or raise an error if not.
- if (optionInfo.expectsArgs)
- {
- parsingErrors.add("Option " + matchedOption + " cannot be combined with flags.\n");
- }
-
- options.put(matchedOption, "true");
- }
- // The remainder could not be matched against a flag it is either an unknown flag
- // or an illegal argument to a flag.
- else
- {
- parsingErrors.add("Illegal argument to a flag in the option " + arg + "\n");
-
- break;
- }
- }
- // Continue until the remainder of the argument has all been matched with flags.
- while (!"".equals(matchedArg));
- }
- // The option is expecting an argument, so store the unmatched portion against it
- // as its argument.
- else
- {
- // Check the arguments format is correct against any specified format.
- checkArgumentFormat(optionInfo, matchedArg);
-
- // Store the argument against its option (regardless of its format).
- options.put(matchedOption, matchedArg);
-
- // The argument to this flag has already been supplied to it. Do not swallow the
- // next command line argument as an argument to this flag.
- expectingArgs = false;
- }
- }
- }
- else // No matching option was found.
- {
- // Add this to the list of parsing errors if errors on unkowns is being used.
- if (errorsOnUnknowns)
- {
- parsingErrors.add("Option " + matchedOption + " is not a recognized option.\n");
- }
- }
- }
- // The command line argument did not being with a '-' so it is an argument to the previous flag or it
- // is a free argument.
- else
- {
- // Check if a previous flag is expecting to swallow this next argument as its argument.
- if (expectingArgs)
- {
- // Get the option info for the option waiting for arguments.
- CommandLineOption optionInfo = optionMap.get(optionExpectingArgs);
-
- // Check the arguments format is correct against any specified format.
- checkArgumentFormat(optionInfo, arg1);
-
- // Store the argument against its option (regardless of its format).
- options.put(optionExpectingArgs, arg1);
-
- // Clear the expecting args flag now that the argument has been swallowed.
- expectingArgs = false;
- optionExpectingArgs = null;
- }
- // This command line option is not an argument to any option. Add it to the set of 'free' options.
- else
- {
- // Get the option info for the free option, if there is any.
- CommandLineOption optionInfo = optionMap.get(Integer.toString(free));
-
- if (optionInfo != null)
- {
- // Check the arguments format is correct against any specified format.
- checkArgumentFormat(optionInfo, arg1);
- }
-
- // Add to the list of free options.
- options.put(Integer.toString(free), arg1);
-
- // Move on to the next free argument.
- free++;
- }
- }
- }
-
- // Scan through all the specified options to check that all mandatory options have been set and that all flags
- // that were not set are set to false in the set of properties.
- for (CommandLineOption optionInfo : optionMap.values())
- {
- // Check if this is a flag.
- if (!optionInfo.expectsArgs)
- {
- // Check if the flag is not set in the properties and set it to false if so.
- if (!options.containsKey(optionInfo.option))
- {
- options.put(optionInfo.option, "false");
- }
- }
- // Check if this is a mandatory option and was not set.
- else if (optionInfo.mandatory && !options.containsKey(optionInfo.option))
- {
- // Create an error for the missing option.
- parsingErrors.add("Option " + optionInfo.option + " is mandatory but not was not specified.\n");
- }
- }
-
- // Check if there were any errors.
- if (!parsingErrors.isEmpty())
- {
- // Throw an illegal argument exception to signify that there were parsing errors.
- throw new IllegalArgumentException();
- }
-
- // Convert any name/value pairs in the free arguments into properties in the parsed options.
- trailingProperties = takeFreeArgsAsProperties(options, 1);
-
- parsedProperties = options;
-
- return options;
- }
-
- /**
- * If a command line has been parsed, calling this method sets all of its free arguments that were name=value pairs
- * on the specified properties.
- *
- * @param properties The property set to add the name=value pairs to.
- */
- public void addTrailingPairsToProperties(Properties properties)
- {
- if (trailingProperties != null)
- {
- for (Object propKey : trailingProperties.keySet())
- {
- String name = (String) propKey;
- String value = trailingProperties.getProperty(name);
-
- properties.setProperty(name, value);
- }
- }
- }
-
- /**
- * If a command line has been parsed, calling this method sets all of its options that were set to the specified
- * properties.
- *
- * @param properties The property set to the options to.
- */
- public void addOptionsToProperties(Properties properties)
- {
- if (parsedProperties != null)
- {
- for (Object propKey : parsedProperties.keySet())
- {
- String name = (String) propKey;
- String value = parsedProperties.getProperty(name);
-
- // This filters out all trailing items.
- if (!name.matches("^[0-9]+$"))
- {
- properties.setProperty(name, value);
- }
- }
- }
- }
-
- /**
- * Resets this command line parser after it has been used to parse a command line. This method will only need
- * to be called to use this parser a second time which is not likely seeing as a command line is usually only
- * specified once. However, it is exposed as a public method for the rare case where this may be done.
- *
- * <p/>Cleans the internal state of this parser, removing all stored errors and information about the options in
- * force.
- */
- public void reset()
- {
- parsingErrors = new ArrayList<String>();
- parsedProperties = null;
- }
-
- /**
- * Adds the option to list of available command line options.
- *
- * @param option The option to add as an available command line option.
- * @param comment A comment for the option.
- * @param argument The text that appears after the option in the usage string.
- * @param mandatory When true, indicates that this option is mandatory.
- * @param formatRegexp The format that the argument must take, defined as a regular head.
- */
- protected void addOption(String option, String comment, String argument, boolean mandatory, String formatRegexp)
- {
- // Check if usage text has been set in which case this option is expecting arguments.
- boolean expectsArgs = (!((argument == null) || argument.equals("")));
-
- // Add the option to the map of command line options.
- CommandLineOption opt = new CommandLineOption(option, expectsArgs, comment, argument, mandatory, formatRegexp);
- optionMap.put(option, opt);
- }
-
- /**
- * Converts the free arguments into property declarations. After parsing the command line the free arguments
- * are numbered from 1, such that the parsed properties contain values for the keys "1", "2", ... This method
- * converts any free arguments declared using the 'name=value' syntax into properties with key 'name', value
- * 'value'.
- *
- * <p/>For example the comand line:
- * <pre>
- * ... debug=true
- * </pre>
- *
- * <p/>After parsing has properties:
- * <pre>[[1, debug=true]]</pre>
- *
- * <p/>After applying this method the properties are:
- * <pre>[[1, debug=true], [debug, true]]</pre>
- *
- * @param properties The parsed command line properties.
- * @param from The free argument index to convert to properties from.
- *
- * @return The parsed command line properties, with free argument name value pairs too.
- */
- private Properties takeFreeArgsAsProperties(Properties properties, int from)
- {
- Properties result = new Properties();
-
- for (int i = from; true; i++)
- {
- String nextFreeArg = properties.getProperty(Integer.toString(i));
-
- // Terminate the loop once all free arguments have been consumed.
- if (nextFreeArg == null)
- {
- break;
- }
-
- // Split it on the =, strip any whitespace and set it as a system property.
- String[] nameValuePair = nextFreeArg.split("=");
-
- if (nameValuePair.length == 2)
- {
- result.setProperty(nameValuePair[0], nameValuePair[1]);
- }
- }
-
- return result;
- }
-
- /**
- * Checks the format of an argument to an option against its specified regular head format if one has
- * been set. Any errors are added to the list of parsing errors.
- *
- * @param optionInfo The command line option information for the option which is havings its argument checked.
- * @param matchedArg The string argument to the option.
- */
- private void checkArgumentFormat(CommandLineOption optionInfo, String matchedArg)
- {
- // Check if this option enforces a format for its argument.
- if (optionInfo.argumentFormatRegexp != null)
- {
- Pattern pattern = Pattern.compile(optionInfo.argumentFormatRegexp);
- Matcher argumentMatcher = pattern.matcher(matchedArg);
-
- // Check if the argument does not meet its required format.
- if (!argumentMatcher.matches())
- {
- // Create an error for this badly formed argument.
- parsingErrors.add("The argument to option " + optionInfo.option + " does not meet its required format.\n");
- }
- }
- }
-
- /**
- * Holds information about a command line options. This includes what its name is, whether or not it is a flag,
- * whether or not it is mandatory, what its user comment is, what its argument reminder text is and what its
- * regular head format is.
- *
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Hold details of a command line option.
- * </table>
- *
- * @author Rupert Smith
- */
- protected class CommandLineOption
- {
- /** Holds the text for the flag to match this argument with. */
- public String option = null;
-
- /** Holds a string describing how to use this command line argument. */
- public String argument = null;
-
- /** Flag that determines whether or not this command line argument can take arguments. */
- public boolean expectsArgs = false;
-
- /** Holds a short comment describing what this command line argument is for. */
- public String comment = null;
-
- /** Flag that determines whether or not this is an mandatory command line argument. */
- public boolean mandatory = false;
-
- /** A regular head describing what format the argument to this option muist have. */
- public String argumentFormatRegexp = null;
-
- /**
- * Create a command line option object that holds specific information about a command line option.
- *
- * @param option The text that matches the option.
- * @param expectsArgs Whether or not the option expects arguments. It is a flag if this is false.
- * @param comment A comment explaining how to use this option.
- * @param argument A short reminder of the format of the argument to this option/
- * @param mandatory Set to true if this option is mandatory.
- * @param formatRegexp The regular head that the argument to this option must meet to be valid.
- */
- public CommandLineOption(String option, boolean expectsArgs, String comment, String argument, boolean mandatory,
- String formatRegexp)
- {
- this.option = option;
- this.expectsArgs = expectsArgs;
- this.comment = comment;
- this.argument = argument;
- this.mandatory = mandatory;
- this.argumentFormatRegexp = formatRegexp;
- }
- }
-}
diff --git a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/util/ContextualProperties.java b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/util/ContextualProperties.java
deleted file mode 100644
index 14de96d165..0000000000
--- a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/util/ContextualProperties.java
+++ /dev/null
@@ -1,494 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.junit.extensions.util;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-
-/**
- * ContextualProperties is an extension of {@link java.util.Properties} that automatically selects properties based on an
- * environment parameter (defined by the system property {@link #ENV_SYS_PROPERTY}), the name of a class, plus a modifier
- * (which can be used to name a method of a class) and a property key. It also supports the definition of arrays of
- * property values using indexes. The properties are searched in the following order until a match is found:
- *
- * <ol>
- * <li>environment + class name with package name + modifier + key
- * <li>environment + class name with package name + key
- * <li>environment + key
- * <li>class name with package name + modifier + key
- * <li>class name with package name + key
- * <li>key
- * </ol>
- *
- * <p>To create arrays of property values add index numbers onto the end of the property keys. An array of string values
- * will be created with the elements of the array set to the value of the property at the matching index. Ideally the
- * index values will be contiguous, starting at 0. This does not need to be the case however. If an array definition
- * begins at index n, and ends at index m, Then an array big enough to hold m + 1 elements will be created and populated
- * with values from n to m. Values before n and any missing values between n and m will be null in the array.
- *
- * <p>To give an example, suppose you have two different environments 'DEVELOPMENT' and 'PRODUCTION' and they each need
- * the same properties but set to different values for each environment and some properties the same in both, you could
- * create a properties file like:
- *
- * <p><code>
- * # Project configuration properties file.<br/>
- * <br/>
- * # These properties are environment specific.<br/>
- * DEVELOPMENT.debug=true<br/>
- * PRODUCTION.debug=false<br/>
- * <br/>
- * # Always debug MyClass in all environments but not the myMethod method.<br/>
- * MyClass.debug=true<br/>
- * MyClass.myMethod.debug=false<br/>
- * <br/>
- * # Set up an array of my ten favourite animals. Leave elements 3 to 8 as null as I haven't decided on them yet.<br/>
- * animals.0=cat<br/>
- * animals.1=dog<br/>
- * animals.2=elephant<br/>
- * animals.9=lion<br/>
- * <br/>
- * # This is a default value that will be used when the environment is not known.<br/>
- * debug=false<br/>
- * </code>
- *
- * <p>The most specific definition of a property is searched for first moving out to the most general. This allows
- * general property defaults to be set and then overiden for specific uses by some classes and modifiers.
- *
- * <p>A ContextualProperties object can be loaded in the same way as a java.utils.Properties. A recommended way to do
- * this that does not assume that the properties file is a file (it could be in a jar) is to load the properties from the
- * url for the resource lookup up on the classpath:
- *
- * <p><code>
- * Properties configProperties = new ContextualProperties();<br/>
- * configProperties.load(this.getClass().getClassLoader().getResourceAsStream("config.properties"));<br/>
- * </code>
- *
- * <p>EnvironmentProperties will load the 'DEVELOPMENT.debug' property or 'PROUCTION.debug' property based on the setting
- * of the system environment property. If a matching property for the environment cannot be found then the simple property
- * name without the environment pre-pended onto it will be used instead. This 'use of default environments' behaviour is
- * turned on initially but it can be disabled by calling the {@link #useDefaultEnvironments} method.
- *
- * <p>When a property matching a key cannot be found then the property accessor methods will always return null. If a
- * default value for a property exists but the 'use of default environments' behavious prevents it being used then the
- * accessor methods will return null.
- *
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Automatically select properties dependant on environment, class name and modifier as well as property key.
- * <tr><td> Convert indexed properties into arrays.
- * </table>
- *
- * @author Rupert Smith
- */
-public class ContextualProperties extends ParsedProperties
-{
- /** The name of the system property that is used to define the environment. */
- public static final String ENV_SYS_PROPERTY = "environment";
-
- /**
- * <p>Holds the iteration count down order.
- *
- * <p>If e = 4, b = 2, m = 1 then the iteration order or i is 7,6,4 and then if using environment defaults 3,2,0
- * where the accessor key is:
- * (i & e != 0 ? environment : "") + (i & b != 0 ? base : "") + (1 + m != 0 ? modifier : "") + key
- *
- * <p>In other words the presence or otherwise of the three least significant bits when counting down from 7
- * specifies which of the environment, base and modifier are to be included in the key where the environment, base
- * and modifier stand for the bits in positions 2, 1 and 0. The numbers 5 and 1 are missed out of the count because
- * they stand for the case where the modifier is used without the base which is not done.
- */
- private static final int[] ORDER = new int[] { 7, 6, 4, 3, 2, 0 };
-
- /**
- * Defines the point in the iteration count order below which the 'use environment defaults' feature is being used.
- */
- private static final int ENVIRONMENT_DEFAULTS_CUTOFF = 4;
-
- /** Defines the bit representation for the environment in the key ordering. See {@link #ORDER}. */
- private static final int E = 4;
-
- /** Defines the bit representation for the base in the key ordering. See {@link #ORDER}. */
- private static final int B = 2;
-
- /** Defines the bit representation for the modifier in the key ordering. See {@link #ORDER}. */
- private static final int M = 1;
-
- /** Used to hold the value of the environment system property. */
- private String environment;
-
- /** Used to indicate that the 'use of defaults' behaviour should be used. */
- private boolean useDefaults = true;
-
- /** Used to hold all the array properties. This is a mapping from property names to ArrayLists of Strings. */
- protected Map arrayProperties = new HashMap();
-
- /**
- * Default constructor that builds a ContextualProperties that uses environment defaults.
- */
- public ContextualProperties()
- {
- super();
-
- // Keep the value of the system environment property.
- environment = System.getProperty(ENV_SYS_PROPERTY);
- }
-
- /**
- * Creates a ContextualProperties that uses environment defaults and is initialized with the specified properties.
- *
- * @param props The properties to initialize this with.
- */
- public ContextualProperties(Properties props)
- {
- super(props);
-
- // Keep the value of the system environment property.
- environment = System.getProperty(ENV_SYS_PROPERTY);
-
- // Extract any array properties as arrays.
- createArrayProperties();
- }
-
- /**
- * Parses an input stream as properties.
- *
- * @param inStream The input stream to read the properties from.
- *
- * @exception IOException If there is an IO error during reading from the input stream.
- */
- public void load(InputStream inStream) throws IOException
- {
- super.load(inStream);
-
- // Extract any array properties as arrays.
- createArrayProperties();
- }
-
- /**
- * Tells this environment aware properties object whether it should use default environment properties without a
- * pre-pended environment when a property for the current environment cannot be found.
- *
- * @param flag True to use defaults, false to not use defaults.
- */
- public void useDefaultEnvironments(boolean flag)
- {
- useDefaults = flag;
- }
-
- /**
- * Looks up a property value relative to the environment, callers class and method. The default environment will be
- * checked for a matching property if defaults are being used. In order to work out the callers class and method this
- * method throws an exception and then searches one level up its stack frames.
- *
- * @param key The property key.
- *
- * @return The value of this property searching from the most specific definition (environment, class, method, key)
- * to the most general (key only), unless use of default environments is turned off in which case the most general
- * proeprty searched is (environment, key).
- */
- public String getProperty(String key)
- {
- // Try to get the callers class name and method name by examing the stack.
- String className = null;
- String methodName = null;
-
- // Java 1.4 onwards only.
- /*try
- {
- throw new Exception();
- }
- catch (Exception e)
- {
- StackTraceElement[] stack = e.getStackTrace();
-
- // Check that the stack trace contains at least two elements, one for this method and one for the caller.
- if (stack.length >= 2)
- {
- className = stack[1].getClassName();
- methodName = stack[1].getMethodName();
- }
- }*/
-
- // Java 1.5 onwards only.
- StackTraceElement[] stack = Thread.currentThread().getStackTrace();
-
- // Check that the stack trace contains at least two elements, one for this method and one for the caller.
- if (stack.length >= 2)
- {
- className = stack[1].getClassName();
- methodName = stack[1].getMethodName();
- }
-
- // Java 1.3 and before? Not sure, some horrible thing that parses the text spat out by printStackTrace?
-
- return getProperty(className, methodName, key);
- }
-
- /**
- * Looks up a property value relative to the environment, base class and modifier. The default environment will be
- * checked for a matching property if defaults are being used.
- *
- * @param base An object of the class to retrieve properties relative to.
- * @param modifier The modifier (which may stand for a method of the class).
- * @param key The property key.
- *
- * @return The value of this property searching from the most specific definition (environment, class, modifier, key)
- * to the most general (key only), unless use of default environments is turned off in which case the most general
- * property searched is (environment, key).
- */
- public String getProperty(Object base, String modifier, String key)
- {
- return getProperty(base.getClass().getName(), modifier, key);
- }
-
- /**
- * Looks up a property value relative to the environment, base class and modifier. The default environment will be
- * checked for a matching property if defaults are being used.
- *
- * @param base The name of the class to retrieve properties relative to.
- * @param modifier The modifier (which may stand for a method of the class).
- * @param key The property key.
- *
- * @return The value of this property searching from the most specific definition (environment, class, modifier, key)
- * to the most general (key only), unless use of default environments is turned off in which case the most general
- * property searched is (environment, key).
- */
- public String getProperty(String base, String modifier, String key)
- {
- String result = null;
-
- // Loop over the key orderings, from the most specific to the most general, until a matching value is found.
- for (Iterator i = getKeyIterator(base, modifier, key); i.hasNext();)
- {
- String nextKey = (String) i.next();
-
- result = super.getProperty(nextKey);
-
- if (result != null)
- {
- break;
- }
- }
-
- return result;
- }
-
- /**
- * Looks up an array property value relative to the environment, callers class and method. The default environment
- * will be checked for a matching array property if defaults are being used. In order to work out the callers class
- * and method this method throws an exception and then searches one level up its stack frames.
- *
- * @param key The property key.
- *
- * @return The array value of this indexed property searching from the most specific definition (environment, class,
- * method, key) to the most general (key only), unless use of default environments is turned off in which
- * case the most general proeprty searched is (environment, key).
- */
- public String[] getProperties(String key)
- {
- // Try to get the callers class name and method name by throwing an exception an searching the stack frames.
- String className = null;
- String methodName = null;
-
- /* Java 1.4 onwards only.
- try {
- throw new Exception();
- } catch (Exception e) {
- StackTraceElement[] stack = e.getStackTrace();
- // Check that the stack trace contains at least two elements, one for this method and one for the caller.
- if (stack.length >= 2) {
- className = stack[1].getClassName();
- methodName = stack[1].getMethodName();
- }
- }*/
- return getProperties(className, methodName, key);
- }
-
- /**
- * Looks up an array property value relative to the environment, base class and modifier. The default environment will
- * be checked for a matching array property if defaults are being used.
- *
- * @param base An object of the class to retrieve properties relative to.
- * @param modifier The modifier (which may stand for a method of the class).
- * @param key The property key.
- *
- * @return The array value of this indexed property searching from the most specific definition (environment, class,
- * modifier, key) to the most general (key only), unless use of default environments is turned off in which
- * case the most general proeprty searched is (environment, key).
- */
- public String[] getProperties(Object base, String modifier, String key)
- {
- return getProperties(base.getClass().getName(), modifier, key);
- }
-
- /**
- * Looks up an array property value relative to the environment, base class and modifier. The default environment will
- * be checked for a matching array property if defaults are being used.
- *
- * @param base The name of the class to retrieve properties relative to.
- * @param modifier The modifier (which may stand for a method of the class).
- * @param key The property key.
- *
- * @return The array value of this indexed property searching from the most specific definition (environment, class,
- * modifier, key) to the most general (key only), unless use of default environments is turned off in which
- * case the most general property searched is (environment, key).
- */
- public String[] getProperties(String base, String modifier, String key)
- {
- String[] result = null;
-
- // Loop over the key orderings, from the most specific to the most general, until a matching value is found.
- for (Iterator i = getKeyIterator(base, modifier, key); i.hasNext();)
- {
- String nextKey = (String) i.next();
- ArrayList arrayList = (ArrayList) arrayProperties.get(nextKey);
-
- if (arrayList != null)
- {
- result = (String[]) arrayList.toArray(new String[] {});
-
- break;
- }
- }
-
- return result;
- }
-
- /**
- * For a given environment, base, modifier and key and setting of the use of default environments feature this
- * generates an iterator that walks over the order in which to try and access properties.
- *
- * <p>See the {@link #ORDER} constant for an explanation of how the key ordering is generated.
- *
- * @param base The name of the class to retrieve properties relative to.
- * @param modifier The modifier (which may stand for a method of the class).
- * @param key The property key.
- *
- * @return An Iterator over String keys defining the order in which properties should be accessed.
- */
- protected Iterator getKeyIterator(final String base, final String modifier, final String key)
- {
- return new Iterator()
- {
- // The key ordering count always begins at the start of the ORDER array.
- private int i = 0;
-
- public boolean hasNext()
- {
- return (useDefaults ? ((i < ORDER.length) && (ORDER[i] > ENVIRONMENT_DEFAULTS_CUTOFF))
- : (i < ORDER.length));
- }
-
- public Object next()
- {
- // Check that there is a next element and return null if not.
- if (!hasNext())
- {
- return null;
- }
-
- // Get the next ordering count.
- int o = ORDER[i];
-
- // Do bit matching on the count to choose which elements to include in the key.
- String result =
- (((o & E) != 0) ? (environment + ".") : "") + (((o & B) != 0) ? (base + ".") : "")
- + (((o & M) != 0) ? (modifier + ".") : "") + key;
-
- // Increment the iterator to get the next key on the next call.
- i++;
-
- return result;
- }
-
- public void remove()
- {
- // This method is not supported.
- throw new UnsupportedOperationException("remove() is not supported on this key order iterator as "
- + "the ordering cannot be changed");
- }
- };
- }
-
- /**
- * Scans all the properties in the parent Properties object and creates arrays for any array property definitions.
- *
- * <p>Array properties are defined with indexes. For example:
- *
- * <p><code>
- * property.1=one<br/>
- * property.2=two<br/>
- * property.3=three<br/>
- * </code>
- *
- * <p>Note that these properties will be stored as the 'empty string' or "" property array.
- *
- * <p><code>
- * .1=one<br/>
- * 2=two<br/>
- * </code>
- */
- protected void createArrayProperties()
- {
- // Scan through all defined properties.
- for (Object o : keySet())
- {
- String key = (String) o;
- String value = super.getProperty(key);
-
- // Split the property key into everything before the last '.' and after it.
- int lastDotIndex = key.lastIndexOf('.');
- String keyEnding = key.substring(lastDotIndex + 1, key.length());
- String keyStart = key.substring(0, (lastDotIndex == -1) ? 0 : lastDotIndex);
-
- // Check if the property key ends in an integer, in which case it is an array property.
- int index = 0;
-
- try
- {
- index = Integer.parseInt(keyEnding);
- }
- // The ending is not an integer so its not an array.
- catch (NumberFormatException e)
- {
- // Scan the next property.
- continue;
- }
-
- // Check if an array property already exists for this base name and create one if not.
- ArrayList propArray = (ArrayList) arrayProperties.get(keyStart);
-
- if (propArray == null)
- {
- propArray = new ArrayList();
- arrayProperties.put(keyStart, propArray);
- }
-
- // Add the new property value to the array property for the index.
- propArray.set(index, value);
- }
- }
-}
diff --git a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/util/MathUtils.java b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/util/MathUtils.java
deleted file mode 100644
index 7c803294f4..0000000000
--- a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/util/MathUtils.java
+++ /dev/null
@@ -1,428 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.junit.extensions.util;
-
-import java.util.ArrayList;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * Mathematical support methods for the toolkit. Caculating averages, variances, min/max for test latencies and
- * generating linear/exponential sequences for test size/concurrency ramping up.
- *
- * <p/>The sequence specifications are of the form [lowest(, ...)(, highest)](,sample=s)(,exp), where round brackets
- * enclose optional values. Using this pattern form it is possible to specify a single value, a range of values divided
- * into s samples, a range of values divided into s samples but distributed exponentially, or a fixed set of samples.
- *
- * <p/>The duration arguments are of the form (dD)(hH)(mM)(sS), where round brackets enclose optional values. At least
- * one of the optional values must be present.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Generate a sequene of integers from a sequence specification.
- * <tr><td> Parse an encoded duration into milliseconds.
- * </table>
- *
- * @author Rupert Smith
- */
-public class MathUtils
-{
- /** Used for debugging. */
- // private static final Logger log = Logger.getLogger(MathUtils.class);
-
- /** The sequence defintion matching regular expression. */
- public static final String SEQUENCE_REGEXP = "^(\\[[0-9:]+\\])(:samples=[0-9]+)?(:exp)?$";
-
- /** The regular expression that matches sequence definitions. */
- private static final Pattern SEQUENCE_PATTERN = Pattern.compile(SEQUENCE_REGEXP);
-
- /** The duration definition matching regular expression. */
- public static final String DURATION_REGEXP = "^(\\d+D)?(\\d+H)?(\\d+M)?(\\d+S)?$";
-
- /** The regular expression that matches the duration expression. */
- public static final Pattern DURATION_PATTERN = Pattern.compile(DURATION_REGEXP);
-
- /** For matching name=value pairs. */
- public static final String NAME_VALUE_REGEXP = "^\\w+=\\w+$";
-
- /** For matching name=[value1: value2: ...] variations. */
- public static final String NAME_VALUE_VARIATION_REGEXP = "^\\w+=\\[[\\w:]+\\]$";
-
- /** For matching name=[n: ... :m](:sample=s)(:exp) sequences. */
- public static final String NAME_VALUE_SEQUENCE_REGEXP = "^\\w+=(\\[[0-9:]+\\])(:samples=[0-9]+)?(:exp)?$";
-
- /** The regular expression that matches name=value pairs and variations. */
- public static final Pattern NAME_VALUE_PATTERN =
- Pattern.compile("(" + NAME_VALUE_REGEXP + ")|(" + NAME_VALUE_VARIATION_REGEXP + ")|(" + NAME_VALUE_SEQUENCE_REGEXP
- + ")");
-
- /**
- * Runs a quick test of the sequence generation methods to confirm that they work as expected.
- *
- * @param args The command line parameters.
- */
- public static void main(String[] args)
- {
- // Use the command line parser to evaluate the command line.
- CommandLineParser commandLine =
- new CommandLineParser(
- new String[][]
- {
- { "s", "The sequence definition.", "[m:...:n](:sample=s)(:exp)", "true", MathUtils.SEQUENCE_REGEXP },
- { "d", "The duration definition.", "dDhHmMsS", "false", MathUtils.DURATION_REGEXP }
- });
-
- // Capture the command line arguments or display errors and correct usage and then exit.
- ParsedProperties options = null;
-
- try
- {
- options = new ParsedProperties(commandLine.parseCommandLine(args));
- }
- catch (IllegalArgumentException e)
- {
- System.out.println(commandLine.getErrors());
- System.out.println(commandLine.getUsage());
- System.exit(-1);
- }
-
- // Extract the command line options.
- String sequence = options.getProperty("s");
- String durationString = options.getProperty("d");
-
- System.out.println("Sequence is: " + printArray(parseSequence(sequence)));
-
- if (durationString != null)
- {
- System.out.println("Duration is: " + parseDuration(durationString));
- }
- }
-
- /**
- * Given a start and end and a number of steps this method generates a sequence of evenly spaced integer
- * values, starting at the start (inclusive) and finishing at the end (inclusive) with the specified number
- * of values in the sequence. The sequence returned may contain less than the specified number where the integer
- * range between start and end is too small to contain that many.
- *
- * <p/>As the results are integers, they will not be perfectly evenly spaced but a best-fit.
- *
- * @param start The sequence start.
- * @param end The sequence end.
- * @param steps The number of steps.
- *
- * @return The sequence.
- */
- public static int[] generateSequence(int start, int end, int steps)
- {
- // Check that there are at least two steps.
- if (steps < 2)
- {
- throw new IllegalArgumentException("There must be at least 2 steps.");
- }
-
- ArrayList<Integer> result = new ArrayList<Integer>();
-
- // Calculate the sequence using floating point, then round into the results.
- double fStart = start;
- double fEnd = end;
- double fCurrent = start;
-
- for (int i = 0; i < steps; i++)
- {
- fCurrent = (((fEnd - fStart) / (steps - 1)) * i) + fStart;
-
- roundAndAdd(result, fCurrent);
- }
-
- // Return the results after converting to a primitive array.
- return intListToPrimitiveArray(result);
- }
-
- /**
- * Given a start and end and a number of steps this method generates a sequence of expontentially spaced integer
- * values, starting at the start (inclusive) and finishing at the end (inclusive) with the specified number
- * of values in the sequence. An exponentially spaced sequence is one where the ratio between any two consecutive
- * numbers in the sequence remains constant. The sequence returned may contain less than the specified number where
- * the difference between two consecutive values is too small (this is more likely at the start of the sequence,
- * where the values are closer together).
- *
- * <p/>As the results are integers, they will not be perfectly exponentially spaced but a best-fit.
- *
- * @param start The sequence start.
- * @param end The sequence end.
- * @param steps The number of steps.
- *
- * @return The sequence.
- */
- public static int[] generateExpSequence(int start, int end, int steps)
- {
- // Check that there are at least two steps.
- if (steps < 2)
- {
- throw new IllegalArgumentException("There must be at least 2 steps.");
- }
-
- ArrayList<Integer> result = new ArrayList<Integer>();
-
- // Calculate the sequence using floating point, then round into the results.
- double fStart = start;
- double fEnd = end;
- // float fCurrent = start;
- double diff = fEnd - fStart;
- double factor = java.lang.Math.pow(diff, (1.0f / (steps - 1)));
-
- for (int i = 0; i < steps; i++)
- {
- // This is a cheat to get the end exactly on and lose the accumulated rounding error.
- if (i == (steps - 1))
- {
- result.add(end);
- }
- else
- {
- roundAndAdd(result, fStart - 1.0f + java.lang.Math.pow(factor, i));
- }
- }
-
- // Return the results after converting to a primitive array.
- return intListToPrimitiveArray(result);
- }
-
- /**
- * Parses a string defintion of a sequence into an int array containing the sequence. The definition will conform
- * to the regular expression: "^(\[[0-9,]+\])(,samples=[0-9]+)?(,exp)?$". This splits it into three parts,
- * an array of integers, the optional sample count and the optional exponential flag.
- *
- * @param sequenceDef The sequence definition.
- *
- * @return The sequence as a fully expanded int array.
- */
- public static int[] parseSequence(String sequenceDef)
- {
- // Match the sequence definition against the regular expression for sequences.
- Matcher matcher = SEQUENCE_PATTERN.matcher(sequenceDef);
-
- // Check that the argument is of the right format accepted by this method.
- if (!matcher.matches())
- {
- throw new IllegalArgumentException("The sequence definition is not in the correct format.");
- }
-
- // Get the total number of matching groups to see if either of the optional samples or exponential flag
- // goups were set.
- int numGroups = matcher.groupCount();
-
- // Split the array of integers on commas.
- String intArrayString = matcher.group(1);
-
- String[] intSplits = intArrayString.split("[:\\[\\]]");
-
- int[] sequence = new int[intSplits.length - 1];
-
- for (int i = 1; i < intSplits.length; i++)
- {
- sequence[i - 1] = Integer.parseInt(intSplits[i]);
- }
-
- // Check for the optional samples count.
- int samples = 0;
-
- if ((numGroups > 1) && (matcher.group(2) != null))
- {
- String samplesGroup = matcher.group(2);
-
- String samplesString = samplesGroup.substring(",samples=".length());
- samples = Integer.parseInt(samplesString);
- }
-
- // Check for the optional exponential flag.
- boolean expFlag = false;
-
- if ((numGroups > 2) && (matcher.group(3) != null))
- {
- expFlag = true;
- }
-
- // If there is a sample count and 2 or more sequence values defined, then generate the sequence from the first
- // and last sequence values.
- if ((samples != 0) && (sequence.length >= 2))
- {
- int start = sequence[0];
- int end = sequence[sequence.length - 1];
-
- if (!expFlag)
- {
- sequence = generateSequence(start, end, samples);
- }
- else
- {
- sequence = generateExpSequence(start, end, samples);
- }
- }
-
- return sequence;
- }
-
- /**
- * Parses a duration defined as a string, giving a duration in days, hours, minutes and seconds into a number
- * of milliseconds equal to that duration.
- *
- * @param duration The duration definition string.
- *
- * @return The duration in millliseconds.
- */
- public static long parseDuration(String duration)
- {
- // Match the duration against the regular expression.
- Matcher matcher = DURATION_PATTERN.matcher(duration);
-
- // Check that the argument is of the right format accepted by this method.
- if (!matcher.matches())
- {
- throw new IllegalArgumentException("The duration definition is not in the correct format.");
- }
-
- // This accumulates the duration.
- long result = 0;
-
- int numGroups = matcher.groupCount();
-
- // Extract the days.
- if (numGroups >= 1)
- {
- String daysString = matcher.group(1);
- result +=
- (daysString == null)
- ? 0 : (Long.parseLong(daysString.substring(0, daysString.length() - 1)) * 24 * 60 * 60 * 1000);
- }
-
- // Extract the hours.
- if (numGroups >= 2)
- {
- String hoursString = matcher.group(2);
- result +=
- (hoursString == null) ? 0
- : (Long.parseLong(hoursString.substring(0, hoursString.length() - 1)) * 60 * 60 * 1000);
- }
-
- // Extract the minutes.
- if (numGroups >= 3)
- {
- String minutesString = matcher.group(3);
- result +=
- (minutesString == null)
- ? 0 : (Long.parseLong(minutesString.substring(0, minutesString.length() - 1)) * 60 * 1000);
- }
-
- // Extract the seconds.
- if (numGroups >= 4)
- {
- String secondsString = matcher.group(4);
- result +=
- (secondsString == null) ? 0 : (Long.parseLong(secondsString.substring(0, secondsString.length() - 1)) * 1000);
- }
-
- return result;
- }
-
- /**
- * Pretty prints an array of ints as a string.
- *
- * @param array The array to pretty print.
- *
- * @return The pretty printed string.
- */
- public static String printArray(int[] array)
- {
- String result = "[";
- for (int i = 0; i < array.length; i++)
- {
- result += array[i];
- result += (i < (array.length - 1)) ? ", " : "";
- }
-
- result += "]";
-
- return result;
- }
-
- /**
- * Returns the maximum value in an array of integers.
- *
- * @param values The array to find the amx in.
- *
- * @return The max value.
- */
- public static int maxInArray(int[] values)
- {
- if ((values == null) || (values.length == 0))
- {
- throw new IllegalArgumentException("Cannot find the max of a null or empty array.");
- }
-
- int max = values[0];
-
- for (int value : values)
- {
- max = (max < value) ? value : max;
- }
-
- return max;
- }
-
- /**
- * The #toArray methods of collections cannot be used with primitive arrays. This loops over and array list
- * of Integers and outputs and array of int.
- *
- * @param result The array of Integers to convert.
- *
- * @return An array of int.
- */
- private static int[] intListToPrimitiveArray(ArrayList<Integer> result)
- {
- int[] resultArray = new int[result.size()];
- int index = 0;
- for (int r : result)
- {
- resultArray[index] = result.get(index);
- index++;
- }
-
- return resultArray;
- }
-
- /**
- * Rounds the specified floating point value to the nearest integer and adds it to the specified list of
- * integers, provided it is not already in the list.
- *
- * @param result The list of integers to add to.
- * @param value The new candidate to round and add to the list.
- */
- private static void roundAndAdd(ArrayList<Integer> result, double value)
- {
- int roundedValue = (int) Math.round(value);
-
- if (!result.contains(roundedValue))
- {
- result.add(roundedValue);
- }
- }
-}
diff --git a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/util/ParsedProperties.java b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/util/ParsedProperties.java
deleted file mode 100644
index 1cc6757675..0000000000
--- a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/util/ParsedProperties.java
+++ /dev/null
@@ -1,390 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.junit.extensions.util;
-
-import java.util.Properties;
-
-/**
- * ParsedProperties extends the basic Properties class with methods to extract properties, not as strings but as strings
- * parsed into basic types.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * </table>
- *
- * @author Rupert Smith
- */
-public class ParsedProperties extends Properties
-{
- /**
- * Creates an empty ParsedProperties.
- */
- public ParsedProperties()
- {
- super();
- }
-
- /**
- * Creates a ParsedProperties initialized with the specified properties.
- *
- * @param props The properties to initialize this with.
- */
- public ParsedProperties(Properties props)
- {
- super(props);
- }
-
- /**
- * Helper method for setting system properties to defaults when they are not already set.
- *
- * @param propname The name of the system property to set.
- * @param value The value to set it to.
- *
- * @return The value of the property after this method call.
- */
- public static boolean setSysPropertyIfNull(String propname, boolean value)
- {
- return Boolean.parseBoolean(setSysPropertyIfNull(propname, Boolean.toString(value)));
- }
-
- /**
- * Helper method for setting system properties to defaults when they are not already set.
- *
- * @param propname The name of the system property to set.
- * @param value The value to set it to.
- *
- * @return The value of the property after this method call.
- */
- public static short setSysPropertyIfNull(String propname, short value)
- {
- return Short.parseShort(setSysPropertyIfNull(propname, Short.toString(value)));
- }
-
- /**
- * Helper method for setting system properties to defaults when they are not already set.
- *
- * @param propname The name of the system property to set.
- * @param value The value to set it to.
- *
- * @return The value of the property after this method call.
- */
- public static int setSysPropertyIfNull(String propname, int value)
- {
- return Integer.parseInt(setSysPropertyIfNull(propname, Integer.toString(value)));
- }
-
- /**
- * Helper method for setting system properties to defaults when they are not already set.
- *
- * @param propname The name of the system property to set.
- * @param value The value to set it to.
- *
- * @return The value of the property after this method call.
- */
- public static long setSysPropertyIfNull(String propname, long value)
- {
- return Long.parseLong(setSysPropertyIfNull(propname, Long.toString(value)));
- }
-
- /**
- * Helper method for setting system properties to defaults when they are not already set.
- *
- * @param propname The name of the system property to set.
- * @param value The value to set it to.
- *
- * @return The value of the property after this method call.
- */
- public static float setSysPropertyIfNull(String propname, float value)
- {
- return Float.parseFloat(setSysPropertyIfNull(propname, Float.toString(value)));
- }
-
- /**
- * Helper method for setting system properties to defaults when they are not already set.
- *
- * @param propname The name of the system property to set.
- * @param value The value to set it to.
- *
- * @return The value of the property after this method call.
- */
- public static double setSysPropertyIfNull(String propname, double value)
- {
- return Double.parseDouble(setSysPropertyIfNull(propname, Double.toString(value)));
- }
-
- /**
- * Helper method for setting system properties to defaults when they are not already set.
- *
- * @param propname The name of the system property to set.
- * @param value The value to set it to.
- *
- * @return The value of the system property after this method call.
- */
- public static String setSysPropertyIfNull(String propname, String value)
- {
- String property = System.getProperty(propname);
-
- if (property == null)
- {
- System.setProperty(propname, value);
-
- return value;
- }
- else
- {
- return property;
- }
- }
-
- /**
- * Helper method for setting properties to defaults when they are not already set.
- *
- * @param propname The name of the system property to set.
- * @param value The value to set it to.
- *
- * @return The value of the property after this method call.
- */
- public boolean setPropertyIfNull(String propname, boolean value)
- {
- return Boolean.parseBoolean(setPropertyIfNull(propname, Boolean.toString(value)));
- }
-
- /**
- * Helper method for setting properties to defaults when they are not already set.
- *
- * @param propname The name of the system property to set.
- * @param value The value to set it to.
- *
- * @return The value of the property after this method call.
- */
- public short setPropertyIfNull(String propname, short value)
- {
- return Short.parseShort(setPropertyIfNull(propname, Short.toString(value)));
- }
-
- /**
- * Helper method for setting properties to defaults when they are not already set.
- *
- * @param propname The name of the system property to set.
- * @param value The value to set it to.
- *
- * @return The value of the property after this method call.
- */
- public int setPropertyIfNull(String propname, int value)
- {
- return Integer.parseInt(setPropertyIfNull(propname, Integer.toString(value)));
- }
-
- /**
- * Helper method for setting properties to defaults when they are not already set.
- *
- * @param propname The name of the system property to set.
- * @param value The value to set it to.
- *
- * @return The value of the property after this method call.
- */
- public long setPropertyIfNull(String propname, long value)
- {
- return Long.parseLong(setPropertyIfNull(propname, Long.toString(value)));
- }
-
- /**
- * Helper method for setting properties to defaults when they are not already set.
- *
- * @param propname The name of the system property to set.
- * @param value The value to set it to.
- *
- * @return The value of the property after this method call.
- */
- public float setPropertyIfNull(String propname, float value)
- {
- return Float.parseFloat(setPropertyIfNull(propname, Float.toString(value)));
- }
-
- /**
- * Helper method for setting properties to defaults when they are not already set.
- *
- * @param propname The name of the system property to set.
- * @param value The value to set it to.
- *
- * @return The value of the property after this method call.
- */
- public double setPropertyIfNull(String propname, double value)
- {
- return Double.parseDouble(setPropertyIfNull(propname, Double.toString(value)));
- }
-
- /**
- * Helper method for setting properties to defaults when they are not already set.
- *
- * @param propname The name of the system property to set.
- * @param value The value to set it to.
- *
- * @return The value of the property after this method call.
- */
- public String setPropertyIfNull(String propname, String value)
- {
- String property = super.getProperty(propname);
-
- if (property == null)
- {
- super.setProperty(propname, value);
-
- return value;
- }
- else
- {
- return property;
- }
- }
-
- /**
- * Helper method for setting properties.
- *
- * @param propname The name of the system property to set.
- * @param value The value to set it to.
- *
- * @return The value of the property after this method call.
- */
- public boolean setProperty(String propname, boolean value)
- {
- setProperty(propname, Boolean.toString(value));
-
- return value;
- }
-
- /**
- * Helper method for setting properties.
- *
- * @param propname The name of the system property to set.
- * @param value The value to set it to.
- *
- * @return The value of the property after this method call.
- */
- public short setProperty(String propname, short value)
- {
- setProperty(propname, Short.toString(value));
-
- return value;
- }
-
- /**
- * Helper method for setting properties.
- *
- * @param propname The name of the system property to set.
- * @param value The value to set it to.
- *
- * @return The value of the property after this method call.
- */
- public int setProperty(String propname, int value)
- {
- setProperty(propname, Integer.toString(value));
-
- return value;
- }
-
- /**
- * Helper method for setting properties.
- *
- * @param propname The name of the system property to set.
- * @param value The value to set it to.
- *
- * @return The value of the property after this method call.
- */
- public long setProperty(String propname, long value)
- {
- setProperty(propname, Long.toString(value));
-
- return value;
- }
-
- /**
- * Helper method for setting properties.
- *
- * @param propname The name of the system property to set.
- * @param value The value to set it to.
- *
- * @return The value of the property after this method call.
- */
- public float setProperty(String propname, float value)
- {
- setProperty(propname, Float.toString(value));
-
- return value;
- }
-
- /**
- * Helper method for setting properties.
- *
- * @param propname The name of the system property to set.
- * @param value The value to set it to.
- *
- * @return The value of the property after this method call.
- */
- public double setProperty(String propname, double value)
- {
- setProperty(propname, Double.toString(value));
-
- return value;
- }
-
- /**
- * Parses a property as a boolean.
- *
- * @param propName The property.
- *
- * @return The property as a boolean, or false if it does not exist.
- */
- public boolean getPropertyAsBoolean(String propName)
- {
- String prop = getProperty(propName);
-
- return (prop != null) && Boolean.parseBoolean(prop);
- }
-
- /**
- * Parses a property as an integer.
- *
- * @param propName The property.
- *
- * @return The property as a integer, or null if it does not exist.
- */
- public Integer getPropertyAsInteger(String propName)
- {
- String prop = getProperty(propName);
-
- return (prop != null) ? new Integer(prop) : null;
- }
-
- /**
- * Parses a property as a long.
- *
- * @param propName The property.
- *
- * @return The property as a long, or null if it does not exist.
- */
- public Long getPropertyAsLong(String propName)
- {
- String prop = getProperty(propName);
-
- return (prop != null) ? new Long(prop) : null;
- }
-}
diff --git a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/util/SizeOf.java b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/util/SizeOf.java
deleted file mode 100644
index ecc08770a9..0000000000
--- a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/util/SizeOf.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.junit.extensions.util;
-
-/**
- * SizeOf provides a static method that does its best to return an accurate measure of the total amount of memory used by
- * the virtual machine. This is calculated as the total memory available to the VM minus the actual amount used by it.
- * Before this measurement is taken the garbage collector is run many times until the used memory calculation stabilizes.
- * Generally, this trick works quite well to provide an accurate reading, however, it cannot be relied upon to be totally
- * accurate. It is also quite slow.
- *
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Calculate total memory used.
- * </table>
- *
- * @author Rupert Smith
- */
-public class SizeOf
-{
- /** Holds a reference to the runtime object. */
- private static final Runtime RUNTIME = Runtime.getRuntime();
-
- /**
- * Makes 4 calls the {@link #runGCTillStable} method.
- */
- public static void runGCTillStableSeveralTimes()
- {
- // It helps to call Runtime.gc() using several method calls.
- for (int r = 0; r < 4; ++r)
- {
- runGCTillStable();
- }
- }
-
- /**
- * Runs the garbage collector until the used memory reading stabilizes. It may run the garbage collector up
- * to 500 times.
- */
- public static void runGCTillStable()
- {
- long usedMem1 = usedMemory(), usedMem2 = Long.MAX_VALUE;
-
- for (int i = 0; (usedMem1 < usedMem2) && (i < 500); ++i)
- {
- RUNTIME.runFinalization();
- RUNTIME.gc();
- Thread.currentThread().yield();
-
- usedMem2 = usedMem1;
- usedMem1 = usedMemory();
- }
- }
-
- /**
- * Runs the garbage collector until the used memory stabilizes and then measures it.
- *
- * @return The amount of memory used by the virtual machine.
- */
- public static long getUsedMemory()
- {
- runGCTillStableSeveralTimes();
-
- return usedMemory();
- }
-
- /**
- * Returns the amount of memory used by subtracting the free memory from the total available memory.
- *
- * @return The amount of memory used.
- */
- private static long usedMemory()
- {
- return RUNTIME.totalMemory() - RUNTIME.freeMemory();
- }
-}
diff --git a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/util/StackQueue.java b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/util/StackQueue.java
deleted file mode 100644
index acc1e2c218..0000000000
--- a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/util/StackQueue.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.junit.extensions.util;
-
-import java.util.EmptyStackException;
-import java.util.NoSuchElementException;
-import java.util.Queue;
-import java.util.Stack;
-
-/**
- * The Stack class in java.util (most unhelpfully) does not implement the Queue interface. This is an adaption of that
- * class as a queue.
- *
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Turn a stack into a queue.
- * </table>
- *
- * @todo Need to override the add method, and iterator and consider other methods too. They work like LIFO but
- * really wany FIFO behaviour accross the whole data structure.
- *
- * @author Rupert Smith
- */
-public class StackQueue<E> extends Stack<E> implements Queue<E>
-{
- /**
- * Retrieves, but does not remove, the head of this queue.
- *
- * @return The element at the top of the stack.
- */
- public E element()
- {
- try
- {
- return super.peek();
- }
- catch (EmptyStackException e)
- {
- NoSuchElementException t = new NoSuchElementException();
- t.initCause(e);
- throw t;
- }
- }
-
- /**
- * Inserts the specified element into this queue, if possible.
- *
- * @param o The data element to push onto the stack.
- *
- * @return True if it was added to the stack, false otherwise (this implementation always returns true).
- */
- public boolean offer(E o)
- {
- push(o);
-
- return true;
- }
-
- /**
- * Retrieves, but does not remove, the head of this queue, returning null if this queue is empty.
- *
- * @return The top element from the stack, or null if the stack is empty.
- */
- public E peek()
- {
- try
- {
- return super.peek();
- }
- catch (EmptyStackException e)
- {
- return null;
- }
- }
-
- /**
- * Retrieves and removes the head of this queue, or null if this queue is empty.
- *
- * @return The top element from the stack, or null if the stack is empty.
- */
- public E poll()
- {
- try
- {
- return super.pop();
- }
- catch (EmptyStackException e)
- {
- return null;
- }
- }
-
- /**
- * Retrieves and removes the head of this queue.
- *
- * @return The top element from the stack, or null if the stack is empty.
- *
- * @throws NoSuchElementException If the stack is empty so no element can be removed from it.
- */
- public E remove()
- {
- try
- {
- return super.pop();
- }
- catch (EmptyStackException e)
- {
- NoSuchElementException t = new NoSuchElementException();
- t.initCause(e);
- throw t;
- }
- }
-}
diff --git a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/util/TestContextProperties.java b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/util/TestContextProperties.java
deleted file mode 100644
index d402077963..0000000000
--- a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/util/TestContextProperties.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.junit.extensions.util;
-
-import java.util.Properties;
-
-/**
- * TestContextProperties is an extension of {@link ParsedProperties} that keeps track of property key/value pairs
- * that are used by tests being run under the {@link org.apache.qpid.junit.extensions.TKTestRunner}. To keep the
- * test runner notified of configurable test parameters, tests should establish their required property values by
- * initiliazing fields or statics or in the constructor, through this class. The tk test runner automatically places
- * any additional properties specified on the command line into the this class, and these are held statically.
- *
- * <p/>Here is an example:
- *
- * <pre>
- * public class MyTestClass extends TestCase {
- * ParsedProperties testProps = TestContextProperties.getInstance();
- * private int testParam = testProps.setPropertyIfNull("testParam", 1);
- * ...
- * </pre>
- *
- * <p/>This has the effect of setting up the field testParam with the default value of 1, unless it is overridden
- * by values passed to the tk test runner. It also notifies the tk test runner of the name and value of the test
- * parameter actually used for the test, so that this can be logged in the test output file.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Log all name/value pairs read or written.
- * </table>
- *
- * @author Rupert Smith
- */
-public class TestContextProperties extends ParsedProperties
-{
- /** Used for debugging. */
- // Logger log = Logger.getLogger(TestContextProperties.class);
-
- /** Holds all properties set or read through this property extension class. */
- private Properties accessedProps = new Properties();
-
- /** The singleton instance of the test context properties. */
- private static TestContextProperties singleton = null;
-
- /**
- * Default constructor that builds a ContextualProperties that uses environment defaults.
- */
- private TestContextProperties()
- {
- super();
- }
-
- /**
- * Gets the singleton instance of the test context properties.
- *
- * @return The singleton instance of the test context properties.
- */
- public static synchronized ParsedProperties getInstance()
- {
- if (singleton == null)
- {
- singleton = new TestContextProperties();
- }
-
- return singleton;
- }
-
- /**
- * Gets the singleton instance of the test context properties, applying a specified set of default properties to
- * it, if they are not already set.
- *
- * @param defaults The defaults to apply for properties not already set.
- *
- * @return The singleton instance of the test context properties.
- */
- public static synchronized ParsedProperties getInstance(Properties defaults)
- {
- ParsedProperties props = getInstance();
-
- for (Object key : defaults.keySet())
- {
- String stringKey = (String) key;
- String value = defaults.getProperty(stringKey);
-
- props.setPropertyIfNull(stringKey, value);
- }
-
- return props;
- }
-
- /*
- * Creates a ContextualProperties that uses environment defaults and is initialized with the specified properties.
- *
- * @param props The properties to initialize this with.
- */
- /*public TestContextProperties(Properties props)
- {
- super();
- }*/
-
- /**
- * Gets all of the properties (with their most recent values) that have been set or read through this class.
- *
- * @return All of the properties accessed through this class.
- */
- public static Properties getAccessedProps()
- {
- return (singleton == null) ? new Properties() : singleton;
- // return accessedProps;
- }
-
- /**
- * Looks up a property value relative to the environment, callers class and method. The default environment will be
- * checked for a matching property if defaults are being used. The property key/value pair is remembered and made
- * available to {@link org.apache.qpid.junit.extensions.TKTestRunner}.
- *
- * @param key The property key.
- *
- * @return The value of this property searching from the most specific definition (environment, class, method, key)
- * to the most general (key only), unless use of default environments is turned off in which case the most general
- * proeprty searched is (environment, key).
- */
- public String getProperty(String key)
- {
- // log.debug("public String getProperty(String key = " + key + "): called");
-
- String value = super.getProperty(key);
-
- if (value != null)
- {
- accessedProps.setProperty(key, value);
- }
-
- // log.debug("value = " + value);
-
- return value;
- }
-
- /**
- * Calls the <tt>Hashtable</tt> method <code>put</code>. Provided for parallelism with the <tt>getProperty</tt>
- * method. Enforces use of strings for property keys and values. The value returned is the result of the
- * <tt>Hashtable</tt> call to <code>put</code>. The property key/value pair is remembered and made
- * available to {@link org.apache.qpid.junit.extensions.TKTestRunner}.
- *
- * @param key The key to be placed into this property list.
- * @param value The value corresponding to <tt>key</tt>.
- *
- * @return The previous value of the specified key in this property list, or <code>null</code> if it did not have one.
- */
- public synchronized Object setProperty(String key, String value)
- {
- // log.debug("public synchronized Object setProperty(String key = " + key + ", String value = " + value + "): called");
-
- Object result = super.setProperty(key, value);
- accessedProps.setProperty(key, value);
-
- return result;
- }
-
- /**
- * Helper method for setting properties to defaults when they are not already set. The property key/value pair is
- * remembered and made available to {@link org.apache.qpid.junit.extensions.TKTestRunner}.
- *
- * @param key The name of the system property to set.
- * @param value The value to set it to.
- *
- * @return The value of the property, which will be the value passed in if it was null, or the existing value otherwise.
- */
- public String setPropertyIfNull(String key, String value)
- {
- // log.debug("public String setPropertyIfNull(String key = " + key + ", String value = " + value + "): called");
-
- String result = super.setPropertyIfNull(key, value);
-
- if (value != null)
- {
- accessedProps.setProperty(key, result);
- }
-
- // log.debug("result = " + result);
-
- return result;
- }
-}
diff --git a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/util/TestUtils.java b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/util/TestUtils.java
deleted file mode 100644
index 553a41ecae..0000000000
--- a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/util/TestUtils.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.junit.extensions.util;
-
-/**
- * Provides commonly used functions that aid testing.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Provide a short pause.
- * </table>
- *
- * @author Rupert Smith
- */
-public class TestUtils
-{
- /**
- * Injects a short pause. The pause may not complete its full length, if the thread is interrupted when waiting.
- * In most cases, this will not happen and this method is a vry adequate pause implementation, without the
- * need to handle interrupted exceptions.
- *
- * @param millis The length of the pause in milliseconds.
- */
- public static void pause(long millis)
- {
- try
- {
- Thread.sleep(millis);
- }
- catch (InterruptedException e)
- {
- // Clear the flag and ignore.
- Thread.interrupted();
- }
- }
-}
diff --git a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/util/package.html b/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/util/package.html
deleted file mode 100644
index f39b892e2d..0000000000
--- a/qpid/java/junit-toolkit/src/main/org/apache/qpid/junit/extensions/util/package.html
+++ /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.
-
--->
-
-<html>
-<body>
-Provides some helper classes. ContextualProperties allows a hierarchy of properties to be used in properties file with
-default overrides. SizeOf takes memeory measurements by stabilizing the garbage collector.
-</body>
-</html>
diff --git a/qpid/java/perftests/RunningPerformanceTests.txt b/qpid/java/perftests/RunningPerformanceTests.txt
deleted file mode 100644
index 2bc9220774..0000000000
--- a/qpid/java/perftests/RunningPerformanceTests.txt
+++ /dev/null
@@ -1,141 +0,0 @@
-The Performance Tests
--------------------------
-
-Building the Tests (Only develoeprs need to know how to do this).
------------------------------------------------------------------
-
-The performance tests are compiled as part of the Maven build by default, but the performance test scripts are not. There is also an additional step to perform, that generates a convenient Jar file containing all of the test dependencies, to simplify invoking Java with a very long command line. The steps to build the performance test suite are:
-
- 1. Cd to the /java/perftests directory.
- 2. Execute: mvn org.apache.qpid:junit-toolkit-maven-plugin:tkscriptgen (this generates the scripts).
- 3. Execute: mvn assembly:assembly
-
-The assembly:assembly step generates a Jar with all the dependecies in it in a file name ending with -all-test-deps.jar, which contains the client code and all its dependencies, plus JUnit and the toolkit test runners. The generated scripts expect to find the jar in the current directory. You can Cd to the /target directory and run the scripts from there. The assembly:assembly step also outputs some archives that contain all the scripts and required Jar for convenient shipping of the test suite. Unpack this anywhere you like and run the tests from there.
-
-Running the Tests
------------------
-
-All the performance tests are run through shell scripts, that have been configured with parameters set up in the pom.xml file. You can override any of these parameters on the command line. It is also possible to pass parameters through the script to the JVM that is running the test. For example to change the heap size you might do:
-
-./Ping-Once.sh -java:Xmx1024M
-
-The tests have all been set up to accept a single integer 'size' parameter, passed to the JUnit TestCase for the test, through the JUnit Toolkit asymptotic test case extension. The 'size' parameter is always interpreted in the performance tests as standing for the number of messages to send per test method invocation. Therefore, in the results of the test the throughput of messages is equal to the number of test method invocations times the 'size' divided by the time taken.
-
-** TODO: Change this, use seconds not millis.
-
-Test timing results are output to .csv files, which can easily be imported into a spreadsheet for graphing and analysis. The timings in this file are always given in milliseconds, which may be a bit confusing and should really be changed to seconds.
-
-The JUnit Toolkit provides a framework for controlling how long tests are run for, how many are run at once and what the 'size' parameter is, which is general enough to handle a wide variety of performance tests. Here is the documentation from the TKTestRunner class that explains what its command line parameters are:
-
- ...
- * TKTestRunner extends {@link junit.textui.TestRunner} with the ability to run tests multiple times, to execute a test
- * simultaneously using many threads, to put a delay between test runs and adds support for tests that take integer
- * parameters that can be 'stepped' through on multiple test runs. These features can be accessed by using this class
- * as an entry point and passing command line arguments to specify which features to use:
- *
- * <pre>
- * -w ms The number of milliseconds between invocations of test cases.
- * -c pattern The number of tests to run concurrently.
- * -r num The number of times to repeat each test.
- * -d duration The length of time to run the tests for.
- * -t name The name of the test case to execute.
- * -s pattern The size parameter to run tests with.
- * -o dir The name of the directory to output test timings to.
- * -v Verbose mode.
- * </pre>
- *
- * <p/>The pattern arguments are of the form [lowest(, ...)(, highest)](,sample=s)(,exp), where round brackets
- * enclose optional values. Using this pattern form it is possible to specify a single value, a range of values divided
- * into s samples, a range of values divided into s samples but distributed exponentially, or a fixed set of samples.
- *
- * <p/>The duration arguments are of the form dD(:hH)(:mM)(:sS), where round brackets enclose optional values.
- *
- * <p/>Here are some examples:
- *
- * <p/><table>
- * <tr><td><pre> -c [10,20,30,40,50] </pre><td> Runs the test with 10,20,...,50 threads.
- * <tr><td><pre> -s [1,100],samples=10 </pre>
- * <td> Runs the test with ten different size parameters evenly spaced between 1 and 100.
- * <tr><td><pre> -s [1,1000000],samples=10,exp </pre>
- * <td> Runs the test with ten different size parameters exponentially spaced between 1 and 1000000.
- * <tr><td><pre> -r 10 </pre><td> Runs each test ten times.
- * <tr><td><pre> -d 10H </pre><td> Runs the test repeatedly for 10 hours.
- * <tr><td><pre> -d 1M, -r 10 </pre>
- * <td> Runs the test repeatedly for 1 minute but only takes a timing sample every 10 test runs.
- * <tr><td><pre> -r 10, -c [1, 5, 10, 50], -s [100, 1000, 10000] </pre>
- * <td> Runs 12 test cycles (4 concurrency samples * 3 size sample), with 10 repeats each. In total the test
- * will be run 199 times (3 + 15 + 30 + 150)
- * </table>
- ...
-
-The specific performance test cases for QPid are implemented as extensions to JUnit TestCase (asymptotic test cases), and also accept a large number of different parameters to control the characteristics of the test. The are passed into the test scripts as name=value pairs. Here is the documentation from the PingPongProducer class that explains what the available parameters and default values are:
-
- ...
- * <p/>This ping tool accepts a vast number of configuration options, all of which are passed in to the constructor. It
- * can ping topics or queues; ping multiple destinations; do persistent pings; send messages of any size; do pings within
- * transactions; control the number of pings to send in each transaction; limit its sending rate; and perform failover
- * testing. A complete list of accepted parameters, default values and comments on their usage is provided here:
- *
- * <p/><table><caption>Parameters</caption>
- * <tr><th> Parameter <th> Default <th> Comments
- * <tr><td> messageSize <td> 0 <td> Message size in bytes. Not including any headers.
- * <tr><td> destinationName <td> ping <td> The root name to use to generate destination names to ping.
- * <tr><td> persistent <td> false <td> Determines whether peristent delivery is used.
- * <tr><td> transacted <td> false <td> Determines whether messages are sent/received in transactions.
- * <tr><td> broker <td> tcp://localhost:5672 <td> Determines the broker to connect to.
- * <tr><td> virtualHost <td> test <td> Determines the virtual host to send all ping over.
- * <tr><td> rate <td> 0 <td> The maximum rate (in hertz) to send messages at. 0 means no limit.
- * <tr><td> verbose <td> false <td> The verbose flag for debugging. Prints to console on every message.
- * <tr><td> pubsub <td> false <td> Whether to ping topics or queues. Uses p2p by default.
- * <tr><td> failAfterCommit <td> false <td> Whether to prompt user to kill broker after a commit batch.
- * <tr><td> failBeforeCommit <td> false <td> Whether to prompt user to kill broker before a commit batch.
- * <tr><td> failAfterSend <td> false <td> Whether to prompt user to kill broker after a send.
- * <tr><td> failBeforeSend <td> false <td> Whether to prompt user to kill broker before a send.
- * <tr><td> failOnce <td> true <td> Whether to prompt for failover only once.
- * <tr><td> username <td> guest <td> The username to access the broker with.
- * <tr><td> password <td> guest <td> The password to access the broker with.
- * <tr><td> selector <td> null <td> Not used. Defines a message selector to filter pings with.
- * <tr><td> destinationCount <td> 1 <td> The number of receivers listening to the pings.
- * <tr><td> timeout <td> 30000 <td> In milliseconds. The timeout to stop waiting for replies.
- * <tr><td> commitBatchSize <td> 1 <td> The number of messages per transaction in transactional mode.
- * <tr><td> uniqueDests <td> true <td> Whether each receiver only listens to one ping destination or all.
- * <tr><td> durableDests <td> false <td> Whether or not durable destinations are used.
- * <tr><td> ackMode <td> AUTO_ACK <td> The message acknowledgement mode. Possible values are:
- * 0 - SESSION_TRANSACTED
- * 1 - AUTO_ACKNOWLEDGE
- * 2 - CLIENT_ACKNOWLEDGE
- * 3 - DUPS_OK_ACKNOWLEDGE
- * 257 - NO_ACKNOWLEDGE
- * 258 - PRE_ACKNOWLEDGE
- * <tr><td> maxPending <td> 0 <td> The maximum size in bytes, of messages sent but not yet received.
- * Limits the volume of messages currently buffered on the client
- * or broker. Can help scale test clients by limiting amount of buffered
- * data to avoid out of memory errors.
- * </table>
- ...
-
-The most common test case to run is implemented in the class PingAsyncTestPerf, which sends and recieves messages simultaneously. This class uses a PingPongProdicer to do its sending and receiving, and wraps it in a suitable way to make it callable through the extended JUnit test runner. This class also accpets another parameter "batchSize" with a default of "1000". This tells the test how many messages to send before stopping sending and waiting for them all to come back. The actual value entered does not matter too much, but typically values larger than 1000 are used to ensure that there is a reasonable opportunity for simultaneous sending and receiving, and less than 10000 to ensure that each test method invocation does not go on for too long.
-
-The test script parameters can all be seen in the pom.xml file. A three letter code is used on the test scripts, first letter P or T for persistent or transient, second letter Q or T for queue (p2p) or topic (pub/sub), third letter R for reliability tests, C for client scaling tests, M for message size tests.Typically tests run and sample their results for 10 minutes, to get a reasonable measurement of a broker running under a steady load. The tests as configured do not measure 'burst' performance.
-
-The reliability/burn in tests, test the broker running at slightly below its maximum throughput for a period of 24 hours. Their purpose is to check that the broker remains stable under load for a reasonable duration, in order to provide some confidence in the long-term stability of its process. These tests are intended to be run as a two step process. The first two tests run for 10 minutes and are used to asses the broker throughput for the test. The output from these tests are to be fed into the rate limiter for the second set of tests, so that the broker may be set up to run at slightly below its maximum throughput for the 24 hour duration. It is suggested that 90% of the rate achieved by the first two tests should be used for this.
-
-The client scaling tests are split into two sub-sections. The first section tests the performance of increasing numbers of client connections, each sending at a fixed rate. The purpose of this is to determine the brokers saturation load, and to evaluate how its performance degrades uder higher loads. The second section varies the fan-out or fan-in ratio of the number of sending clients to receving clients. This is primarily intended to test the pubsub messaging model, but the tests are also run in p2p mode (with each message being received by one consumer), for completeness and to provide a comparison with the pubsub performance.
-
-The message size scaling tests, examine the brokers performance with different message payload sizes. The purpose of these tests is to evaluate where the broker process switches from being an io-bound to a cpu-bound process (if at all). The expected model is that the amount of CPU processing the broker has to carry out depends largely on the number of messages, and not on their size, because it carries out de-framing and routing for each message header but just copies payloads in-place or in a tight instruction loop. Therefore large message should be io-bound and a constant data rate through the broker should be seen for messages larger than the io/cpu threshold. Small messages require more processing so a constant message rate should be seen for message smaller than the io/cpu threshold. If the broker implementation is extremely efficient the threshold may dissapear altogether and the broker will be purely io-bound.
-The final variation, which is applied to all tests, is to run a transactional and non-transactional version of each. Messages are always batched into transactions of 100 messages each.
-
-Running the entire test suite can take some time, in particular their are about 4 24 hour burn-in tests. There are also 8 30 minute client scaling ramp up tests. If you want to run the test for a short time, to skim test that they work on your environment a command line like the following is usefull:
-
-> find . -name '*.sh' -exec {} -d10S \;
-
-If you want to run just a sub-set of the tests, you can use variations of the above command line. For example, to run just the message size tests using persistent p2p messaging do:
-
-> find . -name 'PPM-*.sh' -exec {} \;
-
-and so on.
-
-Interpreting the Results
-------------------------
-
-TODO: Explain what the results are expected to show and how to look for it. What should be graphed to get a visualization of the broker performance. How to turn the measurements into a description of the performance 'envelope'. \ No newline at end of file
diff --git a/qpid/java/perftests/bin/monitoring/monitor-broker.sh b/qpid/java/perftests/bin/monitoring/monitor-broker.sh
deleted file mode 100755
index 27c8ff25f6..0000000000
--- a/qpid/java/perftests/bin/monitoring/monitor-broker.sh
+++ /dev/null
@@ -1,221 +0,0 @@
-#!/bin/bash
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-#
-
-#
-# This script starts a broker and then starts additional logging as required.
-# *.pid files are generated in the LOG_DIR for later use by the stop-monitored-broker
-# script.
-#
-# Currently this process starts:
-# - The broker with additional QPID_OPTS for gc logging
-# - Top to monitoring the CPU usage
-#
-# Additional processes can be started and as long as they write a PID into LOG_DIR/*.pid
-# it will be shutdown with the stop script
-#
-
-#
-# Output the broker log file to aid problem diagnosis
-# then exit.
-#
-brokerFailExit()
-{
- echo "Broker failed to start up."
- cat $BROKER_LOG
- exit 1
-}
-
-showUsageExit()
-{
- echo "Usage $0 <Path to Test Broker> <LOG DIR> <CPU Monitor Rate (s)> [Additional options to
- pass to Qpid broker startup]"
- exit 1
-}
-
-#
-# Perform 3 attempts to get the broker PID via ps and grep
-# if unable the output broker log and exit
-#
-getBrokerPID()
-{
- attempts=3
- ready=0
- while [ $ready == 0 ] ; do
-
- PID=`ps auxwww| grep java | grep Xloggc | awk '{print $2}'`
-
- if [ ! $PID == 0 ] ; then
- ready=1
- else
- attempts=$[ $attempts - 1 ]
-
- if [ $attempts == 0 ] ; then
- brokerFailExit
- fi
-
- sleep 1
- fi
- done
-
-}
-
-
-#
-# Additional Check to ensure that the broker process
-# has correctly written 'Ready' to the log file.
-#
-checkBrokerStarted()
-{
- attempts=3
- ready=0
- while [ $ready == 0 ] ; do
-
- grep Ready $BROKER_LOG > /dev/null
-
- if [ $? == 0 ] ; then
- ready=1
- else
- attempts=$[ $attempts - 1 ]
-
- if [ $attempts == 0 ] ; then
- brokerFailExit
- fi
-
- echo "Broker not ready sleeping 1s"
- sleep 1
- fi
- done
-}
-
-#
-# Command Line setup
-#
-
-# Ensure we have minimum of three arguments
-if [[ $# > 2 ]] ; then
- BROKER_VERSION=$1
- LOG_DIR=$2
- CPU_MONITOR_RATE=$3
- # Remove these arguments from the $@ variable
- shift
- shift
- shift
-else
- # If we have no arguments then use these as the default
- CPU_MONITOR_RATE=0.5
- LOG_DIR=$QPID_WORK/logging
- BROKER_VERSION=qpid-0.5
-fi
-
-
-#
-# Check the specified broker is reachable
-# it it is not the log and show usage
-#
-if [ ! -d $BROKER_VERSION ] ; then
- echo "Broker not available at: $BROKER_VERSION"
- showUsageExit
-fi
-
-#
-# Check to see if we have an absolute path for logging
-#
-logStart=`echo $LOG_DIR|cut -c 1`
-
-
-#
-# If we don't have an absolute path then add the current
-# directory path to the start.
-#
-if [[ $logStart != '/' ]] ; then
- echo -n "$LOG_DIR is not absolute, using "
- LOG_DIR=`pwd`/$LOG_DIR
- echo $LOG_DIR
-fi
-
-#
-# Validate that the directory does not exist
-# - this is so we can guarrantee a clean run.
-# If it does exit then log and show usage
-#
-if [ -d $LOG_DIR ] ; then
- echo "Log directory already exists : $LOG_DIR"
- showUsageExit
-fi
-
-#
-# Create the logging directory
-#
-mkdir -p $LOG_DIR
-
-#
-# Variable for broker log
-#
-BROKER_LOG=$LOG_DIR/broker.log
-
-# Variable to hold broker PID
-PID=0
-
-export QPID_OPTS="-Xloggc:$LOG_DIR/gc.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps"
-
-#
-# Start Qpid Broker
-#
-echo "Starting Broker : $BROKER_VERSION"
-pushd $BROKER_VERSION/bin > /dev/null
-./qpid-server $@ 2> $BROKER_LOG >&2 &
-popd > /dev/null
-
-# Wait and check startup was ok
-echo "Waiting for broker startup"
-getBrokerPID
-
-checkBrokerStarted
-
-echo $PID > $LOG_DIR/broker.pid
-
-#
-# Start CPU Monitoring via TOP
-#
-echo "Starting CPU Monitor at RATE:$CPU_MONITOR_RATE on $SERVER1"
-pushd $LOG_DIR > /dev/null
-
-echo $CPU_MONITOR_RATE > top.rate
-
-top -d $CPU_MONITOR_RATE -S -c -p $PID -b > broker_cpu.log &
-
-#
-# Get top pid using $!
-#
-echo $! > $LOG_DIR/top.pid
-
-popd > /dev/null
-
-
-#
-# Generate Stat files
-#
-echo "Generating Stat data"
-stat $BROKER_LOG > $BROKER_LOG.stat
-stat $LOG_DIR/broker_cpu.log > $LOG_DIR/broker_cpu.log.stat
-stat $LOG_DIR/gc.log > $LOG_DIR/gc.log.stat
-
diff --git a/qpid/java/perftests/bin/monitoring/runTests.sh b/qpid/java/perftests/bin/monitoring/runTests.sh
deleted file mode 100755
index 676db0d4fa..0000000000
--- a/qpid/java/perftests/bin/monitoring/runTests.sh
+++ /dev/null
@@ -1,148 +0,0 @@
-#!/bin/bash
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-#
-
-#
-# Run specified performance tests and
-# gather details about the test run
-#
-
-
-runTest()
-{
- echo "$@"
- echo "$@ --csv -o $LOG_DIR" >> $LOG_DIR/TestRun.log 2>&1
- ./$@ --csv -o $LOG_DIR >> $LOG_DIR/TestRun.log 2>&1
-}
-
-showUsageExit()
-{
- echo "Usage $0 <Path to Test Pack> <LOG DIR> <TEST LIST FILE>"
- exit 1
-}
-
-# Ensure we have minimum of three arguments
-if [[ $# > 2 ]] ; then
- TEST_VERSION=$1
- LOG_DIR=$2
- TEST_LIST=$3
- # Remove these arguments from the $@ variable
- shift
- shift
- shift
-else
- showUsageExit
-fi
-
-#
-# Check the specified broker is reachable
-# it it is not the log and show usage
-#
-if [ ! -d $TEST_VERSION ] ; then
- echo "Tests not available at: $TEST_VERSION"
- showUsageExit
-fi
-
-
-#
-# Check to see if we have an absolute path for logging
-#
-logStart=`echo $LOG_DIR|cut -c 1`
-
-#
-# If we don't have an absolute path then add the current
-# directory path to the start.
-#
-if [[ $logStart != '/' ]] ; then
- echo -n "$LOG_DIR is not absolute, using "
- LOG_DIR=`pwd`/$LOG_DIR
- echo $LOG_DIR
-fi
-
-#
-# Validate that the directory does not exist
-# - this is so we can guarrantee a clean run.
-# If it does exit then log and show usage
-#
-if [ -d $LOG_DIR ] ; then
- echo "Log directory already exists : $LOG_DIR"
- showUsageExit
-fi
-
-#
-# Check to see if we have an absolute path for test list
-#
-testListStart=`echo $TEST_LIST|cut -c 1`
-
-#
-# If we don't have an absolute path then add the current
-# directory path to the start.
-#
-if [[ $testListStart != '/' ]] ; then
- echo -n "$TEST_LIST is not absolute, using "
- TEST_LIST=`pwd`/$TEST_LIST
- echo $TEST_LIST
-fi
-
-#
-# Validate that the directory does not exist
-# - this is so we can guarrantee a clean run.
-# If it does exit then log and show usage
-#
-# -r Check file exists and is readable
-if [ ! -r $TEST_LIST ] ; then
- echo "Test file is not readable : $TEST_LIST"
- showUsageExit
-fi
-
-
-
-#
-# Create the logging directory
-#
-mkdir -p $LOG_DIR
-
-
-
-echo "Starting Test Run in : $TEST_VERSION"
-pushd $TEST_VERSION/bin > /dev/null
-
-#
-# Run tests
-#
-
-
-while read testCommand
-do
- runTest $testCommand
-done < "$TEST_LIST"
-
-
-popd > /dev/null
-
-
-#
-# Generate Stat files
-#
-echo "Generating Stat data"
-for file in `find $LOG_DIR -name "*.csv"` ; do
- stat $file > $file.stat
-done
diff --git a/qpid/java/perftests/bin/monitoring/stop-monitored-broker.sh b/qpid/java/perftests/bin/monitoring/stop-monitored-broker.sh
deleted file mode 100755
index ad882b0bea..0000000000
--- a/qpid/java/perftests/bin/monitoring/stop-monitored-broker.sh
+++ /dev/null
@@ -1,124 +0,0 @@
-#!/bin/bash
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-#
-
-#
-# Script to stop the running of a monitored broker
-# and the associated monitoring processes.
-#
-# Looks in the specifed directory for pid files and
-# stops those proceses
-#
-
-
-usage()
-{
- echo "Usage: $0 <LOG_DIR>"
-}
-
-#
-# Attempt to gracefully kill processs
-#
-stopRun()
-{
- kill $PIDS
-}
-
-
-#
-# Forcibly stop processes
-#
-forceStopRun()
-{
- kill -9 $PIDS
-}
-
-#
-# Show usage if we are not started correctly
-#
-if [ $# != 1 ] ; then
- usage
- exit 1
-fi
-
-LOG_DIR=$1
-
-
-PIDS=`cat $LOG_DIR/*.pid`
-
-echo "Preparing to stop:"
-#
-# Escape the path so we can use sed to remove it.
-#
-path=`echo $LOG_DIR|sed -e s/\\\//\\\\\\\\\\\//g`
-
-for i in `ls $LOG_DIR/*.pid` ; do
- # Remove path from pid item then remove any final '/'
- echo $i|cut -d '.' -f 1| sed -e s/$path// |tr '/' ' '
-done
-
-status=`ps $PIDS |wc -l`
-
-if [ $status == 1 ] ; then
- echo "Processes do not appear to be running."
- echo "Have they already been stopped?"
- exit 0
-fi
-
-attempts=3
-
-while [ ! $status == 1 ] ; do
- stopRun
- sleep 1
- status=`ps $PIDS |wc -l`
-
- if [ $status == 1 ] ; then
- echo "Done"
- exit 0
- else
- attempts=$[ $attempts - 1 ]
-
- if [ $attempts == 0 ] ; then
- break
- fi
-
- echo "Sleeping as processes not stopped"
- sleep 2
-
- fi
-done
-
-# If we haven't been able to kill the processes then
-# forcibly do it
-if [ ! $status == 1 ] ; then
- forceStopRun
- sleep 1
- status=`ps $PIDS |wc -l`
-
- if [ $status == 1 ] ; then
- echo "Done"
- else
- echo "Stop failed"
- exit 1
- fi
-else
- echo "Done"
-fi
diff --git a/qpid/java/perftests/bin/processing/process.sh b/qpid/java/perftests/bin/processing/process.sh
deleted file mode 100755
index 6dbf9b9ea8..0000000000
--- a/qpid/java/perftests/bin/processing/process.sh
+++ /dev/null
@@ -1,388 +0,0 @@
-#!/bin/bash
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-#
-
-
-usage()
-{
- echo "usage: process.sh <Qpid Version> <Test Type Queue/Topic/Latency..> <Volume of data %age> <broker details>"
- echo "These parameters are used to title and name the graphs:"
- echo 'Title = $<Qpid Version> $<Test Type> : $<Volume>% volume'
- echo 'File = $<Qpid Version>-$<Broker Details>-$<Test Type>-$<Volume>'
- exit 1
-}
-
-processCMSGCFile()
-{
- # Extract all the ParNew timings: Ignore any lines corrupted by concurrent CMS logging.
- grep -v CMS gc.log|grep ParNew > $work/parnew.gc.log
-
- # Calculate Full GC Data
- grep failure -B 1 gc.log | sed -e :a -e '$!N;s/\n.(concurrent/ /;ta' -e 'P;D' |grep -v ^\- > $work/full.gc.log
- cut -d ':' -f 1 $work/full.gc.log > $work/full.time.log
- sed -e 's/failure)/\#/g' $work/full.gc.log |cut -d '#' -f 2- |awk '{print $3}' > $work/full.dur.log
-
- # Move to the working directory to further process the gathered data.
- pushd $work &> /dev/null
-
- # Extract the Heap and timing data.
- #8 is the full gc data
- #5 is the paranew gc data
- cat parnew.gc.log | awk '{print $8}' | cut -d '(' -f 2 | cut -d 'K' -f 1 > HEAP_MAX.log
- cat parnew.gc.log | awk '{print $8}' | cut -d 'K' -f 1 > HEAP_PRE_GC.log
- cat parnew.gc.log | awk '{print $8}' | cut -d 'K' -f 2 | cut -d '>' -f 2 > HEAP_POST_GC.log
- cat parnew.gc.log | awk '{print $1}' | cut -d ':' -f 1 > GC_TIME.log
-
- calculateStats "MEM_PRE" HEAP_PRE_GC.log
- calculateStats "MEM_POST" HEAP_POST_GC.log
- calculateStatsBC "GC_FREQ" GC_TIME.log
-
-
- # Calculate ParNew GC Cumulative total
- cat parnew.gc.log |awk '{sum=sum+$6; print $6, sum}' > GC_DUR.log
- # Give a count of GC occurances
- parNewGCCount=`wc -l GC_DUR.log| awk '{print $1}'`
-
- # Create the Heap data file
- paste GC_TIME.log HEAP_POST_GC.log HEAP_PRE_GC.log HEAP_MAX.log > GC.Heap.data
- # Create ParNew GC Duration data file for graphing
- paste GC_TIME.log GC_DUR.log > GC.Dur.data
- # Create Full GC occurance log file for plotting
- paste full.time.log full.dur.log > GC.Full.data
-
- # Calculate All GC Timing and give a count of their occurance
- awk '{print $1}' GC_DUR.log > gc_dur.log
- paste GC_TIME.log gc_dur.log > gc_all.log
- cat GC.Full.data >> gc_all.log
- sort -n gc_all.log | awk '{sum=sum+$2;print $1 , sum}' > GC.Dur.All.data
- fullGCCount=`wc -l GC.Full.data| awk '{print $1}'`
-}
-
-processG1GCFile()
-{
- cat gc.log | grep -e \^[0-9]*.[0-9]*\: -e \^.*[0-9]*.\-\> > $work/g1.gc.log
-
- # Move to the working directory to further process the gathered data.
- pushd $work &> /dev/null
-
- # Calculate Full GC Data
- cat g1.gc.log | sed -e :a -e '$!N;s/\n.\ *\[/ \[/;ta' -e 'P;D' > full.gc.log
- grep Full full.gc.log |awk '{print $1}'| tr ':' ' ' > full.time.log
- grep Full full.gc.log |awk '{print $5}' > full.dur.log
- fullGCCount=`wc -l GC.Full.data| awk '{print $1}'`
-
- # Create Full GC occurance log file for plotting
- paste full.time.log full.dur.log > GC.Full.data
-
- # Extract the Heap and timing data.
- # Create G1 Young Duration data file for graphing
- grep "(young)," full.gc.log |awk '{print $1}' | tr ':' ' ' > GC_TIME.log
- grep "(young)," full.gc.log |awk '{print $5}' > young.gc.time.log
- # Calculate G1 young Cumulative total
- cat young.gc.time.log |awk '{sum=sum+$1; print $1, sum}' > GC_DUR.log
- # Create G1 Young Duration data file for graphing
- paste GC_TIME.log GC_DUR.log > GC.Dur.data
-
- # Give a count of GC occurances
- youngGCCount=`wc -l GC_DUR.log| awk '{print $1}'`
-
- #
- # If we have no GCs then something is wrong
- if [ $youngGCCount == 0 ] ; then
- echo "Error no YoungGC log entries to proceses"
- return
- fi
-
- # Gather the Heap Size data
-
- grep "(young)," full.gc.log | awk '{print $8}' | cut -d '(' -f 2 | cut -d ')' -f 1 > HEAP_MAX.Sized.log
- grep "(young)," full.gc.log | awk '{print $8}' | cut -d '-' -f 1 > HEAP_PRE_GC.Sized.log
- grep "(young)," full.gc.log | awk '{print $8}' | cut -d '>' -f 2| cut -d '(' -f 1 > HEAP_POST_GC.Sized.log
-
- normaliseSizeMemFile HEAP_MAX.Sized.log HEAP_MAX.log
- normaliseSizeMemFile HEAP_PRE_GC.Sized.log HEAP_PRE_GC.log
- normaliseSizeMemFile HEAP_POST_GC.Sized.log HEAP_POST_GC.log
-
-
- # Create the Heap data file
- paste GC_TIME.log HEAP_POST_GC.log HEAP_PRE_GC.log HEAP_MAX.log > GC.Heap.data
-
- # Calculate All GC Timing and give a count of their occurance
- awk '{print $1}' GC_DUR.log > gc_dur.log
- paste GC_TIME.log gc_dur.log > gc_all.log
- cat GC.Full.data >> gc_all.log
- sort -n gc_all.log | awk '{sum=sum+$2;print $1 , sum}' > GC.Dur.All.data
-
-}
-
-calculateStatsBC()
-{
-label=$1
-statFile=$2
-# Calculate GC Frequencies
- prevFreq=0
- countFreq=0
- gcFreqTotal=0
- minFreq=99999999
- maxFreq=0
-
- echo "" > GC_FREQ.log
- for time in `cat $statFile` ; do
- if [ $prevFreq == 0 ] ; then
- prevFreq=$time
- else
- freq=`echo $time - $prevFreq | bc`
- echo $freq >> GC_FREQ.log
-
- prevFreq=$time
- gcFreqTotal=`echo $gcFreqTotal + $freq | bc`
- countFreq=$[$countFreq + 1]
-
- if [ `echo "$freq > $maxFreq " | bc` == 1 ] ; then
- maxFreq=$freq
- fi
-
- if [ `echo "$freq < $minFreq " | bc ` == 1 ] ; then
- minFreq=$freq
- fi
- fi
- done
-
- # Extract Min/Max/Avg
- echo "#type:min/max/avg" > $statFile.stats
-
- if [ $countFreq != 0 ] ; then
- avgFreq=`echo $gcFreqTotal / $countFreq | bc -l 2&> /dev/null`
- echo "$label:$minFreq/$maxFreq/$avgFreq" >> $statFile.stats
- echo "Done GC Freq Stat generation for $statFile"
- else
- echo "$label:-/-/-" >> $statFile.stats
- echo "Unable to calculate GC Freq stats as no freq entries found."
- fi
-}
-
-calculateStats()
-{
-label=$1
-statFile=$2
-
-# Calculate GC Frequencies
- count=0
- gcTotal=0
- min=0
- max=0
-
-
- for item in `cat $statFile` ; do
- if [ $min == 0 ] ; then
- min=$item
- fi
-
- gcTotal=$[$gcTotal + $item]
- count=$[$count + 1]
-
- if [ $item -gt $max ] ; then
- max=$item
- fi
-
- if [ $item -lt $min ] ; then
- min=$item
- fi
- done
-
- # Extract Min/Max/Avg
- echo "#type:min/max/avg" > $statFile.stats
-
- if [ $count != 0 ] ; then
- avg=`echo $gcTotal / $count | bc -l`
-
- echo "$label:$min/$max/$avg" >> $statFile.stats
- echo "Done $label Stat generation for $statFile"
- else
- echo "$label:-/-/-" >> $statFile.stats
- echo "Unable to calculate $label stats as no entries found."
- fi
-
-}
-
-#
-# Take an input file ($1) of lines
-# <value><K|M>
-# and output file $2 of <value> in whole M
-#
-normaliseSizeMemFile()
-{
-rm -f $2
-for i in `cat $1` ; do
- if [[ `echo $i | grep -c "K" ` == 1 ]] ; then
- kb=`echo $i|cut -d 'K' -f 1`
- echo $[ $kb / 1024 ] >> $2
- else
- echo $i|cut -d 'M' -f 1 >> $2
- fi
-done
-
-
-}
-
-
-# Parse command line
-# TODO more advanced processing
-# Check we have enough parameters
-if [ $# != 4 ] ; then
- # Take one arg to be a graph data file.
- if [ $# == 1 ] ; then
- textArray[0]="" # hold text
- length=0
- # read whole file in loop
- while read line
- do
- textArray[$length]=$line # store line
- length=$(expr $length + 1) # increase length by 1
- done < $1
-
- if [ $length != 2 ] ; then
- usage
- fi
-
- #Get Title and file name
- title=${textArray[0]}
- file=${textArray[1]}
-
- pushd `dirname $1`
-
- else
- usage
- fi
-else
- version=$1
- type=$2
- volume=$3
- brokerState=$4
-
-
- # Configure Graph Title and image file names
- title="$version $type : $volume% volume"
- file="$version-$brokerState-$type-$volume"
-fi
-
-work=work
-
-mkdir -p $work
-
-echo -n "Processing GC Usage Data : "
-ParNew=`grep -c ParNew gc.log`
-
-if [ $ParNew != 0 ] ; then
- echo "CMS log file"
- processCMSGCFile
- PLOT="\"GC.Dur.data\" with lines axis x1y1 ti \"ParNew GC Time ($parNewGCCount)\", "
-else
- echo "G1 log file"
- processG1GCFile
- PLOT="\"GC.Dur.data\" with lines axis x1y1 ti \"G1 Young Time ($youngGCCount)\", "
-fi
-
-#
-# Colate Stats
-#
-echo -n "Colating stat Data : "
-echo "#type:min/max/avg" > $file.statistics.txt
-find .. -name "*stats" -exec grep -v "type" {} >> $file.statistics.txt \;
-
-
-# Prepare the plot command
-# If a Full GC occured during this test then plot those
-if [[ $fullGCCount > 0 ]] ; then
-PLOT=$PLOT"\"GC.Dur.data\" using 1:3 with lines axis x1y2 ti \"Cumulative Total Time(ParNew)\", \
- \"GC.Dur.All.data\" with lines axis x1y2 ti \"Cumulative Total Time(All)\", \
- \"GC.Full.data\" with points ti \"Full GCs Time ($fullGCCount)\" "
-else
-PLOT=$PLOT"\"GC.Dur.data\" using 1:3 with lines axis x1y2 ti \"Cumulative Total Time(ParNew)\", \
- \"GC.Dur.All.data\" with lines axis x1y2 ti \"Cumulative Total Time(All)\" "
-fi
-
-if [ $ParNew != 0 ] ; then
- gcs=$parNewGCCount
-else
- gcs=$youngGCCount
-fi
-
-# Call out to gnuplot to generate graphs
-# Only do this if we have data
-if [ $gcs != 0 ] ; then
- # Generate the Heap Graph and the GC Duration Graph
- gnuplot << EOGNUPLOT
-set xlabel "Run Time(s)"
-
-set title "$title : Heap Size"
-set term png
-set output "$file-Heap.png"
-set ylabel "MB" +0.5,0
-plot "GC.Heap.data" using 1:2 with lines axis x1y1 ti "GC Size Post",\
- "GC.Heap.data" using 1:4 with lines axis x1y1 ti "GC Size Max ", \
- "GC.Heap.data" using 1:3 with lines axis x1y1 ti "GC Size Pre "
-
-set y2tics nomirror
-set ytics nomirror
-set key top left
-set title "$title GC Time"
-set ylabel "Time(s)" +0.5,0
-set y2label "Total Time(s)"
-set output "$file-GCDuration.png"
-plot $PLOT
-EOGNUPLOT
-
-else
- echo "Warning: No GC Data to graph"
-fi
-
-# pop back to further process for CPU usage
-popd &> /dev/null
-
-echo "Processing CPU Usage Data"
-
-# CPU.data is just TimeStamp + %age
-cat broker_cpu.log |awk '{print $1 "T" $2 " " $3}' > $work/CPU.data
-
-# Move to work directory to run gnuplot
-pushd $work &> /dev/null
-
-# Call out to gnuplot to generate graphs
-# Generate the Heap Graph and the GC Duration Graph
-gnuplot << EOGNUPLOT
-set term png
-set title "$title : CPU"
-set output "$file-CPU.png"
-unset key
-set xlabel "Real Time(h:m)"
-set ylabel "Usage(%)"
-
-set xdata time
-set timefmt "%Y-%m-%dT%H:%M:%S"
-set format x "%H:%M"
-plot "CPU.data" using 1:2 with lines
-EOGNUPLOT
-
-#"
-# Pop out of $work directory.
-#
-popd &> /dev/null \ No newline at end of file
diff --git a/qpid/java/perftests/bin/processing/processAll.sh b/qpid/java/perftests/bin/processing/processAll.sh
deleted file mode 100755
index 895d59c316..0000000000
--- a/qpid/java/perftests/bin/processing/processAll.sh
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/bin/bash
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-#
-
-
-usage()
-{
- echo "processResults.sh <search dir>"
- exit 1
-}
-
-root=`pwd`
-echo $root
-graphFile=graph.data
-
-if [ $# != 1 ] ; then
- usage
-fi
-
-mkdir -p results
-
-for file in `find $1 -name $graphFile` ; do
-
- dir=`dirname $file`
-
- echo Processing : $dir
- pushd $dir &> /dev/null
-
- $root/process.sh $graphFile
-
- echo Copying Images
- cp work/*png $root/results/
-
- echo Copying Stats
- cp work/*.statistics.txt $root/results/
-
-
- popd &> /dev/null
- echo Done
-done \ No newline at end of file
diff --git a/qpid/java/perftests/bin/processing/processTests.py b/qpid/java/perftests/bin/processing/processTests.py
deleted file mode 100755
index 8db44eda79..0000000000
--- a/qpid/java/perftests/bin/processing/processTests.py
+++ /dev/null
@@ -1,850 +0,0 @@
-#!/usr/bin/env python
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-import os
-import re
-import datetime
-import sys
-import string
-from optparse import OptionParser
-from datetime import datetime, timedelta
-import shutil
-
-
-def showUsage():
- log("./processTests.py [-b|--broker-log-dir] <dir> [-t|--test-dir] <dir>")
-
-
-ACCESS="Access"
-MODIFY="Modify"
-
-BROKER_LOG="broker.log"
-BROKER_PID="broker.pid"
-BROKER_CPU="broker_cpu.log"
-BROKER_CPU_DATED="broker_cpu.log.dated"
-BROKER_STATS="broker.stats"
-BROKER_GC="gc.log"
-
-GRAPH_DATA="graph.data"
-
-_verbose = False
-_debug = False
-_brokerLogs = ""
-
-def exitError(message):
- log(message)
- sys.exit(1)
-
-def main():
- global _log, _verbose, _debug, _brokerLogs
-
- # Load the
- parser = OptionParser()
-
- parser.add_option("-v", "--verbose", dest="verbose",
- action="store_true", default=False, help="enable verbose output")
-
- parser.add_option("-d", "--debug", dest="debug",
- action="store_true", default=False, help="enable debug output")
-
- parser.add_option("-b", "--broker-log-dir", dest="brokerLogs",
- action="store", default=True, help="Broker Logs")
-
- parser.add_option("-t", "--test-dir", dest="testDir",
- action="store", default="", help="Test Results")
-
-
- (options, args) = parser.parse_args()
-
- _verbose = options.verbose
- _debug = options.debug
- testDir = options.testDir
- _brokerLogs = options.brokerLogs
-
- if testDir == "" or _brokerLogs == "" :
- log("Broker Log Dir and Test Dir are both requried.")
- showUsage()
-
- if not os.path.exists(testDir):
- exitError("Test directory does not exist:" + testDir)
-
- if not os.path.exists(_brokerLogs):
- exitError("Broker log directory does not exist:" + _brokerLogs)
-
-
- # Standardize the format of the broker logs
- preProcessBrokerLogs(_brokerLogs)
-
- # Get list of test results from test_dir
- processTestResults(testDir)
-
-#
-# Process the log files we know of
-#
-def preProcessBrokerLogs(resultDir):
-
- print "Pre Processing Broker Logs"
- # Pre-Process GC - no pre processing required
-
- # Process Log4j - no processing required as file is already time stamped.
-
- # Pre-Process broker_cpu
- processCPUUsage(resultDir)
-
-#
-# Process the broker CPU log file and create an output file of format
-# <Date Time> <CPU Usage>
-#
-#
-def processCPUUsage(resultDir):
- logfile=resultDir+os.sep+BROKER_CPU
- datedFile=resultDir+os.sep+BROKER_CPU_DATED
-
- start = extractTime(ACCESS, logfile+".stat")
-
- pid = getPID(BROKER_PID)
-
- topRate = getFirstLine(_brokerLogs+os.sep+"top.rate")
-
- #
- # Calulate addition required per process line output
- #
- if topRate.find(".") == -1:
- seconds = topRate
- millis = 0
- else:
- split = topRate.split('.')
- seconds = split[0]
- # Convert
- millis = float("0."+split[1]) * 1000
-
- offset = timedelta(seconds=int(seconds),milliseconds=int(millis))
-
- #
- # Process the CPU log file and make a file of format:
- # datetime <CPU% usage> <MEM% usage>
- #
- # Open log CPU file for reading
- logfile = open(logfile, "r")
-
- # Open the output file, erasing any existing version
- # Keep track of the min/max sum and entries,.
- minCPU=float(sys.maxint)
- maxCPU=0.0
- minMem=float(sys.maxint)
- maxMem=0.0
-
- entries=0
- sumCPU=0.0
- sumMem=0.0
-
- output= open(datedFile, "w")
- for line in logfile:
- #
- # Data format
- # 0 1 2 3 4 5 6 7 8 9 10 11
- # PID USER PR NI %CPU TIME+ %MEM VIRT RES SHR S COMMAND
- # PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
- #
- # %CPU and %MEM are vary, probably based on os/version of top.
- # lets auto-detect where it is.
- #
- # Index is 0 based for array usage.
- index = 0
- if line.find("PID") != -1:
- for key in line.split(" "):
- strippedKey = key.lstrip()
- if len(strippedKey) > 0:
- # Record the key index
- if (strippedKey == "%CPU"):
- cpuIndex=index
- if (strippedKey == "%MEM"):
- memIndex=index
- # Increase count for next key
- index = index + 1
-
-
- # Find lines that contain our broker process
- if line.find("QPBRKR") != -1:
-
- # Split line on whitespace
- data = line.split()
-
- #Write out the date time (ISO-8601 format)
- output.write(str(start))
- # Output the %CPU value
- output.write(" "+str(data[cpuIndex]))
- # Output the %MEM value
- output.write(" "+str(data[memIndex]))
- output.write('\n')
-
- # Add the offset based on the logging rate
- start = start + offset
-
- # Record entires
- entries = entries + 1
-
- # Record Metrics
- # Record CPU data
- cpu = float(data[cpuIndex])
- if (cpu < minCPU):
- minCPU = cpu
-
- if (cpu > maxCPU):
- maxCPU = cpu
-
- sumCPU = sumCPU + cpu
-
- # Record Mem data
- mem = float(data[memIndex])
-
- if (mem < minMem):
- minMem = mem
-
- if (mem > maxMem):
- maxMem = mem
-
- sumMem = sumMem + mem
-
-
- #end for
-
- # Close the files
- logfile.close
- output.close
-
- # Output stats file
- statFile=resultDir+os.sep+BROKER_CPU+".stats"
- output= open(statFile, "w")
- output.write("#type:min/max/avg")
- output.write('\n')
- output.write("CPU:"+str(minCPU)+"/"+str(maxCPU)+"/"+str(float(sumCPU)/float(entries)))
- output.write('\n')
- output.write("MEM:"+str(minMem)+"/"+str(maxMem)+"/"+str(float(sumMem)/float(entries)))
- output.write('\n')
- output.close
-
- log("Pre Process of CPU Log file '"+BROKER_CPU+"' complete")
-
-
-#
-# Give an known process type get the recorded PID.
-#
-def getPID(process):
- return getFirstLine(_brokerLogs+os.sep+process)
-
-#
-# Get the first line of the file without EOL chars.
-# NOTE: this will load the entire file into memory to do it.
-#
-def getFirstLine(fileName):
- f = open(fileName,"r")
- line = f.read().splitlines()[0]
- f.close
- return line
-
-
-#
-# Walk the directory given and process all csv test results
-#
-def processTestResults(resultDir):
- for root, dirs, files in os.walk(resultDir, topdown=False):
- if len(files) == 0:
- exitError("Test result directory is empty:" + resultDir)
- for file in files:
- if file.endswith(".csv"):
- processTestResult(root , file)
-
-def processTestResult(root, resultFile):
- # Open stat file and extract test times, we determine:
- # -start time based on the 'Access' value
- # -end time based on the 'Modify' value 'Change' would also work
-
- statFile=root+os.sep+resultFile+".stat"
-
- if not os.path.exists(statFile):
- log("Unable to process : Unable to open stat file:" + statFile)
- return
-
-
- createResultSetPackage(root, resultFile)
-
-
-def extractTime(field, statFile):
- stats = open(statFile, "r")
- for line in stats:
- if line.startswith(field):
- if line.find("(") == -1:
- dt = lineToDate(" ".join(line.split()[1:]))
-
- #
- # TODO We need to handle time time zone issues as I'm sure we will have issues with the
- # log4j matching.
-
- stats.close
- return dt
-
-#
-# Given a text line in ISO format convert it to a date object
-#
-def lineToDate(line):
- #2009-06-22 17:04:44,320
- #2009-06-22 17:04:44.320
- pattern = re.compile(r'(?P<year>^[0-9][0-9][0-9][0-9])-(?P<month>[0-9][0-9])-(?P<day>[0-9][0-9]) (?P<hour>[0-9][0-9]):(?P<minute>[0-9][0-9]):(?P<seconds>[0-9][0-9])')
-
-
- m = pattern.match(line)
- if m:
- year = int(m.group('year'))
- month = int(m.group('month'))
- day = int(m.group('day'))
- hour = int(m.group('hour'))
- minute = int(m.group('minute'))
- seconds = int(m.group('seconds'))
-
- pattern = re.compile(r'(?P<year>^[0-9][0-9][0-9][0-9])-(?P<month>[0-9][0-9])-(?P<day>[0-9][0-9]) (?P<hour>[0-9][0-9]):(?P<minute>[0-9][0-9]):(?P<seconds>[0-9][0-9])[.|,](?P<micro>[0-9]+)')
- m = pattern.match(line)
- micro = None
- if m:
- micro = m.group('micro')
-
- if micro == None:
- micro = 0
-
- # Correct issue where micros are actually nanos
- if int(micro) > 999999:
- micro = int(micro) / 1000
-
- return datetime(year,month,day,hour,minute,seconds,int(micro))
- else:
- # Error we shouldn't get here
- return null
-
-def createResultSetPackage(root, resultFile):
- # Get the Name of the test to make a directory with said name
- testName = resultFile.split(".csv")[0]
- resultDir = root+ os.sep + testName
-
- log("Processing Result set for:"+ testName)
-
- mkdir(resultDir)
-
- # Move result file to new directory
- shutil.move(root + os.sep + resultFile, resultDir)
-
- # Move stat file to new directory
- shutil.move(root + os.sep + resultFile + ".stat", resultDir)
-
- statFile=resultDir + os.sep + resultFile + ".stat"
-
- #
- # Get start and end time for test run
- #
- start = extractTime(ACCESS, statFile)
- end = extractTime(MODIFY, statFile)
-
- sliceBrokerLogs(resultDir, start, end)
- createGraphData(resultDir, testName)
- createTestStatData(resultDir, testName)
-
- log("Created Result Package for:"+ testName)
-
-def sliceBrokerLogs(resultDir, start, end):
- sliceCPULog(resultDir, start, end)
- sliceLog4j(resultDir, start, end)
- sliceGCLog(resultDir, start, end)
-
-
-def sliceCPULog(resultDir, start, end):
- global _brokerLogs
- logfilePath=_brokerLogs+os.sep+BROKER_CPU_DATED
- cpuSliceFile=resultDir+os.sep+BROKER_CPU
-
- # Process the CPU log file and make a file of format:
- # datetime <CPU% usage> <MEM% usage>
- #
- # Open log CPU file for reading
- logFile = open(logfilePath, "r")
-
- # Open the output file, erasing any existing version
- # Keep track of the min/max sum and entries,.
- minCPU=float(sys.maxint)
- maxCPU=0.0
- minMem=float(sys.maxint)
- maxMem=0.0
-
- entries=0
- sumCPU=0.0
- sumMem=0.0
-
- #
- # Create outputfile
- #
- cpuslice = open(cpuSliceFile,"w")
- for line in logFile:
- data = line.split()
- #
- # //fixme remove tz addition.
- #
- lineTime = lineToDate(" ".join(data[0:2])+" +0000")
-
- if lineTime > start:
- if lineTime < end:
- # Write the data though to the new file
- cpuslice.writelines(line)
-
- # Perform stat processing for the min/max/avg
-
- data = line.split()
-
- #
- # Data format is
- # <Date> <Time> <%CPU> <%MEM>
- # 2010-02-19 10:16:17 157 28.1
- #
- cpuIndex = 2
- memIndex = 3
-
- # Record entires
- entries = entries + 1
-
- # Record Metrics
- # Record CPU data
- cpu = float(data[cpuIndex])
- if (cpu < minCPU):
- minCPU = cpu
-
- if (cpu > maxCPU):
- maxCPU = cpu
-
- sumCPU = sumCPU + cpu
-
- # Record Mem data
- mem = float(data[memIndex])
-
- if (mem < minMem):
- minMem = mem
-
- if (mem > maxMem):
- maxMem = mem
-
- sumMem = sumMem + mem
-
- logFile.close()
- cpuslice.close()
- log("Sliced CPU log")
-
- # Output stats file
- statFile=cpuSliceFile+".stats"
- output= open(statFile, "w")
- output.write("#type:min/max/avg")
- output.write('\n')
- output.write("CPU:"+str(minCPU)+"/"+str(maxCPU)+"/"+str(float(sumCPU)/float(entries)))
- output.write('\n')
- output.write("MEM:"+str(minMem)+"/"+str(maxMem)+"/"+str(float(sumMem)/float(entries)))
- output.write('\n')
- output.close
-
- log("Generated stat data from CPU Log file")
-
-
-def sliceGCLog(resultDir, start, end):
- global _brokerLogs
- logfilePath=_brokerLogs+os.sep+BROKER_GC
- sliceFile=resultDir+os.sep+BROKER_GC
-
- gcstart = extractTime(ACCESS, logfilePath+".stat")
-
- # Open the output file, erasing any existing version
- # Keep track of the min/max sum and entries,.
- minGCDuration=float(sys.maxint)
- maxGCDuration=0.0
- sumGCDuration=0.0
- entriesGCDuration = 0
-
-
- # Open log GC file for reading
- logFile = open(logfilePath, "r")
-
- # Open the output file, erasing any existing version
- output= open(sliceFile, "w")
-
- # Use a regular expression to pull out the Seconds.Millis values from the
- # Start of the gc log line.
- pattern = re.compile(r'(?P<seconds>^[0-9]+)\.(?P<millis>[0-9]+):')
-
- for line in logFile:
- m = pattern.match(line)
-
- if m:
- seconds = m.group('seconds');
- millis = m.group('millis');
-
- offset = timedelta(seconds=int(seconds),milliseconds=int(millis))
-
- lineTime = gcstart + offset
-
- if lineTime > start:
- if lineTime < end:
- output.writelines(line)
- # Perform stat processing for the min/max/avg
-
- # Process GC Duration lines in ParNew gc ,
- # ensure we do not have CMS printed as that means the line line has been corrupted
- if line.find("ParNew") != -1 & line.find("CMS") == -1:
-
- #
- # Example data line
- # 7.646: [GC 7.646: [ParNew: 14778K->461K(14784K), 0.0026610 secs] 49879K->36609K(73288K), 0.0027560 secs] [Times: user=0.01 sys=0.00, real=0.01 secs]
- #
- # So entry 5 is the ParNew time and 8 is the whole GC cycle. 14 entries total
-
- data = line.split()
-
- gcTime = 0
- # Check we have a valid ParNew Line
- if (len(data) == 15):
-
- # Record entires
- # Record GC Duration data
-
- entriesGCDuration = entriesGCDuration + 1
- gcTime = float(data[8])
-
- if (gcTime < minGCDuration):
- minGCDuration = gcTime
-
- if (gcTime > maxGCDuration):
- maxGCDuration = gcTime
-
- sumGCDuration = sumGCDuration + gcTime
-
-
-
- # Close the files
- logFile.close
- output.close()
-
- log("Sliced gc log")
-
- # Output stats file
- statFile=sliceFile+".stats"
- output= open(statFile, "w")
- output.write("#type:min/max/avg")
- output.write('\n')
- #
- # Only provide GCDuration if it was processed
- #
- output.write("GC_DUR:%.14f/%.14f/%.14f" % (minGCDuration, maxGCDuration , (sumGCDuration/float(entriesGCDuration))))
- output.write('\n')
- output.close
-
- log("Generated stat data from CPU Log file")
-
-
-def sliceLog4j(resultDir, start, end):
- global _brokerLogs
- logfilePath=_brokerLogs+os.sep+BROKER_LOG
- log4jSliceFile=resultDir+os.sep+BROKER_LOG
-
- log4jstart = extractTime(ACCESS, logfilePath+".stat")
-
- #
- # Say that first line is the start of the file,
- # This value will give a time value to the initial
- # logging before Log4j kicks in.
- #
- lineTime = log4jstart
-
- # Process the broker log4j file
- # Open log CPU file for reading
- logFile = open(logfilePath, "r")
-
- #
- # Create outputfile
- #
- log4jslice = open(log4jSliceFile,"w")
-
- for line in logFile:
- data = line.split()
-
- #
- # If the line has a time at the start then process it
- # otherwise use the previous time. This means if there is
- # a stack trace in the middle of the log file then it will
- # be copied over to the split file as long as it is in the
- # split time.
- #
- if (hasTime(data)):
- #
- # //fixme remove tz addition.
- #
- lineTime = lineToDate(" ".join(data[0:2])+" +0000")
-
- if lineTime > start:
- if lineTime < end:
- print line
- log4jslice.writelines(line)
-
- logFile.close()
- log4jslice.close()
- log("Sliced broker log")
-
-
-#
-# Check the first two entries of data can make a datetime object
-#
-def hasTime(data):
- date = data[0]
- time = data[1]
-
- # Examples:
- # 2009-06-22 17:04:44,246
- # 2009-06-22 17:04:44.2464
- # 2009-06-22 17:04:44
-
- # ISO-8601 '-' format date
- dateRE = re.compile('[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]')
-
- #
- # Check for times with/out millis
- # e.g.
- # 10:00:00,000 - log4j
- # 10:00:00.0000 - generated in script for cpu time
- #
- timeRE = re.compile('[0-9][0-9]:[0-9][0-9]:[0-9][0-9]?[0-9]*')
-
- return dateRE.match(date) and timeRE.match(time)
-
-def createGraphData(resultDir, testName):
- # Create graph.data file for process.sh
- # Format two lines : Title and filename
- # $version $type : $volume% volume
- # $version-$brokerState-$type-$volume
- version=getBrokerVersion()
-
- test= extractTestValue("n",resultDir, testName)
- volume = int(float(extractTestResult("Test * Size Throughput", resultDir, testName)) * 1000)
- messageSize = extractTestValue("messageSize",resultDir, testName)
- ackMode = ackModeToString(extractTestValue("consAckMode",resultDir, testName))
-
- graphDataFile=resultDir+os.sep+GRAPH_DATA
-
- graphData = open(graphDataFile, "w")
-
- #
- # Write Title
- graphData.write(version+":"+test+":"+str(messageSize)+"kb x "+str(volume)+" msg/sec using "+ackMode)
- graphData.write('\n')
-
- #
- # Write FileName
- graphData.writelines(version+"-"+testName)
- graphData.write('\n')
- graphData.close
- log("Created graph.data")
-
-
-def getBrokerVersion():
- global _brokerLogs
- READY = "Qpid Broker Ready"
- brokerLogFile = _brokerLogs + os.sep + BROKER_LOG
-
- log = open(brokerLogFile, "r")
-
- dataLine = ""
- for line in log:
- if line.find(READY) != -1:
- dataLine = line
- break
-
- # Log Entry
- #2009-06-19 17:04:02,493 INFO [main] server.Main (Main.java:456) - Qpid Broker Ready :2.3.0.1 build: 727403M
- # Split on READY
- data = dataLine.split(READY)
-
- # So [1] should be
- # :2.3.0.1 build: 727403M
- readyEntries = data[1].split()
-
- # so spliting on white space should give us ':version'
- # and a quick split on ':' will give us the version
- version = readyEntries[0].split(':')[1]
-
- # Strip to ensure we have no whitespace
- return version.strip()
-
-
-def extractTestValue(property,resultDir,testName):
- return extractTestData(property,resultDir,testName," =")
-
-def extractTestResult(property,resultDir,testName):
- return extractTestData(property,resultDir,testName,":")
-
-def extractTestData(property,resultDir,testName,type):
- resultFile = resultDir + os.sep + testName+".csv"
-
- results = open(resultFile, "r")
-
- dataLine = ""
- for line in results:
- if line.find("Total Tests:") == 0:
- dataLine = line
-
- results.close()
-
- # Data is CSV
- data = dataLine.split(',')
-
- found = False
- result = ""
- searchProperty = property+type
-
- for entry in data:
- if found:
- result = entry
- break
- if entry.strip() == searchProperty:
- found=True
-
- return result.strip()
-
-def createTestStatData(resultDir, testName):
- csvFilePath=resultDir + os.sep + testName + ".csv"
-
- # Open the output file, erasing any existing version
- # Keep track of the min/max sum and entries,.
- minLatency=float(sys.maxint)
- maxLatency=0.0
- minThroughput=float(sys.maxint)
- maxThroughput=0.0
-
- entries=0
- sumLatency=0.0
- sumThroughput=0.0
-
- #
- # Open csv File
- #
- csvFile = open(csvFilePath,"r")
- for line in csvFile:
-
- # The PingAsyncTestPerf test class outputs the latency and throughput data.
- if line.find("PingAsyncTestPerf") != -1:
- #
- # Data format is
- # <Test> <TestName> <Thread> <Status> <Time> <Latency> <Concurrency> <Thread> <TestSize>
- #org.apache.qpid.ping.PingAsyncTestPerf, testAsyncPingOk, Dispatcher-Channel-1, Pass, 209.074, 219.706, 0, 1, 10
- LatencyIndex = 5
- ThroughputIndex = 4
-
- # The PingLatencyTestPerf test class just outputs the latency data.
- if line.find("PingLatencyTestPerf") != -1:
- #
- # Data format is
- # <Test> <TestName> <Thread> <Status> <Time> <Latency> <Concurrency> <Thread> <TestSize>
- # org.apache.qpid.ping.PingLatencyTestPerf, testPingLatency, Dispatcher-Channel-1, Pass, 397.05502, 0, 2, 1000
- LatencyIndex = 4
- ThroughputIndex = -1
-
-
- # Only process the test lines that have 'org.apache.qpid.ping', i.e. skip header and footer.
- if line.find("org.apache.qpid.ping") != -1:
- # Perform stat processing for the min/max/avg
- data = line.split(",")
-
- # Record entires
- entries = entries + 1
-
- # Record Metrics
- # Record Latency data
- latency = float(data[LatencyIndex])
- if (latency < minLatency):
- minLatency = latency
-
- if (latency > maxLatency):
- maxLatency = latency
-
- sumLatency = sumLatency + latency
-
- if (ThroughputIndex != -1):
- # Record Latency data
- throughput = float(data[ThroughputIndex])
- if (throughput < minThroughput):
- minThroughput = throughput
-
- if (throughput > maxThroughput):
- maxThroughput = throughput
-
- sumThroughput = sumThroughput + throughput
-
-
- csvFile.close()
-
- # Output stats file
- statFile=resultDir + os.sep + testName+".stats"
- output= open(statFile, "w")
- output.write("#type:min/max/avg")
- output.write('\n')
- output.write("LATENCY:"+str(minLatency)+"/"+str(maxLatency)+"/"+str(float(sumLatency)/float(entries)))
- output.write('\n')
-
- if (ThroughputIndex != -1):
- # Output msgs/sec based on time for a batch of msgs
- output.write("THROUGHPUT:"+str(float(1000)/maxThroughput)+"/"+str(float(1000)/minThroughput)+"/"+str(float(1000)/(float(sumThroughput)/float(entries))))
- output.write('\n')
-
- output.close
-
- log("Generated stat data from test "+testName+" CSV file")
-
-
-def ackModeToString(ackMode):
- if ackMode == '0':
- return "Transacted"
- elif ackMode == '1':
- return "AutoAck"
- elif ackMode == '2':
- return "ClientAck"
- elif ackMode == '3':
- return "DupsOK"
- elif ackMode == '257':
- return "NoAck"
- elif ackMode == '258':
- return "PreAck"
- else:
- return str(ackMode)
-
-
-
-def debug(msg):
- global _debug
- if _debug:
- log(msg)
-
-def log(msg):
- print msg
-
-def mkdir(dir):
- if not os.path.exists(dir):
- os.mkdir(dir)
-
-if __name__ == "__main__":
- main() \ No newline at end of file
diff --git a/qpid/java/perftests/bin/run_many.sh b/qpid/java/perftests/bin/run_many.sh
deleted file mode 100755
index cca2ffec21..0000000000
--- a/qpid/java/perftests/bin/run_many.sh
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/sh
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-
-# args:
-# <number of processes to start>
-# <name of run>
-# <command ro run>
-
-for i in `seq 1 $1`; do
- $3 >$2.$i.out 2>>$2.err &
- echo $! > $2.$i.pid
-done;
diff --git a/qpid/java/perftests/bin/topicListener.sh b/qpid/java/perftests/bin/topicListener.sh
deleted file mode 100755
index 3a925910ad..0000000000
--- a/qpid/java/perftests/bin/topicListener.sh
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-
-# XXX -Xmx512m -Xms512m -XX:NewSize=150m
-QPID_LIBS=$QPID_HOME/lib/qpid-all.jar
-
-# Set other variables used by the qpid-run script before calling
-export JAVA=java \
- JAVA_VM=-server \
- JAVA_MEM="-Xmx128m -Dlog4j.configuration=$HOME/log4j.properties" \
- JAVA_GC="-XX:-UseConcMarkSweepGC -XX:+HeapDumpOnOutOfMemoryError" \
- QPID_CLASSPATH=$QPID_LIBS
-
-. qpid-run -Damqj.logging.level="INFO" org.apache.qpid.oldtopic.Listener $*
diff --git a/qpid/java/perftests/bin/topicPublisher.sh b/qpid/java/perftests/bin/topicPublisher.sh
deleted file mode 100755
index e4e9981a75..0000000000
--- a/qpid/java/perftests/bin/topicPublisher.sh
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-# XXX -Xmx512m -Xms512m -XX:NewSize=150m
-QPID_LIBS=$QPID_HOME/lib/qpid-all.jar
-
-# Set other variables used by the qpid-run script before calling
-export JAVA=java \
- JAVA_VM=-server \
- JAVA_MEM=-Xmx128m \
- JAVA_GC="-XX:-UseConcMarkSweepGC -XX:+HeapDumpOnOutOfMemoryError" \
- QPID_CLASSPATH=$QPID_LIBS
-
-. qpid-run -Damqj.logging.level="INFO" org.apache.qpid.oldtopic.Publisher $*
diff --git a/qpid/java/perftests/build.xml b/qpid/java/perftests/build.xml
deleted file mode 100644
index 497bfc8035..0000000000
--- a/qpid/java/perftests/build.xml
+++ /dev/null
@@ -1,339 +0,0 @@
-<!--
- -
- - Licensed to the Apache Software Foundation (ASF) under one
- - or more contributor license agreements. See the NOTICE file
- - distributed with this work for additional information
- - regarding copyright ownership. The ASF licenses this file
- - to you under the Apache License, Version 2.0 (the
- - "License"); you may not use this file except in compliance
- - with the License. You may obtain a copy of the License at
- -
- - http://www.apache.org/licenses/LICENSE-2.0
- -
- - Unless required by applicable law or agreed to in writing,
- - software distributed under the License is distributed on an
- - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- - KIND, either express or implied. See the License for the
- - specific language governing permissions and limitations
- - under the License.
- -
- -->
-<project name="Performance Tests" default="build">
-
- <property name="module.depends" value="systests client broker common common/test junit-toolkit"/>
-
- <import file="../module.xml"/>
-
- <property name="xms" value="-Xms256m"/>
- <property name="xmx" value="-Xmx1024m"/>
- <property name="test.logging.level" value="-Damqj.test.logging.level=info"/>
- <property name="qpid.logging.level" value="-Damqj.logging.level=warn"/>
- <property name="log4j.config" value="-Dlog4j.configuration=perftests.log4j"/>
- <property name="properties" value="perftests.properties"/>
- <property name="scripts.dir" value="${build.bin}/${module.name}"/>
-
- <condition property="results" value="${result-path}/results" else="${project.root}/${module}/results">
- <isset property="result-path"/>
- </condition>
-
- <property name="scripts.timestamp" location="${build.scratch}/perftests/scripts.timestamp" />
-
- <target name="check_scripts_uptodate">
- <uptodate property="scripts.notRequired" targetfile="${scripts.timestamp}">
- <srcfiles dir="${scripts.dir}" includes="**.sh" />
- <srcfiles dir="${project.root}/perftests/" includes="scripts.xml" />
- </uptodate>
- </target>
-
- <target name="precompile" depends="check_scripts_uptodate" unless="scripts.notRequired">
- <mkdir dir="${scripts.dir}"/>
- <jython path="${mllib.dir}">
- <args>
- <arg value="generate-scripts"/>
- <arg value="scripts.xml"/>
- <arg value="${scripts.dir}"/>
- </args>
- </jython>
- <touch file="${scripts.timestamp}" />
- </target>
-
- <target name="all-tests" depends="all-queue-tests,all-topic-tests"/>
-
- <target name="all-queue-tests" depends="Queue-Duration-Persistent,Queue-Concurrent,
- Queue-Duration,Queue-Latency,Queue-Duration-Transacted,Queue-LargeMessage-Persistent"/>
-
- <target name="all-topic-tests" depends="Topic-Concurrent,Topic-Duration,Topic-Latency,
- Topic-Duration-Transacted"/>
-
- <!-- Queue tests -->
-
- <!--
- Send 10000 (.5K) messages and measure the time for receiving 1000 messages (10 intervals)
- the overall latency is also calculated (See Test * Size Throughput)
- Note that "Test Throughput" is the average time for receiving 1000 messages
- -->
- <target name="Queue-Latency" depends="build" description="Run Queue-Latency">
- <java classname="org.apache.qpid.junit.extensions.TKTestRunner" fork="true">
- <classpath refid="module.test.path"/>
- <jvmarg value="${xms}"/>
- <jvmarg value="${xmx}"/>
- <jvmarg value="${test.logging.level}"/>
- <jvmarg value="${qpid.logging.level}"/>
- <jvmarg value="${log4j.config}"/>
- <!-- args -->
- <arg value="-n Queue-Latency"/>
- <arg value="-s[10000]"/>
- <arg value="-t testPingLatency"/>
- <arg value="-o${results}"/>
- <arg value="--csv"/>
- <arg value="org.apache.qpid.ping.PingLatencyTestPerf"/>
- <arg value="rate=100"/>
- <arg value="batchSize=1000"/>
- <arg value="messageSize=512"/>
- </java>
- </target>
-
- <!--
- Measure the time required for one producer/consumer pair
- for sending and receiving 10000 transient messages.
- The test last for 5 minutes.
- -->
- <target name="Queue-Duration" depends="build" description="">
- <java classname="org.apache.qpid.junit.extensions.TKTestRunner" fork="true">
- <classpath refid="module.test.path"/>
- <jvmarg value="${xms}"/>
- <jvmarg value="${xmx}"/>
- <jvmarg value="${test.logging.level}"/>
- <jvmarg value="${qpid.logging.level}"/>
- <jvmarg value="${log4j.config}"/>
- <!-- args -->
- <arg value="-d5M"/>
- <arg value="-n Queue-Duration"/>
- <arg value="-s[1000]"/>
- <arg value="-t testAsyncPingOk"/>
- <arg value="-o${results}"/>
- <arg value="--csv"/>
- <arg value="org.apache.qpid.ping.PingAsyncTestPerf"/>
- <arg value="messageSize=512"/>
- </java>
- </target>
-
- <!--
- Measure the time required for one producer/consumer pair
- for sending and receiving 10000 0.5K persistent messages.
- The test last for 5 minutes.
- -->
- <target name="Queue-Duration-Persistent" depends="build" description="">
- <java classname="org.apache.qpid.junit.extensions.TKTestRunner" fork="true">
- <classpath refid="module.test.path"/>
- <jvmarg value="${xms}"/>
- <jvmarg value="${xmx}"/>
- <jvmarg value="${test.logging.level}"/>
- <jvmarg value="${qpid.logging.level}"/>
- <jvmarg value="${log4j.config}"/>
- <!-- args -->
- <arg value="-d5M"/>
- <arg value="-n Queue-Duration-Persistent"/>
- <arg value="-s[1000]"/>
- <arg value="-t testAsyncPingOk"/>
- <arg value="-o${results}"/>
- <arg value="--csv"/>
- <arg value="org.apache.qpid.ping.PingAsyncTestPerf"/>
- <arg value="persistent=true"/>
- <arg value="messageSize=512"/>
- </java>
- </target>
-
- <!--
- Measure the time required for one producer/consumer pair
- for sending and receiving 10000 100K persistent messages.
- The test last for 5 minutes.
- -->
- <target name="Queue-LargeMessage-Persistent" depends="build" description="">
- <java classname="org.apache.qpid.junit.extensions.TKTestRunner" fork="true">
- <classpath refid="module.test.path"/>
- <jvmarg value="${xms}"/>
- <jvmarg value="${xmx}"/>
- <jvmarg value="${test.logging.level}"/>
- <jvmarg value="${qpid.logging.level}"/>
- <jvmarg value="${log4j.config}"/>
- <!-- args -->
- <arg value="-d5M"/>
- <arg value="-n Queue-LargeMessage-Persistent"/>
- <arg value="-s[1000]"/>
- <arg value="-t testAsyncPingOk"/>
- <arg value="-o${results}"/>
- <arg value="--csv"/>
- <arg value="org.apache.qpid.ping.PingAsyncTestPerf"/>
- <arg value="persistent=true"/>
- <arg value="messageSize=102400"/>
- </java>
- </target>
-
- <!--
- Measure the time required for one (transacted producer)/(Transacted consumer) pair
- for sending and receiving 10000 (0.5K) persistent messages.
- Tx batch size is 100 (consumer and producer)
- The test last for 5 minutes.
- -->
- <target name="Queue-Duration-Transacted" depends="build" description="">
- <java classname="org.apache.qpid.junit.extensions.TKTestRunner" fork="true">
- <classpath refid="module.test.path"/>
- <jvmarg value="${xms}"/>
- <jvmarg value="${xmx}"/>
- <jvmarg value="${test.logging.level}"/>
- <jvmarg value="${qpid.logging.level}"/>
- <jvmarg value="${log4j.config}"/>
- <!-- args -->
- <arg value="-d5M"/>
- <arg value="-n Queue-Duration-Transacted"/>
- <arg value="-s[1000]"/>
- <arg value="-t testAsyncPingOk"/>
- <arg value="-o${results}"/>
- <arg value="--csv"/>
- <arg value="org.apache.qpid.ping.PingAsyncTestPerf"/>
- <arg value="persistent=true"/>
- <arg value="transacted=true"/>
- <arg value="batchSize=100"/>
- <arg value="consTransacted=true"/>
- <arg value="commitBatchSize=100"/>
- <arg value="messageSize=512"/>
- </java>
- </target>
-
- <!--
- Measure the time for four concurrent producer/receiver pairs to send and receive 1000 transient messages
- -->
- <target name="Queue-Concurrent" depends="build" description="">
- <java classname="org.apache.qpid.junit.extensions.TKTestRunner" fork="true">
- <classpath refid="module.test.path"/>
- <jvmarg value="${xms}"/>
- <jvmarg value="${xmx}"/>
- <jvmarg value="${test.logging.level}"/>
- <jvmarg value="${qpid.logging.level}"/>
- <jvmarg value="${log4j.config}"/>
- <!-- args -->
- <arg value="-r1"/>
- <arg value="-n Queue-Concurrent"/>
- <arg value="-s[1000]"/>
- <arg value="-c[4]"/>
- <arg value="-t testAsyncPingOk"/>
- <arg value="-o${results}"/>
- <arg value="--csv"/>
- <arg value="org.apache.qpid.ping.PingAsyncTestPerf"/>
- <arg value="messageSize=512"/>
- </java>
- </target>
-
-
- <!-- Topic tests -->
-
- <!--
- Send 10000 (.5K) messages and measure the time for receiving 1000 messages (10 intervals)
- the overall latency is also calculated (See Test * Size Throughput)
- Note that "Test Throughput" is the average time for receiving 1000 messages
- -->
- <target name="Topic-Latency" depends="build" description="Run Queue-Latency">
- <java classname="org.apache.qpid.junit.extensions.TKTestRunner" fork="true">
- <classpath refid="module.test.path"/>
- <jvmarg value="${xms}"/>
- <jvmarg value="${xmx}"/>
- <jvmarg value="${test.logging.level}"/>
- <jvmarg value="${qpid.logging.level}"/>
- <jvmarg value="${log4j.config}"/>
- <!-- args -->
- <arg value="-n Topic-Latency"/>
- <arg value="-s[10000]"/>
- <arg value="-t testPingLatency"/>
- <arg value="-o${results}"/>
- <arg value="--csv"/>
- <arg value="org.apache.qpid.ping.PingLatencyTestPerf"/>
- <arg value="rate=100"/>
- <arg value="batchSize=1000"/>
- <arg value="messageSize=512"/>
- <arg value="pubsub=true"/>
- </java>
- </target>
-
- <!--
- Measure the time required for one producer/consumer pair
- for sending and receiving 10000 transient messages.
- The test last for 5 minutes.
- -->
- <target name="Topic-Duration" depends="build" description="">
- <java classname="org.apache.qpid.junit.extensions.TKTestRunner" fork="true">
- <classpath refid="module.test.path"/>
- <jvmarg value="${xms}"/>
- <jvmarg value="${xmx}"/>
- <jvmarg value="${test.logging.level}"/>
- <jvmarg value="${qpid.logging.level}"/>
- <jvmarg value="${log4j.config}"/>
- <!-- args -->
- <arg value="-d5M"/>
- <arg value="-n Topic-Duration"/>
- <arg value="-s[1000]"/>
- <arg value="-t testAsyncPingOk"/>
- <arg value="-o${results}"/>
- <arg value="--csv"/>
- <arg value="org.apache.qpid.ping.PingAsyncTestPerf"/>
- <arg value="messageSize=512"/>
- <arg value="pubsub=true"/>
- </java>
- </target>
-
- <!--
- Measure the time required for one (transacted producer)/(Transacted consumer) pair
- for sending and receiving 10000 (0.5K) persistent messages.
- Tx batch size is 100 (consumer and producer)
- The test last for 5 minutes.
- -->
- <target name="Topic-Duration-Transacted" depends="build" description="">
- <java classname="org.apache.qpid.junit.extensions.TKTestRunner" fork="true">
- <classpath refid="module.test.path"/>
- <jvmarg value="${xms}"/>
- <jvmarg value="${xmx}"/>
- <jvmarg value="${test.logging.level}"/>
- <jvmarg value="${qpid.logging.level}"/>
- <jvmarg value="${log4j.config}"/>
- <!-- args -->
- <arg value="-d5M"/>
- <arg value="-n Topic-Duration-Transacted"/>
- <arg value="-s[1000]"/>
- <arg value="-t testAsyncPingOk"/>
- <arg value="-o${results}"/>
- <arg value="--csv"/>
- <arg value="org.apache.qpid.ping.PingAsyncTestPerf"/>
- <arg value="persistent=true"/>
- <arg value="transacted=true"/>
- <arg value="batchSize=100"/>
- <arg value="consTransacted=true"/>
- <arg value="commitBatchSize=100"/>
- <arg value="messageSize=512"/>
- </java>
- </target>
-
- <!--
- Measure the time for four concurrent producer/receiver pairs to send and receive 1000 transient messages
- -->
- <target name="Topic-Concurrent" depends="build" description="">
- <java classname="org.apache.qpid.junit.extensions.TKTestRunner" fork="true">
- <classpath refid="module.test.path"/>
- <jvmarg value="${xms}"/>
- <jvmarg value="${xmx}"/>
- <jvmarg value="${test.logging.level}"/>
- <jvmarg value="${qpid.logging.level}"/>
- <jvmarg value="${log4j.config}"/>
- <!-- args -->
- <arg value="-r1"/>
- <arg value="-n Topic-Concurrent"/>
- <arg value="-s[1000]"/>
- <arg value="-c[4]"/>
- <arg value="-t testAsyncPingOk"/>
- <arg value="-o${results}"/>
- <arg value="--csv"/>
- <arg value="org.apache.qpid.ping.PingAsyncTestPerf"/>
- <arg value="messageSize=512"/>
- </java>
- </target>
-
-</project>
diff --git a/qpid/java/perftests/dist-zip.xml b/qpid/java/perftests/dist-zip.xml
deleted file mode 100644
index 0039bfb157..0000000000
--- a/qpid/java/perftests/dist-zip.xml
+++ /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.
--->
-<!-- This is an assembly descriptor that produces a zip containing all the test scripts and
- the all dependencies jar. -->
-<assembly>
- <id>perftests</id>
- <formats>
- <format>zip</format>
- <format>tar.gz</format>
- </formats>
- <includeBaseDirectory>false</includeBaseDirectory>
- <fileSets>
- <fileSet>
- <directory>target</directory>
- <outputDirectory>PerformanceTests</outputDirectory>
- <includes>
- <include>qpid-perftests-${qpid.version}-all-test-deps.jar</include>
- <include>*.sh</include>
- </includes>
- </fileSet>
- <fileSet>
- <directory>etc/scripts</directory>
- <outputDirectory>PerformanceTests</outputDirectory>
- <includes>
- <include>*.sh</include>
- </includes>
- </fileSet>
- </fileSets>
-</assembly>
diff --git a/qpid/java/perftests/etc/jndi/activemq.properties b/qpid/java/perftests/etc/jndi/activemq.properties
deleted file mode 100644
index 281577c4a8..0000000000
--- a/qpid/java/perftests/etc/jndi/activemq.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.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url= tcp://localhost:61616
-
diff --git a/qpid/java/perftests/etc/jndi/failovertest.properties b/qpid/java/perftests/etc/jndi/failovertest.properties
deleted file mode 100644
index b437d12062..0000000000
--- a/qpid/java/perftests/etc/jndi/failovertest.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT 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.local = amqp://guest:guest@clientid/test?brokerlist='tcp://localhost:5001;tcp://localhost:5002'
diff --git a/qpid/java/perftests/etc/jndi/perftests.properties b/qpid/java/perftests/etc/jndi/perftests.properties
deleted file mode 100644
index a2348f4547..0000000000
--- a/qpid/java/perftests/etc/jndi/perftests.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT 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.local = amqp://guest:guest@clientid/test?brokerlist='tcp://localhost:5672'
diff --git a/qpid/java/perftests/etc/jndi/swiftmq.properties b/qpid/java/perftests/etc/jndi/swiftmq.properties
deleted file mode 100644
index 2d037a2513..0000000000
--- a/qpid/java/perftests/etc/jndi/swiftmq.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 = com.swiftmq.jndi.InitialContextFactoryImpl
-java.naming.provider.url=smqp://localhost:4001/timeout=10000
-#connectionfactory.local = amqp://guest:guest@clientid/test?brokerlist='tcp://localhost:5672'
diff --git a/qpid/java/perftests/etc/perftests.log4j b/qpid/java/perftests/etc/perftests.log4j
deleted file mode 100644
index af8c1b0784..0000000000
--- a/qpid/java/perftests/etc/perftests.log4j
+++ /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.
-#
-log4j.rootLogger=${root.logging.level}
-
-
-log4j.logger.org.apache.mina=${amqj.logging.level}
-
-log4j.logger.org.apache.qpid=${amqj.logging.level}, console
-log4j.additivity.org.apache.qpid=false
-
-log4j.logger.org.apache.qpid.requestreply=${amqj.test.logging.level}
-log4j.logger.org.apache.qpid.pingpong=${amqj.test.logging.level}
-log4j.logger.org.apache.qpid.ping=${amqj.test.logging.level}
-log4j.logger.org.apache.qpid.topic=${amqj.test.logging.level}
-
-log4j.logger.org.apache.qpid.junit.extensions=${badger.level}, console
-log4j.additivity.org.apache.qpid.junit.extensions=false
-
-log4j.appender.console=org.apache.log4j.ConsoleAppender
-log4j.appender.console.Threshold=all
-log4j.appender.console.layout=org.apache.log4j.PatternLayout
-
-log4j.appender.console.layout.ConversionPattern=%t %d %p [%c{4}] %m%n
-#log4j.appender.console.layout.ConversionPattern=%t %p [%c] %m%n
-
-log4j.appender.fileApp=org.apache.log4j.FileAppender
-log4j.appender.fileApp.file=${log.dir}/perftests.volumetest.log
-log4j.appender.fileApp.Threshold=info
-log4j.appender.fileApp.append=false
-log4j.appender.fileApp.layout=org.apache.log4j.PatternLayout
diff --git a/qpid/java/perftests/etc/scripts/CTQ-Qpid-1.sh b/qpid/java/perftests/etc/scripts/CTQ-Qpid-1.sh
deleted file mode 100755
index 057dec5c63..0000000000
--- a/qpid/java/perftests/etc/scripts/CTQ-Qpid-1.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-./PQ-Qpid-1.sh $@ & ./PQ-Qpid-1-P.sh $@
diff --git a/qpid/java/perftests/etc/scripts/CTQ-Qpid-2.sh b/qpid/java/perftests/etc/scripts/CTQ-Qpid-2.sh
deleted file mode 100755
index 08057cbf44..0000000000
--- a/qpid/java/perftests/etc/scripts/CTQ-Qpid-2.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-./PQ-Qpid-2.sh $@ & ./PQ-Qpid-2-P.sh $@
diff --git a/qpid/java/perftests/etc/scripts/CTQ-Qpid-3.sh b/qpid/java/perftests/etc/scripts/CTQ-Qpid-3.sh
deleted file mode 100755
index 0bb7e25197..0000000000
--- a/qpid/java/perftests/etc/scripts/CTQ-Qpid-3.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-./PQ-Qpid-3.sh $@ & ./PQ-Qpid-3-P.sh $@
diff --git a/qpid/java/perftests/etc/scripts/CTQ-Qpid-4.sh b/qpid/java/perftests/etc/scripts/CTQ-Qpid-4.sh
deleted file mode 100755
index 278e44d12b..0000000000
--- a/qpid/java/perftests/etc/scripts/CTQ-Qpid-4.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-./PQ-Qpid-4.sh $@ & ./PQ-Qpid-4-P.sh $@
diff --git a/qpid/java/perftests/etc/scripts/CTQ-Qpid-5.sh b/qpid/java/perftests/etc/scripts/CTQ-Qpid-5.sh
deleted file mode 100755
index 5dee0176b2..0000000000
--- a/qpid/java/perftests/etc/scripts/CTQ-Qpid-5.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-./PQ-Qpid-5.sh $@ & ./PQ-Qpid-5-P.sh $@
diff --git a/qpid/java/perftests/etc/scripts/CTQ-Qpid-6.sh b/qpid/java/perftests/etc/scripts/CTQ-Qpid-6.sh
deleted file mode 100755
index b9996da77d..0000000000
--- a/qpid/java/perftests/etc/scripts/CTQ-Qpid-6.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-./PQ-Qpid-6.sh $@ & ./PQ-Qpid-6-P.sh $@
diff --git a/qpid/java/perftests/etc/scripts/Connections.sh b/qpid/java/perftests/etc/scripts/Connections.sh
deleted file mode 100755
index 17e69166bf..0000000000
--- a/qpid/java/perftests/etc/scripts/Connections.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/sh
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-find . -regex '\.\/[P|T].CT-.*\.sh' -exec {} -o results-Connections/ --csv \;
diff --git a/qpid/java/perftests/etc/scripts/JobQueue.sh b/qpid/java/perftests/etc/scripts/JobQueue.sh
deleted file mode 100755
index 312037f5ab..0000000000
--- a/qpid/java/perftests/etc/scripts/JobQueue.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-find . -regex '.*BL-.*\.sh' -exec {} -o results-JobQueue/ --csv \;
diff --git a/qpid/java/perftests/etc/scripts/Latency.sh b/qpid/java/perftests/etc/scripts/Latency.sh
deleted file mode 100755
index f70131de38..0000000000
--- a/qpid/java/perftests/etc/scripts/Latency.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-find . -regex '\.\/[P|T].CL-.*\.sh' -exec {} -o results-Latency/ --csv \;
diff --git a/qpid/java/perftests/etc/scripts/MessageSize.sh b/qpid/java/perftests/etc/scripts/MessageSize.sh
deleted file mode 100755
index bb10822257..0000000000
--- a/qpid/java/perftests/etc/scripts/MessageSize.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/sh
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-find . -regex '.*M-Qpid-.*\.sh' -exec {} -o results-messageSize/ --csv $* \;
diff --git a/qpid/java/perftests/etc/scripts/PT-Qpid-13.sh b/qpid/java/perftests/etc/scripts/PT-Qpid-13.sh
deleted file mode 100755
index df35f718b9..0000000000
--- a/qpid/java/perftests/etc/scripts/PT-Qpid-13.sh
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/bin/bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-# Parse arguements taking all - prefixed args as JAVA_OPTS
-for arg in "$@"; do
- if [[ $arg == -java:* ]]; then
- JAVA_OPTS="${JAVA_OPTS}-`echo $arg|cut -d ':' -f 2` "
- else
- ARGS="${ARGS}$arg "
- fi
-done
-
-echo "Starting 6 parallel tests"
-java -Xms256m -Dlog4j.configuration=perftests.log4j -Xmx3072m -Dbadger.level=warn -Damqj.test.logging.level=info -Damqj.logging.level=warn ${JAVA_OPTS} -cp qpid-perftests-1.0-incubating-M2-SNAPSHOT-all-test-deps.jar org.apache.qpid.junit.extensions.TKTestRunner -n PT-Qpid-13.1 -s [250] -c[200] -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf pubsub=true messageSize=256 destinationName=newd1 uniqueDests=true batchSize=250 transacted=true commitBatchSize=50 -o $QPID_WORK/results ${ARGS} &
-
-java -Xms256m -Dlog4j.configuration=perftests.log4j -Xmx3072m -Dbadger.level=warn -Damqj.test.logging.level=info -Damqj.logging.level=warn ${JAVA_OPTS} -cp qpid-perftests-1.0-incubating-M2-SNAPSHOT-all-test-deps.jar org.apache.qpid.junit.extensions.TKTestRunner -n PT-Qpid-13.2 -s [250] -c[200] -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf pubsub=true messageSize=256 destinationName=newd2 uniqueDests=true batchSize=250 transacted=true commitBatchSize=50 -o $QPID_WORK/results ${ARGS} &
-
-java -Xms256m -Dlog4j.configuration=perftests.log4j -Xmx3072m -Dbadger.level=warn -Damqj.test.logging.level=info -Damqj.logging.level=warn ${JAVA_OPTS} -cp qpid-perftests-1.0-incubating-M2-SNAPSHOT-all-test-deps.jar org.apache.qpid.junit.extensions.TKTestRunner -n PT-Qpid-13.3 -s [250] -c[200] -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf pubsub=true messageSize=256 destinationName=newd3 uniqueDests=true batchSize=250 transacted=true commitBatchSize=50 -o $QPID_WORK/results ${ARGS} &
-
-java -Xms256m -Dlog4j.configuration=perftests.log4j -Xmx3072m -Dbadger.level=warn -Damqj.test.logging.level=info -Damqj.logging.level=warn ${JAVA_OPTS} -cp qpid-perftests-1.0-incubating-M2-SNAPSHOT-all-test-deps.jar org.apache.qpid.junit.extensions.TKTestRunner -n PT-Qpid-13.4 -s [250] -c[200] -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf pubsub=true messageSize=256 destinatioNname=newd4 uniqueDests=true batchSize=250 transacted=true commitBatchSize=50 -o $QPID_WORK/results ${ARGS} &
-
-java -Xms256m -Dlog4j.configuration=perftests.log4j -Xmx3072m -Dbadger.level=warn -Damqj.test.logging.level=info -Damqj.logging.level=warn ${JAVA_OPTS} -cp qpid-perftests-1.0-incubating-M2-SNAPSHOT-all-test-deps.jar org.apache.qpid.junit.extensions.TKTestRunner -n PT-Qpid-13.5 -s [250] -c[100] -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf pubsub=true messageSize=256 destinationName=newd5 uniqueDests=true batchSize=250 transacted=true commitBatchSize=50 -o $QPID_WORK/results ${ARGS} &
-
-java -Xms256m -Dlog4j.configuration=perftests.log4j -Xmx3072m -Dbadger.level=warn -Damqj.test.logging.level=info -Damqj.logging.level=warn ${JAVA_OPTS} -cp qpid-perftests-1.0-incubating-M2-SNAPSHOT-all-test-deps.jar org.apache.qpid.junit.extensions.TKTestRunner -n PT-Qpid-13.6 -s [250] -c[100] -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf pubsub=true messageSize=256 destinationName=newd6 uniqueDests=true batchSize=250 transacted=true commitBatchSize=50 -o $QPID_WORK/results ${ARGS}
-
diff --git a/qpid/java/perftests/etc/scripts/PT-Qpid-14.sh b/qpid/java/perftests/etc/scripts/PT-Qpid-14.sh
deleted file mode 100755
index ff5b8a76f9..0000000000
--- a/qpid/java/perftests/etc/scripts/PT-Qpid-14.sh
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/bin/bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-# Parse arguements taking all - prefixed args as JAVA_OPTS
-for arg in "$@"; do
- if [[ $arg == -java:* ]]; then
- JAVA_OPTS="${JAVA_OPTS}-`echo $arg|cut -d ':' -f 2` "
- else
- ARGS="${ARGS}$arg "
- fi
-done
-echo "Starting 6 parallel tests"
-
-java -Xms256m -Dlog4j.configuration=perftests.log4j -Xmx3072m -Dbadger.level=warn -Damqj.test.logging.level=info -Damqj.logging.level=warn ${JAVA_OPTS} -cp qpid-perftests-1.0-incubating-M2-SNAPSHOT-all-test-deps.jar org.apache.qpid.junit.extensions.TKTestRunner -n PT-Qpid-14 -s [250] -c[200] -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf pubsub=true messageSize=256 destinationName=ping1 batchSize=250 -o $QPID_WORK/results ${ARGS} &
-
-java -Xms256m -Dlog4j.configuration=perftests.log4j -Xmx3072m -Dbadger.level=warn -Damqj.test.logging.level=info -Damqj.logging.level=warn ${JAVA_OPTS} -cp qpid-perftests-1.0-incubating-M2-SNAPSHOT-all-test-deps.jar org.apache.qpid.junit.extensions.TKTestRunner -n PT-Qpid-14 -s [250] -c[200] -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf pubsub=true messageSize=256 destinationName=ping2 batchSize=250 -o $QPID_WORK/results ${ARGS} &
-
-java -Xms256m -Dlog4j.configuration=perftests.log4j -Xmx3072m -Dbadger.level=warn -Damqj.test.logging.level=info -Damqj.logging.level=warn ${JAVA_OPTS} -cp qpid-perftests-1.0-incubating-M2-SNAPSHOT-all-test-deps.jar org.apache.qpid.junit.extensions.TKTestRunner -n PT-Qpid-14 -s [250] -c[200] -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf pubsub=true messageSize=256 destinationName=ping3 batchSize=250 -o $QPID_WORK/results ${ARGS} &
-
-java -Xms256m -Dlog4j.configuration=perftests.log4j -Xmx3072m -Dbadger.level=warn -Damqj.test.logging.level=info -Damqj.logging.level=warn ${JAVA_OPTS} -cp qpid-perftests-1.0-incubating-M2-SNAPSHOT-all-test-deps.jar org.apache.qpid.junit.extensions.TKTestRunner -n PT-Qpid-14 -s [250] -c[200] -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf pubsub=true messageSize=256destinationname=ping4 batchSize=250 -o $QPID_WORK/results ${ARGS} &
-
-java -Xms256m -Dlog4j.configuration=perftests.log4j -Xmx3072m -Dbadger.level=warn -Damqj.test.logging.level=info -Damqj.logging.level=warn ${JAVA_OPTS} -cp qpid-perftests-1.0-incubating-M2-SNAPSHOT-all-test-deps.jar org.apache.qpid.junit.extensions.TKTestRunner -n PT-Qpid-14 -s [250] -c[100] -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf pubsub=true messageSize=256 destinationName=ping5 batchSize=250 -o $QPID_WORK/results ${ARGS} &
-
-java -Xms256m -Dlog4j.configuration=perftests.log4j -Xmx3072m -Dbadger.level=warn -Damqj.test.logging.level=info -Damqj.logging.level=warn ${JAVA_OPTS} -cp qpid-perftests-1.0-incubating-M2-SNAPSHOT-all-test-deps.jar org.apache.qpid.junit.extensions.TKTestRunner -n PT-Qpid-14 -s [250] -c[100] -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf pubsub=true messageSize=256 destinationName=ping6 batchSize=250 -o $QPID_WORK/results ${ARGS}
diff --git a/qpid/java/perftests/etc/scripts/Reliability.sh b/qpid/java/perftests/etc/scripts/Reliability.sh
deleted file mode 100755
index 9e5e508743..0000000000
--- a/qpid/java/perftests/etc/scripts/Reliability.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-find . -regex '.*R-Qpid-0[1-8].*\.sh' -exec {} -o results-Reliability/ --csv \;
diff --git a/qpid/java/perftests/etc/scripts/RunAll.sh b/qpid/java/perftests/etc/scripts/RunAll.sh
deleted file mode 100755
index 8b0d8b6e7c..0000000000
--- a/qpid/java/perftests/etc/scripts/RunAll.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/sh
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-./RunCore.sh
-./Connections.sh
-./JobQueue.sh
-./MessageSize.sh
diff --git a/qpid/java/perftests/etc/scripts/RunCore.sh b/qpid/java/perftests/etc/scripts/RunCore.sh
deleted file mode 100755
index fcc45aacf0..0000000000
--- a/qpid/java/perftests/etc/scripts/RunCore.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/sh
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-./Throughput.sh
-./Latency.sh
-./Reliability.sh
diff --git a/qpid/java/perftests/etc/scripts/Test-ActiveMQ.sh b/qpid/java/perftests/etc/scripts/Test-ActiveMQ.sh
deleted file mode 100644
index 27e0411870..0000000000
--- a/qpid/java/perftests/etc/scripts/Test-ActiveMQ.sh
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-# Parse arguements taking all - prefixed args as JAVA_OPTS
-for arg in "$@"; do
- if [[ $arg == -java:* ]]; then
- JAVA_OPTS="${JAVA_OPTS}-`echo $arg|cut -d ':' -f 2` "
- else
- ARGS="${ARGS}$arg "
- fi
-done
-
-java -Xms256m -Dlog4j.configuration=perftests.log4j -Xmx1024m -Dbadger.level=warn -Damqj.test.logging.level=info -Damqj.logging.level=warn ${JAVA_OPTS} -cp "qpid-perftests-1.0-incubating-M2.1-SNAPSHOT.jar;activemq-jars/apache-activemq-4.1.1.jar" org.apache.qpid.junit.extensions.TKTestRunner -n Test-ActiveMQ -s[1] -r 1 -t testAsyncPingOk -o . org.apache.qpid.ping.PingAsyncTestPerf properties=activemq.properties factoryName=ConnectionFactory ${ARGS}
-
-# queueNamePostfix=@router1 overrideClientId=true
diff --git a/qpid/java/perftests/etc/scripts/Test-SwiftMQ.sh b/qpid/java/perftests/etc/scripts/Test-SwiftMQ.sh
deleted file mode 100644
index 1f0b38ccc2..0000000000
--- a/qpid/java/perftests/etc/scripts/Test-SwiftMQ.sh
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-# Parse arguements taking all - prefixed args as JAVA_OPTS
-for arg in "$@"; do
- if [[ $arg == -java:* ]]; then
- JAVA_OPTS="${JAVA_OPTS}-`echo $arg|cut -d ':' -f 2` "
- else
- ARGS="${ARGS}$arg "
- fi
-done
-
-java -Xms256m -Dlog4j.configuration=perftests.log4j -Xmx1024m -Dbadger.level=warn -Damqj.test.logging.level=info -Damqj.logging.level=warn ${JAVA_OPTS} -cp "qpid-perftests-1.0-incubating-M2.1-SNAPSHOT.jar;swiftmqjars/swiftmq.jar" org.apache.qpid.junit.extensions.TKTestRunner -n Test-SwiftMQ -s[1] -r 1 -t testAsyncPingOk -o . org.apache.qpid.ping.PingAsyncTestPerf properties=swiftmq.properties factoryName=ConnectionFactory queueNamePostfix=@router1 overrideClientId=true ${ARGS}
diff --git a/qpid/java/perftests/etc/scripts/Throughput.sh b/qpid/java/perftests/etc/scripts/Throughput.sh
deleted file mode 100755
index d08ad248a5..0000000000
--- a/qpid/java/perftests/etc/scripts/Throughput.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/sh
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-find . -regex '.*[P|T].BT-.*\.sh' -exec {} -o results-throughput/ --csv $* \;
diff --git a/qpid/java/perftests/etc/scripts/drainBroker.sh b/qpid/java/perftests/etc/scripts/drainBroker.sh
deleted file mode 100755
index eea7209f03..0000000000
--- a/qpid/java/perftests/etc/scripts/drainBroker.sh
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/bin/bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-if [ -z "$QPID_HOME" ]; then
- export QPID_HOME=$(dirname $(dirname $(dirname $(readlink -f $0))))
- export PATH=${PATH}:${QPID_HOME}/bin
-fi
-
-# Parse arguements taking all - prefixed args as JAVA_OPTS
-for arg in "$@"; do
- if [[ $arg == -java:* ]]; then
- JAVA_OPTS="${JAVA_OPTS}-`echo $arg|cut -d ':' -f 2` "
- else
- ARGS="${ARGS}$arg "
- fi
-done
-
-# Set classpath to include Qpid jar with all required jars in manifest
-QPID_LIBS=$QPID_HOME/lib/qpid-all.jar
-
-# Set other variables used by the qpid-run script before calling
-export JAVA=java JAVA_VM=-server JAVA_MEM=-Xmx1024m QPID_CLASSPATH=$QPID_LIBS
-
-. qpid-run -Xms256m -Dlog4j.configuration=file://${QPID_HOME}/etc/perftests.log4j -Dbadger.level=warn -Damqj.test.logging.level=info -Damqj.logging.level=warn org.apache.qpid.junit.extensions.TKTestRunner -n PQBT-TX-Qpid-01 -s[1000] -c[1] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=false uniqueDests=true numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=1 batchSize=1000 messageSize=256 destinationCount=1 rate=0 maxPending=0 consumeOnly=true consumeOnly=true${ARGS}
diff --git a/qpid/java/perftests/etc/scripts/extractResults.sh b/qpid/java/perftests/etc/scripts/extractResults.sh
deleted file mode 100755
index 4fc74059af..0000000000
--- a/qpid/java/perftests/etc/scripts/extractResults.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/bash +x
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-#
-
-#
-# Process a given directory (defaults to '.') and provide a list of the tests run so
-# identification of any failures can be seen.
-#
-
-if [ $# == 0 ] ; then
- dir=.
-else
- dir=$1
-fi
-
-grep 'Total Tests:' $dir/*Qpid* | sed -e 's/^.*\/\([A-Z\-]*-Qpid-[0-9]*\).*Total Tests:, \([0-9.]*\).*Total Passed:, \([0-9.]*\).*Total Failed:, \([0-9.]*\).*Total Error:, \([0-9.]*\).*$/\1, Total:\t\2,\tPassed:\t\3,\tFailed:\t\4,\tError:\t\5/'
diff --git a/qpid/java/perftests/etc/scripts/extractThroughputResults.sh b/qpid/java/perftests/etc/scripts/extractThroughputResults.sh
deleted file mode 100755
index 14236c68bc..0000000000
--- a/qpid/java/perftests/etc/scripts/extractThroughputResults.sh
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/bin/bash +x
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-#
-
-#
-# Process a given directory (defaults to '.') and provides the throughput results as
-# reported by the tests.
-#
-# if a second argument of -n is provided then it will only list the number output for
-# easy copy/paste
-#
-
-if [ $# == 0 ] ; then
- dir=.
-else
- dir=$1
-fi
-
-numeric=0
-if [ "$dir" == "-n" ] ; then
- numeric=1
- dir=.
-fi
-
-if [ "$2" == "-n" ] ; then
- numeric=1
-fi
-
-if [ $numeric == 1 ] ; then
- grep 'Total Tests:' $dir/*Qpid* | sed -e 's/^.*\/\([A-Z]*-[A-Z][A-Z]-Qpid-01\).*Size Throughput:, \([0-9.]*\).*$/\1, \2/' | sed -e 's/\.\([0-9][0-9][0-9]\)/\1\./' | sed -e 's/, 0/, /' | awk '{print $2}'
-else
- grep 'Total Tests:' $dir/*Qpid* | sed -e 's/^.*\/\([A-Z]*-[A-Z][A-Z]-Qpid-01\).*Size Throughput:, \([0-9.]*\).*$/\1, \2/' | sed -e 's/\.\([0-9][0-9][0-9]\)/\1\./' | sed -e 's/, 0/, /'
-fi
diff --git a/qpid/java/perftests/etc/scripts/fillBroker.sh b/qpid/java/perftests/etc/scripts/fillBroker.sh
deleted file mode 100755
index 5b7de6f999..0000000000
--- a/qpid/java/perftests/etc/scripts/fillBroker.sh
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/bin/bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-if [ -z "$QPID_HOME" ]; then
- export QPID_HOME=$(dirname $(dirname $(dirname $(readlink -f $0))))
- export PATH=${PATH}:${QPID_HOME}/bin
-fi
-
-# Parse arguements taking all - prefixed args as JAVA_OPTS
-for arg in "$@"; do
- if [[ $arg == -java:* ]]; then
- JAVA_OPTS="${JAVA_OPTS}-`echo $arg|cut -d ':' -f 2` "
- else
- ARGS="${ARGS}$arg "
- fi
-done
-
-# Set classpath to include Qpid jar with all required jars in manifest
-QPID_LIBS=$QPID_HOME/lib/qpid-all.jar
-
-# Set other variables used by the qpid-run script before calling
-export JAVA=java JAVA_VM=-server JAVA_MEM=-Xmx1024m QPID_CLASSPATH=$QPID_LIBS
-
-. qpid-run -Xms256m -Dlog4j.configuration=file://${QPID_HOME}/etc/perftests.log4j -Dbadger.level=warn -Damqj.test.logging.level=info -Damqj.logging.level=warn org.apache.qpid.junit.extensions.TKTestRunner -n PQBT-TX-Qpid-01 -s[1000] -c[1] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=false uniqueDests=true numConsumers=0 transacted=true consTransacted=true consAckMode=0 commitBatchSize=1 batchSize=1000 messageSize=256 destinationCount=1 rate=0 maxPending=0 ${ARGS}
diff --git a/qpid/java/perftests/etc/scripts/sendAndWaitClient.sh b/qpid/java/perftests/etc/scripts/sendAndWaitClient.sh
deleted file mode 100755
index af4b788658..0000000000
--- a/qpid/java/perftests/etc/scripts/sendAndWaitClient.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-#
-
-$JAVA_HOME/bin/java -Dlog4j.configuration=backup-log4j.xml -cp qpid-perftests-1.0-incubating-M2-SNAPSHOT-all-test-deps.jar org.apache.qpid.ping.PingSendOnlyClient messageSize=512
diff --git a/qpid/java/perftests/etc/scripts/testWithPreFill.sh b/qpid/java/perftests/etc/scripts/testWithPreFill.sh
deleted file mode 100755
index 721ecf6ecc..0000000000
--- a/qpid/java/perftests/etc/scripts/testWithPreFill.sh
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/bin/bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-if [ -z "$QPID_HOME" ]; then
- export QPID_HOME=$(dirname $(dirname $(dirname $(readlink -f $0))))
- export PATH=${PATH}:${QPID_HOME}/bin
-fi
-
-# Parse arguements taking all - prefixed args as JAVA_OPTS
-for arg in "$@"; do
- if [[ $arg == -java:* ]]; then
- JAVA_OPTS="${JAVA_OPTS}-`echo $arg|cut -d ':' -f 2` "
- else
- ARGS="${ARGS}$arg "
- fi
-done
-
-# Set classpath to include Qpid jar with all required jars in manifest
-QPID_LIBS=$QPID_HOME/lib/qpid-all.jar
-
-# Set other variables used by the qpid-run script before calling
-export JAVA=java JAVA_VM=-server JAVA_MEM=-Xmx1024m QPID_CLASSPATH=$QPID_LIBS
-
-. qpid-run -Xms256m -Dlog4j.configuration=file://${QPID_HOME}/etc/perftests.log4j -Dbadger.level=warn -Damqj.test.logging.level=info -Damqj.logging.level=warn org.apache.qpid.junit.extensions.TKTestRunner -n PQBT-TX-Qpid-01 -s[1000] -c[1] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=false uniqueDests=true numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=1 batchSize=1000 messageSize=256 destinationCount=1 rate=0 maxPending=0 preFill=1000 delayBeforeConsume=1000 ${ARGS}
diff --git a/qpid/java/perftests/generate-scripts b/qpid/java/perftests/generate-scripts
deleted file mode 100644
index 3d12cc13c3..0000000000
--- a/qpid/java/perftests/generate-scripts
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/usr/bin/env python
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-import os, sys, mllib
-
-template = """#!/bin/bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-if [ -z "$QPID_HOME" ]; then
- export QPID_HOME=$(dirname $(dirname $(dirname $(readlink -f $0))))
- export PATH=${PATH}:${QPID_HOME}/bin
-fi
-
-# Parse arguements taking all - prefixed args as JAVA_OPTS
-for arg in "$@"; do
- if [[ $arg == -java:* ]]; then
- JAVA_OPTS="${JAVA_OPTS}-`echo $arg|cut -d ':' -f 2` "
- else
- ARGS="${ARGS}$arg "
- fi
-done
-
-# Set classpath to include Qpid jar with all required jars in manifest
-QPID_LIBS=$QPID_HOME/lib/qpid-all.jar
-
-# Set other variables used by the qpid-run script before calling
-export JAVA=java \
- JAVA_VM=-server \
- JAVA_MEM=-Xmx1024m \
- QPID_CLASSPATH=$QPID_LIBS
-
-. qpid-run -Xms256m -Dlog4j.configuration=file://${QPID_HOME}/etc/perftests.log4j -Dbadger.level=warn -Damqj.test.logging.level=info -Damqj.logging.level=warn org.apache.qpid.junit.extensions.TKTestRunner %s ${ARGS}
-"""
-
-doc = mllib.xml_parse(sys.argv[1])
-dir = sys.argv[2]
-for s in doc.query["scripts/script"]:
- file = open(os.path.join(dir, "%s.sh" % s["@name"]), "w")
- file.write(template % s.text())
- file.close()
diff --git a/qpid/java/perftests/jar-with-dependencies.xml b/qpid/java/perftests/jar-with-dependencies.xml
deleted file mode 100644
index bbbbd3788e..0000000000
--- a/qpid/java/perftests/jar-with-dependencies.xml
+++ /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.
--->
-<!-- This is an assembly descriptor that produces a distribution that contains all the
- dependencies, with a manifest only jar that references them, required to run the
- tests of a maven project.
--->
-<assembly>
- <id>all-test-deps</id>
- <formats>
- <format>tar.gz</format>
- <format>zip</format>
- </formats>
- <includeBaseDirectory>false</includeBaseDirectory>
- <dependencySets>
- <dependencySet>
- <outputDirectory>/</outputDirectory>
- <unpack>false</unpack>
- <scope>test</scope>
- </dependencySet>
- </dependencySets>
- <fileSets>
- <fileSet>
- <directory>target/classes</directory>
- <outputDirectory></outputDirectory>
- </fileSet>
- <fileSet>
- <directory>target/test-classes</directory>
- <outputDirectory></outputDirectory>
- </fileSet>
-
- <!-- Include all the test scripts, both generated and hand-written. -->
- <fileSet>
- <directory>target</directory>
- <outputDirectory></outputDirectory>
- <includes>
- <include>*.sh</include>
- </includes>
- </fileSet>
- <fileSet>
- <directory>etc/scripts</directory>
- <outputDirectory></outputDirectory>
- <includes>
- <include>*.sh</include>
- </includes>
- </fileSet>
-
- <!-- Include all jndi configurations needed to run the tests. -->
- <fileSet>
- <directory>etc/jndi</directory>
- <outputDirectory></outputDirectory>
- <includes>
- <include>*.properties</include>
- </includes>
- </fileSet>
-
- <!-- Include the build artifact. -->
- <fileSet>
- <directory>target</directory>
- <outputDirectory></outputDirectory>
- <includes>
- <include>qpid-perftests-1.0-incubating-M2-SNAPSHOT.jar</include>
- </includes>
- </fileSet>
-
- <!-- Include the manifest with classpath jar. -->
- <fileSet>
- <directory>target</directory>
- <outputDirectory></outputDirectory>
- <includes>
- <include>qpid-perftests-${qpid.version}.jar</include>
- </includes>
- </fileSet>
-
- </fileSets>
-</assembly>
diff --git a/qpid/java/perftests/scripts.xml b/qpid/java/perftests/scripts.xml
deleted file mode 100644
index 9a5163c598..0000000000
--- a/qpid/java/perftests/scripts.xml
+++ /dev/null
@@ -1,328 +0,0 @@
-<!--
- -
- - Licensed to the Apache Software Foundation (ASF) under one
- - or more contributor license agreements. See the NOTICE file
- - distributed with this work for additional information
- - regarding copyright ownership. The ASF licenses this file
- - to you under the Apache License, Version 2.0 (the
- - "License"); you may not use this file except in compliance
- - with the License. You may obtain a copy of the License at
- -
- - http://www.apache.org/licenses/LICENSE-2.0
- -
- - Unless required by applicable law or agreed to in writing,
- - software distributed under the License is distributed on an
- - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- - KIND, either express or implied. See the License for the
- - specific language governing permissions and limitations
- - under the License.
- -
- -->
-
-<scripts>
- <!-- Single pings. These can be scaled up by overriding the parameters when calling the test script. -->
- <script name="Ping-Once">-n Ping-Once -s[1] -r 1 -t testPingOk -o . org.apache.qpid.ping.PingTestPerf</script>
- <script name="Ping-Once-Async">-n Ping-Once-Async -s[1] -r 1 -t testAsyncPingOk -o . org.apache.qpid.ping.PingAsyncTestPerf</script>
- <script name="Ping-Latency">-n Ping-Latency -s[1000] -d10S -t testPingLatency -o . org.apache.qpid.ping.PingLatencyTestPerf rate=100 batchSize=100</script>
-
- <!-- More example Tests. These are examples to exercise all the features of the test harness. Can scale up with option overrides. -->
- <script name="Ping-Tx">-n Ping-Tx -s[100] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf transacted=true</script>
- <script name="Ping-Size">-n Ping-Size -s[100] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf messageSize=512</script>
- <script name="Ping-Concurrent">-n Ping-Concurrent -s[100] -c [4] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf</script>
- <script name="Ping-Many-Queues">-n Ping-Many-Queues -s[100] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf destinationCount=4</script>
- <script name="Ping-Duration">-n Ping-Duration -s[100] -d10S -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf</script>
- <script name="Ping-Rate">-n Ping-Rate -s[100] -d10S -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf rate=500</script>
- <script name="Ping-PubSub">-n Ping-PubSub -s[100] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf pubsub=true</script>
- <script name="Ping-Many-Topics">-n Ping-Many-Topics -s[100] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf pubsub=true destinationCount=4</script>
- <script name="Ping-Persistent">-n Ping-Persistent -s[100] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true</script>
- <script name="Ping-Batch-Logging">-n Ping-Batch-Logging -s[100] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf batchSize=10</script>
- <script name="Ping-Failover-Before-Send">-n Ping-Failover-Before-Send -s[100] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf commitBatchSize=10 failBeforeSend=true</script>
- <script name="Ping-Failover-After-Send">-n Ping-Failover-After-Send -s[100] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf commitBatchSize=10 failAfterSend=true</script>
- <script name="Ping-Failover-Before-Commit">-n Ping-Failover-Before-Commit -s[100] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf commitBatchSize=10 failBeforeCommit=true</script>
- <script name="Ping-Failover-After-Commit">-n Ping-Failover-After-Commit -s[100] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf commitBatchSize=10 failAfterCommit=true</script>
-
- <!--
- ***** If editing below, please use a non line wrapping mode and keep in columns, makes it easier to check for consistent
- ***** parameter setting accross all of the tests.
- -->
-
- <!--
- Reliability tests. The longer these tests can be run, the better.
- Tests 01 and 02 run for a short time. Use these to get an idea of the expected throughput.
- Tests 03 to 08 test all ack modes, transient/persistent, p2p/pubsub. There are 24 tests in total running for 1 hour each.
- This can be shortened or lengthened for the desired burn-in test time.
- -->
- <script name="TQR-Qpid-01">-n TQR-Qpid-01 -d1M -s[1000] -c[16] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=false uniqueDests=true numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=256 destinationCount=1 rate=0 maxPending=500000 </script>
- <script name="TQR-Qpid-02">-n TQR-Qpid-02 -d1M -s[1000] -c[16] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=false uniqueDests=true numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=256 destinationCount=1 rate=0 maxPending=500000 </script>
- <script name="TTR-Qpid-01">-n TTR-Qpid-01 -d1M -s[100] -c[2] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=8 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=256 destinationCount=1 rate=0 maxPending=500000 </script>
- <script name="TTR-Qpid-02">-n TTR-Qpid-02 -d1M -s[100] -c[2] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=8 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=256 destinationCount=1 rate=0 maxPending=500000 </script>
- <script name="PQR-Qpid-01">-n PQR-Qpid-01 -d1M -s[1000] -c[16] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=false uniqueDests=true numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=256 destinationCount=1 rate=0 maxPending=500000 </script>
- <script name="PQR-Qpid-02">-n PQR-Qpid-02 -d1M -s[1000] -c[16] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=false uniqueDests=true numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=256 destinationCount=1 rate=0 maxPending=500000 </script>
- <script name="PTR-Qpid-01">-n PTR-Qpid-01 -d1M -s[100] -c[2] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=8 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=256 destinationCount=1 rate=0 maxPending=500000 </script>
- <script name="PTR-Qpid-02">-n PTR-Qpid-02 -d1M -s[100] -c[2] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=8 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=256 destinationCount=1 rate=0 maxPending=500000 </script>
-
- <script name="TQR-Qpid-03-TX">-n TQR-Qpid-03 -d1H -s[10000] -c[16] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=false uniqueDests=true numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=100000 messageSize=256 destinationCount=1 rate=0 maxPending=500000 </script>
- <script name="TQR-Qpid-04-AUTOACK">-n TQR-Qpid-04 -d1H -s[10000] -c[16] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=false uniqueDests=true numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=100000 messageSize=256 destinationCount=1 rate=0 maxPending=500000 </script>
- <script name="TQR-Qpid-05-CLIENTACK">-n TQR-Qpid-05 -d1H -s[10000] -c[16] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=false uniqueDests=true numConsumers=1 transacted=false consTransacted=false consAckMode=2 commitBatchSize=10 batchSize=100000 messageSize=256 destinationCount=1 rate=0 maxPending=500000 </script>
- <script name="TQR-Qpid-06-DUPSOKACK">-n TQR-Qpid-06 -d1H -s[10000] -c[16] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=false uniqueDests=true numConsumers=1 transacted=false consTransacted=false consAckMode=3 commitBatchSize=10 batchSize=100000 messageSize=256 destinationCount=1 rate=0 maxPending=500000 </script>
- <script name="TQR-Qpid-07-NOACK">-n TQR-Qpid-07 -d1H -s[10000] -c[16] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=false uniqueDests=true numConsumers=1 transacted=false consTransacted=false consAckMode=257 commitBatchSize=10 batchSize=100000 messageSize=256 destinationCount=1 rate=0 maxPending=500000 </script>
- <script name="TQR-Qpid-08-PREACK">-n TQR-Qpid-08 -d1H -s[10000] -c[16] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=false uniqueDests=true numConsumers=1 transacted=false consTransacted=false consAckMode=258 commitBatchSize=10 batchSize=100000 messageSize=256 destinationCount=1 rate=0 maxPending=500000 </script>
-
- <script name="TTR-Qpid-03-TX">-n TTR-Qpid-03 -d1H -s[1000] -c[2] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=8 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=100000 messageSize=256 destinationCount=1 rate=0 maxPending=500000 </script>
- <script name="TTR-Qpid-04-AUTOACK">-n TTR-Qpid-04 -d1H -s[1000] -c[2] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=8 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=100000 messageSize=256 destinationCount=1 rate=0 maxPending=500000 </script>
- <script name="TTR-Qpid-05-CLIENTACK">-n TTR-Qpid-05 -d1H -s[1000] -c[2] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=8 transacted=false consTransacted=false consAckMode=2 commitBatchSize=10 batchSize=100000 messageSize=256 destinationCount=1 rate=0 maxPending=500000 </script>
- <script name="TTR-Qpid-06-DUPSOKACK">-n TTR-Qpid-06 -d1H -s[1000] -c[2] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=8 transacted=false consTransacted=false consAckMode=3 commitBatchSize=10 batchSize=100000 messageSize=256 destinationCount=1 rate=0 maxPending=500000 </script>
- <script name="TTR-Qpid-07-NOACK">-n TTR-Qpid-07 -d1H -s[1000] -c[2] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=8 transacted=false consTransacted=false consAckMode=257 commitBatchSize=10 batchSize=100000 messageSize=256 destinationCount=1 rate=0 maxPending=500000 </script>
- <script name="TTR-Qpid-08-PREACK">-n TTR-Qpid-08 -d1H -s[1000] -c[2] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=8 transacted=false consTransacted=false consAckMode=258 commitBatchSize=10 batchSize=100000 messageSize=256 destinationCount=1 rate=0 maxPending=500000 </script>
-
- <script name="PQR-Qpid-03-TX">-n PQR-Qpid-03 -d1H -s[1000] -c[16] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=false uniqueDests=true numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=100000 messageSize=256 destinationCount=1 rate=0 maxPending=500000 </script>
- <script name="PQR-Qpid-04-AUTOACK">-n PQR-Qpid-04 -d1H -s[1000] -c[16] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=false uniqueDests=true numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=100000 messageSize=256 destinationCount=1 rate=0 maxPending=500000 </script>
- <script name="PQR-Qpid-05-CLIENTACK">-n PQR-Qpid-05 -d1H -s[1000] -c[16] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=false uniqueDests=true numConsumers=1 transacted=false consTransacted=false consAckMode=2 commitBatchSize=10 batchSize=100000 messageSize=256 destinationCount=1 rate=0 maxPending=500000 </script>
- <script name="PQR-Qpid-06-DUPSOKACK">-n PQR-Qpid-06 -d1H -s[1000] -c[16] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=false uniqueDests=true numConsumers=1 transacted=false consTransacted=false consAckMode=3 commitBatchSize=10 batchSize=100000 messageSize=256 destinationCount=1 rate=0 maxPending=500000 </script>
- <script name="PQR-Qpid-07-NOACK">-n PQR-Qpid-07 -d1H -s[1000] -c[16] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=false uniqueDests=true numConsumers=1 transacted=false consTransacted=false consAckMode=257 commitBatchSize=10 batchSize=100000 messageSize=256 destinationCount=1 rate=0 maxPending=500000 </script>
- <script name="PQR-Qpid-08-PREACK">-n PQR-Qpid-08 -d1H -s[1000] -c[16] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=false uniqueDests=true numConsumers=1 transacted=false consTransacted=false consAckMode=258 commitBatchSize=10 batchSize=100000 messageSize=256 destinationCount=1 rate=0 maxPending=500000 </script>
-
- <script name="PTR-Qpid-03-TX">-n PTR-Qpid-03 -d1H -s[100] -c[2] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=8 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=100000 messageSize=256 destinationCount=1 rate=0 maxPending=500000 </script>
- <script name="PTR-Qpid-04-AUTOACK">-n PTR-Qpid-04 -d1H -s[100] -c[2] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=8 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=100000 messageSize=256 destinationCount=1 rate=0 maxPending=500000 </script>
- <script name="PTR-Qpid-05-CLIENTACK">-n PTR-Qpid-05 -d1H -s[100] -c[2] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=8 transacted=false consTransacted=false consAckMode=2 commitBatchSize=10 batchSize=100000 messageSize=256 destinationCount=1 rate=0 maxPending=500000 </script>
- <script name="PTR-Qpid-06-DUPSOKACK">-n PTR-Qpid-06 -d1H -s[100] -c[2] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=8 transacted=false consTransacted=false consAckMode=3 commitBatchSize=10 batchSize=100000 messageSize=256 destinationCount=1 rate=0 maxPending=500000 </script>
- <script name="PTR-Qpid-07-NOACK">-n PTR-Qpid-07 -d1H -s[100] -c[2] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=8 transacted=false consTransacted=false consAckMode=257 commitBatchSize=10 batchSize=100000 messageSize=256 destinationCount=1 rate=0 maxPending=500000 </script>
- <script name="PTR-Qpid-08-PREACK">-n PTR-Qpid-08 -d1H -s[100] -c[2] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=8 transacted=false consTransacted=false consAckMode=258 commitBatchSize=10 batchSize=100000 messageSize=256 destinationCount=1 rate=0 maxPending=500000 </script>
-
- <!-- Performance Tests. -->
-
- <!-- Transient, P2P Tests -->
- <!-- Concurrency Tests : What are the effects of increasing consumers from 1...30 consumers -->
- <script name="TQCT-Qpid-01">-n TQCT-Qpid-01 -d1M -s[1000] -c[1:30]:samples=30 -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=false uniqueDests=true numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=256 destinationCount=1 rate=2000 maxPending=2000000 </script>
- <script name="TQCT-Qpid-02">-n TQCT-Qpid-02 -d1M -s[1000] -c[1:30]:samples=30 -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=false uniqueDests=true numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=256 destinationCount=1 rate=2000 maxPending=2000000 </script>
- <!-- Latency Tests : What are the effects on latency of increasing consumers from 1...30 consumers -->
- <script name="TQCL-Qpid-01">-n TQCL-Qpid-01 -d1M -s[1000] -c[1:30]:samples=30 -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=false uniqueDests=true numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=256 destinationCount=1 rate=2000 maxPending=2000000 </script>
- <script name="TQCL-Qpid-02">-n TQCL-Qpid-02 -d1M -s[1000] -c[1:30]:samples=30 -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=false uniqueDests=true numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=256 destinationCount=1 rate=2000 maxPending=2000000 </script>
-
- <!-- <script name="TQC-Qpid-05">-n TQC-Qpid-05 -d10M -s[10] -c[100] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=false uniqueDests=true numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=256 destinationCount=10 rate=0 maxPending=100000 </script> -->
- <!-- <script name="TQC-Qpid-06">-n TQC-Qpid-06 -d10M -s[10] -c[100] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=false uniqueDests=true numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=256 destinationCount=10 rate=0 maxPending=100000 </script> -->
-
-
- <!-- Message Size Tests : Tests sending message from 512b upto 1M with Point to Point messaging -->
- <script name="TQM-Qpid-01-512b">-n TQM-Qpid-01-512b -d10M -s[1000] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=false uniqueDests=true numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=512 destinationCount=1 rate=0 maxPending=2000000 </script>
- <script name="TQM-Qpid-02-512b">-n TQM-Qpid-02-512b -d10M -s[1000] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=false uniqueDests=true numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=512 destinationCount=1 rate=0 maxPending=2000000 </script>
- <script name="TQM-Qpid-01-1K">-n TQM-Qpid-01-1K -d10M -s[1000] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=false uniqueDests=true numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=1024 destinationCount=1 rate=0 maxPending=2000000 </script>
- <script name="TQM-Qpid-02-1K">-n TQM-Qpid-02-1K -d10M -s[1000] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=false uniqueDests=true numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=1024 destinationCount=1 rate=0 maxPending=2000000 </script>
- <script name="TQM-Qpid-01-5K">-n TQM-Qpid-01-5K -d10M -s[1000] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=false uniqueDests=true numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=5120 destinationCount=1 rate=0 maxPending=2000000 </script>
- <script name="TQM-Qpid-02-5K">-n TQM-Qpid-02-5K -d10M -s[1000] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=false uniqueDests=true numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=5120 destinationCount=1 rate=0 maxPending=2000000 </script>
- <script name="TQM-Qpid-01-10K">-n TQM-Qpid-01-10K -d10M -s[100] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=false uniqueDests=true numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=10240 destinationCount=1 rate=0 maxPending=2000000 </script>
- <script name="TQM-Qpid-02-10K">-n TQM-Qpid-02-10K -d10M -s[100] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=false uniqueDests=true numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=10240 destinationCount=1 rate=0 maxPending=2000000 </script>
- <script name="TQM-Qpid-01-50K">-n TQM-Qpid-01-50K -d10M -s[100] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=false uniqueDests=true numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=51200 destinationCount=1 rate=0 maxPending=100000000</script>
- <script name="TQM-Qpid-02-50K">-n TQM-Qpid-02-50K -d10M -s[100] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=false uniqueDests=true numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=51200 destinationCount=1 rate=0 maxPending=100000000</script>
- <script name="TQM-Qpid-01-100K">-n TQM-Qpid-01-100K -d10M -s[100] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=false uniqueDests=true numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=102400 destinationCount=1 rate=0 maxPending=100000000</script>
- <script name="TQM-Qpid-02-100K">-n TQM-Qpid-02-100K -d10M -s[100] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=false uniqueDests=true numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=102400 destinationCount=1 rate=0 maxPending=100000000</script>
- <script name="TQM-Qpid-01-500K">-n TQM-Qpid-01-500K -d10M -s[100] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=false uniqueDests=true numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=512000 destinationCount=1 rate=0 maxPending=100000000</script>
- <script name="TQM-Qpid-02-500K">-n TQM-Qpid-02-500K -d10M -s[100] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=false uniqueDests=true numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=512000 destinationCount=1 rate=0 maxPending=100000000</script>
- <script name="TQM-Qpid-01-1M">-n TQM-Qpid-01-1M -d10M -s[100] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=false uniqueDests=true numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=1048576 destinationCount=1 rate=0 maxPending=100000000</script>
- <script name="TQM-Qpid-02-1M">-n TQM-Qpid-02-1M -d10M -s[100] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=false uniqueDests=true numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=1048576 destinationCount=1 rate=0 maxPending=100000000</script>
-
- <!-- Transient, Pub/Sub Tests -->
- <!-- Concurrency Tests : What are the effects of increasing consumers from 1...30 consumers -->
- <script name="TTCT-Qpid-01">-n TTCT-Qpid-01 -d1M -s[10] -c[1:30]:samples=30 -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=256 destinationCount=1 rate=40 maxPending=2000000 </script>
- <script name="TTCT-Qpid-02">-n TTCT-Qpid-02 -d1M -s[10] -c[1:30]:samples=30 -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=256 destinationCount=1 rate=40 maxPending=2000000 </script>
- <!-- Latency Tests : What are the effects on latency of increasing consumers from 1...30 consumers -->
- <script name="TTCL-Qpid-01">-n TTCL-Qpid-01 -d1M -s[10] -c[1:30]:samples=30 -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=256 destinationCount=1 rate=40 maxPending=2000000 </script>
- <script name="TTCL-Qpid-02">-n TTCL-Qpid-02 -d1M -s[10] -c[1:30]:samples=30 -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=256 destinationCount=1 rate=40 maxPending=2000000 </script>
-
- <!-- <script name="TTC-Qpid-05">-n TTC-Qpid-05 -d10M -s[10] -c[100] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=256 destinationCount=10 rate=0 maxPending=100000 </script> -->
- <!-- <script name="TTC-Qpid-06">-n TTC-Qpid-06 -d10M -s[10] -c[100] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=256 destinationCount=10 rate=0 maxPending=100000 </script> -->
-
- <!-- Message Size Tests : Tests sending message from 512b upto 1M with Point to Point messaging -->
- <script name="TTM-Qpid-01-512b">-n TTM-Qpid-01-512b -d10M -s[1000] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=512 destinationCount=1 rate=0 maxPending=2000000 </script>
- <script name="TTM-Qpid-02-512b">-n TTM-Qpid-02-512b -d10M -s[1000] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=512 destinationCount=1 rate=0 maxPending=2000000 </script>
- <script name="TTM-Qpid-01-1K">-n TTM-Qpid-01-1K -d10M -s[1000] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=1024 destinationCount=1 rate=0 maxPending=2000000 </script>
- <script name="TTM-Qpid-02-1K">-n TTM-Qpid-02-1K -d10M -s[1000] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=1024 destinationCount=1 rate=0 maxPending=2000000 </script>
- <script name="TTM-Qpid-01-5K">-n TTM-Qpid-01-5K -d10M -s[1000] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=5120 destinationCount=1 rate=0 maxPending=2000000 </script>
- <script name="TTM-Qpid-02-5K">-n TTM-Qpid-02-5K -d10M -s[1000] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=5120 destinationCount=1 rate=0 maxPending=2000000 </script>
- <script name="TTM-Qpid-01-10K">-n TTM-Qpid-01-10K -d10M -s[100] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=10240 destinationCount=1 rate=0 maxPending=2000000 </script>
- <script name="TTM-Qpid-02-10K">-n TTM-Qpid-02-10K -d10M -s[100] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=10240 destinationCount=1 rate=0 maxPending=2000000 </script>
- <script name="TTM-Qpid-01-50K">-n TTM-Qpid-01-50K -d10M -s[100] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=51200 destinationCount=1 rate=0 maxPending=20000000</script>
- <script name="TTM-Qpid-02-50K">-n TTM-Qpid-02-50K -d10M -s[100] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=51200 destinationCount=1 rate=0 maxPending=20000000</script>
- <script name="TTM-Qpid-01-100K">-n TTM-Qpid-01-100K -d10M -s[40] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=102400 destinationCount=1 rate=0 maxPending=20000000</script>
- <script name="TTM-Qpid-02-100K">-n TTM-Qpid-02-100K -d10M -s[40] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=102400 destinationCount=1 rate=0 maxPending=20000000</script>
- <script name="TTM-Qpid-01-500K">-n TTM-Qpid-01-500K -d10M -s[8] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=512000 destinationCount=1 rate=0 maxPending=20000000</script>
- <script name="TTM-Qpid-02-500K">-n TTM-Qpid-02-500K -d10M -s[8] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=512000 destinationCount=1 rate=0 maxPending=20000000</script>
- <script name="TTM-Qpid-01-1M">-n TTM-Qpid-01-1M -d10M -s[4] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=1048576 destinationCount=1 rate=0 maxPending=20000000</script>
- <script name="TTM-Qpid-02-1M">-n TTM-Qpid-02-1M -d10M -s[4] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=1048476 destinationCount=1 rate=0 maxPending=20000000</script>
-
- <!-- Persistent, P2P Tests -->
- <!-- Concurrency Tests : What are the effects of increasing consumers from 1...30 consumers -->
- <script name="PQCT-Qpid-01">-n PQCT-Qpid-01 -d1M -s[1000] -c[1:30]:samples=30 -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=false uniqueDests=true numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=256 destinationCount=1 rate=600 maxPending=2000000 </script>
- <script name="PQCT-Qpid-02">-n PQCT-Qpid-02 -d1M -s[1000] -c[1:30]:samples=30 -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=false uniqueDests=true numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=256 destinationCount=1 rate=100 maxPending=2000000 </script>
- <!-- Latency Tests : What are the effects on latency of increasing consumers from 1...30 consumers -->
- <script name="PQCL-Qpid-01">-n PQCL-Qpid-01 -d1M -s[1000] -c[1:30]:samples=30 -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=true pubsub=false uniqueDests=true numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=256 destinationCount=1 rate=600 maxPending=2000000 </script>
- <script name="PQCL-Qpid-02">-n PQCL-Qpid-02 -d1M -s[1000] -c[1:30]:samples=30 -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=true pubsub=false uniqueDests=true numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=256 destinationCount=1 rate=100 maxPending=2000000 </script>
-
- <!-- <script name="PQC-Qpid-05">-n PQC-Qpid-05 -d10M -s[10] -c[100] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=false uniqueDests=true numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=256 destinationCount=10 rate=0 maxPending=100000 </script> -->
- <!-- <script name="PQC-Qpid-06">-n PQC-Qpid-06 -d10M -s[10] -c[100] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=false uniqueDests=true numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=256 destinationCount=10 rate=0 maxPending=100000 </script> -->
-
- <!-- Message Size Tests : Tests sending message from 512b upto 1M with Point to Point messaging -->
- <script name="PQM-Qpid-01-512b">-n PQM-Qpid-01-512b -d10M -s[1000] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=false uniqueDests=true numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=512 destinationCount=1 rate=0 maxPending=2000000 </script>
- <script name="PQM-Qpid-02-512b">-n PQM-Qpid-02-512b -d10M -s[1000] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=false uniqueDests=true numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=512 destinationCount=1 rate=0 maxPending=2000000 </script>
- <script name="PQM-Qpid-01-1K">-n PQM-Qpid-01-1K -d10M -s[1000] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=false uniqueDests=true numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=1024 destinationCount=1 rate=0 maxPending=2000000 </script>
- <script name="PQM-Qpid-02-1K">-n PQM-Qpid-02-1K -d10M -s[1000] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=false uniqueDests=true numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=1024 destinationCount=1 rate=0 maxPending=2000000 </script>
- <script name="PQM-Qpid-01-5K">-n PQM-Qpid-01-5K -d10M -s[1000] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=false uniqueDests=true numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=5120 destinationCount=1 rate=0 maxPending=2000000 </script>
- <script name="PQM-Qpid-02-5K">-n PQM-Qpid-02-5K -d10M -s[1000] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=false uniqueDests=true numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=5120 destinationCount=1 rate=0 maxPending=2000000 </script>
- <script name="PQM-Qpid-01-10K">-n PQM-Qpid-01-10K -d10M -s[100] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=false uniqueDests=true numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=10240 destinationCount=1 rate=0 maxPending=2000000 </script>
- <script name="PQM-Qpid-02-10K">-n PQM-Qpid-02-10K -d10M -s[100] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=false uniqueDests=true numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=10240 destinationCount=1 rate=0 maxPending=2000000 </script>
- <script name="PQM-Qpid-01-50K">-n PQM-Qpid-01-50K -d10M -s[100] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=false uniqueDests=true numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=51200 destinationCount=1 rate=0 maxPending=20000000</script>
- <script name="PQM-Qpid-02-50K">-n PQM-Qpid-02-50K -d10M -s[100] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=false uniqueDests=true numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=51200 destinationCount=1 rate=0 maxPending=20000000</script>
- <script name="PQM-Qpid-01-100K">-n PQM-Qpid-01-100K -d10M -s[40] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=false uniqueDests=true numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=102400 destinationCount=1 rate=0 maxPending=20000000</script>
- <script name="PQM-Qpid-02-100K">-n PQM-Qpid-02-100K -d10M -s[40] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=false uniqueDests=true numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=102400 destinationCount=1 rate=0 maxPending=20000000</script>
- <script name="PQM-Qpid-01-500K">-n PQM-Qpid-01-500K -d10M -s[8] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=false uniqueDests=true numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=512000 destinationCount=1 rate=0 maxPending=20000000</script>
- <script name="PQM-Qpid-02-500K">-n PQM-Qpid-02-500K -d10M -s[8] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=false uniqueDests=true numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=512000 destinationCount=1 rate=0 maxPending=20000000</script>
- <script name="PQM-Qpid-01-1M">-n PQM-Qpid-01-1M -d10M -s[4] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=false uniqueDests=true numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=1048576 destinationCount=1 rate=0 maxPending=20000000</script>
- <script name="PQM-Qpid-02-1M">-n PQM-Qpid-02-1M -d10M -s[4] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=false uniqueDests=true numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=1048576 destinationCount=1 rate=0 maxPending=20000000</script>
-
- <!-- Persistent, Pub/Sub Tests -->
- <script name="PTCT-Qpid-01">-n PTCT-Qpid-01 -d1M -s[1] -c[1:30]:samples=30 -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=256 destinationCount=1 rate=1 maxPending=2000000 </script>
- <script name="PTCT-Qpid-02">-n PTCT-Qpid-02 -d1M -s[1] -c[1:30]:samples=30 -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=256 destinationCount=1 rate=1 maxPending=2000000 </script>
- <script name="PTCL-Qpid-01">-n PTCL-Qpid-01 -d1M -s[1] -c[1:30]:samples=30 -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=256 destinationCount=1 rate=1 maxPending=2000000 </script>
- <script name="PTCL-Qpid-02">-n PTCL-Qpid-02 -d1M -s[1] -c[1:30]:samples=30 -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=256 destinationCount=1 rate=1 maxPending=2000000 </script>
-
- <!-- <script name="PTC-Qpid-05">-n PTC-Qpid-05 -d10M -s[10] -c[100] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=256 destinationCount=10 rate=0 maxPending=100000 </script> -->
- <!-- <script name="PTC-Qpid-06">-n PTC-Qpid-06 -d10M -s[10] -c[100] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=256 destinationCount=10 rate=0 maxPending=100000 </script> -->
-
- <script name="PTM-Qpid-01-512b">-n PTM-Qpid-01-512b -d10M -s[1000] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=512 destinationCount=1 rate=0 maxPending=2000000 </script>
- <script name="PTM-Qpid-02-512b">-n PTM-Qpid-02-512b -d10M -s[1000] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=512 destinationCount=1 rate=0 maxPending=2000000 </script>
- <script name="PTM-Qpid-01-1K">-n PTM-Qpid-01-1K -d10M -s[1000] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=1024 destinationCount=1 rate=0 maxPending=2000000 </script>
- <script name="PTM-Qpid-02-1K">-n PTM-Qpid-02-1K -d10M -s[1000] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=1024 destinationCount=1 rate=0 maxPending=2000000 </script>
- <script name="PTM-Qpid-01-5K">-n PTM-Qpid-01-5K -d10M -s[1000] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=5120 destinationCount=1 rate=0 maxPending=2000000 </script>
- <script name="PTM-Qpid-02-5K">-n PTM-Qpid-02-5K -d10M -s[1000] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=5120 destinationCount=1 rate=0 maxPending=2000000 </script>
- <script name="PTM-Qpid-01-10K">-n PTM-Qpid-01-10K -d10M -s[100] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=10240 destinationCount=1 rate=0 maxPending=2000000 </script>
- <script name="PTM-Qpid-02-10K">-n PTM-Qpid-02-10K -d10M -s[100] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=10240 destinationCount=1 rate=0 maxPending=2000000 </script>
- <script name="PTM-Qpid-01-50K">-n PTM-Qpid-01-50K -d10M -s[100] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=51200 destinationCount=1 rate=0 maxPending=20000000</script>
- <script name="PTM-Qpid-02-50K">-n PTM-Qpid-02-50K -d10M -s[100] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=51200 destinationCount=1 rate=0 maxPending=20000000</script>
- <script name="PTM-Qpid-01-100K">-n PTM-Qpid-01-100K -d10M -s[40] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=102400 destinationCount=1 rate=0 maxPending=20000000</script>
- <script name="PTM-Qpid-02-100K">-n PTM-Qpid-02-100K -d10M -s[40] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=102400 destinationCount=1 rate=0 maxPending=20000000</script>
- <script name="PTM-Qpid-01-500K">-n PTM-Qpid-01-500K -d10M -s[8] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=512000 destinationCount=1 rate=0 maxPending=20000000</script>
- <script name="PTM-Qpid-02-500K">-n PTM-Qpid-02-500K -d10M -s[8] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=512000 destinationCount=1 rate=0 maxPending=20000000</script>
- <script name="PTM-Qpid-01-1M">-n PTM-Qpid-01-1M -d10M -s[4] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=10 batchSize=1000 messageSize=1048576 destinationCount=1 rate=0 maxPending=20000000</script>
- <script name="PTM-Qpid-02-1M">-n PTM-Qpid-02-1M -d10M -s[4] -c[8] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=10 batchSize=1000 messageSize=1048476 destinationCount=1 rate=0 maxPending=20000000</script>
-
- <!-- Benchmarking tests. -->
- <!-- Throughput. -->
- <script name="TQBT-TX-Qpid-01">-n TQBT-TX-Qpid-01 -d10M -s[1000] -c[16] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=false uniqueDests=true numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=1 batchSize=1000 messageSize=256 destinationCount=1 rate=0 maxPending=2000000 </script>
- <script name="TQBT-AA-Qpid-01">-n TQBT-AA-Qpid-01 -d10M -s[1000] -c[16] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=false uniqueDests=true numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=1000 messageSize=256 destinationCount=1 rate=0 maxPending=2000000 </script>
- <script name="TQBT-NA-Qpid-01">-n TQBT-NA-Qpid-01 -d10M -s[1000] -c[16] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=false uniqueDests=true numConsumers=1 transacted=false consTransacted=false consAckMode=257 commitBatchSize=1 batchSize=1000 messageSize=256 destinationCount=1 rate=0 maxPending=2000000 </script>
- <script name="TTBT-TX-Qpid-01">-n TTBT-TX-Qpid-01 -d10M -s[1000] -c[2] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=8 transacted=true consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=1000 messageSize=256 destinationCount=1 rate=0 maxPending=2000000 </script>
- <script name="TTBT-AA-Qpid-01">-n TTBT-AA-Qpid-01 -d10M -s[1000] -c[2] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=8 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=1000 messageSize=256 destinationCount=1 rate=0 maxPending=2000000 </script>
- <script name="TTBT-NA-Qpid-01">-n TTBT-NA-Qpid-01 -d10M -s[1000] -c[2] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=8 transacted=false consTransacted=false consAckMode=257 commitBatchSize=1 batchSize=1000 messageSize=256 destinationCount=1 rate=0 maxPending=2000000 </script>
-
- <script name="PQBT-TX-Qpid-01">-n PQBT-TX-Qpid-01 -d10M -s[1000] -c[16] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=false uniqueDests=true numConsumers=1 transacted=true consTransacted=true consAckMode=0 commitBatchSize=1 batchSize=1000 messageSize=256 destinationCount=1 rate=0 maxPending=2000000 </script>
- <script name="PQBT-AA-Qpid-01">-n PQBT-AA-Qpid-01 -d10M -s[1000] -c[16] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=false uniqueDests=true numConsumers=1 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=1000 messageSize=256 destinationCount=1 rate=0 maxPending=2000000 </script>
- <script name="PTBT-TX-Qpid-01">-n PTBT-TX-Qpid-01 -d10M -s[1000] -c[2] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=8 transacted=true consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=1000 messageSize=256 destinationCount=1 rate=0 maxPending=2000000 </script>
- <script name="PTBT-AA-Qpid-01">-n PTBT-AA-Qpid-01 -d10M -s[1000] -c[2] -o $QPID_WORK/results -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=8 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=1000 messageSize=256 destinationCount=1 rate=0 maxPending=2000000 </script>
-
- <!-- Benchmark Latency testing-->
- <!-- Job Queueing. 1:10 -->
- <script name="TQBL-AA-Qpid-02-01">-n TQBL-AA-Qpid-02 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=false uniqueDests=true numConsumers=10 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=1000 messageSize=5120 destinationCount=1 rate=1000 maxPending=2000000 </script>
- <script name="TQBL-AA-Qpid-02-02">-n TQBL-AA-Qpid-02 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=false uniqueDests=true numConsumers=10 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=1000 messageSize=5120 destinationCount=1 rate=2000 maxPending=2000000 </script>
- <script name="TQBL-AA-Qpid-02-03">-n TQBL-AA-Qpid-02 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=false uniqueDests=true numConsumers=10 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=1000 messageSize=5120 destinationCount=1 rate=3000 maxPending=2000000 </script>
- <script name="TQBL-AA-Qpid-02-04">-n TQBL-AA-Qpid-02 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=false uniqueDests=true numConsumers=10 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=1000 messageSize=5120 destinationCount=1 rate=4000 maxPending=2000000 </script>
- <script name="TQBL-AA-Qpid-02-05">-n TQBL-AA-Qpid-02 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=false uniqueDests=true numConsumers=10 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=1000 messageSize=5120 destinationCount=1 rate=5000 maxPending=2000000 </script>
- <script name="TQBL-AA-Qpid-02-06">-n TQBL-AA-Qpid-02 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=false uniqueDests=true numConsumers=10 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=1000 messageSize=5120 destinationCount=1 rate=6000 maxPending=2000000 </script>
- <script name="TQBL-AA-Qpid-02-07">-n TQBL-AA-Qpid-02 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=false uniqueDests=true numConsumers=10 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=1000 messageSize=5120 destinationCount=1 rate=7000 maxPending=2000000 </script>
- <script name="TQBL-AA-Qpid-02-08">-n TQBL-AA-Qpid-02 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=false uniqueDests=true numConsumers=10 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=1000 messageSize=5120 destinationCount=1 rate=8000 maxPending=2000000 </script>
- <script name="TQBL-AA-Qpid-02-09">-n TQBL-AA-Qpid-02 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=false uniqueDests=true numConsumers=10 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=1000 messageSize=5120 destinationCount=1 rate=9000 maxPending=2000000 </script>
- <script name="TQBL-AA-Qpid-02-10">-n TQBL-AA-Qpid-02 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=false uniqueDests=true numConsumers=10 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=1000 messageSize=5120 destinationCount=1 rate=10000 maxPending=2000000 </script>
-
- <script name="PQBL-AA-Qpid-02-01">-n PQBL-AA-Qpid-02 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=true pubsub=false uniqueDests=true numConsumers=10 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=1000 messageSize=5120 destinationCount=1 rate=100 maxPending=2000000 </script>
- <script name="PQBL-AA-Qpid-02-02">-n PQBL-AA-Qpid-02 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=true pubsub=false uniqueDests=true numConsumers=10 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=1000 messageSize=5120 destinationCount=1 rate=200 maxPending=2000000 </script>
- <script name="PQBL-AA-Qpid-02-03">-n PQBL-AA-Qpid-02 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=true pubsub=false uniqueDests=true numConsumers=10 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=1000 messageSize=5120 destinationCount=1 rate=300 maxPending=2000000 </script>
- <script name="PQBL-AA-Qpid-02-04">-n PQBL-AA-Qpid-02 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=true pubsub=false uniqueDests=true numConsumers=10 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=1000 messageSize=5120 destinationCount=1 rate=400 maxPending=2000000 </script>
- <script name="PQBL-AA-Qpid-02-05">-n PQBL-AA-Qpid-02 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=true pubsub=false uniqueDests=true numConsumers=10 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=1000 messageSize=5120 destinationCount=1 rate=500 maxPending=2000000 </script>
- <script name="PQBL-AA-Qpid-02-06">-n PQBL-AA-Qpid-02 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=true pubsub=false uniqueDests=true numConsumers=10 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=1000 messageSize=5120 destinationCount=1 rate=600 maxPending=2000000 </script>
- <script name="PQBL-AA-Qpid-02-07">-n PQBL-AA-Qpid-02 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=true pubsub=false uniqueDests=true numConsumers=10 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=1000 messageSize=5120 destinationCount=1 rate=700 maxPending=2000000 </script>
- <script name="PQBL-AA-Qpid-02-08">-n PQBL-AA-Qpid-02 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=true pubsub=false uniqueDests=true numConsumers=10 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=1000 messageSize=5120 destinationCount=1 rate=800 maxPending=2000000 </script>
- <script name="PQBL-AA-Qpid-02-09">-n PQBL-AA-Qpid-02 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=true pubsub=false uniqueDests=true numConsumers=10 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=1000 messageSize=5120 destinationCount=1 rate=900 maxPending=2000000 </script>
- <script name="PQBL-AA-Qpid-02-10">-n PQBL-AA-Qpid-02 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=true pubsub=false uniqueDests=true numConsumers=10 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=1000 messageSize=5120 destinationCount=1 rate=1000 maxPending=2000000 </script>
-
- <!-- Broadcast of small sized time critical messages. Lowish rates. Transient/Persistent. 1:100, auto ack. -->
- <script name="TTBL-AA-Qpid-03-01">-n TTBL-AA-Qpid-03 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=1001 messageSize=256 destinationCount=1 rate=200 maxPending=2000000 </script>
- <script name="TTBL-AA-Qpid-03-02">-n TTBL-AA-Qpid-03 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=1001 messageSize=256 destinationCount=1 rate=400 maxPending=2000000 </script>
- <script name="TTBL-AA-Qpid-03-03">-n TTBL-AA-Qpid-03 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=1001 messageSize=256 destinationCount=1 rate=600 maxPending=2000000 </script>
- <script name="TTBL-AA-Qpid-03-04">-n TTBL-AA-Qpid-03 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=1001 messageSize=256 destinationCount=1 rate=800 maxPending=2000000 </script>
- <script name="TTBL-AA-Qpid-03-05">-n TTBL-AA-Qpid-03 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=1001 messageSize=256 destinationCount=1 rate=1000 maxPending=2000000 </script>
- <script name="TTBL-AA-Qpid-03-06">-n TTBL-AA-Qpid-03 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=1001 messageSize=256 destinationCount=1 rate=1200 maxPending=2000000 </script>
- <script name="TTBL-AA-Qpid-03-07">-n TTBL-AA-Qpid-03 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=1001 messageSize=256 destinationCount=1 rate=1400 maxPending=2000000 </script>
- <script name="TTBL-AA-Qpid-03-08">-n TTBL-AA-Qpid-03 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=1001 messageSize=256 destinationCount=1 rate=1600 maxPending=2000000 </script>
- <script name="TTBL-AA-Qpid-03-09">-n TTBL-AA-Qpid-03 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=1001 messageSize=256 destinationCount=1 rate=1800 maxPending=2000000 </script>
- <script name="TTBL-AA-Qpid-03-10">-n TTBL-AA-Qpid-03 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=1001 messageSize=256 destinationCount=1 rate=2000 maxPending=2000000 </script>
-
- <script name="PTBL-AA-Qpid-03-01">-n PTBL-AA-Qpid-03 -d1M -s[100] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=101 messageSize=256 destinationCount=1 rate=10 maxPending=2000000 </script>
- <script name="PTBL-AA-Qpid-03-02">-n PTBL-AA-Qpid-03 -d1M -s[100] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=101 messageSize=256 destinationCount=1 rate=20 maxPending=2000000 </script>
- <script name="PTBL-AA-Qpid-03-03">-n PTBL-AA-Qpid-03 -d1M -s[100] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=101 messageSize=256 destinationCount=1 rate=30 maxPending=2000000 </script>
- <script name="PTBL-AA-Qpid-03-04">-n PTBL-AA-Qpid-03 -d1M -s[100] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=101 messageSize=256 destinationCount=1 rate=40 maxPending=2000000 </script>
- <script name="PTBL-AA-Qpid-03-05">-n PTBL-AA-Qpid-03 -d1M -s[100] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=101 messageSize=256 destinationCount=1 rate=50 maxPending=2000000 </script>
- <script name="PTBL-AA-Qpid-03-06">-n PTBL-AA-Qpid-03 -d1M -s[100] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=101 messageSize=256 destinationCount=1 rate=60 maxPending=2000000 </script>
- <script name="PTBL-AA-Qpid-03-07">-n PTBL-AA-Qpid-03 -d1M -s[100] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=101 messageSize=256 destinationCount=1 rate=70 maxPending=2000000 </script>
- <script name="PTBL-AA-Qpid-03-08">-n PTBL-AA-Qpid-03 -d1M -s[100] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=101 messageSize=256 destinationCount=1 rate=80 maxPending=2000000 </script>
- <script name="PTBL-AA-Qpid-03-09">-n PTBL-AA-Qpid-03 -d1M -s[100] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=101 messageSize=256 destinationCount=1 rate=90 maxPending=2000000 </script>
- <script name="PTBL-AA-Qpid-03-10">-n PTBL-AA-Qpid-03 -d1M -s[100] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=101 messageSize=256 destinationCount=1 rate=100 maxPending=2000000 </script>
-
- <!-- Broadcast of medium sized time critical messages. Lowish rates. Transient/Persistent. 1:100, auto ack. -->
- <script name="TTBL-AA-Qpid-04-01">-n TTBL-AA-Qpid-04 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=1001 messageSize=5120 destinationCount=1 rate=100 maxPending=2000000 </script>
- <script name="TTBL-AA-Qpid-04-02">-n TTBL-AA-Qpid-04 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=1001 messageSize=5120 destinationCount=1 rate=200 maxPending=2000000 </script>
- <script name="TTBL-AA-Qpid-04-03">-n TTBL-AA-Qpid-04 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=1001 messageSize=5120 destinationCount=1 rate=300 maxPending=2000000 </script>
- <script name="TTBL-AA-Qpid-04-04">-n TTBL-AA-Qpid-04 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=1001 messageSize=5120 destinationCount=1 rate=400 maxPending=2000000 </script>
- <script name="TTBL-AA-Qpid-04-05">-n TTBL-AA-Qpid-04 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=1001 messageSize=5120 destinationCount=1 rate=500 maxPending=2000000 </script>
- <script name="TTBL-AA-Qpid-04-06">-n TTBL-AA-Qpid-04 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=1001 messageSize=5120 destinationCount=1 rate=600 maxPending=2000000 </script>
- <script name="TTBL-AA-Qpid-04-07">-n TTBL-AA-Qpid-04 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=1001 messageSize=5120 destinationCount=1 rate=700 maxPending=2000000 </script>
- <script name="TTBL-AA-Qpid-04-08">-n TTBL-AA-Qpid-04 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=1001 messageSize=5120 destinationCount=1 rate=800 maxPending=2000000 </script>
- <script name="TTBL-AA-Qpid-04-09">-n TTBL-AA-Qpid-04 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=1001 messageSize=5120 destinationCount=1 rate=900 maxPending=2000000 </script>
- <script name="TTBL-AA-Qpid-04-10">-n TTBL-AA-Qpid-04 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=1001 messageSize=5120 destinationCount=1 rate=1000 maxPending=2000000 </script>
-
- <script name="PTBL-AA-Qpid-04-01">-n PTBL-AA-Qpid-04 -d1M -s[100] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=101 messageSize=5120 destinationCount=1 rate=10 maxPending=2000000 </script>
- <script name="PTBL-AA-Qpid-04-02">-n PTBL-AA-Qpid-04 -d1M -s[100] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=101 messageSize=5120 destinationCount=1 rate=20 maxPending=2000000 </script>
- <script name="PTBL-AA-Qpid-04-03">-n PTBL-AA-Qpid-04 -d1M -s[100] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=101 messageSize=5120 destinationCount=1 rate=30 maxPending=2000000 </script>
- <script name="PTBL-AA-Qpid-04-04">-n PTBL-AA-Qpid-04 -d1M -s[100] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=101 messageSize=5120 destinationCount=1 rate=40 maxPending=2000000 </script>
- <script name="PTBL-AA-Qpid-04-05">-n PTBL-AA-Qpid-04 -d1M -s[100] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=101 messageSize=5120 destinationCount=1 rate=50 maxPending=2000000 </script>
- <script name="PTBL-AA-Qpid-04-06">-n PTBL-AA-Qpid-04 -d1M -s[100] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=101 messageSize=5120 destinationCount=1 rate=60 maxPending=2000000 </script>
- <script name="PTBL-AA-Qpid-04-07">-n PTBL-AA-Qpid-04 -d1M -s[100] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=101 messageSize=5120 destinationCount=1 rate=70 maxPending=2000000 </script>
- <script name="PTBL-AA-Qpid-04-08">-n PTBL-AA-Qpid-04 -d1M -s[100] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=101 messageSize=5120 destinationCount=1 rate=80 maxPending=2000000 </script>
- <script name="PTBL-AA-Qpid-04-09">-n PTBL-AA-Qpid-04 -d1M -s[100] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=101 messageSize=5120 destinationCount=1 rate=90 maxPending=2000000 </script>
- <script name="PTBL-AA-Qpid-04-10">-n PTBL-AA-Qpid-04 -d1M -s[100] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=true pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=1 commitBatchSize=1 batchSize=101 messageSize=5120 destinationCount=1 rate=100 maxPending=2000000 </script>
-
- <!-- Low-latency broadcast of time sensitive events. Transient, no_ack. -->
- <script name="TTBL-NA-Qpid-05-01">-n TTBL-NA-Qpid-05 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=257 commitBatchSize=1 batchSize=1001 messageSize=256 destinationCount=1 rate=400 maxPending=2000000 </script>
- <script name="TTBL-NA-Qpid-05-02">-n TTBL-NA-Qpid-05 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=257 commitBatchSize=1 batchSize=1001 messageSize=256 destinationCount=1 rate=800 maxPending=2000000 </script>
- <script name="TTBL-NA-Qpid-05-03">-n TTBL-NA-Qpid-05 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=257 commitBatchSize=1 batchSize=1001 messageSize=256 destinationCount=1 rate=1200 maxPending=2000000 </script>
- <script name="TTBL-NA-Qpid-05-04">-n TTBL-NA-Qpid-05 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=257 commitBatchSize=1 batchSize=1001 messageSize=256 destinationCount=1 rate=1600 maxPending=2000000 </script>
- <script name="TTBL-NA-Qpid-05-05">-n TTBL-NA-Qpid-05 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=257 commitBatchSize=1 batchSize=1001 messageSize=256 destinationCount=1 rate=2000 maxPending=2000000 </script>
- <script name="TTBL-NA-Qpid-05-06">-n TTBL-NA-Qpid-05 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=257 commitBatchSize=1 batchSize=1001 messageSize=256 destinationCount=1 rate=2400 maxPending=2000000 </script>
- <script name="TTBL-NA-Qpid-05-07">-n TTBL-NA-Qpid-05 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=257 commitBatchSize=1 batchSize=1001 messageSize=256 destinationCount=1 rate=2800 maxPending=2000000 </script>
- <script name="TTBL-NA-Qpid-05-08">-n TTBL-NA-Qpid-05 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=257 commitBatchSize=1 batchSize=1001 messageSize=256 destinationCount=1 rate=3200 maxPending=2000000 </script>
- <script name="TTBL-NA-Qpid-05-09">-n TTBL-NA-Qpid-05 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=257 commitBatchSize=1 batchSize=1001 messageSize=256 destinationCount=1 rate=3600 maxPending=2000000 </script>
- <script name="TTBL-NA-Qpid-05-10">-n TTBL-NA-Qpid-05 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=257 commitBatchSize=1 batchSize=1001 messageSize=256 destinationCount=1 rate=4000 maxPending=2000000 </script>
-
- <!-- Low-latency broadcast of medium sized time sensitive events. Transient, no_ack. -->
- <script name="TTBL-NA-Qpid-06-01">-n TTBL-NA-Qpid-06 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=257 commitBatchSize=1 batchSize=1001 messageSize=5120 destinationCount=1 rate=100 maxPending=2000000 </script>
- <script name="TTBL-NA-Qpid-06-02">-n TTBL-NA-Qpid-06 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=257 commitBatchSize=1 batchSize=1001 messageSize=5120 destinationCount=1 rate=200 maxPending=2000000 </script>
- <script name="TTBL-NA-Qpid-06-03">-n TTBL-NA-Qpid-06 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=257 commitBatchSize=1 batchSize=1001 messageSize=5120 destinationCount=1 rate=300 maxPending=2000000 </script>
- <script name="TTBL-NA-Qpid-06-04">-n TTBL-NA-Qpid-06 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=257 commitBatchSize=1 batchSize=1001 messageSize=5120 destinationCount=1 rate=400 maxPending=2000000 </script>
- <script name="TTBL-NA-Qpid-06-05">-n TTBL-NA-Qpid-06 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=257 commitBatchSize=1 batchSize=1001 messageSize=5120 destinationCount=1 rate=500 maxPending=2000000 </script>
- <script name="TTBL-NA-Qpid-06-06">-n TTBL-NA-Qpid-06 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=257 commitBatchSize=1 batchSize=1001 messageSize=5120 destinationCount=1 rate=600 maxPending=2000000 </script>
- <script name="TTBL-NA-Qpid-06-07">-n TTBL-NA-Qpid-06 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=257 commitBatchSize=1 batchSize=1001 messageSize=5120 destinationCount=1 rate=700 maxPending=2000000 </script>
- <script name="TTBL-NA-Qpid-06-08">-n TTBL-NA-Qpid-06 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=257 commitBatchSize=1 batchSize=1001 messageSize=5120 destinationCount=1 rate=800 maxPending=2000000 </script>
- <script name="TTBL-NA-Qpid-06-09">-n TTBL-NA-Qpid-06 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=257 commitBatchSize=1 batchSize=1001 messageSize=5120 destinationCount=1 rate=900 maxPending=2000000 </script>
- <script name="TTBL-NA-Qpid-06-10">-n TTBL-NA-Qpid-06 -d1M -s[1000] -c[1] -o $QPID_WORK/results -t testPingLatency org.apache.qpid.ping.PingLatencyTestPerf persistent=false pubsub=true uniqueDests=false numConsumers=50 transacted=false consTransacted=false consAckMode=257 commitBatchSize=1 batchSize=1001 messageSize=5120 destinationCount=1 rate=1000 maxPending=2000000 </script>
-
- <!-- Failover Tests. -->
- <script name="FT-Qpid-01">-n FT-Qpid-01 -s[2500] -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf messageSize=256 batchSize=10000 transacted=true properties=failovertest.properties failBeforeSend=true -o $QPID_WORK/results</script>
- <script name="FT-Qpid-02">-n FT-Qpid-02 -s[2500] -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf messageSize=256 batchSize=10000 transacted=true properties=failovertest.properties failAfterSend=true -o $QPID_WORK/results</script>
- <script name="FT-Qpid-03">-n FT-Qpid-03 -s[2500] -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf messageSize=256 batchSize=1000 transacted=true properties=failovertest.properties failAfterCommit=true -o $QPID_WORK/results</script>
- <script name="FT-Qpid-04">-n FT-Qpid-04 -s[2500] -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf messageSize=256 batchSize=1000 properties=failovertest.properties transacted=false failBeforeSend=true -o $QPID_WORK/results</script>
- <script name="FT-Qpid-05">-n FT-Qpid-05 -s[2500] -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf messageSize=256 batchSize=1000 properties=failovertest.properties transacted=false failAfterSend=true -o $QPID_WORK/results</script>
- <script name="FT-Qpid-01-P">-n FT-Qpid-01-P -s[2500] -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true messageSize=256 batchSize=1000 transacted=true properties=failovertest.properties failBeforeSend=true -o $QPID_WORK/results</script>
- <script name="FT-Qpid-02-P">-n FT-Qpid-02-P -s[2500] -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true messageSize=256 batchSize=1000 transacted=true properties=failovertest.properties failAfterSend=true -o $QPID_WORK/results</script>
- <script name="FT-Qpid-03-P">-n FT-Qpid-03-P -s[2500] -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true messageSize=256 batchSize=1000 transacted=true properties=failovertest.properties failAfterCommit=true -o $QPID_WORK/results</script>
- <script name="FT-Qpid-04-P">-n FT-Qpid-04-P -s[250] -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true messageSize=256 batchSize=1000 properties=failovertest.properties transacted=false failBeforeSend=true -o $QPID_WORK/results</script>
- <script name="FT-Qpid-05-P">-n FT-Qpid-05-P -s[250] -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf persistent=true messageSize=256 batchSize=1000 properties=failovertest.properties transacted=false failAfterSend=true -o $QPID_WORK/results</script>
-
-</scripts>
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/client/message/TestMessageFactory.java b/qpid/java/perftests/src/main/java/org/apache/qpid/client/message/TestMessageFactory.java
deleted file mode 100644
index d94ca5592b..0000000000
--- a/qpid/java/perftests/src/main/java/org/apache/qpid/client/message/TestMessageFactory.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.client.message;
-
-import javax.jms.JMSException;
-import javax.jms.Session;
-import javax.jms.ObjectMessage;
-import javax.jms.StreamMessage;
-import javax.jms.BytesMessage;
-import javax.jms.TextMessage;
-import javax.jms.DeliveryMode;
-import javax.jms.Destination;
-
-public class TestMessageFactory
-{
- private static final String MESSAGE_DATA_BYTES = "-message payload-message paylaod-message payload-message paylaod";
-
- public static TextMessage newTextMessage(Session session, int size) throws JMSException
- {
- return session.createTextMessage(createMessagePayload(size));
- }
-
- public static TextMessage newJMSTextMessage(Session session, int size, String encoding) throws JMSException
- {
-
- TextMessage message = session.createTextMessage();
- message.clearBody();
- message.setText(createMessagePayload(size));
- return message;
- }
-
- public static BytesMessage newBytesMessage(Session session, int size) throws JMSException
- {
- BytesMessage message = session.createBytesMessage();
- message.writeUTF(createMessagePayload(size));
- return message;
- }
-
- public static StreamMessage newStreamMessage(Session session, int size) throws JMSException
- {
- StreamMessage message = session.createStreamMessage();
- message.writeString(createMessagePayload(size));
- return message;
- }
-
- public static ObjectMessage newObjectMessage(Session session, int size) throws JMSException
- {
- if (size == 0)
- {
- return session.createObjectMessage();
- }
- else
- {
- return session.createObjectMessage(createMessagePayload(size));
- }
- }
-
- /**
- * Creates an ObjectMessage with given size and sets the JMS properties (JMSReplyTo and DeliveryMode)
- * @param session
- * @param replyDestination
- * @param size
- * @param persistent
- * @return the new ObjectMessage
- * @throws JMSException
- */
- public static ObjectMessage newObjectMessage(Session session, Destination replyDestination, int size, boolean persistent) throws JMSException
- {
- ObjectMessage msg = newObjectMessage(session, size);
-
- // Set the messages persistent delivery flag.
- msg.setJMSDeliveryMode(persistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT);
-
- // Ensure that the temporary reply queue is set as the reply to destination for the message.
- if (replyDestination != null)
- {
- msg.setJMSReplyTo(replyDestination);
- }
-
- return msg;
- }
-
- public static String createMessagePayload(int size)
- {
- StringBuffer buf = new StringBuffer(size);
- int count = 0;
- while (count <= (size - MESSAGE_DATA_BYTES.length()))
- {
- buf.append(MESSAGE_DATA_BYTES);
- count += MESSAGE_DATA_BYTES.length();
- }
- if (count < size)
- {
- buf.append(MESSAGE_DATA_BYTES, 0, size - count);
- }
-
- return buf.toString();
- }
-}
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/config/AMQConnectionFactoryInitialiser.java b/qpid/java/perftests/src/main/java/org/apache/qpid/config/AMQConnectionFactoryInitialiser.java
deleted file mode 100644
index 76fd318625..0000000000
--- a/qpid/java/perftests/src/main/java/org/apache/qpid/config/AMQConnectionFactoryInitialiser.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.config;
-
-import org.apache.qpid.client.AMQConnectionFactory;
-import org.apache.qpid.client.AMQConnectionURL;
-import org.apache.qpid.config.ConnectionFactoryInitialiser;
-import org.apache.qpid.config.ConnectorConfig;
-import org.apache.qpid.jms.ConnectionURL;
-import org.apache.qpid.url.URLSyntaxException;
-
-import javax.jms.ConnectionFactory;
-
-class AMQConnectionFactoryInitialiser implements ConnectionFactoryInitialiser
-{
- public ConnectionFactory getFactory(ConnectorConfig config)
- {
- try
- {
- final ConnectionURL connectionUrl = new AMQConnectionURL(ConnectionURL.AMQ_PROTOCOL +
- "://guest:guest@/test_path?brokerlist='tcp://" + config.getHost() + ":" + config.getPort() + "'");
- return new AMQConnectionFactory(connectionUrl);
- }
- catch (URLSyntaxException e)
- {
- throw new RuntimeException("Problem building URL", e);
- }
- }
-}
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/config/AbstractConfig.java b/qpid/java/perftests/src/main/java/org/apache/qpid/config/AbstractConfig.java
deleted file mode 100644
index 14db74438f..0000000000
--- a/qpid/java/perftests/src/main/java/org/apache/qpid/config/AbstractConfig.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.config;
-
-public abstract class AbstractConfig
-{
- public boolean setOptions(String[] argv)
- {
- try
- {
- for(int i = 0; i < argv.length - 1; i += 2)
- {
- String key = argv[i];
- String value = argv[i+1];
- setOption(key, value);
- }
- return true;
- }
- catch(Exception e)
- {
- System.out.println(e.getMessage());
- }
- return false;
- }
-
- protected int parseInt(String msg, String i)
- {
- try
- {
- return Integer.parseInt(i);
- }
- catch(NumberFormatException e)
- {
- throw new RuntimeException(msg + ": " + i, e);
- }
- }
-
- protected long parseLong(String msg, String i)
- {
- try
- {
- return Long.parseLong(i);
- }
- catch(NumberFormatException e)
- {
- throw new RuntimeException(msg + ": " + i, e);
- }
- }
-
- public abstract void setOption(String key, String value);
-}
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/config/ConnectionFactoryInitialiser.java b/qpid/java/perftests/src/main/java/org/apache/qpid/config/ConnectionFactoryInitialiser.java
deleted file mode 100644
index a9984eb09a..0000000000
--- a/qpid/java/perftests/src/main/java/org/apache/qpid/config/ConnectionFactoryInitialiser.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.config;
-
-import javax.jms.ConnectionFactory;
-import javax.jms.JMSException;
-
-public interface ConnectionFactoryInitialiser
-{
- public ConnectionFactory getFactory(ConnectorConfig config) throws JMSException;
-}
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/config/Connector.java b/qpid/java/perftests/src/main/java/org/apache/qpid/config/Connector.java
deleted file mode 100644
index 81541a3260..0000000000
--- a/qpid/java/perftests/src/main/java/org/apache/qpid/config/Connector.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.config;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-
-public class Connector
-{
- public Connection createConnection(ConnectorConfig config) throws Exception
- {
- return getConnectionFactory(config).createConnection();
- }
-
- ConnectionFactory getConnectionFactory(ConnectorConfig config) throws Exception
- {
- String factory = config.getFactory();
- if(factory == null)
- {
- factory = AMQConnectionFactoryInitialiser.class.getName();
- }
- System.out.println("Using " + factory);
- return ((ConnectionFactoryInitialiser) Class.forName(factory).newInstance()).getFactory(config);
- }
-}
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/config/ConnectorConfig.java b/qpid/java/perftests/src/main/java/org/apache/qpid/config/ConnectorConfig.java
deleted file mode 100644
index b120ed3f12..0000000000
--- a/qpid/java/perftests/src/main/java/org/apache/qpid/config/ConnectorConfig.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.config;
-
-public interface ConnectorConfig
-{
- public String getHost();
- public int getPort();
- public String getFactory();
-}
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/config/JBossConnectionFactoryInitialiser.java b/qpid/java/perftests/src/main/java/org/apache/qpid/config/JBossConnectionFactoryInitialiser.java
deleted file mode 100644
index a0248a8f79..0000000000
--- a/qpid/java/perftests/src/main/java/org/apache/qpid/config/JBossConnectionFactoryInitialiser.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.config;
-
-import org.apache.qpid.config.ConnectionFactoryInitialiser;
-import org.apache.qpid.config.ConnectorConfig;
-import org.apache.qpid.client.JMSAMQException;
-
-import javax.jms.ConnectionFactory;
-import javax.jms.JMSException;
-import javax.management.MBeanServerConnection;
-import javax.management.ObjectName;
-import javax.management.MBeanException;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import javax.naming.NameNotFoundException;
-import java.util.Hashtable;
-
-public class JBossConnectionFactoryInitialiser implements ConnectionFactoryInitialiser
-{
- public ConnectionFactory getFactory(ConnectorConfig config) throws JMSException
- {
- ConnectionFactory cf = null;
- InitialContext ic = null;
- Hashtable ht = new Hashtable();
- ht.put(InitialContext.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
- String jbossHost = System.getProperty("jboss.host", "eqd-lxamq01");
- String jbossPort = System.getProperty("jboss.port", "1099");
- ht.put(InitialContext.PROVIDER_URL, "jnp://" + jbossHost + ":" + jbossPort);
- ht.put(InitialContext.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
-
- try
- {
- ic = new InitialContext(ht);
- if (!doesDestinationExist("topictest.messages", ic))
- {
- deployTopic("topictest.messages", ic);
- }
- if (!doesDestinationExist("topictest.control", ic))
- {
- deployTopic("topictest.control", ic);
- }
-
- cf = (ConnectionFactory) ic.lookup("/ConnectionFactory");
- return cf;
- }
- catch (NamingException e)
- {
- throw new JMSAMQException("Unable to lookup object: " + e, e);
- }
- catch (Exception e)
- {
- throw new JMSAMQException("Error creating topic: " + e, e);
- }
- }
-
- private boolean doesDestinationExist(String name, InitialContext ic) throws Exception
- {
- try
- {
- ic.lookup("/" + name);
- }
- catch (NameNotFoundException e)
- {
- return false;
- }
- return true;
- }
-
- private void deployTopic(String name, InitialContext ic) throws Exception
- {
- MBeanServerConnection mBeanServer = lookupMBeanServerProxy(ic);
-
- ObjectName serverObjectName = new ObjectName("jboss.messaging:service=ServerPeer");
-
- String jndiName = "/" + name;
- try
- {
- mBeanServer.invoke(serverObjectName, "createTopic",
- new Object[]{name, jndiName},
- new String[]{"java.lang.String", "java.lang.String"});
- }
- catch (MBeanException e)
- {
- System.err.println("Error: " + e);
- System.err.println("Cause: " + e.getCause());
- }
- }
-
- private MBeanServerConnection lookupMBeanServerProxy(InitialContext ic) throws NamingException
- {
- return (MBeanServerConnection) ic.lookup("jmx/invoker/RMIAdaptor");
- }
-}
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/oldtopic/Config.java b/qpid/java/perftests/src/main/java/org/apache/qpid/oldtopic/Config.java
deleted file mode 100644
index 5b6169ed2d..0000000000
--- a/qpid/java/perftests/src/main/java/org/apache/qpid/oldtopic/Config.java
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.oldtopic;
-
-import org.apache.qpid.client.AMQSession;
-import org.apache.qpid.config.ConnectorConfig;
-import org.apache.qpid.config.ConnectionFactoryInitialiser;
-import org.apache.qpid.config.Connector;
-import org.apache.qpid.config.AbstractConfig;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-
-class Config extends AbstractConfig implements ConnectorConfig
-{
-
- private String host = "localhost";
- private int port = 5672;
- private String factory = null;
-
- private int payload = 256;
- private int messages = 1000;
- private int clients = 1;
- private int batch = 1;
- private long delay = 1;
- private int warmup;
- private int ackMode= AMQSession.NO_ACKNOWLEDGE;
- private String clientId;
- private String subscriptionId;
- private boolean persistent;
-
- public Config()
- {
- }
-
- int getAckMode()
- {
- return ackMode;
- }
-
- void setPayload(int payload)
- {
- this.payload = payload;
- }
-
- int getPayload()
- {
- return payload;
- }
-
- void setClients(int clients)
- {
- this.clients = clients;
- }
-
- int getClients()
- {
- return clients;
- }
-
- void setMessages(int messages)
- {
- this.messages = messages;
- }
-
- int getMessages()
- {
- return messages;
- }
-
- public String getHost()
- {
- return host;
- }
-
- public void setHost(String host)
- {
- this.host = host;
- }
-
- public int getPort()
- {
- return port;
- }
-
- public String getFactory()
- {
- return factory;
- }
-
- public void setPort(int port)
- {
- this.port = port;
- }
-
- int getBatch()
- {
- return batch;
- }
-
- void setBatch(int batch)
- {
- this.batch = batch;
- }
-
- int getWarmup()
- {
- return warmup;
- }
-
- void setWarmup(int warmup)
- {
- this.warmup = warmup;
- }
-
- public long getDelay()
- {
- return delay;
- }
-
- public void setDelay(long delay)
- {
- this.delay = delay;
- }
-
- String getClientId()
- {
- return clientId;
- }
-
- String getSubscriptionId()
- {
- return subscriptionId;
- }
-
- boolean usePersistentMessages()
- {
- return persistent;
- }
-
- public void setOption(String key, String value)
- {
- if("-host".equalsIgnoreCase(key))
- {
- setHost(value);
- }
- else if("-port".equalsIgnoreCase(key))
- {
- try
- {
- setPort(Integer.parseInt(value));
- }
- catch(NumberFormatException e)
- {
- throw new RuntimeException("Bad port number: " + value);
- }
- }
- else if("-payload".equalsIgnoreCase(key))
- {
- setPayload(parseInt("Bad payload size", value));
- }
- else if("-messages".equalsIgnoreCase(key))
- {
- setMessages(parseInt("Bad message count", value));
- }
- else if("-clients".equalsIgnoreCase(key))
- {
- setClients(parseInt("Bad client count", value));
- }
- else if("-batch".equalsIgnoreCase(key))
- {
- setBatch(parseInt("Bad batch count", value));
- }
- else if("-delay".equalsIgnoreCase(key))
- {
- setDelay(parseLong("Bad batch delay", value));
- }
- else if("-warmup".equalsIgnoreCase(key))
- {
- setWarmup(parseInt("Bad warmup count", value));
- }
- else if("-ack".equalsIgnoreCase(key))
- {
- ackMode = parseInt("Bad ack mode", value);
- }
- else if("-factory".equalsIgnoreCase(key))
- {
- factory = value;
- }
- else if("-clientId".equalsIgnoreCase(key))
- {
- clientId = value;
- }
- else if("-subscriptionId".equalsIgnoreCase(key))
- {
- subscriptionId = value;
- }
- else if("-persistent".equalsIgnoreCase(key))
- {
- persistent = "true".equalsIgnoreCase(value);
- }
- else
- {
- System.out.println("Ignoring unrecognised option: " + key);
- }
- }
-
- static String getAckModeDescription(int ackMode)
- {
- switch(ackMode)
- {
- case AMQSession.NO_ACKNOWLEDGE: return "NO_ACKNOWLEDGE";
- case AMQSession.AUTO_ACKNOWLEDGE: return "AUTO_ACKNOWLEDGE";
- case AMQSession.CLIENT_ACKNOWLEDGE: return "CLIENT_ACKNOWLEDGE";
- case AMQSession.DUPS_OK_ACKNOWLEDGE: return "DUPS_OK_ACKNOWELDGE";
- case AMQSession.PRE_ACKNOWLEDGE: return "PRE_ACKNOWLEDGE";
- }
- return "AckMode=" + ackMode;
- }
-
- public Connection createConnection() throws Exception
- {
- return new Connector().createConnection(this);
- }
-}
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/oldtopic/Listener.java b/qpid/java/perftests/src/main/java/org/apache/qpid/oldtopic/Listener.java
deleted file mode 100644
index 4732782d4c..0000000000
--- a/qpid/java/perftests/src/main/java/org/apache/qpid/oldtopic/Listener.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.oldtopic;
-import org.apache.log4j.*;
-import javax.jms.Connection;
-import javax.jms.Message;
-import javax.jms.MessageListener;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-
-public class Listener implements MessageListener
-{
- private final Connection _connection;
- private final MessageProducer _controller;
- private final javax.jms.Session _session;
- private final MessageFactory _factory;
- private boolean init;
- private int count;
- private long start;
-
- Listener(Connection connection, int ackMode) throws Exception
- {
- this(connection, ackMode, null);
- }
-
- Listener(Connection connection, int ackMode, String name) throws Exception
- {
- _connection = connection;
- _session = connection.createSession(false, ackMode);
- _factory = new MessageFactory(_session);
-
- //register for events
- if(name == null)
- {
- _factory.createTopicConsumer().setMessageListener(this);
- }
- else
- {
- _factory.createDurableTopicConsumer(name).setMessageListener(this);
- }
-
- _connection.start();
-
- _controller = _factory.createControlPublisher();
- System.out.println("Waiting for messages " +
- Config.getAckModeDescription(ackMode)
- + (name == null ? "" : " (subscribed with name " + name + " and client id " + connection.getClientID() + ")")
- + "...");
-
- }
-
- private void shutdown()
- {
- try
- {
- _session.close();
- _connection.stop();
- _connection.close();
- }
- catch(Exception e)
- {
- e.printStackTrace(System.out);
- }
- }
-
- private void report()
- {
- try
- {
- String msg = getReport();
- _controller.send(_factory.createReportResponseMessage(msg));
- System.out.println("Sent report: " + msg);
- }
- catch(Exception e)
- {
- e.printStackTrace(System.out);
- }
- }
-
- private String getReport()
- {
- long time = (System.currentTimeMillis() - start);
- return "Received " + count + " in " + time + "ms";
- }
-
- public void onMessage(Message message)
- {
- if(!init)
- {
- start = System.currentTimeMillis();
- count = 0;
- init = true;
- }
-
- if(_factory.isShutdown(message))
- {
- shutdown();
- }
- else if(_factory.isReport(message))
- {
- //send a report:
- report();
- init = false;
- }
- else if (++count % 100 == 0)
- {
- System.out.println("Received " + count + " messages.");
- }
- }
-
- public static void main(String[] argv) throws Exception
- {
- Config config = new Config();
- config.setOptions(argv);
-
- Connection con = config.createConnection();
- if(config.getClientId() != null)
- {
- con.setClientID(config.getClientId());
- }
- new Listener(con, config.getAckMode(), config.getSubscriptionId());
- }
-}
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/oldtopic/MessageFactory.java b/qpid/java/perftests/src/main/java/org/apache/qpid/oldtopic/MessageFactory.java
deleted file mode 100644
index b2fbeb7e35..0000000000
--- a/qpid/java/perftests/src/main/java/org/apache/qpid/oldtopic/MessageFactory.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.oldtopic;
-
-import org.apache.qpid.client.AMQSession;
-import org.apache.qpid.client.AMQTopic;
-
-import javax.jms.*;
-
-/**
- */
-class MessageFactory
-{
- private static final char[] DATA = "abcdefghijklmnopqrstuvwxyz".toCharArray();
-
- private final Session _session;
- private final Topic _topic;
- private final Topic _control;
- private final byte[] _payload;
-
-
- MessageFactory(Session session) throws JMSException
- {
- this(session, 256);
- }
-
- MessageFactory(Session session, int size) throws JMSException
- {
- _session = session;
-/* if(session instanceof AMQSession)
- {
- _topic = new AMQTopic("topictest.messages");
- _control = new AMQTopic("topictest.control");
- }
- else*/
- {
- _topic = session.createTopic("topictest.messages");
- _control = session.createTopic("topictest.control");
- }
- _payload = new byte[size];
-
- for(int i = 0; i < size; i++)
- {
- _payload[i] = (byte) DATA[i % DATA.length];
- }
- }
-
- Topic getTopic()
- {
- return _topic;
- }
-
- Message createEventMessage() throws JMSException
- {
- BytesMessage msg = _session.createBytesMessage();
- msg.writeBytes(_payload);
- return msg;
- }
-
- Message createShutdownMessage() throws JMSException
- {
- return _session.createTextMessage("SHUTDOWN");
- }
-
- Message createReportRequestMessage() throws JMSException
- {
- return _session.createTextMessage("REPORT");
- }
-
- Message createReportResponseMessage(String msg) throws JMSException
- {
- return _session.createTextMessage(msg);
- }
-
- boolean isShutdown(Message m)
- {
- return checkText(m, "SHUTDOWN");
- }
-
- boolean isReport(Message m)
- {
- return checkText(m, "REPORT");
- }
-
- Object getReport(Message m)
- {
- try
- {
- return ((TextMessage) m).getText();
- }
- catch (JMSException e)
- {
- e.printStackTrace(System.out);
- return e.toString();
- }
- }
-
- MessageConsumer createTopicConsumer() throws Exception
- {
- return _session.createConsumer(_topic);
- }
-
- MessageConsumer createDurableTopicConsumer(String name) throws Exception
- {
- return _session.createDurableSubscriber(_topic, name);
- }
-
- MessageConsumer createControlConsumer() throws Exception
- {
- return _session.createConsumer(_control);
- }
-
- MessageProducer createTopicPublisher() throws Exception
- {
- return _session.createProducer(_topic);
- }
-
- MessageProducer createControlPublisher() throws Exception
- {
- return _session.createProducer(_control);
- }
-
- private static boolean checkText(Message m, String s)
- {
- try
- {
- return m instanceof TextMessage && ((TextMessage) m).getText().equals(s);
- }
- catch (JMSException e)
- {
- e.printStackTrace(System.out);
- return false;
- }
- }
-}
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/oldtopic/Publisher.java b/qpid/java/perftests/src/main/java/org/apache/qpid/oldtopic/Publisher.java
deleted file mode 100644
index 841fcc63ad..0000000000
--- a/qpid/java/perftests/src/main/java/org/apache/qpid/oldtopic/Publisher.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.oldtopic;
-
-import javax.jms.*;
-
-public class Publisher implements MessageListener
-{
- private final Object _lock = new Object();
- private final Connection _connection;
- private final Session _session;
- private final MessageFactory _factory;
- private final MessageProducer _publisher;
- private int _count;
-
- Publisher(Connection connection, int size, int ackMode, boolean persistent) throws Exception
- {
- _connection = connection;
- _session = _connection.createSession(false, ackMode);
- _factory = new MessageFactory(_session, size);
- _publisher = _factory.createTopicPublisher();
- _publisher.setDeliveryMode(persistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT);
- System.out.println("Publishing " + (persistent ? "persistent" : "non-persistent") + " messages of " + size + " bytes, " + Config.getAckModeDescription(ackMode) + ".");
- }
-
- private void test(Config config) throws Exception
- {
- test(config.getBatch(), config.getDelay(), config.getMessages(), config.getClients(), config.getWarmup());
- }
-
- private void test(int batches, long delay, int msgCount, int consumerCount, int warmup) throws Exception
- {
- _factory.createControlConsumer().setMessageListener(this);
- _connection.start();
-
- if(warmup > 0)
- {
- System.out.println("Runing warmup (" + warmup + " msgs)");
- long time = batch(warmup, consumerCount);
- System.out.println("Warmup completed in " + time + "ms");
- }
-
- long[] times = new long[batches];
- for(int i = 0; i < batches; i++)
- {
- if(i > 0)
- {
- Thread.sleep(delay*1000);
- }
- times[i] = batch(msgCount, consumerCount);
- System.out.println("Batch " + (i+1) + " of " + batches + " completed in " + times[i] + " ms.");
- }
-
- long min = min(times);
- long max = max(times);
- System.out.println("min: " + min + ", max: " + max + " avg: " + avg(times, min, max));
-
- //request shutdown
- _publisher.send(_factory.createShutdownMessage());
-
- _connection.stop();
- _connection.close();
- }
-
- private long batch(int msgCount, int consumerCount) throws Exception
- {
- _count = consumerCount;
- long start = System.currentTimeMillis();
- publish(msgCount);
- waitForCompletion(consumerCount);
- return System.currentTimeMillis() - start;
- }
-
- private void publish(int count) throws Exception
- {
-
- //send events
- for (int i = 0; i < count; i++)
- {
- _publisher.send(_factory.createEventMessage());
- if ((i + 1) % 100 == 0)
- {
- System.out.println("Sent " + (i + 1) + " messages");
- }
- }
-
- //request report
- _publisher.send(_factory.createReportRequestMessage());
- }
-
- private void waitForCompletion(int consumers) throws Exception
- {
- System.out.println("Waiting for completion...");
- synchronized (_lock)
- {
- while (_count > 0)
- {
- _lock.wait();
- }
- }
- }
-
-
- public void onMessage(Message message)
- {
- System.out.println("Received report " + _factory.getReport(message) + " " + --_count + " remaining");
- if (_count == 0)
- {
- synchronized (_lock)
- {
- _lock.notify();
- }
- }
- }
-
- static long min(long[] times)
- {
- long min = times.length > 0 ? times[0] : 0;
- for(int i = 0; i < times.length; i++)
- {
- min = Math.min(min, times[i]);
- }
- return min;
- }
-
- static long max(long[] times)
- {
- long max = times.length > 0 ? times[0] : 0;
- for(int i = 0; i < times.length; i++)
- {
- max = Math.max(max, times[i]);
- }
- return max;
- }
-
- static long avg(long[] times, long min, long max)
- {
- long sum = 0;
- for(int i = 0; i < times.length; i++)
- {
- sum += times[i];
- }
- sum -= min;
- sum -= max;
-
- return (sum / (times.length - 2));
- }
-
- public static void main(String[] argv) throws Exception
- {
- Config config = new Config();
- config.setOptions(argv);
-
- Connection con = config.createConnection();
- int size = config.getPayload();
- int ackMode = config.getAckMode();
- boolean persistent = config.usePersistentMessages();
- new Publisher(con, size, ackMode, persistent).test(config);
- }
-}
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/ping/PingAsyncTestPerf.java b/qpid/java/perftests/src/main/java/org/apache/qpid/ping/PingAsyncTestPerf.java
deleted file mode 100644
index b55dac45c7..0000000000
--- a/qpid/java/perftests/src/main/java/org/apache/qpid/ping/PingAsyncTestPerf.java
+++ /dev/null
@@ -1,323 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.ping;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.requestreply.PingPongProducer;
-
-import org.apache.qpid.junit.extensions.TimingController;
-import org.apache.qpid.junit.extensions.TimingControllerAware;
-
-import javax.jms.JMSException;
-import javax.jms.Message;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicLong;
-
-/**
- * PingAsyncTestPerf is a performance test that outputs multiple timings from its test method, using the timing controller
- * interface supplied by the test runner from a seperate listener thread. It differs from the {@link PingTestPerf} test
- * that it extends because it can output timings as replies are received, rather than waiting until all expected replies
- * are received. This is less 'blocky' than the tests in {@link PingTestPerf}, and provides a truer simulation of sending
- * and recieving clients working asynchronously.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><td> Responsibilities <th> Collaborations
- * <tr><td> Send many ping messages and output timings asynchronously on batches received.
- * </table>
- */
-public class PingAsyncTestPerf extends PingTestPerf implements TimingControllerAware
-{
- private static Logger _logger = Logger.getLogger(PingAsyncTestPerf.class);
-
- /** Holds the name of the property to get the test results logging batch size. */
- public static final String TEST_RESULTS_BATCH_SIZE_PROPNAME = "batchSize";
-
- /** Holds the default test results logging batch size. */
- public static final int TEST_RESULTS_BATCH_SIZE_DEFAULT = 1000;
-
- /** Used to hold the timing controller passed from the test runner. */
- private TimingController _timingController;
-
- /** Used to generate unique correlation ids for each test run. */
- private AtomicLong corellationIdGenerator = new AtomicLong();
-
- /** Holds test specifics by correlation id. This consists of the expected number of messages and the timing controler. */
- private Map<String, PerCorrelationId> perCorrelationIds =
- Collections.synchronizedMap(new HashMap<String, PerCorrelationId>());
-
- /** Holds the batched results listener, that does logging on batch boundaries. */
- private BatchedResultsListener batchedResultsListener = null;
-
- /**
- * Creates a new asynchronous ping performance test with the specified name.
- *
- * @param name The test name.
- */
- public PingAsyncTestPerf(String name)
- {
- super(name);
-
- // Sets up the test parameters with defaults.
- testParameters.setPropertyIfNull(TEST_RESULTS_BATCH_SIZE_PROPNAME,
- Integer.toString(TEST_RESULTS_BATCH_SIZE_DEFAULT));
- }
-
- /**
- * Compile all the tests into a test suite.
- * @return The test suite to run. Should only contain testAsyncPingOk method.
- */
- public static Test suite()
- {
- // Build a new test suite
- TestSuite suite = new TestSuite("Ping Performance Tests");
-
- // Run performance tests in read committed mode.
- suite.addTest(new PingAsyncTestPerf("testAsyncPingOk"));
-
- return suite;
- }
-
- /**
- * Accepts a timing controller from the test runner.
- *
- * @param timingController The timing controller to register mutliple timings with.
- */
- public void setTimingController(TimingController timingController)
- {
- _timingController = timingController;
- }
-
- /**
- * Gets the timing controller passed in by the test runner.
- *
- * @return The timing controller passed in by the test runner.
- */
- public TimingController getTimingController()
- {
- return _timingController;
- }
-
- /**
- * Sends the specified number of pings, asynchronously outputs timings on every batch boundary, and waits until
- * all replies have been received or a time out occurs before exiting this method.
- *
- * @param numPings The number of pings to send.
- * @throws Exception pass all errors out to the test harness
- */
- public void testAsyncPingOk(int numPings) throws Exception
- {
- // _logger.debug("public void testAsyncPingOk(int numPings): called");
-
- // get prefill count to update the expected count
- int preFill = testParameters.getPropertyAsInteger(PingPongProducer.PREFILL_PROPNAME);
-
- // Ensure that at least one ping was requeusted.
- if (numPings + preFill == 0)
- {
- _logger.error("Number of pings requested was zero.");
- fail("Number of pings requested was zero.");
- }
-
- // Get the per thread test setup to run the test through.
- PerThreadSetup perThreadSetup = threadSetup.get();
- PingClient pingClient = perThreadSetup._pingClient;
-
- // Advance the correlation id of messages to send, to make it unique for this run.
- perThreadSetup._correlationId = Long.toString(corellationIdGenerator.incrementAndGet());
- // String messageCorrelationId = perThreadSetup._correlationId;
- // _logger.debug("messageCorrelationId = " + messageCorrelationId);
-
-
- // Initialize the count and timing controller for the new correlation id.
- // This perCorrelationId is only used for controlling the test.
- // The PingClient itself uses its own perCorrelationId see in PingPongProducer
- PerCorrelationId perCorrelationId = new PerCorrelationId();
- TimingController tc = getTimingController().getControllerForCurrentThread();
- perCorrelationId._tc = tc;
- perCorrelationId._expectedCount = pingClient.getExpectedNumPings(numPings + preFill);
- perCorrelationIds.put(perThreadSetup._correlationId, perCorrelationId);
-
- // Must be called before pingAndWaitForReply to setup the CorrelationID.
- // This is required because pingClient.start() will start all client threads
- // This means that the CorrelationID must be registered before hand.
- pingClient.setupCorrelationID(perThreadSetup._correlationId, perCorrelationId._expectedCount);
-
- // Start the client connection if:
- // 1) we are not in a SEND_ONLY test.
- // 2) if we have not yet started client because messages are sitting on broker.
- // This is either due to a preFill or a consume only test.
- if (!testParameters.getPropertyAsBoolean(PingPongProducer.SEND_ONLY_PROPNAME) &&
- (preFill > 0 || testParameters.getPropertyAsBoolean(PingPongProducer.CONSUME_ONLY_PROPNAME)))
- {
- pingClient.start();
- }
-
- // Send the requested number of messages, and wait until they have all been received.
- long timeout = Long.parseLong(testParameters.getProperty(PingPongProducer.TIMEOUT_PROPNAME));
- int numReplies = pingClient.pingAndWaitForReply(null, numPings , preFill, timeout, perThreadSetup._correlationId);
-
- // Check that all the replies were received and log a fail if they were not.
- if (numReplies < perCorrelationId._expectedCount)
- {
- System.out.println("##### " + numReplies + "replies, expected " + perCorrelationId._expectedCount + " #####");
- perCorrelationId._tc.completeTest(false, numPings - perCorrelationId._expectedCount);
- }
-
- // Remove the expected count and timing controller for the message correlation id, to ensure they are cleaned up.
- perCorrelationIds.remove(perThreadSetup._correlationId);
- }
-
- /**
- * Performs test fixture creation on a per thread basis. This will only be called once for each test thread.
- */
- public void threadSetUp()
- {
- _logger.debug("public void threadSetUp(): called");
-
- try
- {
- // Call the set up method in the super class. This creates a PingClient pinger.
- super.threadSetUp();
-
- // Create the chained message listener, only if it has not already been created. This is set up with the
- // batch size property, to tell it what batch size to output results on. A synchronized block is used to
- // ensure that only one thread creates this.
- synchronized (this)
- {
- if (batchedResultsListener == null)
- {
- int batchSize = Integer.parseInt(testParameters.getProperty(TEST_RESULTS_BATCH_SIZE_PROPNAME));
- batchedResultsListener = new BatchedResultsListener(batchSize);
- }
- }
-
- // Get the set up that the super class created.
- PerThreadSetup perThreadSetup = threadSetup.get();
-
- // Register the chained message listener on the pinger to do its asynchronous test timings from.
- perThreadSetup._pingClient.setChainedMessageListener(batchedResultsListener);
- }
- catch (Exception e)
- {
- _logger.warn("There was an exception during per thread setup.", e);
- }
- }
-
- /**
- * BatchedResultsListener is a {@link PingPongProducer.ChainedMessageListener} that can be attached to the
- * pinger, in order to receive notifications about every message received and the number remaining to be
- * received. Whenever the number remaining crosses a batch size boundary this results listener outputs
- * a test timing for the actual number of messages received in the current batch.
- */
- private class BatchedResultsListener implements PingPongProducer.ChainedMessageListener
- {
- /** The test results logging batch size. */
- int _batchSize;
-
- /** The latency recoreded for the batch */
- private long _batchLatency = 0;
-
- /**
- * Creates a results listener on the specified batch size.
- *
- * @param batchSize The batch size to use.
- */
- public BatchedResultsListener(int batchSize)
- {
- _batchSize = batchSize;
- }
-
- /**
- * This callback method is called from all of the pingers that this test creates. It uses the correlation id
- * from the message to identify the timing controller for the test thread that was responsible for sending those
- * messages.
- *
- * @param message The message.
- * @param remainingCount The count of messages remaining to be received with a particular correlation id.
- *
- * @throws JMSException Any underlying JMSException is allowed to fall through.
- */
- public void onMessage(Message message, int remainingCount, long latency) throws JMSException
- {
- // Record the latency for the whole batch
- _batchLatency += latency;
- // Check if a batch boundary has been crossed.
- if ((remainingCount % _batchSize) == 0)
- {
- // Extract the correlation id from the message.
- String correlationId = message.getJMSCorrelationID();
-
- /*_logger.debug("public void onMessage(Message message, int remainingCount = " + remainingCount
- + "): called on batch boundary for message id: " + correlationId + " with thread id: "
- + Thread.currentThread().getId());*/
-
- // Get the details for the correlation id and check that they are not null. They can become null
- // if a test times out.
- PerCorrelationId perCorrelationId = perCorrelationIds.get(correlationId);
- if (perCorrelationId != null)
- {
- // Get the timing controller and expected count for this correlation id.
- TimingController tc = perCorrelationId._tc;
- int expected = perCorrelationId._expectedCount;
-
- // Calculate how many messages were actually received in the last batch. This will be the batch size
- // except where the number expected is not a multiple of the batch size and this is the first remaining
- // count to cross a batch size boundary, in which case it will be the number expected modulo the batch
- // size.
- int receivedInBatch = ((expected - remainingCount) < _batchSize) ? (expected % _batchSize) : _batchSize;
-
- // Register a test result for the correlation id.
- try
- {
- // Record the total latency for the batch.
- // if batchSize=1 then this will just be the message latency
- tc.completeTest(true, receivedInBatch, null, _batchSize == 1 ? latency : _batchLatency);
- // Reset latency
- _batchLatency = 0;
- }
- catch (InterruptedException e)
- {
- // Ignore this. It means the test runner wants to stop as soon as possible.
- _logger.warn("Got InterruptedException.", e);
- }
- }
- // Else ignore, test timed out. Should log a fail here?
- }
- }
- }
-
- /**
- * Holds state specific to each correlation id, needed to output test results. This consists of the count of
- * the total expected number of messages, and the timing controller for the thread sending those message ids.
- */
- private static class PerCorrelationId
- {
- public int _expectedCount;
- public TimingController _tc;
- }
-}
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/ping/PingClient.java b/qpid/java/perftests/src/main/java/org/apache/qpid/ping/PingClient.java
deleted file mode 100644
index dcfc67d4fc..0000000000
--- a/qpid/java/perftests/src/main/java/org/apache/qpid/ping/PingClient.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.ping;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.requestreply.PingPongProducer;
-
-import javax.jms.Destination;
-
-import java.util.List;
-import java.util.Properties;
-
-/**
- * PingClient is a {@link PingPongProducer} that does not need a {@link org.apache.qpid.requestreply.PingPongBouncer}
- * to send replies to its pings. It simply listens to its own ping destinations, rather than seperate reply queues.
- * It is an all in one ping client, that produces and consumes its own pings.
- *
- * <p/>The constructor increments a count of the number of ping clients created. It is assumed that where many
- * are created they will all be run in parallel and be active in sending and consuming pings at the same time.
- * If the unique destinations flag is not set and a pub/sub ping cycle is being run, this means that they will all hear
- * pings sent by each other. The expected number of pings received will therefore be multiplied up by the number of
- * active ping clients. The {@link #getConsumersPerDestination()} method is used to supply this multiplier under these
- * conditions.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Create a ping producer that listens to its own pings <td> {@link PingPongProducer}
- * <tr><td> Count the number of ping producers and produce multiplier for scaling up messages expected over topic pings.
- * </table>
- */
-public class PingClient extends PingPongProducer
-{
- /** Used for debugging. */
- private final Logger log = Logger.getLogger(PingClient.class);
-
- /** Used to count the number of ping clients created. */
- private static int _pingClientCount;
-
- /**
- * Creates a ping producer with the specified parameters, of which there are many. See the class level comments
- * for {@link PingPongProducer} for details. This constructor creates a connection to the broker and creates
- * producer and consumer sessions on it, to send and recieve its pings and replies on.
- *
- * @param overrides Properties containing any desired overrides to the defaults.
- *
- * @throws Exception Any exceptions are allowed to fall through.
- */
- public PingClient(Properties overrides) throws Exception
- {
- super(overrides);
-
- _pingClientCount++;
- }
-
- /**
- * Returns the ping destinations themselves as the reply destinations for this pinger to listen to. This has the
- * effect of making this pinger listen to its own pings.
- *
- * @return The ping destinations.
- */
- public List<Destination> getReplyDestinations()
- {
- return _pingDestinations;
- }
-
- /**
- * Supplies the multiplier for the number of ping clients that will hear each ping when doing pub/sub pinging.
- *
- * @return The scaling up of the number of expected pub/sub pings.
- */
- public int getConsumersPerDestination()
- {
- log.debug("public int getConsumersPerDestination(): called");
-
- if (_isUnique)
- {
- log.debug(_noOfConsumers + " consumer per destination.");
-
- return _noOfConsumers;
- }
- else
- {
- log.debug((_pingClientCount * _noOfConsumers) + " consumers per destination.");
-
- return _pingClientCount * _noOfConsumers;
- }
- }
-
- public int getClientCount()
- {
- return _pingClientCount;
- }
-}
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/ping/PingDurableClient.java b/qpid/java/perftests/src/main/java/org/apache/qpid/ping/PingDurableClient.java
deleted file mode 100644
index a15897c82b..0000000000
--- a/qpid/java/perftests/src/main/java/org/apache/qpid/ping/PingDurableClient.java
+++ /dev/null
@@ -1,452 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.ping;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.requestreply.PingPongProducer;
-import org.apache.qpid.util.CommandLineParser;
-
-import org.apache.qpid.junit.extensions.util.MathUtils;
-import org.apache.qpid.junit.extensions.util.ParsedProperties;
-
-import javax.jms.*;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.List;
-import java.util.Properties;
-import java.util.concurrent.atomic.AtomicInteger;
-
-/**
- * PingDurableClient is a variation of the {@link PingPongProducer} ping tool. Instead of sending its pings and
- * receiving replies to them at the same time, this tool sends pings until it is signalled by some 'event' to stop
- * sending. It then waits for another signal before it re-opens a fresh connection and attempts to receive all of the
- * pings that it has succesfully sent. It is intended to be an interactive test that lets a user experiment with
- * failure conditions when using durable messaging.
- *
- * <p/>The events that can stop it from sending are input from the user on the console, failure of its connection to
- * the broker, completion of sending a specified number of messages, or expiry of a specified duration. In all cases
- * it will do its best to clean up and close the connection before opening a fresh connection to receive the pings
- * with.
- *
- * <p/>The event to re-connect and attempt to recieve the pings is input from the user on the console.
- *
- * <p/>This ping client inherits the configuration properties of its parent class ({@link PingPongProducer}) and
- * additionally accepts the following parameters:
- *
- * <p/><table><caption>Parameters</caption>
- * <tr><th> Parameter <th> Default <th> Comments
- * <tr><td> numMessages <td> 100 <td> The total number of messages to send.
- * <tr><td> numMessagesToAction <td> -1 <td> The number of messages to send before taking a custom 'action'.
- * <tr><td> duration <td> 30S <td> The length of time to ping for. (Format dDhHmMsS, for d days, h hours,
- * m minutes and s seconds).
- * </table>
- *
- * <p/>This ping client also overrides some of the defaults of its parent class, to provide a reasonable set up
- * when no parameters are specified.
- *
- * <p/><table><caption>Parameters</caption>
- * <tr><th> Parameter <th> Default <th> Comments
- * <tr><td> uniqueDests <td> false <td> Prevents destination names being timestamped.
- * <tr><td> transacted <td> true <td> Only makes sense to test with transactions.
- * <tr><td> persistent <td> true <td> Only makes sense to test persistent.
- * <tr><td> durableDests <td> true <td> Should use durable queues with persistent messages.
- * <tr><td> commitBatchSize <td> 10
- * <tr><td> rate <td> 20 <td> Total default test time is 5 seconds.
- * </table>
- *
- * <p/>When a number of messages or duration is specified, this ping client will ping until the first of those limits
- * is reached. Reaching the limit will be interpreted as the first signal to stop sending, and the ping client will
- * wait for the second signal before receiving its pings.
- *
- * <p/>This class provides a mechanism for extensions to add arbitrary actions, after a particular number of messages
- * have been sent. When the number of messages equal the value set in the 'numMessagesToAction' property is method,
- * the {@link #takeAction} method is called. By default this does nothing, but extensions of this class can provide
- * custom behaviour with alternative implementations of this method (for example taking a backup).
- *
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Send and receive pings.
- * <tr><td> Accept user input to signal stop sending.
- * <tr><td> Accept user input to signal start receiving.
- * <tr><td> Provide feedback on pings sent versus pings received.
- * <tr><td> Provide extension point for arbitrary action on a particular message count.
- * </table>
- */
-public class PingDurableClient extends PingPongProducer implements ExceptionListener
-{
- private static final Logger log = Logger.getLogger(PingDurableClient.class);
-
- public static final String NUM_MESSAGES_PROPNAME = "numMessages";
- public static final String NUM_MESSAGES_DEFAULT = "100";
- public static final String DURATION_PROPNAME = "duration";
- public static final String DURATION_DEFAULT = "30S";
- public static final String NUM_MESSAGES_TO_ACTION_PROPNAME = "numMessagesToAction";
- public static final String NUM_MESSAGES_TO_ACTION_DEFAULT = "-1";
-
- /** The maximum length of time to wait whilst receiving pings before assuming that no more are coming. */
- private static final long TIME_OUT = 3000;
-
- static
- {
- defaults.setProperty(NUM_MESSAGES_PROPNAME, NUM_MESSAGES_DEFAULT);
- defaults.setProperty(DURATION_PROPNAME, DURATION_DEFAULT);
- defaults.setProperty(UNIQUE_DESTS_PROPNAME, "false");
- defaults.setProperty(TRANSACTED_PROPNAME, "true");
- defaults.setProperty(PERSISTENT_MODE_PROPNAME, "true");
- defaults.setProperty(TX_BATCH_SIZE_PROPNAME, "10");
- defaults.setProperty(RATE_PROPNAME, "20");
- defaults.setProperty(DURABLE_DESTS_PROPNAME, "true");
- defaults.setProperty(NUM_MESSAGES_TO_ACTION_PROPNAME, NUM_MESSAGES_TO_ACTION_DEFAULT);
- }
-
- /** Specifies the number of pings to send, if larger than 0. 0 means send until told to stop. */
- private int numMessages;
-
- /** Holds the number of messages to send before taking triggering the action. */
- private int numMessagesToAction;
-
- /** Sepcifies how long to ping for, if larger than 0. 0 means send until told to stop. */
- private long duration;
-
- /** Used to indciate that this application should terminate. Set by the shutdown hook. */
- private boolean terminate = false;
-
- /**
- * @throws Exception Any exceptions are allowed to fall through.
- */
- public PingDurableClient(Properties overrides) throws Exception
- {
- super(overrides);
- log.debug("public PingDurableClient(Properties overrides = " + overrides + "): called");
-
- // Extract the additional configuration parameters.
- ParsedProperties properties = new ParsedProperties(defaults);
- properties.putAll(overrides);
-
- numMessages = properties.getPropertyAsInteger(NUM_MESSAGES_PROPNAME);
- String durationSpec = properties.getProperty(DURATION_PROPNAME);
- numMessagesToAction = properties.getPropertyAsInteger(NUM_MESSAGES_TO_ACTION_PROPNAME);
-
- if (durationSpec != null)
- {
- duration = MathUtils.parseDuration(durationSpec) * 1000000;
- }
- }
-
- /**
- * Starts the ping/wait/receive process.
- *
- * @param args The command line arguments.
- */
- public static void main(String[] args)
- {
- try
- {
- // Create a ping producer overriding its defaults with all options passed on the command line.
- Properties options =
- CommandLineParser.processCommandLine(args, new CommandLineParser(new String[][] {}), System.getProperties());
- PingDurableClient pingProducer = new PingDurableClient(options);
-
- // Create a shutdown hook to terminate the ping-pong producer.
- Runtime.getRuntime().addShutdownHook(pingProducer.getShutdownHook());
-
- // Ensure that the ping pong producer is registered to listen for exceptions on the connection too.
- // pingProducer.getConnection().setExceptionListener(pingProducer);
-
- // Run the test procedure.
- int sent = pingProducer.send();
- pingProducer.closeConnection();
- pingProducer.waitForUser("Press return to begin receiving the pings.");
- pingProducer.receive(sent);
-
- System.exit(0);
- }
- catch (Exception e)
- {
- System.err.println(e.getMessage());
- log.error("Top level handler caught execption.", e);
- System.exit(1);
- }
- }
-
- /**
- * Performs the main test procedure implemented by this ping client. See the class level comment for details.
- */
- protected int send() throws Exception
- {
- log.debug("public void sendWaitReceive(): called");
-
- log.debug("duration = " + duration);
- log.debug("numMessages = " + numMessages);
-
- if (duration > 0)
- {
- System.out.println("Sending for up to " + (duration / 1000000000f) + " seconds.");
- }
-
- if (_rate > 0)
- {
- System.out.println("Sending at " + _rate + " messages per second.");
- }
-
- if (numMessages > 0)
- {
- System.out.println("Sending up to " + numMessages + " messages.");
- }
-
- // Establish the connection and the message producer.
- establishConnection(true, false);
- _connection.start();
-
- Message message = getTestMessage(getReplyDestinations().get(0), _messageSize, _persistent);
-
- // Send pings until a terminating condition is received.
- boolean endCondition = false;
- int messagesSent = 0;
- int messagesCommitted = 0;
- int messagesNotCommitted = 0;
- long start = System.nanoTime();
-
- // Clear console in.
- clearConsole();
-
- while (!endCondition)
- {
- boolean committed = false;
-
- try
- {
- committed = sendMessage(messagesSent, message) && _transacted;
-
- messagesSent++;
- messagesNotCommitted++;
-
- // Keep count of the number of messsages currently committed and pending commit.
- if (committed)
- {
- log.debug("Adding " + messagesNotCommitted + " messages to the committed count.");
- messagesCommitted += messagesNotCommitted;
- messagesNotCommitted = 0;
-
- System.out.println("Commited: " + messagesCommitted);
- }
- }
- catch (JMSException e)
- {
- log.debug("Got JMSException whilst sending.");
- _publish = false;
- }
-
- // Perform the arbitrary action if the number of messages sent has reached the right number.
- if (messagesSent == numMessagesToAction)
- {
- System.out.println("At action point, Messages sent = " + messagesSent + ", Messages Committed = "
- + messagesCommitted + ", Messages not Committed = " + messagesNotCommitted);
- takeAction();
- }
-
- // Determine if the end condition has been met, based on the number of messages, time passed, errors on
- // the connection or user input.
- long now = System.nanoTime();
-
- if ((duration != 0) && ((now - start) > duration))
- {
- System.out.println("Send halted because duration expired.");
- endCondition = true;
- }
- else if ((numMessages != 0) && (messagesSent >= numMessages))
- {
- System.out.println("Send halted because # messages completed.");
- endCondition = true;
- }
- else if (System.in.available() > 0)
- {
- System.out.println("Send halted by user input.");
- endCondition = true;
-
- clearConsole();
- }
- else if (!_publish)
- {
- System.out.println("Send halted by error on the connection.");
- endCondition = true;
- }
- }
-
- log.debug("messagesSent = " + messagesSent);
- log.debug("messagesCommitted = " + messagesCommitted);
- log.debug("messagesNotCommitted = " + messagesNotCommitted);
-
- System.out.println("Messages sent: " + messagesSent + ", Messages Committed = " + messagesCommitted
- + ", Messages not Committed = " + messagesNotCommitted);
-
- return messagesSent;
- }
-
- protected void closeConnection()
- {
- // Clean up the connection.
- try
- {
- close();
- }
- catch (JMSException e)
- {
- log.debug("There was an error whilst closing the connection: " + e, e);
- System.out.println("There was an error whilst closing the connection.");
-
- // Ignore as did best could manage to clean up.
- }
- }
-
- protected void receive(int messagesSent) throws Exception
- {
- // Re-establish the connection and the message consumer.
- _queueJVMSequenceID = new AtomicInteger();
- _queueSharedID = new AtomicInteger();
-
- establishConnection(false, true);
- _consumer[0].setMessageListener(null);
- _consumerConnection[0].start();
-
- // Try to receive all of the pings that were successfully sent.
- int messagesReceived = 0;
- boolean endCondition = false;
-
- while (!endCondition)
- {
- // Message received = _consumer.receiveNoWait();
- Message received = _consumer[0].receive(TIME_OUT);
- log.debug("received = " + received);
-
- if (received != null)
- {
- messagesReceived++;
- }
-
- // Determine if the end condition has been met, based on the number of messages and time passed since last
- // receiving a message.
- if (received == null)
- {
- System.out.println("Timed out.");
- endCondition = true;
- }
- else if (messagesReceived >= messagesSent)
- {
- System.out.println("Got all messages.");
- endCondition = true;
- }
- }
-
- // Ensure messages received are committed.
- if (_consTransacted)
- {
- try
- {
- _consumerSession[0].commit();
- System.out.println("Committed for all messages received.");
- }
- catch (JMSException e)
- {
- log.debug("Error during commit: " + e, e);
- System.out.println("Error during commit.");
- try
- {
- _consumerSession[0].rollback();
- System.out.println("Rolled back on all messages received.");
- }
- catch (JMSException e2)
- {
- log.debug("Error during rollback: " + e, e);
- System.out.println("Error on roll back of all messages received.");
- }
-
- }
- }
-
- log.debug("messagesReceived = " + messagesReceived);
-
- System.out.println("Messages received: " + messagesReceived);
-
- // Clean up the connection.
- close();
- }
-
- /**
- * Clears any pending input from the console.
- */
- private void clearConsole()
- {
- try
- {
- BufferedReader bis = new BufferedReader(new InputStreamReader(System.in));
-
- // System.in.skip(System.in.available());
- while (bis.ready())
- {
- bis.readLine();
- }
- }
- catch (IOException e)
- { }
- }
-
- /**
- * Returns the ping destinations themselves as the reply destinations for this pinger to listen to. This has the
- * effect of making this pinger listen to its own pings.
- *
- * @return The ping destinations.
- */
- public List<Destination> getReplyDestinations()
- {
- return _pingDestinations;
- }
-
- /**
- * Gets a shutdown hook that will cleanly shut this down when it is running the ping loop. This can be registered with
- * the runtime system as a shutdown hook. This shutdown hook sets an additional terminate flag, compared with the
- * shutdown hook in {@link PingPongProducer}, because the publish flag is used to indicate that sending or receiving
- * message should stop, not that the application should termiante.
- *
- * @return A shutdown hook for the ping loop.
- */
- public Thread getShutdownHook()
- {
- return new Thread(new Runnable()
- {
- public void run()
- {
- stop();
- terminate = true;
- }
- });
- }
-
- /**
- * Performs an aribtrary action once the 'numMesagesToAction' count is reached on sending messages. This default
- * implementation does nothing.
- */
- public void takeAction()
- { }
-}
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/ping/PingLatencyTestPerf.java b/qpid/java/perftests/src/main/java/org/apache/qpid/ping/PingLatencyTestPerf.java
deleted file mode 100644
index 5ba4004c56..0000000000
--- a/qpid/java/perftests/src/main/java/org/apache/qpid/ping/PingLatencyTestPerf.java
+++ /dev/null
@@ -1,311 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.ping;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.client.AMQSession;
-import org.apache.qpid.requestreply.PingPongProducer;
-
-import org.apache.qpid.junit.extensions.TimingController;
-import org.apache.qpid.junit.extensions.TimingControllerAware;
-import org.apache.qpid.junit.extensions.util.ParsedProperties;
-
-import javax.jms.JMSException;
-import javax.jms.Message;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicLong;
-
-/**
- * PingLatencyTestPerf is a performance test that outputs multiple timings from its test method, using the timing
- * controller interface supplied by the test runner from a seperate listener thread. It outputs round trip timings for
- * individual ping messages rather than for how long a complete batch of messages took to process. It also differs from
- * the {@link PingTestPerf} test that it extends because it can output timings as replies are received, rather than
- * waiting until all expected replies are received.
- *
- * <p/>This test does not output timings for every single ping message, as when running at high volume, writing the test
- * log for a vast number of messages would slow the testing down. Instead samples ping latency occasionally. The
- * frequency of ping sampling is set using the {@link #TEST_RESULTS_BATCH_SIZE_PROPNAME} property, to override the
- * default of every {@link #DEFAULT_TEST_RESULTS_BATCH_SIZE}.
- *
- * <p/>The size parameter logged for each individual ping is set to the size of the batch of messages that the
- * individual timed ping was taken from, rather than 1 for a single message. This is so that the total throughput
- * (messages / time) can be calculated in order to examine the relationship between throughput and latency.
- *
- * <p/><table id="crc"><caption>CRC Card</caption> <tr><td> Responsibilities <th> Collaborations <tr><td> Send many ping
- * messages and output timings for sampled individual pings. </table>
- */
-public class PingLatencyTestPerf extends PingTestPerf implements TimingControllerAware
-{
- private static Logger _logger = Logger.getLogger(PingLatencyTestPerf.class);
-
- /** Holds the name of the property to get the test results logging batch size. */
- public static final String TEST_RESULTS_BATCH_SIZE_PROPNAME = "batchSize";
-
- /** Holds the default test results logging batch size. */
- public static final int DEFAULT_TEST_RESULTS_BATCH_SIZE = 1000;
-
- /** Used to hold the timing controller passed from the test runner. */
- private TimingController _timingController;
-
- /** Used to generate unique correlation ids for each test run. */
- private AtomicLong corellationIdGenerator = new AtomicLong();
-
- /**
- * Holds test specifics by correlation id. This consists of the expected number of messages and the timing
- * controler.
- */
- private Map<String, PerCorrelationId> perCorrelationIds =
- Collections.synchronizedMap(new HashMap<String, PerCorrelationId>());
-
- /** Holds the batched results listener, that does logging on batch boundaries. */
- private BatchedResultsListener batchedResultsListener = null;
-
- /**
- * Creates a new asynchronous ping performance test with the specified name.
- *
- * @param name The test name.
- */
- public PingLatencyTestPerf(String name)
- {
- super(name);
-
- // Sets up the test parameters with defaults.
- ParsedProperties.setSysPropertyIfNull(TEST_RESULTS_BATCH_SIZE_PROPNAME,
- Integer.toString(DEFAULT_TEST_RESULTS_BATCH_SIZE));
- }
-
- /** Compile all the tests into a test suite. */
- public static Test suite()
- {
- // Build a new test suite
- TestSuite suite = new TestSuite("Ping Latency Tests");
-
- // Run performance tests in read committed mode.
- suite.addTest(new PingLatencyTestPerf("testPingLatency"));
-
- return suite;
- }
-
- /**
- * Accepts a timing controller from the test runner.
- *
- * @param timingController The timing controller to register mutliple timings with.
- */
- public void setTimingController(TimingController timingController)
- {
- _timingController = timingController;
- }
-
- /**
- * Gets the timing controller passed in by the test runner.
- *
- * @return The timing controller passed in by the test runner.
- */
- public TimingController getTimingController()
- {
- return _timingController;
- }
-
- /**
- * Sends the specified number of pings, asynchronously outputs timings on every batch boundary, and waits until all
- * replies have been received or a time out occurs before exiting this method.
- *
- * @param numPings The number of pings to send.
- */
- public void testPingLatency(int numPings) throws Exception
- {
- _logger.debug("public void testPingLatency(int numPings): called");
-
- // Ensure that at least one ping was requeusted.
- if (numPings == 0)
- {
- _logger.error("Number of pings requested was zero.");
- }
-
- // Get the per thread test setup to run the test through.
- PerThreadSetup perThreadSetup = threadSetup.get();
- PingClient pingClient = perThreadSetup._pingClient;
-
- // Advance the correlation id of messages to send, to make it unique for this run.
- String messageCorrelationId = Long.toString(corellationIdGenerator.incrementAndGet());
- _logger.debug("messageCorrelationId = " + messageCorrelationId);
-
- // Initialize the count and timing controller for the new correlation id.
- PerCorrelationId perCorrelationId = new PerCorrelationId();
- TimingController tc = getTimingController().getControllerForCurrentThread();
- perCorrelationId._tc = tc;
- perCorrelationId._expectedCount = numPings;
- perCorrelationIds.put(messageCorrelationId, perCorrelationId);
-
- // Attach the chained message listener to the ping producer to listen asynchronously for the replies to these
- // messages.
- pingClient.setChainedMessageListener(batchedResultsListener);
-
- // Generate a sample message of the specified size.
- Message msg =
- pingClient.getTestMessage(perThreadSetup._pingClient.getReplyDestinations().get(0),
- testParameters.getPropertyAsInteger(PingPongProducer.MESSAGE_SIZE_PROPNAME),
- testParameters.getPropertyAsBoolean(PingPongProducer.PERSISTENT_MODE_PROPNAME));
-
- // Send the requested number of messages, and wait until they have all been received.
- long timeout = Long.parseLong(testParameters.getProperty(PingPongProducer.TIMEOUT_PROPNAME));
- int numReplies = pingClient.pingAndWaitForReply(msg, numPings, timeout, null);
-
- // Check that all the replies were received and log a fail if they were not.
- if (numReplies < numPings)
- {
- tc.completeTest(false, 0);
- }
-
- // Remove the chained message listener from the ping producer.
- pingClient.removeChainedMessageListener();
-
- // Remove the expected count and timing controller for the message correlation id, to ensure they are cleaned up.
- perCorrelationIds.remove(messageCorrelationId);
- }
-
- /** Performs test fixture creation on a per thread basis. This will only be called once for each test thread. */
- public void threadSetUp()
- {
- _logger.debug("public void threadSetUp(): called");
-
- try
- {
- // Call the set up method in the super class. This creates a PingClient pinger.
- super.threadSetUp();
-
- // Create the chained message listener, only if it has not already been created. This is set up with the
- // batch size property, to tell it what batch size to output results on. A synchronized block is used to
- // ensure that only one thread creates this.
- synchronized (this)
- {
- if (batchedResultsListener == null)
- {
- int batchSize = Integer.parseInt(testParameters.getProperty(TEST_RESULTS_BATCH_SIZE_PROPNAME));
- batchedResultsListener = new BatchedResultsListener(batchSize);
- }
- }
-
- // Get the set up that the super class created.
- PerThreadSetup perThreadSetup = threadSetup.get();
-
- // Register the chained message listener on the pinger to do its asynchronous test timings from.
- perThreadSetup._pingClient.setChainedMessageListener(batchedResultsListener);
- }
- catch (Exception e)
- {
- _logger.warn("There was an exception during per thread setup.", e);
- }
- }
-
- /**
- * BatchedResultsListener is a {@link org.apache.qpid.requestreply.PingPongProducer.ChainedMessageListener} that can
- * be attached to the pinger, in order to receive notifications about every message received and the number
- * remaining to be received. Whenever the number remaining crosses a batch size boundary this results listener
- * outputs a test timing for the actual number of messages received in the current batch.
- */
- private class BatchedResultsListener implements PingPongProducer.ChainedMessageListener
- {
- /** The test results logging batch size. */
- int _batchSize;
- private boolean _strictAMQP;
-
- /**
- * Creates a results listener on the specified batch size.
- *
- * @param batchSize The batch size to use.
- */
- public BatchedResultsListener(int batchSize)
- {
- _batchSize = batchSize;
- _strictAMQP =
- Boolean.parseBoolean(System.getProperties().getProperty(AMQSession.STRICT_AMQP,
- AMQSession.STRICT_AMQP_DEFAULT));
- }
-
- /**
- * This callback method is called from all of the pingers that this test creates. It uses the correlation id
- * from the message to identify the timing controller for the test thread that was responsible for sending those
- * messages.
- *
- * @param message The message.
- * @param remainingCount The count of messages remaining to be received with a particular correlation id.
- *
- * @throws javax.jms.JMSException Any underlying JMSException is allowed to fall through.
- */
- public void onMessage(Message message, int remainingCount, long latency) throws JMSException
- {
- _logger.debug("public void onMessage(Message message, int remainingCount = " + remainingCount + "): called");
-
- // Check if a batch boundary has been crossed.
- if ((remainingCount % _batchSize) == 0)
- {
- // Extract the correlation id from the message.
- String correlationId = message.getJMSCorrelationID();
-
- // Get the details for the correlation id and check that they are not null. They can become null
- // if a test times out.
- PerCorrelationId perCorrelationId = perCorrelationIds.get(correlationId);
- if (perCorrelationId != null)
- {
- // Get the timing controller and expected count for this correlation id.
- TimingController tc = perCorrelationId._tc;
- int expected = perCorrelationId._expectedCount;
-
- // Calculate how many messages were actually received in the last batch. This will be the batch size
- // except where the number expected is not a multiple of the batch size and this is the first remaining
- // count to cross a batch size boundary, in which case it will be the number expected modulo the batch
- // size.
- int receivedInBatch = ((expected - remainingCount) < _batchSize) ? (expected % _batchSize) : _batchSize;
-
- // Register a test result for the correlation id.
- try
- {
- tc.completeTest(true, receivedInBatch, latency);
- }
- catch (InterruptedException e)
- {
- // Ignore this. It means the test runner wants to stop as soon as possible.
- _logger.warn("Got InterruptedException.", e);
- }
- }
- // Else ignore, test timed out. Should log a fail here?
- }
- }
- }
-
- /**
- * Holds state specific to each correlation id, needed to output test results. This consists of the count of the
- * total expected number of messages, and the timing controller for the thread sending those message ids.
- */
- private static class PerCorrelationId
- {
- public int _expectedCount;
- public TimingController _tc;
- }
-}
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/ping/PingSendOnlyClient.java b/qpid/java/perftests/src/main/java/org/apache/qpid/ping/PingSendOnlyClient.java
deleted file mode 100644
index 2fe852af77..0000000000
--- a/qpid/java/perftests/src/main/java/org/apache/qpid/ping/PingSendOnlyClient.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.qpid.ping;
-
-import java.util.Properties;
-
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.ObjectMessage;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.client.message.TestMessageFactory;
-import org.apache.qpid.util.CommandLineParser;
-
-/**
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * </table>
- */
-public class PingSendOnlyClient extends PingDurableClient
-{
- private static final Logger log = Logger.getLogger(PingSendOnlyClient.class);
-
- public PingSendOnlyClient(Properties overrides) throws Exception
- {
- super(overrides);
- }
-
- /**
- * Starts the ping/wait/receive process.
- *
- * @param args The command line arguments.
- */
- public static void main(String[] args)
- {
- try
- {
- // Create a ping producer overriding its defaults with all options passed on the command line.
- Properties options = CommandLineParser.processCommandLine(args, new CommandLineParser(new String[][] {}), System.getProperties());
- PingSendOnlyClient pingProducer = new PingSendOnlyClient(options);
-
- // Create a shutdown hook to terminate the ping-pong producer.
- Runtime.getRuntime().addShutdownHook(pingProducer.getShutdownHook());
-
- // Ensure that the ping pong producer is registered to listen for exceptions on the connection too.
- // pingProducer.getConnection().setExceptionListener(pingProducer);
-
- // Run the test procedure.
- pingProducer.send();
- pingProducer.waitForUser("Press return to close connection and quit.");
- pingProducer.closeConnection();
-
- System.exit(0);
- }
- catch (Exception e)
- {
- System.err.println(e.getMessage());
- log.error("Top level handler caught execption.", e);
- System.exit(1);
- }
- }
-
- public Message getTestMessage(Destination replyQueue, int messageSize, boolean persistent) throws JMSException
- {
- Message msg = TestMessageFactory.newTextMessage(_producerSession, messageSize);
-
- // Timestamp the message in nanoseconds.
- msg.setLongProperty(MESSAGE_TIMESTAMP_PROPNAME, System.nanoTime());
-
- return msg;
- }
-}
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/ping/PingTestPerf.java b/qpid/java/perftests/src/main/java/org/apache/qpid/ping/PingTestPerf.java
deleted file mode 100644
index cf16abc596..0000000000
--- a/qpid/java/perftests/src/main/java/org/apache/qpid/ping/PingTestPerf.java
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.ping;
-
-import junit.framework.Assert;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.requestreply.PingPongProducer;
-
-import org.apache.qpid.junit.extensions.AsymptoticTestCase;
-import org.apache.qpid.junit.extensions.TestThreadAware;
-import org.apache.qpid.junit.extensions.util.ParsedProperties;
-import org.apache.qpid.junit.extensions.util.TestContextProperties;
-
-import javax.jms.*;
-
-/**
- * PingTestPerf is a ping test, that has been written with the intention of being scaled up to run many times
- * simultaneously to simluate many clients/producers/connections.
- *
- * <p/>A single run of the test using the default JUnit test runner will result in the sending and timing of a single
- * full round trip ping. This test may be scaled up using a suitable JUnit test runner.
- *
- * <p/>The setup/teardown cycle establishes a connection to a broker and sets up a queue to send ping messages to and a
- * temporary queue for replies. This setup is only established once for all the test repeats/threads that may be run,
- * except if the connection is lost in which case an attempt to re-establish the setup is made.
- *
- * <p/>The test cycle is: Connects to a queue, creates a temporary queue, creates messages containing a property that
- * is the name of the temporary queue, fires off a message on the original queue and waits for a response on the
- * temporary queue.
- *
- * <p/>Configurable test properties: message size, transacted or not, persistent or not. Broker connection details.
- *
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * </table>
- */
-public class PingTestPerf extends AsymptoticTestCase implements TestThreadAware
-{
- private static Logger _logger = Logger.getLogger(PingTestPerf.class);
-
- /** Thread local to hold the per-thread test setup fields. */
- ThreadLocal<PerThreadSetup> threadSetup = new ThreadLocal<PerThreadSetup>();
-
- /** Holds a property reader to extract the test parameters from. */
- protected ParsedProperties testParameters =
- TestContextProperties.getInstance(PingPongProducer.defaults /*System.getProperties()*/);
-
- public PingTestPerf(String name)
- {
- super(name);
-
- _logger.debug("testParameters = " + testParameters);
- }
-
- /**
- * Compile all the tests into a test suite.
- * @return The test method testPingOk.
- */
- public static Test suite()
- {
- // Build a new test suite
- TestSuite suite = new TestSuite("Ping Performance Tests");
-
- // Run performance tests in read committed mode.
- suite.addTest(new PingTestPerf("testPingOk"));
-
- return suite;
- }
-
- public void testPingOk(int numPings) throws Exception
- {
- if (numPings == 0)
- {
- Assert.fail("Number of pings requested was zero.");
- }
-
- // Get the per thread test setup to run the test through.
- PerThreadSetup perThreadSetup = threadSetup.get();
-
- if (perThreadSetup == null)
- {
- Assert.fail("Could not get per thread test setup, it was null.");
- }
-
- // Generate a sample message. This message is already time stamped and has its reply-to destination set.
- Message msg =
- perThreadSetup._pingClient.getTestMessage(perThreadSetup._pingClient.getReplyDestinations().get(0),
- testParameters.getPropertyAsInteger(PingPongProducer.MESSAGE_SIZE_PROPNAME),
- testParameters.getPropertyAsBoolean(PingPongProducer.PERSISTENT_MODE_PROPNAME));
-
- // start the test
- long timeout = Long.parseLong(testParameters.getProperty(PingPongProducer.TIMEOUT_PROPNAME));
- int numReplies = perThreadSetup._pingClient.pingAndWaitForReply(msg, numPings, timeout, null);
-
- // Fail the test if the timeout was exceeded.
- if (numReplies != perThreadSetup._pingClient.getExpectedNumPings(numPings))
- {
- Assert.fail("The ping timed out after " + timeout + " ms. Messages Sent = " + numPings + ", MessagesReceived = "
- + numReplies);
- }
- }
-
- /** Performs test fixture creation on a per thread basis. This will only be called once for each test thread. */
- public void threadSetUp()
- {
- _logger.debug("public void threadSetUp(): called");
-
- try
- {
- PerThreadSetup perThreadSetup = new PerThreadSetup();
-
- // This is synchronized because there is a race condition, which causes one connection to sleep if
- // all threads try to create connection concurrently.
- synchronized (this)
- {
- // Establish a client to ping a Destination and listen the reply back from same Destination
- perThreadSetup._pingClient = new PingClient(testParameters);
- perThreadSetup._pingClient.establishConnection(true, true);
- }
-
- // Attach the per-thread set to the thread.
- threadSetup.set(perThreadSetup);
- }
- catch (Exception e)
- {
- _logger.warn("There was an exception during per thread setup.", e);
- }
- }
-
- /**
- * Called after all threads have completed their setup.
- */
- public void postThreadSetUp()
- {
- _logger.debug("public void postThreadSetUp(): called");
-
- PerThreadSetup perThreadSetup = threadSetup.get();
- // Prefill the broker unless we are in consume only mode.
- int preFill = testParameters.getPropertyAsInteger(PingPongProducer.PREFILL_PROPNAME);
- if (!testParameters.getPropertyAsBoolean(PingPongProducer.CONSUME_ONLY_PROPNAME) && preFill > 0)
- {
- try
- {
- // Manually set the correlation ID to 1. This is not ideal but it is the
- // value that the main test loop will use.
- perThreadSetup._pingClient.pingNoWaitForReply(null, preFill, String.valueOf(perThreadSetup._pingClient.getClientCount()));
-
- // Note with a large preFill and non-tx session the messages will be
- // rapidly pushed in to the mina buffers. OOM's are a real risk here.
- // Should perhaps consider using a TX session for the prefill.
-
- long delayBeforeConsume = testParameters.getPropertyAsLong(PingPongProducer.DELAY_BEFORE_CONSUME_PROPNAME);
-
- // Only delay if we are
- // not doing send only
- // and we have consumers
- // and a delayBeforeConsume
- if (!(testParameters.getPropertyAsBoolean(PingPongProducer.SEND_ONLY_PROPNAME))
- && (testParameters.getPropertyAsInteger(PingPongProducer.NUM_CONSUMERS_PROPNAME) > 0)
- && delayBeforeConsume > 0)
- {
-
- boolean verbose = testParameters.getPropertyAsBoolean(PingPongProducer.VERBOSE_PROPNAME);
- // Only do logging if in verbose mode.
- if (verbose)
- {
- if (delayBeforeConsume > 60000)
- {
- long minutes = delayBeforeConsume / 60000;
- long seconds = (delayBeforeConsume - (minutes * 60000)) / 1000;
- long ms = delayBeforeConsume - (minutes * 60000) - (seconds * 1000);
- _logger.info("Delaying for " + minutes + "m " + seconds + "s " + ms + "ms before starting test.");
- }
- else
- {
- _logger.info("Delaying for " + delayBeforeConsume + "ms before starting test.");
- }
- }
-
- Thread.sleep(delayBeforeConsume);
-
- if (verbose)
- {
- _logger.info("Starting Test.");
- }
- }
-
- // We can't start the client's here as the test client has not yet been configured to receieve messages.
- // only when the test method is executed will the correlationID map be set up and ready to consume
- // the messages we have sent here.
- }
- catch (Exception e)
- {
- _logger.warn("There was an exception during per thread setup.", e);
- }
- }
- else //Only start the consumer if we are not preFilling.
- {
- // Start the consumers, unless we have data on the broker
- // already this is signified by being in consume_only, we will
- // start the clients after setting up the correlation IDs.
- // We should also not start the clients if we are in Send only
- if (!testParameters.getPropertyAsBoolean(PingPongProducer.CONSUME_ONLY_PROPNAME) &&
- !(testParameters.getPropertyAsBoolean(PingPongProducer.SEND_ONLY_PROPNAME)))
- {
- // Start the client connection
- try
- {
- perThreadSetup._pingClient.start();
- }
- catch (JMSException e)
- {
- e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
- }
- }
- }
- }
-
- /**
- * Performs test fixture clean
- */
- public void threadTearDown()
- {
- _logger.debug("public void threadTearDown(): called");
-
- try
- {
- // Get the per thread test fixture.
- PerThreadSetup perThreadSetup = threadSetup.get();
-
- // Close the pingers so that it cleans up its connection cleanly.
- synchronized (this)
- {
- if ((perThreadSetup != null) && (perThreadSetup._pingClient != null))
- {
- perThreadSetup._pingClient.close();
- }
- }
- }
- catch (JMSException e)
- {
- _logger.warn("There was an exception during per thread tear down.");
- }
- finally
- {
- // Ensure the per thread fixture is reclaimed.
- threadSetup.remove();
- }
- }
-
- protected static class PerThreadSetup
- {
- /**
- * Holds the test ping client.
- */
- protected PingClient _pingClient;
- protected String _correlationId;
- }
-}
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongBouncer.java b/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongBouncer.java
deleted file mode 100644
index 8e010ccf07..0000000000
--- a/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongBouncer.java
+++ /dev/null
@@ -1,453 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.requestreply;
-
-import java.io.IOException;
-import java.net.InetAddress;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import javax.jms.*;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.client.AMQConnection;
-import org.apache.qpid.client.AMQQueue;
-import org.apache.qpid.client.AMQTopic;
-import org.apache.qpid.jms.ConnectionListener;
-import org.apache.qpid.jms.Session;
-import org.apache.qpid.topic.Config;
-import org.apache.qpid.exchange.ExchangeDefaults;
-
-/**
- * PingPongBouncer is a message listener the bounces back messages to their reply to destination. This is used to return
- * ping messages generated by {@link org.apache.qpid.requestreply.PingPongProducer} but could be used for other purposes
- * too.
- *
- * <p/>The correlation id from the received message is extracted, and placed into the reply as the correlation id. Messages
- * are bounced back to their reply-to destination. The original sender of the message has the option to use either a unique
- * temporary queue or the correlation id to correlate the original message to the reply.
- *
- * <p/>There is a verbose mode flag which causes information about each ping to be output to the console
- * (info level logging, so usually console). This can be helpfull to check the bounce backs are happening but should
- * be disabled for real timing tests as writing to the console will slow things down.
- *
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Bounce back messages to their reply to destination.
- * <tr><td> Provide command line invocation to start the bounce back on a configurable broker url.
- * </table>
- *
- * @todo Replace the command line parsing with a neater tool.
- *
- * @todo Make verbose accept a number of messages, only prints to console every X messages.
- */
-public class PingPongBouncer implements MessageListener
-{
- private static final Logger _logger = Logger.getLogger(PingPongBouncer.class);
-
- /** The default prefetch size for the message consumer. */
- private static final int PREFETCH = 1;
-
- /** The default no local flag for the message consumer. */
- private static final boolean NO_LOCAL = true;
-
- private static final String DEFAULT_DESTINATION_NAME = "ping";
-
- /** The default exclusive flag for the message consumer. */
- private static final boolean EXCLUSIVE = false;
-
- /** A convenient formatter to use when time stamping output. */
- protected static final SimpleDateFormat timestampFormatter = new SimpleDateFormat("hh:mm:ss:SS");
-
- /** Used to indicate that the reply generator should log timing info to the console (logger info level). */
- private boolean _verbose = false;
-
- /** Determines whether this bounce back client bounces back messages persistently. */
- private boolean _persistent = false;
-
- private Destination _consumerDestination;
-
- /** Keeps track of the response destination of the previous message for the last reply to producer cache. */
- private Destination _lastResponseDest;
-
- /** The producer for sending replies with. */
- private MessageProducer _replyProducer;
-
- /** The consumer controlSession. */
- private Session _consumerSession;
-
- /** The producer controlSession. */
- private Session _producerSession;
-
- /** Holds the connection to the broker. */
- private AMQConnection _connection;
-
- /** Flag used to indicate if this is a point to point or pub/sub ping client. */
- private boolean _isPubSub = false;
-
- /**
- * This flag is used to indicate that the user should be prompted to kill a broker, in order to test
- * failover, immediately before committing a transaction.
- */
- protected boolean _failBeforeCommit = false;
-
- /**
- * This flag is used to indicate that the user should be prompted to a kill a broker, in order to test
- * failover, immediate after committing a transaction.
- */
- protected boolean _failAfterCommit = false;
-
- /**
- * Creates a PingPongBouncer on the specified producer and consumer sessions.
- *
- * @param brokerDetails The addresses of the brokers to connect to.
- * @param username The broker username.
- * @param password The broker password.
- * @param virtualpath The virtual host name within the broker.
- * @param destinationName The name of the queue to receive pings on
- * (or root of the queue name where many queues are generated).
- * @param persistent A flag to indicate that persistent message should be used.
- * @param transacted A flag to indicate that pings should be sent within transactions.
- * @param selector A message selector to filter received pings with.
- * @param verbose A flag to indicate that message timings should be sent to the console.
- *
- * @throws Exception All underlying exceptions allowed to fall through. This is only test code...
- */
- public PingPongBouncer(String brokerDetails, String username, String password, String virtualpath,
- String destinationName, boolean persistent, boolean transacted, String selector, boolean verbose,
- boolean pubsub) throws Exception
- {
- // Create a client id to uniquely identify this client.
- InetAddress address = InetAddress.getLocalHost();
- String clientId = address.getHostName() + System.currentTimeMillis();
- _verbose = verbose;
- _persistent = persistent;
- setPubSub(pubsub);
- // Connect to the broker.
- setConnection(new AMQConnection(brokerDetails, username, password, clientId, virtualpath));
- _logger.info("Connected with URL:" + getConnection().toURL());
-
- // Set up the failover notifier.
- getConnection().setConnectionListener(new FailoverNotifier());
-
- // Create a controlSession to listen for messages on and one to send replies on, transactional depending on the
- // command line option.
- _consumerSession = (Session) getConnection().createSession(transacted, Session.AUTO_ACKNOWLEDGE);
- _producerSession = (Session) getConnection().createSession(transacted, Session.AUTO_ACKNOWLEDGE);
-
- // Create the queue to listen for message on.
- createConsumerDestination(destinationName);
- MessageConsumer consumer =
- _consumerSession.createConsumer(_consumerDestination, PREFETCH, NO_LOCAL, EXCLUSIVE, selector);
-
- // Create a producer for the replies, without a default destination.
- _replyProducer = _producerSession.createProducer(null);
- _replyProducer.setDisableMessageTimestamp(true);
- _replyProducer.setDeliveryMode(_persistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT);
-
- // Set this up to listen for messages on the queue.
- consumer.setMessageListener(this);
- }
-
- /**
- * Starts a stand alone ping-pong client running in verbose mode.
- *
- * @param args
- */
- public static void main(String[] args) throws Exception
- {
- System.out.println("Starting...");
-
- // Display help on the command line.
- if (args.length == 0)
- {
- _logger.info("Running test with default values...");
- //usage();
- //System.exit(0);
- }
-
- // Extract all command line parameters.
- Config config = new Config();
- config.setOptions(args);
- String brokerDetails = config.getHost() + ":" + config.getPort();
- String virtualpath = "test";
- String destinationName = config.getDestination();
- if (destinationName == null)
- {
- destinationName = DEFAULT_DESTINATION_NAME;
- }
-
- String selector = config.getSelector();
- boolean transacted = config.isTransacted();
- boolean persistent = config.usePersistentMessages();
- boolean pubsub = config.isPubSub();
- boolean verbose = true;
-
- //String selector = null;
-
- // Instantiate the ping pong client with the command line options and start it running.
- PingPongBouncer pingBouncer =
- new PingPongBouncer(brokerDetails, "guest", "guest", virtualpath, destinationName, persistent, transacted,
- selector, verbose, pubsub);
- pingBouncer.getConnection().start();
-
- System.out.println("Waiting...");
- }
-
- private static void usage()
- {
- System.err.println("Usage: PingPongBouncer \n" + "-host : broker host\n" + "-port : broker port\n"
- + "-destinationname : queue/topic name\n" + "-transacted : (true/false). Default is false\n"
- + "-persistent : (true/false). Default is false\n"
- + "-pubsub : (true/false). Default is false\n" + "-selector : selector string\n");
- }
-
- /**
- * This is a callback method that is notified of all messages for which this has been registered as a message
- * listener on a message consumer. It sends a reply (pong) to all messages it receieves on the reply to
- * destination of the message.
- *
- * @param message The message that triggered this callback.
- */
- public void onMessage(Message message)
- {
- try
- {
- String messageCorrelationId = message.getJMSCorrelationID();
- if (_verbose)
- {
- _logger.info(timestampFormatter.format(new Date()) + ": Got ping with correlation id, "
- + messageCorrelationId);
- }
-
- // Get the reply to destination from the message and check it is set.
- Destination responseDest = message.getJMSReplyTo();
-
- if (responseDest == null)
- {
- _logger.debug("Cannot send reply because reply-to destination is null.");
-
- return;
- }
-
- // Spew out some timing information if verbose mode is on.
- if (_verbose)
- {
- Long timestamp = message.getLongProperty("timestamp");
-
- if (timestamp != null)
- {
- long diff = System.currentTimeMillis() - timestamp;
- _logger.info("Time to bounce point: " + diff);
- }
- }
-
- // Correlate the reply to the original.
- message.setJMSCorrelationID(messageCorrelationId);
-
- // Send the receieved message as the pong reply.
- _replyProducer.send(responseDest, message);
-
- if (_verbose)
- {
- _logger.info(timestampFormatter.format(new Date()) + ": Sent reply with correlation id, "
- + messageCorrelationId);
- }
-
- // Commit the transaction if running in transactional mode.
- commitTx(_producerSession);
- }
- catch (JMSException e)
- {
- _logger.debug("There was a JMSException: " + e.getMessage(), e);
- }
- }
-
- /**
- * Gets the underlying connection that this ping client is running on.
- *
- * @return The underlying connection that this ping client is running on.
- */
- public AMQConnection getConnection()
- {
- return _connection;
- }
-
- /**
- * Sets the connection that this ping client is using.
- *
- * @param connection The ping connection.
- */
- public void setConnection(AMQConnection connection)
- {
- this._connection = connection;
- }
-
- /**
- * Sets or clears the pub/sub flag to indiciate whether this client is pinging a queue or a topic.
- *
- * @param pubsub <tt>true</tt> if this client is pinging a topic, <tt>false</tt> if it is pinging a queue.
- */
- public void setPubSub(boolean pubsub)
- {
- _isPubSub = pubsub;
- }
-
- /**
- * Checks whether this client is a p2p or pub/sub ping client.
- *
- * @return <tt>true</tt> if this client is pinging a topic, <tt>false</tt> if it is pinging a queue.
- */
- public boolean isPubSub()
- {
- return _isPubSub;
- }
-
- /**
- * Convenience method to commit the transaction on the specified controlSession. If the controlSession to commit on is not
- * a transactional controlSession, this method does nothing.
- *
- * <p/>If the {@link #_failBeforeCommit} flag is set, this will prompt the user to kill the broker before the
- * commit is applied. If the {@link #_failAfterCommit} flag is set, this will prompt the user to kill the broker
- * after the commit is applied.
- *
- * @throws javax.jms.JMSException If the commit fails and then the rollback fails.
- */
- protected void commitTx(Session session) throws JMSException
- {
- if (session.getTransacted())
- {
- try
- {
- if (_failBeforeCommit)
- {
- _logger.debug("Failing Before Commit");
- doFailover();
- }
-
- session.commit();
-
- if (_failAfterCommit)
- {
- _logger.debug("Failing After Commit");
- doFailover();
- }
-
- _logger.debug("Session Commited.");
- }
- catch (JMSException e)
- {
- _logger.trace("JMSException on commit:" + e.getMessage(), e);
-
- try
- {
- session.rollback();
- _logger.debug("Message rolled back.");
- }
- catch (JMSException jmse)
- {
- _logger.trace("JMSE on rollback:" + jmse.getMessage(), jmse);
-
- // Both commit and rollback failed. Throw the rollback exception.
- throw jmse;
- }
- }
- }
- }
-
- /**
- * Prompts the user to terminate the named broker, in order to test failover functionality. This method will block
- * until the user supplied some input on the terminal.
- *
- * @param broker The name of the broker to terminate.
- */
- protected void doFailover(String broker)
- {
- System.out.println("Kill Broker " + broker + " now.");
- try
- {
- System.in.read();
- }
- catch (IOException e)
- { }
-
- System.out.println("Continuing.");
- }
-
- /**
- * Prompts the user to terminate the broker, in order to test failover functionality. This method will block
- * until the user supplied some input on the terminal.
- */
- protected void doFailover()
- {
- System.out.println("Kill Broker now.");
- try
- {
- System.in.read();
- }
- catch (IOException e)
- { }
-
- System.out.println("Continuing.");
-
- }
-
- private void createConsumerDestination(String name)
- {
- if (isPubSub())
- {
- _consumerDestination = new AMQTopic(ExchangeDefaults.TOPIC_EXCHANGE_NAME, name);
- }
- else
- {
- _consumerDestination = new AMQQueue(ExchangeDefaults.DIRECT_EXCHANGE_NAME, name);
- }
- }
-
- /**
- * A connection listener that logs out any failover complete events. Could do more interesting things with this
- * at some point...
- */
- public static class FailoverNotifier implements ConnectionListener
- {
- public void bytesSent(long count)
- { }
-
- public void bytesReceived(long count)
- { }
-
- public boolean preFailover(boolean redirect)
- {
- return true;
- }
-
- public boolean preResubscribe()
- {
- return true;
- }
-
- public void failoverComplete()
- {
- _logger.info("App got failover complete callback.");
- }
- }
-}
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java b/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java
deleted file mode 100644
index 639b0c72ba..0000000000
--- a/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java
+++ /dev/null
@@ -1,1818 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.requestreply;
-
-import org.apache.log4j.Logger;
-import org.apache.log4j.NDC;
-
-import org.apache.qpid.test.framework.TestUtils;
-
-import org.apache.qpid.junit.extensions.BatchedThrottle;
-import org.apache.qpid.junit.extensions.Throttle;
-import org.apache.qpid.junit.extensions.util.CommandLineParser;
-import org.apache.qpid.junit.extensions.util.ParsedProperties;
-
-import javax.jms.*;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
-import java.io.*;
-import java.net.InetAddress;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.*;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.SynchronousQueue;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicLong;
-
-/**
- * PingPongProducer is a client that sends test messages, and waits for replies to these messages. The replies may
- * either be generated by another client (see {@link PingPongBouncer}, or an extension of it may be used that listens
- * to its own messages and does not send replies (see {@link org.apache.qpid.ping.PingClient}). The intention of ping
- * pong producer is that it is a swiss-army knife test client that makes almost every aspect of its behaviour
- * configurable.
- *
- * <p/>The pings are sent with a reply-to field set to a single temporary queue, which is the same for all pings. This
- * means that this class has to do some work to correlate pings with pongs; it expectes the original message correlation
- * id in the ping to be bounced back in the reply correlation id.
- *
- * <p/>This ping tool accepts a vast number of configuration options, all of which are passed in to the constructor. It
- * can ping topics or queues; ping multiple destinations; do persistent pings; send messages of any size; do pings within
- * transactions; control the number of pings to send in each transaction; limit its sending rate; and perform failover
- * testing. A complete list of accepted parameters, default values and comments on their usage is provided here:
- *
- * <p/><table><caption>Parameters</caption>
- * <tr><th> Parameter <th> Default <th> Comments
- * <tr><td> messageSize <td> 0 <td> Message size in bytes. Not including any headers.
- * <tr><td> destinationName <td> ping <td> The root name to use to generate destination names to ping.
- * <tr><td> persistent <td> false <td> Determines whether peristent delivery is used.
- * <tr><td> transacted <td> false <td> Determines whether messages are sent/received in transactions.
- * <tr><td> broker <td> tcp://localhost:5672 <td> Determines the broker to connect to.
- * <tr><td> virtualHost <td> test <td> Determines the virtual host to send all ping over.
- * <tr><td> rate <td> 0 <td> The maximum rate (in hertz) to send messages at. 0 means no limit.
- * <tr><td> verbose <td> false <td> The verbose flag for debugging. Prints to console on every message.
- * <tr><td> pubsub <td> false <td> Whether to ping topics or queues. Uses p2p by default.
- * <tr><td> failAfterCommit <td> false <td> Whether to prompt user to kill broker after a commit batch.
- * <tr><td> failBeforeCommit <td> false <td> Whether to prompt user to kill broker before a commit batch.
- * <tr><td> failAfterSend <td> false <td> Whether to prompt user to kill broker after a send.
- * <tr><td> failBeforeSend <td> false <td> Whether to prompt user to kill broker before a send.
- * <tr><td> failOnce <td> true <td> Whether to prompt for failover only once.
- * <tr><td> username <td> guest <td> The username to access the broker with.
- * <tr><td> password <td> guest <td> The password to access the broker with.
- * <tr><td> selector <td> null <td> Not used. Defines a message selector to filter pings with.
- * <tr><td> destinationCount <td> 1 <td> The number of destinations to send pings to.
- * <tr><td> numConsumers <td> 1 <td> The number of consumers on each destination.
- * <tr><td> timeout <td> 30000 <td> In milliseconds. The timeout to stop waiting for replies.
- * <tr><td> commitBatchSize <td> 1 <td> The number of messages per transaction in transactional mode.
- * <tr><td> uniqueDests <td> true <td> Whether each receivers only listens to one ping destination or all.
- * <tr><td> durableDests <td> false <td> Whether or not durable destinations are used.
- * <tr><td> ackMode <td> AUTO_ACK <td> The message acknowledgement mode. Possible values are:
- * 0 - SESSION_TRANSACTED
- * 1 - AUTO_ACKNOWLEDGE
- * 2 - CLIENT_ACKNOWLEDGE
- * 3 - DUPS_OK_ACKNOWLEDGE
- * 257 - NO_ACKNOWLEDGE
- * 258 - PRE_ACKNOWLEDGE
- * <tr><td> consTransacted <td> false <td> Whether or not consumers use transactions. Defaults to the same value
- * as the 'transacted' option if not seperately defined.
- * <tr><td> consAckMode <td> AUTO_ACK <td> The message acknowledgement mode for consumers. Defaults to the same
- * value as 'ackMode' if not seperately defined.
- * <tr><td> maxPending <td> 0 <td> The maximum size in bytes, of messages sent but not yet received.
- * Limits the volume of messages currently buffered on the client
- * or broker. Can help scale test clients by limiting amount of buffered
- * data to avoid out of memory errors.
- * </table>
- *
- * <p/>This implements the Runnable interface with a run method that implements an infinite ping loop. The ping loop
- * does all its work through helper methods, so that code wishing to run a ping-pong cycle is not forced to do so by
- * starting a new thread. The command line invocation does take advantage of this ping loop. A shutdown hook is also
- * registered to terminate the ping-pong loop cleanly.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Provide a ping and wait for all responses cycle.
- * <tr><td> Provide command line invocation to loop the ping cycle on a configurable broker url.
- * </table>
- *
- * @todo Use read/write lock in the onmessage, not for reading writing but to make use of a shared and exlcusive lock pair.
- * Obtain read lock on all messages, before decrementing the message count. At the end of the on message method add a
- * block that obtains the write lock for the very last message, releases any waiting producer. Means that the last
- * message waits until all other messages have been handled before releasing producers but allows messages to be
- * processed concurrently, unlike the current synchronized block.
- */
-public class PingPongProducer implements Runnable, ExceptionListener
-{
- /** Used for debugging. */
- private static final Logger log = Logger.getLogger(PingPongProducer.class);
-
- /** Holds the name of the property to determine whether of not client id is overridden at connection time. */
- public static final String OVERRIDE_CLIENT_ID_PROPNAME = "overrideClientId";
-
- /** Holds the default value of the override client id flag. */
- public static final String OVERRIDE_CLIENT_ID_DEAFULT = "false";
-
- /** Holds the name of the property to define the JNDI factory name with. */
- public static final String FACTORY_NAME_PROPNAME = "factoryName";
-
- /** Holds the default JNDI name of the connection factory. */
- public static final String FACTORY_NAME_DEAFULT = "local";
-
- /** Holds the name of the property to set the JNDI initial context properties with. */
- public static final String FILE_PROPERTIES_PROPNAME = "properties";
-
- /** Holds the default file name of the JNDI initial context properties. */
- public static final String FILE_PROPERTIES_DEAFULT = "perftests.properties";
-
- /** Holds the name of the property to get the test message size from. */
- public static final String MESSAGE_SIZE_PROPNAME = "messageSize";
-
- /** Used to set up a default message size. */
- public static final int MESSAGE_SIZE_DEAFULT = 0;
-
- /** Holds the name of the property to get the ping queue name from. */
- public static final String PING_QUEUE_NAME_PROPNAME = "destinationName";
-
- /** Holds the name of the default destination to send pings on. */
- public static final String PING_QUEUE_NAME_DEFAULT = "ping";
-
- /** Holds the name of the property to get the queue name postfix from. */
- public static final String QUEUE_NAME_POSTFIX_PROPNAME = "queueNamePostfix";
-
- /** Holds the default queue name postfix value. */
- public static final String QUEUE_NAME_POSTFIX_DEFAULT = "";
-
- /** Holds the name of the property to get the test delivery mode from. */
- public static final String PERSISTENT_MODE_PROPNAME = "persistent";
-
- /** Holds the message delivery mode to use for the test. */
- public static final boolean PERSISTENT_MODE_DEFAULT = false;
-
- /** Holds the name of the property to get the test transactional mode from. */
- public static final String TRANSACTED_PROPNAME = "transacted";
-
- /** Holds the transactional mode to use for the test. */
- public static final boolean TRANSACTED_DEFAULT = false;
-
- /** Holds the name of the property to get the test consumer transacted mode from. */
- public static final String CONSUMER_TRANSACTED_PROPNAME = "consTransacted";
-
- /** Holds the consumer transactional mode default setting. */
- public static final boolean CONSUMER_TRANSACTED_DEFAULT = false;
-
- /** Holds the name of the property to get the test broker url from. */
- public static final String BROKER_PROPNAME = "broker";
-
- /** Holds the default broker url for the test. */
- public static final String BROKER_DEFAULT = "tcp://localhost:5672";
-
- /** Holds the name of the property to get the test broker virtual path. */
- public static final String VIRTUAL_HOST_PROPNAME = "virtualHost";
-
- /** Holds the default virtual path for the test. */
- public static final String VIRTUAL_HOST_DEFAULT = "";
-
- /** Holds the name of the property to get the message rate from. */
- public static final String RATE_PROPNAME = "rate";
-
- /** Defines the default rate (in pings per second) to send pings at. 0 means as fast as possible, no restriction. */
- public static final int RATE_DEFAULT = 0;
-
- /** Holds the name of the property to get the verbose mode proeprty from. */
- public static final String VERBOSE_PROPNAME = "verbose";
-
- /** Holds the default verbose mode. */
- public static final boolean VERBOSE_DEFAULT = false;
-
- /** Holds the name of the property to get the p2p or pub/sub messaging mode from. */
- public static final String PUBSUB_PROPNAME = "pubsub";
-
- /** Holds the pub/sub mode default, true means ping a topic, false means ping a queue. */
- public static final boolean PUBSUB_DEFAULT = false;
-
- /** Holds the name of the property to get the fail after commit flag from. */
- public static final String FAIL_AFTER_COMMIT_PROPNAME = "failAfterCommit";
-
- /** Holds the default failover after commit test flag. */
- public static final boolean FAIL_AFTER_COMMIT_DEFAULT = false;
-
- /** Holds the name of the proeprty to get the fail before commit flag from. */
- public static final String FAIL_BEFORE_COMMIT_PROPNAME = "failBeforeCommit";
-
- /** Holds the default failover before commit test flag. */
- public static final boolean FAIL_BEFORE_COMMIT_DEFAULT = false;
-
- /** Holds the name of the proeprty to get the fail after send flag from. */
- public static final String FAIL_AFTER_SEND_PROPNAME = "failAfterSend";
-
- /** Holds the default failover after send test flag. */
- public static final boolean FAIL_AFTER_SEND_DEFAULT = false;
-
- /** Holds the name of the property to get the fail before send flag from. */
- public static final String FAIL_BEFORE_SEND_PROPNAME = "failBeforeSend";
-
- /** Holds the default failover before send test flag. */
- public static final boolean FAIL_BEFORE_SEND_DEFAULT = false;
-
- /** Holds the name of the property to get the fail once flag from. */
- public static final String FAIL_ONCE_PROPNAME = "failOnce";
-
- /** The default failover once flag, true means only do one failover, false means failover on every commit cycle. */
- public static final boolean FAIL_ONCE_DEFAULT = true;
-
- /** Holds the name of the property to get the broker access username from. */
- public static final String USERNAME_PROPNAME = "username";
-
- /** Holds the default broker log on username. */
- public static final String USERNAME_DEFAULT = "guest";
-
- /** Holds the name of the property to get the broker access password from. */
- public static final String PASSWORD_PROPNAME = "password";
-
- /** Holds the default broker log on password. */
- public static final String PASSWORD_DEFAULT = "guest";
-
- /** Holds the name of the proeprty to get the. */
- public static final String SELECTOR_PROPNAME = "selector";
-
- /** Holds the default message selector. */
- public static final String SELECTOR_DEFAULT = "";
-
- /** Holds the name of the property to get the destination count from. */
- public static final String DESTINATION_COUNT_PROPNAME = "destinationCount";
-
- /** Defines the default number of destinations to ping. */
- public static final int DESTINATION_COUNT_DEFAULT = 1;
-
- /** Holds the name of the property to get the number of consumers per destination from. */
- public static final String NUM_CONSUMERS_PROPNAME = "numConsumers";
-
- /** Defines the default number consumers per destination. */
- public static final int NUM_CONSUMERS_DEFAULT = 1;
-
- /** Holds the name of the property to get the waiting timeout for response messages. */
- public static final String TIMEOUT_PROPNAME = "timeout";
-
- /** Default time to wait before assuming that a ping has timed out. */
- public static final long TIMEOUT_DEFAULT = 30000;
-
- /** Holds the name of the property to get the commit batch size from. */
- public static final String TX_BATCH_SIZE_PROPNAME = "commitBatchSize";
-
- /** Defines the default number of pings to send in each transaction when running transactionally. */
- public static final int TX_BATCH_SIZE_DEFAULT = 1;
-
- /** Holds the name of the property to get the unique destinations flag from. */
- public static final String UNIQUE_DESTS_PROPNAME = "uniqueDests";
-
- /** Defines the default value for the unique destinations property. */
- public static final boolean UNIQUE_DESTS_DEFAULT = true;
-
- /** Holds the name of the property to get the durable destinations flag from. */
- public static final String DURABLE_DESTS_PROPNAME = "durableDests";
-
- /** Defines the default value of the durable destinations flag. */
- public static final boolean DURABLE_DESTS_DEFAULT = false;
-
- /** Holds the name of the proeprty to get the message acknowledgement mode from. */
- public static final String ACK_MODE_PROPNAME = "ackMode";
-
- /** Defines the default message acknowledgement mode. */
- public static final int ACK_MODE_DEFAULT = Session.AUTO_ACKNOWLEDGE;
-
- /** Holds the name of the property to get the consumers message acknowledgement mode from. */
- public static final String CONSUMER_ACK_MODE_PROPNAME = "consAckMode";
-
- /** Defines the default consumers message acknowledgement mode. */
- public static final int CONSUMER_ACK_MODE_DEFAULT = Session.AUTO_ACKNOWLEDGE;
-
- /** Holds the name of the property to get the maximum pending message size setting from. */
- public static final String MAX_PENDING_PROPNAME = "maxPending";
-
- /** Defines the default value for the maximum pending message size setting. 0 means no limit. */
- public static final int MAX_PENDING_DEFAULT = 0;
-
- /** Defines the default prefetch size to use when consuming messages. */
- public static final int PREFETCH_DEFAULT = 100;
-
- /** Defines the default value of the no local flag to use when consuming messages. */
- public static final boolean NO_LOCAL_DEFAULT = false;
-
- /** Defines the default value of the exclusive flag to use when consuming messages. */
- public static final boolean EXCLUSIVE_DEFAULT = false;
-
- /** Holds the name of the property to store nanosecond timestamps in ping messages with. */
- public static final String MESSAGE_TIMESTAMP_PROPNAME = "timestamp";
-
- /** Holds the name of the property to get the number of message to prefill the broker with before starting the main test. */
- public static final String PREFILL_PROPNAME = "preFill";
-
- /** Defines the default value for the number of messages to prefill. 0,default, no messages. */
- public static final int PREFILL_DEFAULT = 0;
-
- /** Holds the name of the property to get the delay to wait in ms before starting the main test after having prefilled. */
- public static final String DELAY_BEFORE_CONSUME_PROPNAME = "delayBeforeConsume";
-
- /** Defines the default value for delay in ms to wait before starting thet test run. 0,default, no delay. */
- public static final long DELAY_BEFORE_CONSUME = 0;
-
- /** Holds the name of the property to get when no messasges should be sent. */
- public static final String CONSUME_ONLY_PROPNAME = "consumeOnly";
-
- /** Defines the default value of the consumeOnly flag to use when publishing messages is not desired. */
- public static final boolean CONSUME_ONLY_DEFAULT = false;
-
- /** Holds the name of the property to get when no messasges should be sent. */
- public static final String SEND_ONLY_PROPNAME = "sendOnly";
-
- /** Defines the default value of the consumeOnly flag to use when publishing messages is not desired. */
- public static final boolean SEND_ONLY_DEFAULT = false;
-
- /** Holds the default configuration properties. */
- public static ParsedProperties defaults = new ParsedProperties();
-
- static
- {
- defaults.setPropertyIfNull(OVERRIDE_CLIENT_ID_PROPNAME, OVERRIDE_CLIENT_ID_DEAFULT);
- defaults.setPropertyIfNull(FILE_PROPERTIES_PROPNAME, FILE_PROPERTIES_DEAFULT);
- defaults.setPropertyIfNull(FACTORY_NAME_PROPNAME, FACTORY_NAME_DEAFULT);
- defaults.setPropertyIfNull(BROKER_PROPNAME, BROKER_DEFAULT);
- defaults.setPropertyIfNull(USERNAME_PROPNAME, USERNAME_DEFAULT);
- defaults.setPropertyIfNull(PASSWORD_PROPNAME, PASSWORD_DEFAULT);
- defaults.setPropertyIfNull(VIRTUAL_HOST_PROPNAME, VIRTUAL_HOST_DEFAULT);
- defaults.setPropertyIfNull(PING_QUEUE_NAME_PROPNAME, PING_QUEUE_NAME_DEFAULT);
- defaults.setPropertyIfNull(QUEUE_NAME_POSTFIX_PROPNAME, QUEUE_NAME_POSTFIX_DEFAULT);
- defaults.setPropertyIfNull(SELECTOR_PROPNAME, SELECTOR_DEFAULT);
- defaults.setPropertyIfNull(TRANSACTED_PROPNAME, TRANSACTED_DEFAULT);
- defaults.setPropertyIfNull(CONSUMER_TRANSACTED_PROPNAME, CONSUMER_TRANSACTED_DEFAULT);
- defaults.setPropertyIfNull(PERSISTENT_MODE_PROPNAME, PERSISTENT_MODE_DEFAULT);
- defaults.setPropertyIfNull(ACK_MODE_PROPNAME, ACK_MODE_DEFAULT);
- defaults.setPropertyIfNull(CONSUMER_ACK_MODE_PROPNAME, CONSUMER_ACK_MODE_DEFAULT);
- defaults.setPropertyIfNull(MESSAGE_SIZE_PROPNAME, MESSAGE_SIZE_DEAFULT);
- defaults.setPropertyIfNull(VERBOSE_PROPNAME, VERBOSE_DEFAULT);
- defaults.setPropertyIfNull(PUBSUB_PROPNAME, PUBSUB_DEFAULT);
- defaults.setPropertyIfNull(UNIQUE_DESTS_PROPNAME, UNIQUE_DESTS_DEFAULT);
- defaults.setPropertyIfNull(DURABLE_DESTS_PROPNAME, DURABLE_DESTS_DEFAULT);
- defaults.setPropertyIfNull(FAIL_BEFORE_COMMIT_PROPNAME, FAIL_BEFORE_COMMIT_DEFAULT);
- defaults.setPropertyIfNull(FAIL_AFTER_COMMIT_PROPNAME, FAIL_AFTER_COMMIT_DEFAULT);
- defaults.setPropertyIfNull(FAIL_BEFORE_SEND_PROPNAME, FAIL_BEFORE_SEND_DEFAULT);
- defaults.setPropertyIfNull(FAIL_AFTER_SEND_PROPNAME, FAIL_AFTER_SEND_DEFAULT);
- defaults.setPropertyIfNull(FAIL_ONCE_PROPNAME, FAIL_ONCE_DEFAULT);
- defaults.setPropertyIfNull(TX_BATCH_SIZE_PROPNAME, TX_BATCH_SIZE_DEFAULT);
- defaults.setPropertyIfNull(DESTINATION_COUNT_PROPNAME, DESTINATION_COUNT_DEFAULT);
- defaults.setPropertyIfNull(NUM_CONSUMERS_PROPNAME, NUM_CONSUMERS_DEFAULT);
- defaults.setPropertyIfNull(RATE_PROPNAME, RATE_DEFAULT);
- defaults.setPropertyIfNull(TIMEOUT_PROPNAME, TIMEOUT_DEFAULT);
- defaults.setPropertyIfNull(MAX_PENDING_PROPNAME, MAX_PENDING_DEFAULT);
- defaults.setPropertyIfNull(PREFILL_PROPNAME, PREFILL_DEFAULT);
- defaults.setPropertyIfNull(DELAY_BEFORE_CONSUME_PROPNAME, DELAY_BEFORE_CONSUME);
- defaults.setPropertyIfNull(CONSUME_ONLY_PROPNAME, CONSUME_ONLY_DEFAULT);
- defaults.setPropertyIfNull(SEND_ONLY_PROPNAME, SEND_ONLY_DEFAULT);
- }
-
- /** Allows setting of client ID on the connection, rather than through the connection URL. */
- protected boolean _overrideClientId;
-
- /** Holds the JNDI name of the JMS connection factory. */
- protected String _factoryName;
-
- /** Holds the name of the properties file to configure JNDI with. */
- protected String _fileProperties;
-
- /** Holds the broker url. */
- protected String _brokerDetails;
-
- /** Holds the username to access the broker with. */
- protected String _username;
-
- /** Holds the password to access the broker with. */
- protected String _password;
-
- /** Holds the virtual host on the broker to run the tests through. */
- protected String _virtualpath;
-
- /** Holds the root name from which to generate test destination names. */
- protected String _destinationName;
-
- /** Holds the default queue name postfix value. */
- protected String _queueNamePostfix;
-
- /** Holds the message selector to filter the pings with. */
- protected String _selector;
-
- /** Holds the producers transactional mode flag. */
- protected boolean _transacted;
-
- /** Holds the consumers transactional mode flag. */
- protected boolean _consTransacted;
-
- /** Determines whether this producer sends persistent messages. */
- protected boolean _persistent;
-
- /** Holds the acknowledgement mode used for the producers. */
- protected int _ackMode;
-
- /** Holds the acknowledgement mode setting for the consumers. */
- protected int _consAckMode;
-
- /** Determines what size of messages this producer sends. */
- protected int _messageSize;
-
- /** Used to indicate that the ping loop should print out whenever it pings. */
- protected boolean _verbose;
-
- /** Flag used to indicate if this is a point to point or pub/sub ping client. */
- protected boolean _isPubSub;
-
- /** Flag used to indicate if the destinations should be unique client. */
- protected boolean _isUnique;
-
- /** Flag used to indicate that durable destination should be used. */
- protected boolean _isDurable;
-
- /** Flag used to indicate that the user should be prompted to terminate a broker, to test failover before a commit. */
- protected boolean _failBeforeCommit;
-
- /** Flag used to indicate that the user should be prompted to terminate a broker, to test failover after a commit. */
- protected boolean _failAfterCommit;
-
- /** Flag used to indicate that the user should be prompted to terminate a broker, to test failover before a send. */
- protected boolean _failBeforeSend;
-
- /** Flag used to indicate that the user should be prompted to terminate a broker, to test failover after a send. */
- protected boolean _failAfterSend;
-
- /** Flag used to indicate that failover prompting should only be done on the first commit, not on every commit. */
- protected boolean _failOnce;
-
- /** Holds the number of sends that should be performed in every transaction when using transactions. */
- protected int _txBatchSize;
-
- /** Holds the number of destinations to ping. */
- protected int _noOfDestinations;
-
- /** Holds the number of consumers per destination. */
- protected int _noOfConsumers;
-
- private int[] _consumerBatchCounts;
-
- /** Holds the maximum send rate in herz. */
- protected int _rate;
-
- /**
- * Holds the size of the maximum amount of pending data that the client should buffer, sending is suspended
- * if this limit is breached.
- */
- protected int _maxPendingSize;
-
- /**
- * Holds the number of messages to send during the setup phase, before the clients start consuming.
- */
- private Integer _preFill;
-
- /**
- * Holds the time in ms to wait after preFilling before starting thet test.
- */
- private Long _delayBeforeConsume;
-
- /**
- * Holds a boolean value of wither this test should just consume, i.e. skips
- * sending messages, but still expects to receive the specified number.
- */
- private boolean _consumeOnly;
-
- /**
- * Holds a boolean value of wither this test should just send, i.e. skips
- * consuming messages, but still creates clients just doesn't start them.
- */
- private boolean _sendOnly;
-
-
- /** A source for providing sequential unique correlation ids. These will be unique within the same JVM. */
- private static AtomicLong _correlationIdGenerator = new AtomicLong(0L);
-
- /** A source for providing sequential unqiue ids for instances of this class to be identifed with. */
- private static AtomicInteger _instanceIdGenerator = new AtomicInteger(0);
-
- /** Holds this instances unique id. */
- private int instanceId;
-
- /**
- * Holds a map from message ids to latches on which threads wait for replies. This map is shared accross multiple
- * ping producers on the same JVM.
- */
- private static Map<String, PerCorrelationId> perCorrelationIds =
- Collections.synchronizedMap(new HashMap<String, PerCorrelationId>());
-
- /** A convenient formatter to use when time stamping output. */
- protected static final DateFormat timestampFormatter = new SimpleDateFormat("hh:mm:ss:SS");
-
- /** Holds the connection for the message producer. */
- protected Connection _connection;
-
- /** Holds the consumer connections. */
- protected Connection[] _consumerConnection;
-
- /** Holds the controlSession on which ping replies are received. */
- protected Session[] _consumerSession;
-
- /** Holds the producer controlSession, needed to create ping messages. */
- protected Session _producerSession;
-
- /** Holds the destination where the response messages will arrive. */
- protected Destination _replyDestination;
-
- /** Holds the set of destinations that this ping producer pings. */
- protected List<Destination> _pingDestinations;
-
- /** Used to restrict the sending rate to a specified limit. */
- protected Throttle _rateLimiter;
-
- /** Holds a message listener that this message listener chains all its messages to. */
- protected ChainedMessageListener _chainedMessageListener = null;
-
- /**
- * This id generator is used to generate ids to append to the queue name to ensure that queues can be unique when
- * creating multiple ping producers in the same JVM.
- */
- protected static AtomicInteger _queueJVMSequenceID = new AtomicInteger();
-
- /**
- * This id generator is used to generates ids that are only unique within this pinger. Creating multiple pingers
- * on the same JVM using this id generator will allow them to ping on the same queues.
- */
- protected AtomicInteger _queueSharedID = new AtomicInteger();
-
- /** Used to tell the ping loop when to terminate, it only runs while this is true. */
- protected boolean _publish = true;
-
- /** Holds the message producer to send the pings through. */
- protected MessageProducer _producer;
-
- /** Holds the message consumer to receive the ping replies through. */
- protected MessageConsumer[] _consumer;
-
- /** The prompt to display when asking the user to kill the broker for failover testing. */
- private static final String KILL_BROKER_PROMPT = "Kill broker now, then press Return.";
-
- /** Holds the name for this test client to be identified to the broker with. */
- private String _clientID;
-
- /** Keeps count of the total messages sent purely for debugging purposes. */
- private static AtomicInteger numSent = new AtomicInteger();
-
- /**
- * Holds a monitor which is used to synchronize sender and receivers threads, where the sender has elected
- * to wait until the number of unreceived message is reduced before continuing to send. This monitor is a
- * fair SynchronousQueue becuase that provides fair scheduling, to ensure that all producer threads get an
- * equal chance to produce messages.
- */
- static final SynchronousQueue _sendPauseMonitor = new SynchronousQueue(true);
-
- /** Keeps a count of the number of message currently sent but not received. */
- static AtomicInteger _unreceived = new AtomicInteger(0);
-
- /**
- * Creates a ping producer with the specified parameters, of which there are many. See the class level comments
- * for details. This constructor creates a connection to the broker and creates producer and consumer sessions on
- * it, to send and recieve its pings and replies on.
- *
- * @param overrides Properties containing any desired overrides to the defaults.
- *
- * @throws Exception Any exceptions are allowed to fall through.
- */
- public PingPongProducer(Properties overrides) throws Exception
- {
- // log.debug("public PingPongProducer(Properties overrides = " + overrides + "): called");
- instanceId = _instanceIdGenerator.getAndIncrement();
-
- // Create a set of parsed properties from the defaults overriden by the passed in values.
- ParsedProperties properties = new ParsedProperties(defaults);
- properties.putAll(overrides);
-
- // Extract the configuration properties to set the pinger up with.
- _overrideClientId = properties.getPropertyAsBoolean(OVERRIDE_CLIENT_ID_PROPNAME);
- _factoryName = properties.getProperty(FACTORY_NAME_PROPNAME);
- _fileProperties = properties.getProperty(FILE_PROPERTIES_PROPNAME);
- _brokerDetails = properties.getProperty(BROKER_PROPNAME);
- _username = properties.getProperty(USERNAME_PROPNAME);
- _password = properties.getProperty(PASSWORD_PROPNAME);
- _virtualpath = properties.getProperty(VIRTUAL_HOST_PROPNAME);
- _destinationName = properties.getProperty(PING_QUEUE_NAME_PROPNAME);
- _queueNamePostfix = properties.getProperty(QUEUE_NAME_POSTFIX_PROPNAME);
- _selector = properties.getProperty(SELECTOR_PROPNAME);
- _transacted = properties.getPropertyAsBoolean(TRANSACTED_PROPNAME);
- _consTransacted = properties.getPropertyAsBoolean(CONSUMER_TRANSACTED_PROPNAME);
- _persistent = properties.getPropertyAsBoolean(PERSISTENT_MODE_PROPNAME);
- _messageSize = properties.getPropertyAsInteger(MESSAGE_SIZE_PROPNAME);
- _verbose = properties.getPropertyAsBoolean(VERBOSE_PROPNAME);
- _failAfterCommit = properties.getPropertyAsBoolean(FAIL_AFTER_COMMIT_PROPNAME);
- _failBeforeCommit = properties.getPropertyAsBoolean(FAIL_BEFORE_COMMIT_PROPNAME);
- _failAfterSend = properties.getPropertyAsBoolean(FAIL_AFTER_SEND_PROPNAME);
- _failBeforeSend = properties.getPropertyAsBoolean(FAIL_BEFORE_SEND_PROPNAME);
- _failOnce = properties.getPropertyAsBoolean(FAIL_ONCE_PROPNAME);
- _txBatchSize = properties.getPropertyAsInteger(TX_BATCH_SIZE_PROPNAME);
- _noOfDestinations = properties.getPropertyAsInteger(DESTINATION_COUNT_PROPNAME);
- _noOfConsumers = properties.getPropertyAsInteger(NUM_CONSUMERS_PROPNAME);
- _consumerBatchCounts = new int[_noOfConsumers];
- _rate = properties.getPropertyAsInteger(RATE_PROPNAME);
- _isPubSub = properties.getPropertyAsBoolean(PUBSUB_PROPNAME);
- _isUnique = properties.getPropertyAsBoolean(UNIQUE_DESTS_PROPNAME);
- _isDurable = properties.getPropertyAsBoolean(DURABLE_DESTS_PROPNAME);
- _ackMode = _transacted ? 0 : properties.getPropertyAsInteger(ACK_MODE_PROPNAME);
- _consAckMode = _consTransacted ? 0 : properties.getPropertyAsInteger(CONSUMER_ACK_MODE_PROPNAME);
- _maxPendingSize = properties.getPropertyAsInteger(MAX_PENDING_PROPNAME);
- _preFill = properties.getPropertyAsInteger(PREFILL_PROPNAME);
- _delayBeforeConsume = properties.getPropertyAsLong(DELAY_BEFORE_CONSUME_PROPNAME);
- _consumeOnly = properties.getPropertyAsBoolean(CONSUME_ONLY_PROPNAME);
- _sendOnly = properties.getPropertyAsBoolean(SEND_ONLY_PROPNAME);
-
- // Check that one or more destinations were specified.
- if (_noOfDestinations < 1)
- {
- throw new IllegalArgumentException("There must be at least one destination.");
- }
-
- // Set up a throttle to control the send rate, if a rate > 0 is specified.
- if (_rate > 0)
- {
- _rateLimiter = new BatchedThrottle();
- _rateLimiter.setRate(_rate);
- }
-
- // Create the connection and message producers/consumers.
- // establishConnection(true, true);
- }
-
- /**
- * Establishes a connection to the broker and creates message consumers and producers based on the parameters
- * that this ping client was created with.
- *
- * @param producer Flag to indicate whether or not the producer should be set up.
- * @param consumer Flag to indicate whether or not the consumers should be set up.
- *
- * @throws Exception Any exceptions are allowed to fall through.
- */
- public void establishConnection(boolean producer, boolean consumer) throws Exception
- {
- // log.debug("public void establishConnection(): called");
-
- // Generate a unique identifying name for this client, based on it ip address and the current time.
- InetAddress address = InetAddress.getLocalHost();
- // _clientID = address.getHostName() + System.currentTimeMillis();
- _clientID = "perftest_" + instanceId;
-
- // Create a connection to the broker.
- createConnection(_clientID);
-
- // Create transactional or non-transactional sessions, based on the command line arguments.
- _producerSession = _connection.createSession(_transacted, _ackMode);
-
- _consumerSession = new Session[_noOfConsumers];
-
- for (int i = 0; i < _noOfConsumers; i++)
- {
- _consumerSession[i] = _consumerConnection[i].createSession(_consTransacted, _consAckMode);
- }
-
- // Create the destinations to send pings to and receive replies from.
- if (_noOfConsumers > 0)
- {
- _replyDestination = _consumerSession[0].createTemporaryQueue();
- }
- createPingDestinations(_noOfDestinations, _selector, _destinationName, _isUnique, _isDurable);
-
- // Create the message producer only if instructed to.
- if (producer)
- {
- createProducer();
- }
-
- // Create the message consumer only if instructed to.
- if (consumer)
- {
- createReplyConsumers(getReplyDestinations(), _selector);
- }
- }
-
- /**
- * Establishes a connection to the broker, based on the configuration parameters that this ping client was
- * created with.
- *
- * @param clientID The clients identifier.
- *
- * @throws JMSException Underlying exceptions allowed to fall through.
- * @throws NamingException Underlying exceptions allowed to fall through.
- * @throws IOException Underlying exceptions allowed to fall through.
- */
- protected void createConnection(String clientID) throws JMSException, NamingException, IOException
- {
- // _log.debug("protected void createConnection(String clientID = " + clientID + "): called");
-
- // _log.debug("Creating a connection for the message producer.");
- File propsFile = new File(_fileProperties);
- InputStream is = new FileInputStream(propsFile);
- Properties properties = new Properties();
- properties.load(is);
-
- Context context = new InitialContext(properties);
- ConnectionFactory factory = (ConnectionFactory) context.lookup(_factoryName);
- _connection = factory.createConnection(_username, _password);
-
- if (_overrideClientId)
- {
- _connection.setClientID(clientID);
- }
-
- // _log.debug("Creating " + _noOfConsumers + " connections for the consumers.");
-
- _consumerConnection = new Connection[_noOfConsumers];
-
- for (int i = 0; i < _noOfConsumers; i++)
- {
- _consumerConnection[i] = factory.createConnection(_username, _password);
- // _consumerConnection[i].setClientID(clientID);
- }
- }
-
- /**
- * Starts a ping-pong loop running from the command line. The bounce back client {@link PingPongBouncer} also needs
- * to be started to bounce the pings back again.
- *
- * @param args The command line arguments.
- */
- public static void main(String[] args)
- {
- try
- {
- Properties options =
- CommandLineParser.processCommandLine(args, new CommandLineParser(new String[][] {}), System.getProperties());
-
- // Create a ping producer overriding its defaults with all options passed on the command line.
- PingPongProducer pingProducer = new PingPongProducer(options);
- pingProducer.establishConnection(true, true);
-
- // Start the ping producers dispatch thread running.
- pingProducer._connection.start();
-
- // Create a shutdown hook to terminate the ping-pong producer.
- Runtime.getRuntime().addShutdownHook(pingProducer.getShutdownHook());
-
- // Ensure that the ping pong producer is registered to listen for exceptions on the connection too.
- pingProducer._connection.setExceptionListener(pingProducer);
-
- // Create the ping loop thread and run it until it is terminated by the shutdown hook or exception.
- Thread pingThread = new Thread(pingProducer);
- pingThread.run();
- pingThread.join();
- }
- catch (Exception e)
- {
- System.err.println(e.getMessage());
- log.error("Top level handler caught execption.", e);
- System.exit(1);
- }
- }
-
- /**
- * Convenience method for a short pause.
- *
- * @param sleepTime The time in milliseconds to pause for.
- */
- public static void pause(long sleepTime)
- {
- if (sleepTime > 0)
- {
- try
- {
- Thread.sleep(sleepTime);
- }
- catch (InterruptedException ie)
- { }
- }
- }
-
- /**
- * Gets all the reply destinations (to listen for replies on). In this case this will just be the single reply to
- * destination of this pinger.
- *
- * @return The single reply to destination of this pinger, wrapped in a list.
- */
- public List<Destination> getReplyDestinations()
- {
- // log.debug("public List<Destination> getReplyDestinations(): called");
-
- List<Destination> replyDestinations = new ArrayList<Destination>();
- replyDestinations.add(_replyDestination);
-
- // log.debug("replyDestinations = " + replyDestinations);
-
- return replyDestinations;
- }
-
- /**
- * Creates the producer to send the pings on. This is created without a default destination. Its persistent delivery
- * flag is set accoring the ping producer creation options.
- *
- * @throws JMSException Any JMSExceptions are allowed to fall through.
- */
- public void createProducer() throws JMSException
- {
- // log.debug("public void createProducer(): called");
-
- _producer = (MessageProducer) _producerSession.createProducer(null);
- _producer.setDeliveryMode(_persistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT);
-
- // log.debug("Created producer for " + (_persistent ? "persistent" : "non-persistent") + " messages.");
- }
-
- /**
- * Creates consumers for the specified number of destinations. The destinations themselves are also created by this
- * method.
- *
- * @param noOfDestinations The number of destinations to create consumers for.
- * @param selector The message selector to filter the consumers with.
- * @param rootName The root of the name, or actual name if only one is being created.
- * @param unique <tt>true</tt> to make the destinations unique to this pinger, <tt>false</tt> to share the
- * numbering with all pingers on the same JVM.
- * @param durable If the destinations are durable topics.
- *
- * @throws JMSException Any JMSExceptions are allowed to fall through.
- */
- public void createPingDestinations(int noOfDestinations, String selector, String rootName, boolean unique,
- boolean durable) throws JMSException
- {
- /*log.debug("public void createPingDestinations(int noOfDestinations = " + noOfDestinations + ", String selector = "
- + selector + ", String rootName = " + rootName + ", boolean unique = " + unique + ", boolean durable = "
- + durable + "): called");*/
-
- _pingDestinations = new ArrayList<Destination>();
-
- // Create the desired number of ping destinations and consumers for them.
- // log.debug("Creating " + noOfDestinations + " destinations to ping.");
-
- for (int i = 0; i < noOfDestinations; i++)
- {
- Destination destination;
- String id;
-
- // Generate an id, unique within this pinger or to the whole JVM depending on the unique flag.
- if (unique)
- {
- // log.debug("Creating unique destinations.");
- id = "_" + _queueJVMSequenceID.incrementAndGet() + "_" + _connection.getClientID();
- }
- else
- {
- // log.debug("Creating shared destinations.");
- id = "_" + _queueSharedID.incrementAndGet();
- }
-
- // Check if this is a pub/sub pinger, in which case create topics.
- if (_isPubSub)
- {
- destination = _producerSession.createTopic(rootName + id);
- // log.debug("Created non-durable topic " + destination);
-
- if (durable)
- {
- _producerSession.createDurableSubscriber((Topic) destination, _connection.getClientID());
- }
- }
- // Otherwise this is a p2p pinger, in which case create queues.
- else
- {
- destination = _producerSession.createQueue(rootName + id + _queueNamePostfix);
- // log.debug("Created queue " + destination);
- }
-
- // Keep the destination.
- _pingDestinations.add(destination);
- }
- }
-
- /**
- * Creates consumers for the specified destinations and registers this pinger to listen to their messages.
- *
- * @param destinations The destinations to listen to.
- * @param selector A selector to filter the messages with.
- *
- * @throws javax.jms.JMSException Any JMSExceptions are allowed to fall through.
- */
- public void createReplyConsumers(Collection<Destination> destinations, String selector) throws JMSException
- {
- /*log.debug("public void createReplyConsumers(Collection<Destination> destinations = " + destinations
- + ", String selector = " + selector + "): called");*/
-
- log.debug("There are " + destinations.size() + " destinations.");
- log.debug("Creating " + _noOfConsumers + " consumers on each destination.");
- log.debug("Total number of consumers is: " + (destinations.size() * _noOfConsumers));
-
- for (Destination destination : destinations)
- {
- _consumer = new MessageConsumer[_noOfConsumers];
-
- // If we don't have consumers then ensure we have created the
- // destination.
- if (_noOfConsumers == 0)
- {
- _producerSession.createConsumer(destination, selector,
- NO_LOCAL_DEFAULT).close();
- }
-
- for (int i = 0; i < _noOfConsumers; i++)
- {
- // Create a consumer for the destination and set this pinger to listen to its messages.
- _consumer[i] = _consumerSession[i].createConsumer(destination, selector, NO_LOCAL_DEFAULT);
-
- final int consumerNo = i;
-
- _consumer[i].setMessageListener(new MessageListener()
- {
- public void onMessage(Message message)
- {
- onMessageWithConsumerNo(message, consumerNo);
- }
- });
-
- log.debug("Set consumer " + i + " to listen to replies sent to destination: " + destination);
- }
- }
- }
-
- /**
- * Stores the received message in the replies map, then resets the boolean latch that a thread waiting for a
- * correlating reply may be waiting on. This is only done if the reply has a correlation id that is expected in the
- * replies map.
- *
- * @param message The received message.
- * @param consumerNo The consumer number within this test pinger instance.
- */
- public void onMessageWithConsumerNo(Message message, int consumerNo)
- {
- // log.debug("public void onMessageWithConsumerNo(Message message, int consumerNo = " + consumerNo + "): called");
- try
- {
- long now = System.nanoTime();
- long timestamp = getTimestamp(message);
- long pingTime = now - timestamp;
-
- // NDC.push("id" + instanceId + "/cons" + consumerNo);
-
- // Extract the messages correlation id.
- String correlationID = message.getJMSCorrelationID();
- // log.debug("correlationID = " + correlationID);
-
- // int num = message.getIntProperty("MSG_NUM");
- // log.info("Message " + num + " received.");
-
- boolean isRedelivered = message.getJMSRedelivered();
- // log.debug("isRedelivered = " + isRedelivered);
-
- if (!isRedelivered)
- {
- // Countdown on the traffic light if there is one for the matching correlation id.
- PerCorrelationId perCorrelationId = perCorrelationIds.get(correlationID);
-
- if (perCorrelationId != null)
- {
- CountDownLatch trafficLight = perCorrelationId.trafficLight;
-
- // Restart the timeout timer on every message.
- perCorrelationId.timeOutStart = System.nanoTime();
-
- // log.debug("Reply was expected, decrementing the latch for the id, " + correlationID);
-
- // Release waiting senders if there are some and using maxPending limit.
- if ((_maxPendingSize > 0))
- {
- // Decrement the count of sent but not yet received messages.
- int unreceived = _unreceived.decrementAndGet();
- int unreceivedSize =
- (unreceived * ((_messageSize == 0) ? 1 : _messageSize))
- / (_isPubSub ? getConsumersPerDestination() : 1);
-
- // log.debug("unreceived = " + unreceived);
- // log.debug("unreceivedSize = " + unreceivedSize);
-
- // synchronized (_sendPauseMonitor)
- // {
- if (unreceivedSize < _maxPendingSize)
- {
- _sendPauseMonitor.poll();
- }
- // }
- }
-
- // Decrement the countdown latch. Before this point, it is possible that two threads might enter this
- // method simultanesouly with the same correlation id. Decrementing the latch in a synchronized block
- // ensures that each thread will get a unique value for the remaining messages.
- long trueCount;
- long remainingCount;
-
- synchronized (trafficLight)
- {
- trafficLight.countDown();
-
- trueCount = trafficLight.getCount();
- remainingCount = trueCount - 1;
-
- if (++_consumerBatchCounts[consumerNo] == _txBatchSize)
- {
- _consumerBatchCounts[consumerNo] = 0;
- if (_consAckMode == 2)
- {
- // log.debug("Doing client ack for consumer " + consumerNo + ".");
- message.acknowledge();
- }
- else
- {
- // log.debug("Trying commit for consumer " + consumerNo + ".");
- commitTx(_consumerSession[consumerNo]);
- // log.info("Tx committed on consumer " + consumerNo);
- }
- }
-
- // Forward the message and remaining count to any interested chained message listener.
- if (_chainedMessageListener != null)
- {
- _chainedMessageListener.onMessage(message, (int) remainingCount, pingTime);
- }
-
- // Check if this is the last message, in which case release any waiting producers. This is done
- // after the transaction has been committed and any listeners notified.
- if (trueCount == 1)
- {
- trafficLight.countDown();
- }
- }
- }
- else
- {
- log.warn(consumerNo + " Got unexpected message with correlationId: " + correlationID);
- log.warn(consumerNo + " Map contains:" + perCorrelationIds.entrySet());
- }
- }
- else
- {
- log.warn("Got redelivered message, ignoring.");
- }
- }
- catch (Exception e)
- {
- log.warn("There was a Exception: " + e.getMessage(), e);
- }
- finally
- {
- // log.debug("public void onMessageWithConsumerNo(Message message, int consumerNo): ending");
- // NDC.clear();
- }
- }
-
- public void setupCorrelationID(String correlationId, int expectedCount)
- {
- PerCorrelationId perCorrelationId = new PerCorrelationId();
-
- // Create a count down latch to count the number of replies with. This is created before the messages are
- // sent so that the replies cannot be received before the count down is created.
- // One is added to this, so that the last reply becomes a special case. The special case is that the
- // chained message listener must be called before this sender can be unblocked, but that decrementing the
- // countdown needs to be done before the chained listener can be called.
- perCorrelationId.trafficLight = new CountDownLatch(expectedCount + 1);
-
- perCorrelationIds.put(correlationId, perCorrelationId);
- }
-
-
- /**
- * Sends the specified number of ping message and then waits for all correlating replies. If the wait times out
- * before a reply arrives, then a null reply is returned from this method. This method allows the caller to specify
- * the correlation id.
- *
- * Can be augmented through a pre-fill property (PingPongProducer.PREFILL_PROPNAME) that will populate the destination
- * with a set number of messages so the total pings sent and therefore expected will be PREFILL + numPings.
- *
- * If pre-fill is specified then the consumers will start paused to allow the prefilling to occur.
- *
- * @param message The message to send. If this is null, one is generated.
- * @param numPings The number of ping messages to send.
- * @param timeout The timeout in milliseconds.
- * @param messageCorrelationId The message correlation id. If this is null, one is generated.
- *
- * @return The number of replies received. This may be less than the number sent if the timeout terminated the wait
- * for all prematurely. If we are running in noConsumer=0 so send only mode then it will return the no msgs sent.
- *
- * @throws JMSException All underlying JMSExceptions are allowed to fall through.
- * @throws InterruptedException When interrupted by a timeout
- */
- public int pingAndWaitForReply(Message message, int numPings, long timeout, String messageCorrelationId)
- throws JMSException, InterruptedException
- {
- return pingAndWaitForReply(message, numPings, 0, timeout, messageCorrelationId);
- }
-
- public int pingAndWaitForReply(Message message, int numPings, int preFill, long timeout, String messageCorrelationId)
- throws JMSException, InterruptedException
- {
- /*log.debug("public int pingAndWaitForReply(Message message, int numPings = " + numPings + ", long timeout = "
- + timeout + ", String messageCorrelationId = " + messageCorrelationId + "): called");*/
-
- int totalPingsRequested = numPings + preFill;
-
- // Generate a unique correlation id to put on the messages before sending them, if one was not specified.
- if (messageCorrelationId == null)
- {
- messageCorrelationId = Long.toString(_correlationIdGenerator.incrementAndGet());
-
- setupCorrelationID(messageCorrelationId, getExpectedNumPings(totalPingsRequested));
- }
-
- try
- {
- // NDC.push("prod");
-
- PerCorrelationId perCorrelationId = perCorrelationIds.get(messageCorrelationId);
-
- // Set up the current time as the start time for pinging on the correlation id. This is used to determine
- // timeouts.
- perCorrelationId.timeOutStart = System.nanoTime();
-
- // Send the specifed number of messages for this test
- pingNoWaitForReply(message, numPings, messageCorrelationId);
-
- boolean timedOut;
- boolean allMessagesReceived;
- int numReplies;
-
- // We don't have a consumer so don't try and wait for the messages.
- // this does mean that if the producerSession is !TXed then we may
- // get to exit before all msgs have been received.
- //
- // Return the number of requested messages, this will let the test
- // report a pass.
- if (_noOfConsumers == 0 || _sendOnly)
- {
- return getExpectedNumPings(totalPingsRequested);
- }
-
- do
- {
- // Block the current thread until replies to all the messages are received, or it times out.
- perCorrelationId.trafficLight.await(timeout, TimeUnit.MILLISECONDS);
-
- // Work out how many replies were receieved.
- numReplies = getExpectedNumPings(totalPingsRequested) - (int) perCorrelationId.trafficLight.getCount();
-
- allMessagesReceived = numReplies == getExpectedNumPings(totalPingsRequested);
-
- // log.debug("numReplies = " + numReplies);
- // log.debug("allMessagesReceived = " + allMessagesReceived);
-
- // Recheck the timeout condition.
- long now = System.nanoTime();
- long lastMessageReceievedAt = perCorrelationId.timeOutStart;
- timedOut = (now - lastMessageReceievedAt) > (timeout * 1000000);
-
- // log.debug("now = " + now);
- // log.debug("lastMessageReceievedAt = " + lastMessageReceievedAt);
- }
- while (!timedOut && !allMessagesReceived);
-
- if ((numReplies < getExpectedNumPings(totalPingsRequested)) && _verbose)
- {
- log.info("Timed out (" + timeout + " ms) before all replies received on id, " + messageCorrelationId);
- }
- else if (_verbose)
- {
- log.info("Got all replies on id, " + messageCorrelationId);
- }
-
- // commitTx(_consumerSession);
-
- // log.debug("public int pingAndWaitForReply(Message message, int numPings, long timeout): ending");
-
- return numReplies;
- }
- // Ensure that the message countdown latch is always removed from the reply map. The reply map is long lived,
- // so will be a memory leak if this is not done.
- finally
- {
- // NDC.pop();
- perCorrelationIds.remove(messageCorrelationId);
- }
- }
-
- /**
- * Sends the specified number of ping messages and does not wait for correlating replies.
- *
- * @param message The message to send.
- * @param numPings The number of pings to send.
- * @param messageCorrelationId A correlation id to place on all messages sent.
- *
- * @throws JMSException All underlying JMSExceptions are allowed to fall through.
- */
- public void pingNoWaitForReply(Message message, int numPings, String messageCorrelationId) throws JMSException
- {
- /*log.debug("public void pingNoWaitForReply(Message message, int numPings = " + numPings
- + ", String messageCorrelationId = " + messageCorrelationId + "): called");*/
-
- // If we are runnning a consumeOnly test then don't send any messages
- if (_consumeOnly)
- {
- return;
- }
-
- if (message == null)
- {
- message = getTestMessage(getReplyDestinations().get(0), _messageSize, _persistent);
- }
-
- message.setJMSCorrelationID(messageCorrelationId);
-
- // Set up a committed flag to detect uncommitted messages at the end of the send loop. This may occurr if the
- // transaction batch size is not a factor of the number of pings. In which case an extra commit at the end is
- // needed.
- boolean committed = false;
-
- // Send all of the ping messages.
- for (int i = 0; i < numPings; i++)
- {
- // Re-timestamp the message.
- // message.setLongProperty(MESSAGE_TIMESTAMP_PROPNAME, System.nanoTime());
-
- // Send the message, passing in the message count.
- committed = sendMessage(i, message);
-
- // Spew out per message timings on every message sonly in verbose mode.
- /*if (_verbose)
- {
- log.info(timestampFormatter.format(new Date()) + ": Pinged at with correlation id, " + messageCorrelationId);
- }*/
- }
-
- // Call commit if the send loop finished before reaching a batch size boundary so there may still be uncommitted messages.
- if (!committed)
- {
- commitTx(_producerSession);
- }
- }
-
- /**
- * Sends the sepcified message, applies rate limiting and possibly commits the current transaction. The count of
- * messages sent so far must be specified and is used to round robin the ping destinations (where there are more
- * than one), and to determine if the transaction batch size has been reached and the sent messages should be
- * committed.
- *
- * @param i The count of messages sent so far in a loop of multiple calls to this send method.
- * @param message The message to send.
- *
- * @return <tt>true</tt> if the messages were committed, <tt>false</tt> otherwise.
- *
- * @throws JMSException All underlyiung JMSExceptions are allowed to fall through.
- */
- protected boolean sendMessage(int i, Message message) throws JMSException
- {
- try
- {
- NDC.push("id" + instanceId + "/prod");
-
- // log.debug("protected boolean sendMessage(int i = " + i + ", Message message): called");
- // log.debug("_txBatchSize = " + _txBatchSize);
-
- // Round robin the destinations as the messages are sent.
- Destination destination = _pingDestinations.get(i % _pingDestinations.size());
-
- // Prompt the user to kill the broker when doing failover testing.
- _failBeforeSend = waitForUserToPromptOnFailure(_failBeforeSend);
-
- // Get the test setup for the correlation id.
- String correlationID = message.getJMSCorrelationID();
- PerCorrelationId perCorrelationId = perCorrelationIds.get(correlationID);
-
- // If necessary, wait until the max pending message size comes within its limit.
- if (_maxPendingSize > 0)
- {
- synchronized (_sendPauseMonitor)
- {
- // Used to keep track of the number of times that send has to wait.
- int numWaits = 0;
-
- // The maximum number of waits before the test gives up and fails. This has been chosen to correspond with
- // the test timeout.
- int waitLimit = (int) (TIMEOUT_DEFAULT / 10000);
-
- while (true)
- {
- // Get the size estimate of sent but not yet received messages.
- int unreceived = _unreceived.get();
- int unreceivedSize =
- (unreceived * ((_messageSize == 0) ? 1 : _messageSize))
- / (_isPubSub ? getConsumersPerDestination() : 1);
-
- // log.debug("unreceived = " + unreceived);
- // log.debug("unreceivedSize = " + unreceivedSize);
- // log.debug("_maxPendingSize = " + _maxPendingSize);
-
- if (unreceivedSize > _maxPendingSize)
- {
- // log.debug("unreceived size estimate over limit = " + unreceivedSize);
-
- // Fail the test if the send has had to wait more than the maximum allowed number of times.
- if (numWaits > waitLimit)
- {
- String errorMessage =
- "Send has had to wait for the unreceivedSize (" + unreceivedSize
- + ") to come below the maxPendingSize (" + _maxPendingSize + ") more that " + waitLimit
- + " times.";
- log.warn(errorMessage);
- throw new RuntimeException(errorMessage);
- }
-
- // Wait on the send pause barrier for the limit to be re-established.
- try
- {
- long start = System.nanoTime();
- // _sendPauseMonitor.wait(10000);
- _sendPauseMonitor.offer(new Object(), 10000, TimeUnit.MILLISECONDS);
- long end = System.nanoTime();
-
- // Count the wait only if it was for > 99% of the requested wait time.
- if (((float) (end - start) / (float) (10000 * 1000000L)) > 0.99)
- {
- numWaits++;
- }
- }
- catch (InterruptedException e)
- {
- // Restore the interrupted status
- Thread.currentThread().interrupt();
- throw new RuntimeException(e);
- }
- }
- else
- {
- break;
- }
- }
- }
- }
-
- // Send the message either to its round robin destination, or its default destination.
- // int num = numSent.incrementAndGet();
- // message.setIntProperty("MSG_NUM", num);
- setTimestamp(message);
-
- if (destination == null)
- {
- _producer.send(message);
- }
- else
- {
- _producer.send(destination, message);
- }
-
- // Increase the unreceived size, this may actually happen after the message is received.
- // The unreceived size is incremented by the number of consumers that will get a copy of the message,
- // in pub/sub mode.
- if (_maxPendingSize > 0)
- {
- int newUnreceivedCount = _unreceived.addAndGet(_isPubSub ? getConsumersPerDestination() : 1);
- // log.debug("newUnreceivedCount = " + newUnreceivedCount);
- }
-
- // Apply message rate throttling if a rate limit has been set up.
- if (_rateLimiter != null)
- {
- _rateLimiter.throttle();
- }
-
- // Call commit every time the commit batch size is reached.
- boolean committed = false;
-
- // Commit on every transaction batch size boundary. Here i + 1 is the count of actual messages sent.
- if (((i + 1) % _txBatchSize) == 0)
- {
- // log.debug("Trying commit on producer session.");
- committed = commitTx(_producerSession);
- }
-
- return committed;
- }
- finally
- {
- NDC.clear();
- }
- }
-
- /**
- * If the specified fail flag is set, this method waits for the user to cause a failure and then indicate to the
- * test that the failure has occurred, before the method returns.
- *
- * @param failFlag The fail flag to test.
- *
- * @return The new value for the fail flag. If the {@link #_failOnce} flag is set, then each fail flag is only
- * used once, then reset.
- */
- private boolean waitForUserToPromptOnFailure(boolean failFlag)
- {
- if (failFlag)
- {
- if (_failOnce)
- {
- failFlag = false;
- }
-
- // log.debug("Failing Before Send");
- waitForUser(KILL_BROKER_PROMPT);
- }
-
- return failFlag;
- }
-
- /**
- * Implements a single iteration of the ping loop. This sends the number of pings specified by the transaction batch
- * size property, and waits for replies to all of them. Any errors cause the publish flag to be cleared, which will
- * terminate the pinger.
- */
- public void pingLoop()
- {
- try
- {
- // Generate a sample message and time stamp it.
- Message msg = getTestMessage(_replyDestination, _messageSize, _persistent);
- // setTimestamp(msg);
-
- // Send the message and wait for a reply.
- pingAndWaitForReply(msg, TX_BATCH_SIZE_DEFAULT, TIMEOUT_DEFAULT, null);
- }
- catch (JMSException e)
- {
- _publish = false;
- // log.debug("There was a JMSException: " + e.getMessage(), e);
- }
- catch (InterruptedException e)
- {
- _publish = false;
- // log.debug("There was an interruption: " + e.getMessage(), e);
- }
- }
-
- /**
- * Sets a chained message listener. The message listener on this pinger, chains all its messages to the one set
- * here.
- *
- * @param messageListener The chained message listener.
- */
- public void setChainedMessageListener(ChainedMessageListener messageListener)
- {
- _chainedMessageListener = messageListener;
- }
-
- /** Removes any chained message listeners from this pinger. */
- public void removeChainedMessageListener()
- {
- _chainedMessageListener = null;
- }
-
- /**
- * Generates a test message of the specified size, with the specified reply-to destination and persistence flag.
- *
- * @param replyQueue The reply-to destination for the message.
- * @param messageSize The desired size of the message in bytes.
- * @param persistent <tt>true</tt> if the message should use persistent delivery, <tt>false</tt> otherwise.
- *
- * @return A freshly generated test message.
- *
- * @throws javax.jms.JMSException All underlying JMSException are allowed to fall through.
- */
- public Message getTestMessage(Destination replyQueue, int messageSize, boolean persistent) throws JMSException
- {
- // return TestMessageFactory.newObjectMessage(_producerSession, replyQueue, messageSize, persistent);
- return TestUtils.createTestMessageOfSize(_producerSession, messageSize);
- }
-
- /**
- * Sets the current time in nanoseconds as the timestamp on the message.
- *
- * @param msg The message to timestamp.
- *
- * @throws JMSException Any JMSExceptions are allowed to fall through.
- */
- protected void setTimestamp(Message msg) throws JMSException
- {
- /*if (((AMQSession)_producerSession).isStrictAMQP())
- {
- ((AMQMessage)msg).setTimestampProperty(new AMQShortString(MESSAGE_TIMESTAMP_PROPNAME), System.nanoTime());
- }
- else
- {*/
- msg.setLongProperty(MESSAGE_TIMESTAMP_PROPNAME, System.nanoTime());
- // }
- }
-
- /**
- * Extracts the nanosecond timestamp from a message.
- *
- * @param msg The message to extract the time stamp from.
- *
- * @return The timestamp in nanos.
- *
- * @throws JMSException Any JMSExceptions are allowed to fall through.
- */
- protected long getTimestamp(Message msg) throws JMSException
- {
- /*if (((AMQSession)_producerSession).isStrictAMQP())
- {
- Long value = ((AMQMessage)msg).getTimestampProperty(new AMQShortString(MESSAGE_TIMESTAMP_PROPNAME));
-
- return (value == null) ? 0L : value;
- }
- else
- {*/
- return msg.getLongProperty(PingPongProducer.MESSAGE_TIMESTAMP_PROPNAME);
- // }
- }
-
- /**
- * Stops the ping loop by clearing the publish flag. The current loop will complete when it notices that this flag
- * has been cleared.
- */
- public void stop()
- {
- _publish = false;
- }
-
- /**
- * Starts the producer and consumer connections.
- *
- * @throws JMSException Any JMSExceptions are allowed to fall through.
- */
- public void start() throws JMSException
- {
- // log.debug("public void start(): called");
-
- _connection.start();
- // log.debug("Producer started.");
-
- for (int i = 0; i < _noOfConsumers; i++)
- {
- _consumerConnection[i].start();
- // log.debug("Consumer " + i + " started.");
- }
- }
-
- /** Implements a ping loop that repeatedly pings until the publish flag becomes false. */
- public void run()
- {
- // Keep running until the publish flag is cleared.
- while (_publish)
- {
- pingLoop();
- }
- }
-
- /**
- * Callback method, implementing ExceptionListener. This should be registered to listen for exceptions on the
- * connection, this clears the publish flag which in turn will halt the ping loop.
- *
- * @param e The exception that triggered this callback method.
- */
- public void onException(JMSException e)
- {
- // log.debug("public void onException(JMSException e = " + e + "): called", e);
- _publish = false;
- }
-
- /**
- * Gets a shutdown hook that will cleanly shut this down when it is running the ping loop. This can be registered
- * with the runtime system as a shutdown hook.
- *
- * @return A shutdown hook for the ping loop.
- */
- public Thread getShutdownHook()
- {
- return new Thread(new Runnable()
- {
- public void run()
- {
- stop();
- }
- });
- }
-
- /**
- * Closes all of the producer and consumer connections.
- *
- * @throws JMSException All JMSException are allowed to fall through.
- */
- public void close() throws JMSException
- {
- // log.debug("public void close(): called");
-
- try
- {
- if (_connection != null)
- {
- // log.debug("Before close producer connection.");
- _connection.close();
- // log.debug("Closed producer connection.");
- }
-
- for (int i = 0; i < _noOfConsumers; i++)
- {
- if (_consumerConnection[i] != null)
- {
- // log.debug("Before close consumer connection " + i + ".");
- _consumerConnection[i].close();
- // log.debug("Closed consumer connection " + i + ".");
- }
- }
- }
- finally
- {
- _connection = null;
- _producerSession = null;
- _consumerSession = null;
- _consumerConnection = null;
- _producer = null;
- _consumer = null;
- _pingDestinations = null;
- _replyDestination = null;
- }
- }
-
- /**
- * Convenience method to commit the transaction on the specified controlSession. If the controlSession to commit on is not a
- * transactional controlSession, this method does nothing (unless the failover after send flag is set).
- *
- * <p/>If the {@link #_failAfterSend} flag is set, this will prompt the user to kill the broker before the commit is
- * applied. This flag applies whether the pinger is transactional or not.
- *
- * <p/>If the {@link #_failBeforeCommit} flag is set, this will prompt the user to kill the broker before the commit
- * is applied. If the {@link #_failAfterCommit} flag is set, this will prompt the user to kill the broker after the
- * commit is applied. These flags will only apply if using a transactional pinger.
- *
- * @param session The controlSession to commit
- *
- * @return <tt>true</tt> if the controlSession was committed, <tt>false</tt> if it was not.
- *
- * @throws javax.jms.JMSException If the commit fails and then the rollback fails.
- *
- * @todo Consider moving the fail after send logic into the send method. It is confusing to have it in this commit
- * method, because commits only apply to transactional pingers, but fail after send applied to transactional and
- * non-transactional alike.
- */
- protected boolean commitTx(Session session) throws JMSException
- {
- // log.debug("protected void commitTx(Session session): called");
-
- boolean committed = false;
-
- _failAfterSend = waitForUserToPromptOnFailure(_failAfterSend);
-
- if (session.getTransacted())
- {
- // log.debug("Session is transacted.");
-
- try
- {
- _failBeforeCommit = waitForUserToPromptOnFailure(_failBeforeCommit);
-
- long start = System.nanoTime();
- session.commit();
- committed = true;
- // log.debug("Time taken to commit :" + ((System.nanoTime() - start) / 1000000f) + " ms");
-
- _failAfterCommit = waitForUserToPromptOnFailure(_failAfterCommit);
-
- // log.debug("Session Commited.");
- }
- catch (JMSException e)
- {
- // log.debug("JMSException on commit:" + e.getMessage(), e);
-
- try
- {
- session.rollback();
- // log.debug("Message rolled back.");
- }
- catch (JMSException jmse)
- {
- // log.debug("JMSE on rollback:" + jmse.getMessage(), jmse);
-
- // Both commit and rollback failed. Throw the rollback exception.
- throw jmse;
- }
- }
- }
-
- return committed;
- }
-
- /**
- * Outputs a prompt to the console and waits for the user to press return.
- *
- * @param prompt The prompt to display on the console.
- */
- public void waitForUser(String prompt)
- {
- System.out.println(prompt);
-
- try
- {
- System.in.read();
- }
- catch (IOException e)
- {
- // Ignored.
- }
-
- System.out.println("Continuing.");
- }
-
- /**
- * Gets the number of consumers that are listening to each destination in the test.
- *
- * @return int The number of consumers subscribing to each topic.
- */
- public int getConsumersPerDestination()
- {
- return _noOfConsumers;
- }
-
- /**
- * Calculates how many pings are expected to be received for the given number sent.
- *
- * Note : that if you have set noConsumers to 0 then this will also return 0
- * in the case of PubSub testing. This is correct as without consumers there
- * will be no-one to receive the sent messages so they will be unable to respond.
- *
- * @param numpings The number of pings that will be sent.
- *
- * @return The number that should be received, for the test to pass.
- */
- public int getExpectedNumPings(int numpings)
- {
- // Wow, I'm freaking sorry about this return here...
- return ((_failAfterSend || _failBeforeCommit) ? numpings - 1: numpings) *
- (_isPubSub ? getConsumersPerDestination() : 1);
- }
-
- /**
- * Defines a chained message listener interface that can be attached to this pinger. Whenever this pinger's {@link
- * PingPongProducer#onMessageWithConsumerNo} method is called, the chained listener set through the {@link
- * PingPongProducer#setChainedMessageListener} method is passed the message, and the remaining expected count of
- * messages with that correlation id.
- *
- * <p/>Provided only one pinger is producing messages with that correlation id, the chained listener will always be
- * given unique message counts. It will always be called while the producer waiting for all messages to arrive is
- * still blocked.
- */
- public static interface ChainedMessageListener
- {
- /**
- * Notifies interested listeners about message arrival and important test stats, the number of messages
- * remaining in the test, and the messages send timestamp.
- *
- * @param message The newly arrived message.
- * @param remainingCount The number of messages left to complete the test.
- * @param latency The nanosecond latency of the message.
- *
- * @throws JMSException Any JMS exceptions is allowed to fall through.
- */
- public void onMessage(Message message, int remainingCount, long latency) throws JMSException;
- }
-
- /**
- * Holds information on each correlation id. The countdown latch, the current timeout timer... More stuff to be
- * added to this: read/write lock to make onMessage more concurrent as described in class header comment.
- */
- protected static class PerCorrelationId
- {
- /** Holds a countdown on number of expected messages. */
- CountDownLatch trafficLight;
-
- /** Holds the last timestamp that the timeout was reset to. */
- Long timeOutStart;
- }
-}
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongTestPerf.java b/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongTestPerf.java
deleted file mode 100644
index 009254c612..0000000000
--- a/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongTestPerf.java
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.requestreply;
-
-import junit.framework.Assert;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.junit.extensions.AsymptoticTestCase;
-import org.apache.qpid.junit.extensions.util.ParsedProperties;
-import org.apache.qpid.junit.extensions.util.TestContextProperties;
-
-import javax.jms.*;
-
-/**
- * PingPongTestPerf is a full round trip ping test, that has been written with the intention of being scaled up to run
- * many times simultaneously to simluate many clients/producer/connections. A full round trip ping sends a message from
- * a producer to a conumer, then the consumer replies to the message on a temporary queue.
- *
- * <p/>A single run of the test using the default JUnit test runner will result in the sending and timing of the number
- * of pings specified by the test size and time how long it takes for all of these to complete. This test may be scaled
- * up using a suitable JUnit test runner. See {@link org.apache.qpid.junit.extensions.TKTestRunner} for more
- * information on how to do this.
- *
- * <p/>The setup/teardown cycle establishes a connection to a broker and sets up a queue to send ping messages to and a
- * temporary queue for replies. This setup is only established once for all the test repeats, but each test threads
- * gets its own connection/producer/consumer, this is only re-established if the connection is lost.
- *
- * <p/>The test cycle is: Connects to a queue, creates a temporary queue, creates messages containing a property that
- * is the name of the temporary queue, fires off many messages on the original queue and waits for them all to come
- * back on the temporary queue.
- *
- * <p/>Configurable test properties: message size, transacted or not, persistent or not. Broker connection details.
- *
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * </table>
- */
-public class PingPongTestPerf extends AsymptoticTestCase
-{
- private static Logger _logger = Logger.getLogger(PingPongTestPerf.class);
-
- /** Thread local to hold the per-thread test setup fields. */
- ThreadLocal<PerThreadSetup> threadSetup = new ThreadLocal<PerThreadSetup>();
-
- // Set up a property reader to extract the test parameters from. Once ContextualProperties is available in
- // the project dependencies, use it to get property overrides for configurable tests and to notify the test runner
- // of the test parameters to log with the results. It also providers some basic type parsing convenience methods.
- // private Properties testParameters = System.getProperties();
- private ParsedProperties testParameters =
- TestContextProperties.getInstance(PingPongProducer.defaults /*System.getProperties()*/);
-
- public PingPongTestPerf(String name)
- {
- super(name);
-
- _logger.debug(testParameters);
-
- // Sets up the test parameters with defaults.
- /*testParameters.setPropertyIfNull(PingPongProducer.TX_BATCH_SIZE_PROPNAME,
- Integer.toString(PingPongProducer.TX_BATCH_SIZE_DEFAULT));
- testParameters.setPropertyIfNull(PingPongProducer.MESSAGE_SIZE_PROPNAME,
- Integer.toString(PingPongProducer.MESSAGE_SIZE_DEAFULT));
- testParameters.setPropertyIfNull(PingPongProducer.PING_QUEUE_NAME_PROPNAME,
- PingPongProducer.PING_QUEUE_NAME_DEFAULT);
- testParameters.setPropertyIfNull(PingPongProducer.PERSISTENT_MODE_PROPNAME,
- Boolean.toString(PingPongProducer.PERSISTENT_MODE_DEFAULT));
- testParameters.setPropertyIfNull(PingPongProducer.TRANSACTED_PROPNAME,
- Boolean.toString(PingPongProducer.TRANSACTED_DEFAULT));
- testParameters.setPropertyIfNull(PingPongProducer.BROKER_PROPNAME, PingPongProducer.BROKER_DEFAULT);
- testParameters.setPropertyIfNull(PingPongProducer.USERNAME_PROPNAME, PingPongProducer.USERNAME_DEFAULT);
- testParameters.setPropertyIfNull(PingPongProducer.PASSWORD_PROPNAME, PingPongProducer.PASSWORD_DEFAULT);
- testParameters.setPropertyIfNull(PingPongProducer.VIRTUAL_HOST_PROPNAME, PingPongProducer.VIRTUAL_HOST_DEFAULT);
- testParameters.setPropertyIfNull(PingPongProducer.VERBOSE_PROPNAME,
- Boolean.toString(PingPongProducer.VERBOSE_DEFAULT));
- testParameters.setPropertyIfNull(PingPongProducer.RATE_PROPNAME, Integer.toString(PingPongProducer.RATE_DEFAULT));
- testParameters.setPropertyIfNull(PingPongProducer.PUBSUB_PROPNAME,
- Boolean.toString(PingPongProducer.PUBSUB_DEFAULT));
- testParameters.setPropertyIfNull(PingPongProducer.TX_BATCH_SIZE_PROPNAME,
- Integer.toString(PingPongProducer.TX_BATCH_SIZE_DEFAULT));
- testParameters.setPropertyIfNull(PingPongProducer.TIMEOUT_PROPNAME, Long.toString(PingPongProducer.TIMEOUT_DEFAULT));
- testParameters.setPropertyIfNull(PingPongProducer.DESTINATION_COUNT_PROPNAME,
- Integer.toString(PingPongProducer.DESTINATION_COUNT_DEFAULT));
- testParameters.setPropertyIfNull(PingPongProducer.FAIL_AFTER_COMMIT_PROPNAME,
- PingPongProducer.FAIL_AFTER_COMMIT_DEFAULT);
- testParameters.setPropertyIfNull(PingPongProducer.FAIL_BEFORE_COMMIT_PROPNAME,
- PingPongProducer.FAIL_BEFORE_COMMIT_DEFAULT);
- testParameters.setPropertyIfNull(PingPongProducer.FAIL_AFTER_SEND_PROPNAME,
- PingPongProducer.FAIL_AFTER_SEND_DEFAULT);
- testParameters.setPropertyIfNull(PingPongProducer.FAIL_BEFORE_SEND_PROPNAME,
- PingPongProducer.FAIL_BEFORE_SEND_DEFAULT);
- testParameters.setPropertyIfNull(PingPongProducer.FAIL_ONCE_PROPNAME, PingPongProducer.FAIL_ONCE_DEFAULT);
- testParameters.setPropertyIfNull(PingPongProducer.UNIQUE_DESTS_PROPNAME,
- Boolean.toString(PingPongProducer.UNIQUE_DESTS_DEFAULT));
- testParameters.setPropertyIfNull(PingPongProducer.ACK_MODE_PROPNAME,
- Integer.toString(PingPongProducer.ACK_MODE_DEFAULT));
- testParameters.setPropertyIfNull(PingPongProducer.PAUSE_AFTER_BATCH_PROPNAME,
- PingPongProducer.PAUSE_AFTER_BATCH_DEFAULT);*/
- }
-
- /**
- * Compile all the tests into a test suite.
- */
- public static Test suite()
- {
- // Build a new test suite
- TestSuite suite = new TestSuite("Ping-Pong Performance Tests");
-
- // Run performance tests in read committed mode.
- suite.addTest(new PingPongTestPerf("testPingPongOk"));
-
- return suite;
- }
-
- private static void setSystemPropertyIfNull(String propName, String propValue)
- {
- if (System.getProperty(propName) == null)
- {
- System.setProperty(propName, propValue);
- }
- }
-
- public void testPingPongOk(int numPings) throws Exception
- {
- // Get the per thread test setup to run the test through.
- PerThreadSetup perThreadSetup = threadSetup.get();
-
- // Generate a sample message. This message is already time stamped and has its reply-to destination set.
- Message msg =
- perThreadSetup._testPingProducer.getTestMessage(perThreadSetup._testPingProducer.getReplyDestinations().get(0),
- testParameters.getPropertyAsInteger(PingPongProducer.MESSAGE_SIZE_PROPNAME),
- testParameters.getPropertyAsBoolean(PingPongProducer.PERSISTENT_MODE_PROPNAME));
-
- // Send the message and wait for a reply.
- int numReplies =
- perThreadSetup._testPingProducer.pingAndWaitForReply(msg, numPings, PingPongProducer.TIMEOUT_DEFAULT, null);
-
- // Fail the test if the timeout was exceeded.
- if (numReplies != numPings)
- {
- Assert.fail("The ping timed out, got " + numReplies + " out of " + numPings);
- }
- }
-
- /**
- * Performs test fixture creation on a per thread basis. This will only be called once for each test thread.
- */
- public void threadSetUp()
- {
- try
- {
- PerThreadSetup perThreadSetup = new PerThreadSetup();
-
- // Extract the test set up paramaeters.
- String brokerDetails = testParameters.getProperty(PingPongProducer.BROKER_PROPNAME);
- String username = testParameters.getProperty(PingPongProducer.USERNAME_PROPNAME);
- String password = testParameters.getProperty(PingPongProducer.PASSWORD_PROPNAME);
- String virtualPath = testParameters.getProperty(PingPongProducer.VIRTUAL_HOST_PROPNAME);
- String destinationName = testParameters.getProperty(PingPongProducer.PING_QUEUE_NAME_PROPNAME);
- boolean persistent = testParameters.getPropertyAsBoolean(PingPongProducer.PERSISTENT_MODE_PROPNAME);
- boolean transacted = testParameters.getPropertyAsBoolean(PingPongProducer.TRANSACTED_PROPNAME);
- String selector = testParameters.getProperty(PingPongProducer.SELECTOR_PROPNAME);
- boolean verbose = testParameters.getPropertyAsBoolean(PingPongProducer.VERBOSE_PROPNAME);
- boolean pubsub = testParameters.getPropertyAsBoolean(PingPongProducer.PUBSUB_PROPNAME);
-
- synchronized (this)
- {
- // Establish a bounce back client on the ping queue to bounce back the pings.
- perThreadSetup._testPingBouncer =
- new PingPongBouncer(brokerDetails, username, password, virtualPath, destinationName, persistent,
- transacted, selector, verbose, pubsub);
-
- // Start the connections for client and producer running.
- perThreadSetup._testPingBouncer.getConnection().start();
-
- // Establish a ping-pong client on the ping queue to send the pings and receive replies with.
- perThreadSetup._testPingProducer = new PingPongProducer(testParameters);
- perThreadSetup._testPingProducer.establishConnection(true, true);
- perThreadSetup._testPingProducer.start();
- }
-
- // Attach the per-thread set to the thread.
- threadSetup.set(perThreadSetup);
- }
- catch (Exception e)
- {
- _logger.warn("There was an exception during per thread setup.", e);
- }
- }
-
- /**
- * Performs test fixture clean
- */
- public void threadTearDown()
- {
- _logger.debug("public void threadTearDown(): called");
-
- try
- {
- // Get the per thread test fixture.
- PerThreadSetup perThreadSetup = threadSetup.get();
-
- // Close the pingers so that it cleans up its connection cleanly.
- synchronized (this)
- {
- perThreadSetup._testPingProducer.close();
- // perThreadSetup._testPingBouncer.close();
- }
-
- // Ensure the per thread fixture is reclaimed.
- threadSetup.remove();
- }
- catch (JMSException e)
- {
- _logger.warn("There was an exception during per thread tear down.");
- }
- }
-
- protected static class PerThreadSetup
- {
- /**
- * Holds the test ping-pong producer.
- */
- private PingPongProducer _testPingProducer;
-
- /**
- * Holds the test ping client.
- */
- private PingPongBouncer _testPingBouncer;
- }
-}
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/topic/Config.java b/qpid/java/perftests/src/main/java/org/apache/qpid/topic/Config.java
deleted file mode 100644
index d5c0979399..0000000000
--- a/qpid/java/perftests/src/main/java/org/apache/qpid/topic/Config.java
+++ /dev/null
@@ -1,326 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.topic;
-
-import org.apache.qpid.client.AMQSession;
-import org.apache.qpid.config.ConnectorConfig;
-import org.apache.qpid.config.Connector;
-import org.apache.qpid.config.AbstractConfig;
-
-import javax.jms.Connection;
-
-public class Config extends AbstractConfig implements ConnectorConfig
-{
-
- private String host = "localhost";
- private int port = 5672;
- private String factory = null;
-
- private int payload = 256;
- private int messages = 1000;
- private int clients = 1;
- private int batch = 1;
- private long delay = 1;
- private int warmup;
- private int ackMode= AMQSession.NO_ACKNOWLEDGE;
- private String clientId;
- private String subscriptionId;
- private String selector;
- private String destinationName;
- private boolean persistent;
- private boolean transacted;
- private int destinationsCount;
- private int batchSize;
- private int rate;
- private boolean ispubsub;
- private long timeout;
-
- public Config()
- {
- }
-
- public int getAckMode()
- {
- return ackMode;
- }
-
- public void setPayload(int payload)
- {
- this.payload = payload;
- }
-
- public int getPayload()
- {
- return payload;
- }
-
- void setClients(int clients)
- {
- this.clients = clients;
- }
-
- int getClients()
- {
- return clients;
- }
-
- void setMessages(int messages)
- {
- this.messages = messages;
- }
-
- public int getMessages()
- {
- return messages;
- }
-
- public int getBatchSize()
- {
- return batchSize;
- }
-
- public int getRate()
- {
- return rate;
- }
-
- public int getDestinationsCount()
- {
- return destinationsCount;
- }
-
- public String getHost()
- {
- return host;
- }
-
- public void setHost(String host)
- {
- this.host = host;
- }
-
- public int getPort()
- {
- return port;
- }
-
- public String getFactory()
- {
- return factory;
- }
-
- public void setPort(int port)
- {
- this.port = port;
- }
-
- int getBatch()
- {
- return batch;
- }
-
- void setBatch(int batch)
- {
- this.batch = batch;
- }
-
- int getWarmup()
- {
- return warmup;
- }
-
- void setWarmup(int warmup)
- {
- this.warmup = warmup;
- }
-
- public long getDelay()
- {
- return delay;
- }
-
- public void setDelay(long delay)
- {
- this.delay = delay;
- }
-
- public long getTimeout()
- {
- return timeout;
- }
-
- public void setTimeout(long time)
- {
- this.timeout = time;
- }
-
- public String getClientId()
- {
- return clientId;
- }
-
- public String getSubscriptionId()
- {
- return subscriptionId;
- }
-
- public String getSelector()
- {
- return selector;
- }
-
- public String getDestination()
- {
- return destinationName;
- }
-
- public boolean usePersistentMessages()
- {
- return persistent;
- }
-
- public boolean isTransacted()
- {
- return transacted;
- }
-
- public boolean isPubSub()
- {
- return ispubsub;
- }
-
- public void setOption(String key, String value)
- {
- if("-host".equalsIgnoreCase(key))
- {
- setHost(value);
- }
- else if("-port".equalsIgnoreCase(key))
- {
- try
- {
- setPort(Integer.parseInt(value));
- }
- catch(NumberFormatException e)
- {
- throw new RuntimeException("Bad port number: " + value, e);
- }
- }
- else if("-payload".equalsIgnoreCase(key))
- {
- setPayload(parseInt("Bad payload size", value));
- }
- else if("-messages".equalsIgnoreCase(key))
- {
- setMessages(parseInt("Bad message count", value));
- }
- else if("-clients".equalsIgnoreCase(key))
- {
- setClients(parseInt("Bad client count", value));
- }
- else if("-batch".equalsIgnoreCase(key))
- {
- setBatch(parseInt("Bad batch count", value));
- }
- else if("-delay".equalsIgnoreCase(key))
- {
- setDelay(parseLong("Bad batch delay", value));
- }
- else if("-warmup".equalsIgnoreCase(key))
- {
- setWarmup(parseInt("Bad warmup count", value));
- }
- else if("-ack".equalsIgnoreCase(key))
- {
- ackMode = parseInt("Bad ack mode", value);
- }
- else if("-factory".equalsIgnoreCase(key))
- {
- factory = value;
- }
- else if("-clientId".equalsIgnoreCase(key))
- {
- clientId = value;
- }
- else if("-subscriptionId".equalsIgnoreCase(key))
- {
- subscriptionId = value;
- }
- else if("-persistent".equalsIgnoreCase(key))
- {
- persistent = "true".equalsIgnoreCase(value);
- }
- else if("-transacted".equalsIgnoreCase(key))
- {
- transacted = "true".equalsIgnoreCase(value);
- }
- else if ("-destinationscount".equalsIgnoreCase(key))
- {
- destinationsCount = parseInt("Bad destinations count", value);
- }
- else if ("-batchsize".equalsIgnoreCase(key))
- {
- batchSize = parseInt("Bad batch size", value);
- }
- else if ("-rate".equalsIgnoreCase(key))
- {
- rate = parseInt("MEssage rate", value);
- }
- else if("-pubsub".equalsIgnoreCase(key))
- {
- ispubsub = "true".equalsIgnoreCase(value);
- }
- else if("-selector".equalsIgnoreCase(key))
- {
- selector = value;
- }
- else if("-destinationname".equalsIgnoreCase(key))
- {
- destinationName = value;
- }
- else if("-timeout".equalsIgnoreCase(key))
- {
- setTimeout(parseLong("Bad timeout data", value));
- }
- else
- {
- System.out.println("Ignoring unrecognised option: " + key);
- }
- }
-
- static String getAckModeDescription(int ackMode)
- {
- switch(ackMode)
- {
- case AMQSession.NO_ACKNOWLEDGE: return "NO_ACKNOWLEDGE";
- case AMQSession.AUTO_ACKNOWLEDGE: return "AUTO_ACKNOWLEDGE";
- case AMQSession.CLIENT_ACKNOWLEDGE: return "CLIENT_ACKNOWLEDGE";
- case AMQSession.DUPS_OK_ACKNOWLEDGE: return "DUPS_OK_ACKNOWELDGE";
- case AMQSession.PRE_ACKNOWLEDGE: return "PRE_ACKNOWLEDGE";
- }
- return "AckMode=" + ackMode;
- }
-
- public Connection createConnection() throws Exception
- {
- return new Connector().createConnection(this);
- }
-}
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/topic/Listener.java b/qpid/java/perftests/src/main/java/org/apache/qpid/topic/Listener.java
deleted file mode 100644
index 6dcea42bfe..0000000000
--- a/qpid/java/perftests/src/main/java/org/apache/qpid/topic/Listener.java
+++ /dev/null
@@ -1,303 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.topic;
-
-import java.util.Random;
-
-import javax.jms.*;
-
-import org.apache.log4j.Logger;
-import org.apache.log4j.NDC;
-
-import org.apache.qpid.client.AMQConnection;
-import org.apache.qpid.client.AMQQueue;
-import org.apache.qpid.client.AMQSession;
-import org.apache.qpid.client.AMQTopic;
-import org.apache.qpid.exchange.ExchangeDefaults;
-
-/**
- * This class has not kept up to date with the topic_listener in the cpp tests. It should provide identical behaviour for
- * cross testing the java and cpp clients.
- *
- * <p/>How the cpp topic_publisher operates:
- * It publishes text messages to the default topic exchange, on virtual host "/test", on the topic "topic_control", for
- * the specified number of test messages to be sent.
- * It publishes a report request message (on same topic), with the header text field "TYPE", value "REPORT_REQUEST",
- * optionally within a transaction, and waits for the specified number of consumers to reply to this request. The
- * listeners should reply to this message on a queue named "response", on virtual host "/test", with some sort of message
- * about the number of messages received and how long it took, although the publisher never looks at the message content.
- * The publisher then send a message (on the same topic), with the header text field "TYPE", value "TERMINATION_REQUEST",
- * which the listener should close its connection and terminate upon receipt of.
- *
- * @todo I've added lots of field table types in the report message, just to check if the other end can decode them
- * correctly. Not really the right place to test this, so remove them from
- * {@link #createReportResponseMessage(String)} once a better test exists.
- */
-public class Listener implements MessageListener
-{
- private static Logger log = Logger.getLogger(Listener.class);
-
- public static final String CONTROL_TOPIC = "topic_control";
- public static final String RESPONSE_QUEUE = "response";
-
- private final Topic _topic;
- //private final Topic _control;
-
- private final Queue _response;
-
- /** Holds the connection to listen on. */
- private final Connection _connection;
-
- /** Holds the producer to send control messages on. */
- private final MessageProducer _controller;
-
- /** Holds the JMS session. */
- private final javax.jms.Session _session;
-
- /** Holds a flag to indicate that a timer has begun on the first message. Reset when report is sent. */
- private boolean init;
-
- /** Holds the count of messages received by this listener. */
- private int count;
-
- /** Used to hold the start time of the first message. */
- private long start;
- private static String clientId;
-
- Listener(Connection connection, int ackMode, String name) throws Exception
- {
- log.debug("Listener(Connection connection = " + connection + ", int ackMode = " + ackMode + ", String name = " + name
- + "): called");
-
- _connection = connection;
- _session = connection.createSession(false, ackMode);
-
- if (_session instanceof AMQSession)
- {
- _topic = new AMQTopic(ExchangeDefaults.TOPIC_EXCHANGE_NAME, CONTROL_TOPIC);
- //_control = new AMQTopic(CONTROL_TOPIC);
- _response = new AMQQueue(ExchangeDefaults.DIRECT_EXCHANGE_NAME, RESPONSE_QUEUE);
- }
- else
- {
- _topic = _session.createTopic(CONTROL_TOPIC);
- //_control = _session.createTopic(CONTROL_TOPIC);
- _response = _session.createQueue(RESPONSE_QUEUE);
- }
-
- //register for events
- if (name == null)
- {
- log.debug("Calling _factory.createTopicConsumer().setMessageListener(this)");
- createTopicConsumer().setMessageListener(this);
- }
- else
- {
- log.debug("Calling createDurableTopicConsumer(name).setMessageListener(this)");
- createDurableTopicConsumer(name).setMessageListener(this);
- }
-
- _connection.start();
-
- _controller = createControlPublisher();
- System.out.println("Waiting for messages " + Config.getAckModeDescription(ackMode)
- +
- ((name == null)
- ? "" : (" (subscribed with name " + name + " and client id " + connection.getClientID() + ")"))
- + "...");
- }
-
- public static void main(String[] argv) throws Exception
- {
- clientId = "Listener-" + System.currentTimeMillis();
-
- NDC.push(clientId);
-
- Config config = new Config();
- config.setOptions(argv);
-
- //Connection con = config.createConnection();
- Connection con =
- new AMQConnection("amqp://guest:guest@testid/test?brokerlist='" + config.getHost() + ":" + config.getPort()
- + "'");
-
- if (config.getClientId() != null)
- {
- con.setClientID(config.getClientId());
- }
-
- new Listener(con, config.getAckMode(), config.getSubscriptionId());
-
- NDC.pop();
- NDC.remove();
- }
-
- /**
- * Checks whether or not a text field on a message has the specified value.
- *
- * @param m The message to check.
- * @param fieldName The name of the field to check.
- * @param value The expected value of the field to compare with.
- *
- * @return <tt>true</tt>If the specified field has the specified value, <tt>fals</tt> otherwise.
- *
- * @throws JMSException Any JMSExceptions are allowed to fall through.
- */
- private static boolean checkTextField(Message m, String fieldName, String value) throws JMSException
- {
- log.debug("private static boolean checkTextField(Message m = " + m + ", String fieldName = " + fieldName
- + ", String value = " + value + "): called");
-
- String comp = m.getStringProperty(fieldName);
- log.debug("comp = " + comp);
-
- boolean result = (comp != null) && comp.equals(value);
- log.debug("result = " + result);
-
- return result;
- }
-
- public void onMessage(Message message)
- {
- NDC.push(clientId);
-
- log.debug("public void onMessage(Message message = " + message + "): called");
-
- if (!init)
- {
- start = System.nanoTime() / 1000000;
- count = 0;
- init = true;
- }
-
- try
- {
- if (isShutdown(message))
- {
- log.debug("Got a shutdown message.");
- shutdown();
- }
- else if (isReport(message))
- {
- log.debug("Got a report request message.");
-
- // Send the report.
- report();
- init = false;
- }
- }
- catch (JMSException e)
- {
- log.warn("There was a JMSException during onMessage.", e);
- }
- finally
- {
- NDC.pop();
- }
- }
-
- Message createReportResponseMessage(String msg) throws JMSException
- {
- Message message = _session.createTextMessage(msg);
-
- // Shove some more field table type in the message just to see if the other end can handle it.
- message.setBooleanProperty("BOOLEAN", true);
- message.setByteProperty("BYTE", (byte) 5);
- message.setDoubleProperty("DOUBLE", Math.PI);
- message.setFloatProperty("FLOAT", 1.0f);
- message.setIntProperty("INT", 1);
- message.setShortProperty("SHORT", (short) 1);
- message.setLongProperty("LONG", (long) 1827361278);
- message.setStringProperty("STRING", "hello");
-
- return message;
- }
-
- boolean isShutdown(Message m) throws JMSException
- {
- boolean result = checkTextField(m, "TYPE", "TERMINATION_REQUEST");
-
- //log.debug("isShutdown = " + result);
-
- return result;
- }
-
- boolean isReport(Message m) throws JMSException
- {
- boolean result = checkTextField(m, "TYPE", "REPORT_REQUEST");
-
- //log.debug("isReport = " + result);
-
- return result;
- }
-
- MessageConsumer createTopicConsumer() throws Exception
- {
- return _session.createConsumer(_topic);
- }
-
- MessageConsumer createDurableTopicConsumer(String name) throws Exception
- {
- return _session.createDurableSubscriber(_topic, name);
- }
-
- MessageProducer createControlPublisher() throws Exception
- {
- return _session.createProducer(_response);
- }
-
- private void shutdown()
- {
- try
- {
- _session.close();
- _connection.stop();
- _connection.close();
- }
- catch (Exception e)
- {
- e.printStackTrace(System.out);
- }
- }
-
- private void report()
- {
- log.debug("private void report(): called");
-
- try
- {
- String msg = getReport();
- _controller.send(createReportResponseMessage(msg));
- log.debug("Sent report: " + msg);
- }
- catch (Exception e)
- {
- e.printStackTrace(System.out);
- }
- }
-
- private String getReport()
- {
- long time = ((System.nanoTime() / 1000000) - start);
-
- return "Received " + count + " in " + time + "ms";
- }
-}
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/topic/MessageFactory.java b/qpid/java/perftests/src/main/java/org/apache/qpid/topic/MessageFactory.java
deleted file mode 100644
index 4efdc1cb56..0000000000
--- a/qpid/java/perftests/src/main/java/org/apache/qpid/topic/MessageFactory.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.topic;
-
-import javax.jms.*;
-
-import org.apache.qpid.client.AMQSession;
-import org.apache.qpid.client.AMQTopic;
-import org.apache.qpid.exchange.ExchangeDefaults;
-
-/**
- */
-class MessageFactory
-{
- private static final char[] DATA = "abcdefghijklmnopqrstuvwxyz".toCharArray();
-
- private final Session _session;
- private final Topic _topic;
- private final Topic _control;
- private final byte[] _payload;
-
- MessageFactory(Session session) throws JMSException
- {
- this(session, 256);
- }
-
- MessageFactory(Session session, int size) throws JMSException
- {
- _session = session;
- if (session instanceof AMQSession)
- {
- _topic = new AMQTopic(ExchangeDefaults.TOPIC_EXCHANGE_NAME, "topic_control");
- _control = new AMQTopic(ExchangeDefaults.TOPIC_EXCHANGE_NAME, "topictest.control");
- }
- else
- {
- _topic = session.createTopic("topic_control");
- _control = session.createTopic("topictest.control");
- }
-
- _payload = new byte[size];
-
- for (int i = 0; i < size; i++)
- {
- _payload[i] = (byte) DATA[i % DATA.length];
- }
- }
-
- private static boolean checkText(Message m, String s)
- {
- try
- {
- return (m instanceof TextMessage) && ((TextMessage) m).getText().equals(s);
- }
- catch (JMSException e)
- {
- e.printStackTrace(System.out);
-
- return false;
- }
- }
-
- Topic getTopic()
- {
- return _topic;
- }
-
- Message createEventMessage() throws JMSException
- {
- BytesMessage msg = _session.createBytesMessage();
- msg.writeBytes(_payload);
-
- return msg;
- }
-
- Message createShutdownMessage() throws JMSException
- {
- return _session.createTextMessage("SHUTDOWN");
- }
-
- Message createReportRequestMessage() throws JMSException
- {
- return _session.createTextMessage("REPORT");
- }
-
- Message createReportResponseMessage(String msg) throws JMSException
- {
- return _session.createTextMessage(msg);
- }
-
- boolean isShutdown(Message m)
- {
- return checkText(m, "SHUTDOWN");
- }
-
- boolean isReport(Message m)
- {
- return checkText(m, "REPORT");
- }
-
- Object getReport(Message m)
- {
- try
- {
- return ((TextMessage) m).getText();
- }
- catch (JMSException e)
- {
- e.printStackTrace(System.out);
-
- return e.toString();
- }
- }
-
- MessageConsumer createTopicConsumer() throws Exception
- {
- return _session.createConsumer(_topic);
- }
-
- MessageConsumer createDurableTopicConsumer(String name) throws Exception
- {
- return _session.createDurableSubscriber(_topic, name);
- }
-
- MessageConsumer createControlConsumer() throws Exception
- {
- return _session.createConsumer(_control);
- }
-
- MessageProducer createTopicPublisher() throws Exception
- {
- return _session.createProducer(_topic);
- }
-
- MessageProducer createControlPublisher() throws Exception
- {
- return _session.createProducer(_control);
- }
-}
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/topic/Publisher.java b/qpid/java/perftests/src/main/java/org/apache/qpid/topic/Publisher.java
deleted file mode 100644
index c3b19b558a..0000000000
--- a/qpid/java/perftests/src/main/java/org/apache/qpid/topic/Publisher.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.topic;
-
-import javax.jms.*;
-
-public class Publisher implements MessageListener
-{
- private final Object _lock = new Object();
- private final Connection _connection;
- private final Session _session;
- private final MessageFactory _factory;
- private final MessageProducer _publisher;
- private int _count;
-
- Publisher(Connection connection, int size, int ackMode, boolean persistent) throws Exception
- {
- _connection = connection;
- _session = _connection.createSession(false, ackMode);
- _factory = new MessageFactory(_session, size);
- _publisher = _factory.createTopicPublisher();
- _publisher.setDeliveryMode(persistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT);
- System.out.println("Publishing " + (persistent ? "persistent" : "non-persistent") + " messages of " + size + " bytes, " + Config.getAckModeDescription(ackMode) + ".");
- }
-
- private void test(Config config) throws Exception
- {
- test(config.getBatch(), config.getDelay(), config.getMessages(), config.getClients(), config.getWarmup());
- }
-
- private void test(int batches, long delay, int msgCount, int consumerCount, int warmup) throws Exception
- {
- _factory.createControlConsumer().setMessageListener(this);
- _connection.start();
-
- if (warmup > 0)
- {
- System.out.println("Runing warmup (" + warmup + " msgs)");
- long time = batch(warmup, consumerCount);
- System.out.println("Warmup completed in " + time + "ms");
- }
-
- long[] times = new long[batches];
- for (int i = 0; i < batches; i++)
- {
- if (i > 0)
- {
- Thread.sleep(delay * 1000);
- }
- times[i] = batch(msgCount, consumerCount);
- System.out.println("Batch " + (i + 1) + " of " + batches + " completed in " + times[i] + " ms.");
- }
-
- long min = min(times);
- long max = max(times);
- System.out.println("min: " + min + ", max: " + max + " avg: " + avg(times, min, max));
-
- //request shutdown
- _publisher.send(_factory.createShutdownMessage());
-
- _connection.stop();
- _connection.close();
- }
-
- private long batch(int msgCount, int consumerCount) throws Exception
- {
- _count = consumerCount;
- long start = System.currentTimeMillis();
- publish(msgCount);
- waitForCompletion(consumerCount);
- return System.currentTimeMillis() - start;
- }
-
- private void publish(int count) throws Exception
- {
-
- //send events
- for (int i = 0; i < count; i++)
- {
- _publisher.send(_factory.createEventMessage());
- if ((i + 1) % 100 == 0)
- {
- System.out.println("Sent " + (i + 1) + " messages");
- }
- }
-
- //request report
- _publisher.send(_factory.createReportRequestMessage());
- }
-
- private void waitForCompletion(int consumers) throws Exception
- {
- System.out.println("Waiting for completion...");
- synchronized (_lock)
- {
- while (_count > 0)
- {
- _lock.wait();
- }
- }
- }
-
-
- public void onMessage(Message message)
- {
- System.out.println("Received report " + _factory.getReport(message) + " " + --_count + " remaining");
- if (_count == 0)
- {
- synchronized (_lock)
- {
- _lock.notify();
- }
- }
- }
-
- static long min(long[] times)
- {
- long min = times.length > 0 ? times[0] : 0;
- for (int i = 0; i < times.length; i++)
- {
- min = Math.min(min, times[i]);
- }
- return min;
- }
-
- static long max(long[] times)
- {
- long max = times.length > 0 ? times[0] : 0;
- for (int i = 0; i < times.length; i++)
- {
- max = Math.max(max, times[i]);
- }
- return max;
- }
-
- static long avg(long[] times, long min, long max)
- {
- long sum = 0;
- for (int i = 0; i < times.length; i++)
- {
- sum += times[i];
- }
-
- int adjustment = 0;
-
- // Remove min and max if we have run enough batches.
- if (times.length > 2)
- {
- sum -= min;
- sum -= max;
- adjustment = 2;
- }
-
- return (sum / (times.length - adjustment));
- }
-
- public static void main(String[] argv) throws Exception
- {
- Config config = new Config();
- config.setOptions(argv);
-
- Connection con = config.createConnection();
- int size = config.getPayload();
- int ackMode = config.getAckMode();
- boolean persistent = config.usePersistentMessages();
- new Publisher(con, size, ackMode, persistent).test(config);
- }
-}
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/topic/TopicWithSelectorsTransientVolumeTest.java b/qpid/java/perftests/src/main/java/org/apache/qpid/topic/TopicWithSelectorsTransientVolumeTest.java
deleted file mode 100644
index 1d6ec07bb0..0000000000
--- a/qpid/java/perftests/src/main/java/org/apache/qpid/topic/TopicWithSelectorsTransientVolumeTest.java
+++ /dev/null
@@ -1,344 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.topic;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-
-import javax.jms.BytesMessage;
-import javax.jms.DeliveryMode;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.Session;
-import javax.jms.Topic;
-import javax.jms.TopicConnection;
-import javax.jms.TopicPublisher;
-import javax.jms.TopicSession;
-import javax.jms.TopicSubscriber;
-import javax.naming.NamingException;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.client.AMQQueue;
-import org.apache.qpid.client.AMQSession;
-import org.apache.qpid.client.AMQTopic;
-import org.apache.qpid.exchange.ExchangeDefaults;
-import org.apache.qpid.test.utils.QpidBrokerTestCase;
-
-public class TopicWithSelectorsTransientVolumeTest extends QpidBrokerTestCase
-{
- private static final int NUM_MSG_PER_ITERATION = 50;//must be a multiple of 10
- private static final int NUM_ITERATIONS = 1000;
-
- private static final int NUM_CONSUMERS = 50;
- private static final int MSG_SIZE = 1024;
- private static final byte[] BYTE_ARRAY = new byte[MSG_SIZE];
-
- private ArrayList<MyMessageSubscriber> _subscribers = new ArrayList<MyMessageSubscriber>();
- private HashMap<String,Long> _queueMsgCounts = new HashMap<String,Long>();
-
- private final static Object _lock=new Object();
- private boolean _producerFailed;
- private static int _finishedCount;
- private static int _failedCount;
-
- protected void setUp() throws Exception
- {
- super.setUp();
- init();
- }
-
- protected void tearDown() throws Exception
- {
- super.tearDown();
- }
-
- private void init()
- {
- _finishedCount = 0;
- _failedCount = 0;
- _producerFailed = false;
- _subscribers.clear();
- _queueMsgCounts.clear();
- }
-
-
- private Message createMessage(Session session) throws JMSException
- {
- BytesMessage message = session.createBytesMessage();
- message.writeBytes(BYTE_ARRAY);
-
- return message;
- }
-
- /**
- * 1 Topic with 50 subscribers using a selector, and 1 producer sending 50,000 1K messages with 90% selector success ratio.
- */
- public void test50SubscribersWith90PercentMatched() throws Exception
- {
- Topic topic = new AMQTopic(ExchangeDefaults.TOPIC_EXCHANGE_NAME, "test50ConsumersWith10PercentUnmatched");
-
- System.out.println("Creating consumers");
-
- MyMessageSubscriber sub;
-
- for(int i=1; i <= NUM_CONSUMERS; i++)
- {
- sub = new MyMessageSubscriber(topic, "consumer" + i, ((9 * NUM_MSG_PER_ITERATION * NUM_ITERATIONS) / 10));
- _subscribers.add(sub);
- }
-
- System.out.println("Starting consumers");
- for(MyMessageSubscriber s: _subscribers)
- {
- Thread consumer = new Thread(s);
- consumer.start();
- }
-
- System.out.println("Creating producer");
- MyMessageProducer prod = new MyMessageProducer(topic);
-
- long startTime = System.currentTimeMillis();
-
- System.out.println("Starting producer");
- Thread producer = new Thread(prod);
- producer.start();
-
-
- // Wait for all the messageConsumers to have finished or failed
- synchronized (_lock)
- {
- while (_finishedCount + _failedCount < NUM_CONSUMERS)
- {
- try
- {
- _lock.wait();
- }
- catch (InterruptedException e)
- {
- //ignore
- }
- }
- }
-
- long endTime = System.currentTimeMillis();
- System.out.println("Elapsed time for messaging: " + (endTime-startTime) + "ms");
-
- assertFalse("Producer failed to send all messages", _producerFailed);
-
- //check if all messages received by consumers, or if there were failures
- if (_finishedCount != NUM_CONSUMERS)
- {
- fail(_failedCount + " consumers did not recieve all their expected messages");
- }
-
- //check if all queue depths were 0
- for(String consumer: _queueMsgCounts.keySet())
- {
- long depth = _queueMsgCounts.get(consumer);
- assertEquals(consumer + " subscription queue msg count was not 0", 0, depth);
- }
-
- }
-
- private class MyMessageProducer implements Runnable
- {
- private TopicConnection _connection;
- private TopicSession _session;
- private TopicPublisher _messagePublisher;
-
- public MyMessageProducer(Topic topic) throws JMSException, NamingException
- {
- _connection = (TopicConnection) getConnection();
- _session = (TopicSession) _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
- _messagePublisher = _session.createPublisher(topic);
- }
-
- public void run()
- {
- try
- {
- for(int iter = 0; iter < NUM_ITERATIONS; iter++)
- {
- int i = 0;
-
- //send 90% matching messages
- for (; i < (9 * NUM_MSG_PER_ITERATION)/10; i++)
- {
- Message message = createMessage(_session);
- message.setStringProperty("testprop", "true");
-
- _messagePublisher.publish(message, DeliveryMode.NON_PERSISTENT,
- Message.DEFAULT_PRIORITY, Message.DEFAULT_TIME_TO_LIVE);
-
- Thread.yield();
- }
-
- //send remaining 10% non-matching messages
- for (; i < NUM_MSG_PER_ITERATION; i++)
- {
- Message message = _session.createMessage();
- message.setStringProperty("testprop", "false");
-
- _messagePublisher.publish(message, DeliveryMode.NON_PERSISTENT,
- Message.DEFAULT_PRIORITY, Message.DEFAULT_TIME_TO_LIVE);
-
- Thread.yield();
- }
- }
-
- }
- catch (Exception exp)
- {
- System.out.println("producer: caught an exception, probably exiting before all messages sent");
- exp.printStackTrace();
- synchronized (_lock)
- {
- _producerFailed=true;
- _lock.notifyAll();
- }
- }
- }
- }
-
-
- private class MyMessageSubscriber implements Runnable
- {
- /* The topic this subscriber is subscribing to */
- private Topic _topic;
- private String _consumerName;
- private int _outstandingMsgCount;
- private TopicConnection _connection;
- private TopicSession _session;
- private TopicSubscriber _durSub;
-
- public MyMessageSubscriber(Topic topic, String consumerName, int messageCount) throws JMSException, NamingException
- {
- _outstandingMsgCount = messageCount;
- _topic=topic;
- _consumerName = consumerName;
- _connection = (TopicConnection) getConnection();
- _session = (TopicSession) _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
- _durSub = _session.createDurableSubscriber(_topic, _consumerName,"testprop='true'", false);
- _connection.start();
- }
-
- public void run()
- {
-
- boolean failed = false;
- do
- {
- Message m = null;
- try
- {
- m = _durSub.receive(10000);
- }
- catch (JMSException exp)
- {
- System.out.println(_consumerName + ": caught an exception handling a received message");
- exp.printStackTrace();
-
- failed = true;
- break;
- }
-
- Thread.yield();
-
- _outstandingMsgCount--;
-
- if(_outstandingMsgCount % 500 == 0)
- {
- System.out.println(_consumerName + ": outstanding message count: " + _outstandingMsgCount);
- }
-
- if(m == null)
- {
- if(_outstandingMsgCount != 0)
- {
- failed = true;
- }
- break;
- }
- }
- while(_outstandingMsgCount > 0);
-
- System.out.println(_consumerName + ": outstanding message count: " + _outstandingMsgCount);
-
- try
- {
- AMQQueue subcriptionQueue = new AMQQueue(ExchangeDefaults.TOPIC_EXCHANGE_NAME,"clientid" + ":" + _consumerName);
-
- ((AMQSession)_session).sync();
- Long depth = ((AMQSession)_session).getQueueDepth(subcriptionQueue);
- _queueMsgCounts.put(_consumerName, depth);
-
- System.out.println(_consumerName + ": completion queue msg count: " + depth);
- }
- catch (AMQException exp)
- {
- System.out.println(_consumerName + ": caught an exception determining completion queue depth");
- exp.printStackTrace();
- }
- finally
- {
- try
- {
- _session.unsubscribe(_consumerName);
- }
- catch (JMSException e)
- {
- System.out.println(_consumerName + ": caught an exception whilst unsubscribing");
- e.printStackTrace();
- }
- }
-
- synchronized (_lock)
- {
- if (_outstandingMsgCount == 0 && !failed)
- {
- _finishedCount++;
- System.out.println(_consumerName + ": finished");
- }
- else
- {
- _failedCount++;
- System.out.println(_consumerName + ": failed");
- }
- _lock.notifyAll();
- }
-
- }
- }
-
- //helper method to allow easily running against an external standalone broker
-// public static void main(String[] args) throws Exception
-// {
-// System.setProperty("broker.config", "/dev/null");
-// System.setProperty("broker", "external");
-// System.setProperty("java.naming.factory.initial", "org.apache.qpid.jndi.PropertiesFileInitialContextFactory");
-// System.setProperty("java.naming.provider.url", "test-profiles/test-provider.properties");
-//
-// TopicWithSelectorsTransientVolumeTest test = new TopicWithSelectorsTransientVolumeTest();
-// test.init();
-// test.test50SubscribersWith90PercentMatched();
-// test.tearDown();
-// }
-}
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/topic/topicselectors.properties b/qpid/java/perftests/src/main/java/org/apache/qpid/topic/topicselectors.properties
deleted file mode 100644
index 1f572af58a..0000000000
--- a/qpid/java/perftests/src/main/java/org/apache/qpid/topic/topicselectors.properties
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT 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
-
-
-# register some connection factories
-# connectionfactory.[jndiname] = [ConnectionURL]
-connectionfactory.default = amqp://guest:guest@clientid/test?brokerlist='tcp://localhost:5672' \ No newline at end of file
diff --git a/qpid/java/systests/build.xml b/qpid/java/systests/build.xml
index fd7203dd40..8f56eb21f1 100644
--- a/qpid/java/systests/build.xml
+++ b/qpid/java/systests/build.xml
@@ -27,7 +27,7 @@ nn - or more contributor license agreements. See the NOTICE file
</and>
</condition>
- <property name="module.depends" value="client management/common broker broker/test common common/test junit-toolkit jca ${systests.optional.depends}"/>
+ <property name="module.depends" value="client management/common broker broker/test common common/test jca ${systests.optional.depends}"/>
<property name="module.test.src" location="src/main/java"/>
<property name="module.test.excludes"
value="**/DropInTest.java,**/TestClientControlledTest.java"/>
diff --git a/qpid/java/systests/etc/bin/testclients.sh b/qpid/java/systests/etc/bin/testclients.sh
deleted file mode 100755
index 002f3d98bb..0000000000
--- a/qpid/java/systests/etc/bin/testclients.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-for x in `seq 1 $1`;
-do
- java -cp qpid-integrationtests-1.0-incubating-M2-SNAPSHOT-all-test-deps.jar -Dlog4j.configuration=file:/home/rupert/qpid/trunk/qpid/java/etc/mylog4j.xml org.apache.qpid.test.framework.distributedtesting.TestClient -n java$x &
-done
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/exchange/MessagingTestConfigProperties.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/exchange/MessagingTestConfigProperties.java
deleted file mode 100644
index 4a92f04b30..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/server/exchange/MessagingTestConfigProperties.java
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.server.exchange;
-
-import org.apache.qpid.jms.Session;
-import org.apache.qpid.junit.extensions.util.ParsedProperties;
-
-/**
- * MessagingTestConfigProperties defines a set of property names and default values for specifying a messaging topology,
- * and test parameters for running a messaging test over that topology. A Properties object holding some of these
- * properties, superimposed onto the defaults, is used to establish test topologies and control test behaviour.
- *
- * <p/>A complete list of the parameters, default values and comments on their usage is provided here:
- *
- * <p/><table><caption>Parameters</caption>
- * <tr><th> Parameter <th> Default <th> Comments
- * <tr><td> messageSize <td> 0 <td> Message size in bytes. Not including any headers.
- * <tr><td> destinationName <td> ping <td> The root name to use to generate destination names to ping.
- * <tr><td> persistent <td> false <td> Determines whether peristent delivery is used.
- * <tr><td> transacted <td> false <td> Determines whether messages are sent/received in transactions.
- * <tr><td> broker <td> tcp://localhost:5672 <td> Determines the broker to connect to.
- * <tr><td> virtualHost <td> test <td> Determines the virtual host to send all ping over.
- * <tr><td> rate <td> 0 <td> The maximum rate (in hertz) to send messages at. 0 means no limit.
- * <tr><td> verbose <td> false <td> The verbose flag for debugging. Prints to console on every message.
- * <tr><td> pubsub <td> false <td> Whether to ping topics or queues. Uses p2p by default.
- * <tr><td> username <td> guest <td> The username to access the broker with.
- * <tr><td> password <td> guest <td> The password to access the broker with.
- * <tr><td> selector <td> null <td> Not used. Defines a message selector to filter pings with.
- * <tr><td> destinationCount <td> 1 <td> The number of receivers listening to the pings.
- * <tr><td> timeout <td> 30000 <td> In milliseconds. The timeout to stop waiting for replies.
- * <tr><td> commitBatchSize <td> 1 <td> The number of messages per transaction in transactional mode.
- * <tr><td> uniqueDests <td> true <td> Whether each receiver only listens to one ping destination or all.
- * <tr><td> durableDests <td> false <td> Whether or not durable destinations are used.
- * <tr><td> ackMode <td> AUTO_ACK <td> The message acknowledgement mode. Possible values are:
- * 0 - SESSION_TRANSACTED
- * 1 - AUTO_ACKNOWLEDGE
- * 2 - CLIENT_ACKNOWLEDGE
- * 3 - DUPS_OK_ACKNOWLEDGE
- * 257 - NO_ACKNOWLEDGE
- * 258 - PRE_ACKNOWLEDGE
- * <tr><td> maxPending <td> 0 <td> The maximum size in bytes, of messages sent but not yet received.
- * Limits the volume of messages currently buffered on the client
- * or broker. Can help scale test clients by limiting amount of buffered
- * data to avoid out of memory errors.
- * </table>
- *
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Provide the names and defaults of all test parameters.
- * </table>
- */
-public class MessagingTestConfigProperties
-{
- // ====================== Connection Properties ==================================
-
- /** Holds the name of the default connection configuration. */
- public static final String CONNECTION_NAME = "broker";
-
- /** Holds the name of the property to get the initial context factory name from. */
- public static final String INITIAL_CONTEXT_FACTORY_PROPNAME = "java.naming.factory.initial";
-
- /** Defines the class to use as the initial context factory by default. */
- public static final String INITIAL_CONTEXT_FACTORY_DEFAULT = "org.apache.qpid.jndi.PropertiesFileInitialContextFactory";
-
- /** Holds the name of the default connection factory configuration property. */
- public static final String CONNECTION_PROPNAME = "connectionfactory.broker";
-
- /** Holds the name of the property to get the test broker url from. */
- public static final String BROKER_PROPNAME = "qpid.test.broker";
-
- /** Holds the name of the property to get the test broker virtual path. */
- public static final String VIRTUAL_HOST_PROPNAME = "virtualHost";
-
- /** Holds the default virtual path for the test. */
- public static final String VIRTUAL_HOST_DEFAULT = "";
-
- /** Holds the name of the property to get the broker access username from. */
- public static final String USERNAME_PROPNAME = "username";
-
- /** Holds the default broker log on username. */
- public static final String USERNAME_DEFAULT = "guest";
-
- /** Holds the name of the property to get the broker access password from. */
- public static final String PASSWORD_PROPNAME = "password";
-
- /** Holds the default broker log on password. */
- public static final String PASSWORD_DEFAULT = "guest";
-
- // ====================== Messaging Topology Properties ==========================
-
- /** Holds the name of the property to get the bind publisher procuder flag from. */
- public static final String PUBLISHER_PRODUCER_BIND_PROPNAME = "publisherProducerBind";
-
- /** Holds the default value of the publisher producer flag. */
- public static final boolean PUBLISHER_PRODUCER_BIND_DEFAULT = true;
-
- /** Holds the name of the property to get the bind publisher procuder flag from. */
- public static final String PUBLISHER_CONSUMER_BIND_PROPNAME = "publisherConsumerBind";
-
- /** Holds the default value of the publisher consumer flag. */
- public static final boolean PUBLISHER_CONSUMER_BIND_DEFAULT = false;
-
- /** Holds the name of the property to get the bind receiver procuder flag from. */
- public static final String RECEIVER_PRODUCER_BIND_PROPNAME = "receiverProducerBind";
-
- /** Holds the default value of the receiver producer flag. */
- public static final boolean RECEIVER_PRODUCER_BIND_DEFAULT = false;
-
- /** Holds the name of the property to get the bind receiver procuder flag from. */
- public static final String RECEIVER_CONSUMER_BIND_PROPNAME = "receiverConsumerBind";
-
- /** Holds the default value of the receiver consumer flag. */
- public static final boolean RECEIVER_CONSUMER_BIND_DEFAULT = true;
-
- /** Holds the name of the property to get the destination name root from. */
- public static final String SEND_DESTINATION_NAME_ROOT_PROPNAME = "sendDestinationRoot";
-
- /** Holds the root of the name of the default destination to send to. */
- public static final String SEND_DESTINATION_NAME_ROOT_DEFAULT = "sendTo";
-
- /** Holds the name of the property to get the destination name root from. */
- public static final String RECEIVE_DESTINATION_NAME_ROOT_PROPNAME = "receiveDestinationRoot";
-
- /** Holds the root of the name of the default destination to send to. */
- public static final String RECEIVE_DESTINATION_NAME_ROOT_DEFAULT = "receiveFrom";
-
- /** Holds the name of the proeprty to get the destination count from. */
- public static final String DESTINATION_COUNT_PROPNAME = "destinationCount";
-
- /** Defines the default number of destinations to ping. */
- public static final int DESTINATION_COUNT_DEFAULT = 1;
-
- /** Holds the name of the property to get the p2p or pub/sub messaging mode from. */
- public static final String PUBSUB_PROPNAME = "pubsub";
-
- /** Holds the pub/sub mode default, true means ping a topic, false means ping a queue. */
- public static final boolean PUBSUB_DEFAULT = false;
-
- // ====================== JMS Options and Flags =================================
-
- /** Holds the name of the property to get the test delivery mode from. */
- public static final String PERSISTENT_MODE_PROPNAME = "persistent";
-
- /** Holds the message delivery mode to use for the test. */
- public static final boolean PERSISTENT_MODE_DEFAULT = false;
-
- /** Holds the name of the property to get the test transactional mode from. */
- public static final String TRANSACTED_PROPNAME = "transacted";
-
- /** Holds the transactional mode to use for the test. */
- public static final boolean TRANSACTED_DEFAULT = false;
-
- /** Holds the name of the property to set the no local flag from. */
- public static final String NO_LOCAL_PROPNAME = "noLocal";
-
- /** Defines the default value of the no local flag to use when consuming messages. */
- public static final boolean NO_LOCAL_DEFAULT = false;
-
- /** Holds the name of the property to get the message acknowledgement mode from. */
- public static final String ACK_MODE_PROPNAME = "ackMode";
-
- /** Defines the default message acknowledgement mode. */
- public static final int ACK_MODE_DEFAULT = Session.AUTO_ACKNOWLEDGE;
-
- /** Holds the name of the property to get the durable subscriptions flag from, when doing pub/sub messaging. */
- public static final String DURABLE_SUBSCRIPTION_PROPNAME = "durableSubscription";
-
- /** Defines the default value of the durable subscriptions flag. */
- public static final boolean DURABLE_SUBSCRIPTION_DEFAULT = false;
-
- // ====================== Qpid Options and Flags ================================
-
- /** Holds the name of the property to set the exclusive flag from. */
- public static final String EXCLUSIVE_PROPNAME = "exclusive";
-
- /** Defines the default value of the exclusive flag to use when consuming messages. */
- public static final boolean EXCLUSIVE_DEFAULT = false;
-
- /** Holds the name of the property to set the immediate flag from. */
- public static final String IMMEDIATE_PROPNAME = "immediate";
-
- /** Defines the default value of the immediate flag to use when sending messages. */
- public static final boolean IMMEDIATE_DEFAULT = false;
-
- /** Holds the name of the property to set the mandatory flag from. */
- public static final String MANDATORY_PROPNAME = "mandatory";
-
- /** Defines the default value of the mandatory flag to use when sending messages. */
- public static final boolean MANDATORY_DEFAULT = false;
-
- /** Holds the name of the property to get the durable destinations flag from. */
- public static final String DURABLE_DESTS_PROPNAME = "durableDests";
-
- /** Default value for the durable destinations flag. */
- public static final boolean DURABLE_DESTS_DEFAULT = false;
-
- /** Holds the name of the proeprty to set the prefetch size from. */
- public static final String PREFECTH_PROPNAME = "prefetch";
-
- /** Defines the default prefetch size to use when consuming messages. */
- public static final int PREFETCH_DEFAULT = 100;
-
- // ====================== Common Test Parameters ================================
-
- /** Holds the name of the property to get the test message size from. */
- public static final String MESSAGE_SIZE_PROPNAME = "messageSize";
-
- /** Used to set up a default message size. */
- public static final int MESSAGE_SIZE_DEAFULT = 0;
-
- /** Holds the name of the property to get the message rate from. */
- public static final String RATE_PROPNAME = "rate";
-
- /** Defines the default rate (in pings per second) to send pings at. 0 means as fast as possible, no restriction. */
- public static final int RATE_DEFAULT = 0;
-
- /** Holds the name of the proeprty to get the. */
- public static final String SELECTOR_PROPNAME = "selector";
-
- /** Holds the default message selector. */
- public static final String SELECTOR_DEFAULT = "";
-
- /** Holds the name of the property to get the waiting timeout for response messages. */
- public static final String TIMEOUT_PROPNAME = "timeout";
-
- /** Default time to wait before assuming that a ping has timed out. */
- public static final long TIMEOUT_DEFAULT = 30000;
-
- /** Holds the name of the property to get the commit batch size from. */
- public static final String TX_BATCH_SIZE_PROPNAME = "commitBatchSize";
-
- /** Defines the default number of pings to send in each transaction when running transactionally. */
- public static final int TX_BATCH_SIZE_DEFAULT = 1;
-
- /** Holds the name of the property to set the maximum amount of pending message data for a producer to hold. */
- public static final String MAX_PENDING_PROPNAME = "maxPending";
-
- /** Defines the default maximum quantity of pending message data to allow producers to hold. */
- public static final int MAX_PENDING_DEFAULT = 0;
-
- /** Holds the name of the property to get the verbose mode proeprty from. */
- public static final String VERBOSE_PROPNAME = "verbose";
-
- /** Holds the default verbose mode. */
- public static final boolean VERBOSE_DEFAULT = false;
-
- /** Holds the default configuration properties. */
- public static ParsedProperties defaults = new ParsedProperties();
-
- static
- {
- defaults.setPropertyIfNull(INITIAL_CONTEXT_FACTORY_PROPNAME, INITIAL_CONTEXT_FACTORY_DEFAULT);
- defaults.setPropertyIfNull(MESSAGE_SIZE_PROPNAME, MESSAGE_SIZE_DEAFULT);
- defaults.setPropertyIfNull(PUBLISHER_PRODUCER_BIND_PROPNAME, PUBLISHER_PRODUCER_BIND_DEFAULT);
- defaults.setPropertyIfNull(PUBLISHER_CONSUMER_BIND_PROPNAME, PUBLISHER_CONSUMER_BIND_DEFAULT);
- defaults.setPropertyIfNull(RECEIVER_PRODUCER_BIND_PROPNAME, RECEIVER_PRODUCER_BIND_DEFAULT);
- defaults.setPropertyIfNull(RECEIVER_CONSUMER_BIND_PROPNAME, RECEIVER_CONSUMER_BIND_DEFAULT);
- defaults.setPropertyIfNull(SEND_DESTINATION_NAME_ROOT_PROPNAME, SEND_DESTINATION_NAME_ROOT_DEFAULT);
- defaults.setPropertyIfNull(RECEIVE_DESTINATION_NAME_ROOT_PROPNAME, RECEIVE_DESTINATION_NAME_ROOT_DEFAULT);
- defaults.setPropertyIfNull(PERSISTENT_MODE_PROPNAME, PERSISTENT_MODE_DEFAULT);
- defaults.setPropertyIfNull(TRANSACTED_PROPNAME, TRANSACTED_DEFAULT);
- defaults.setPropertyIfNull(VIRTUAL_HOST_PROPNAME, VIRTUAL_HOST_DEFAULT);
- defaults.setPropertyIfNull(RATE_PROPNAME, RATE_DEFAULT);
- defaults.setPropertyIfNull(VERBOSE_PROPNAME, VERBOSE_DEFAULT);
- defaults.setPropertyIfNull(PUBSUB_PROPNAME, PUBSUB_DEFAULT);
- defaults.setPropertyIfNull(USERNAME_PROPNAME, USERNAME_DEFAULT);
- defaults.setPropertyIfNull(PASSWORD_PROPNAME, PASSWORD_DEFAULT);
- defaults.setPropertyIfNull(SELECTOR_PROPNAME, SELECTOR_DEFAULT);
- defaults.setPropertyIfNull(DESTINATION_COUNT_PROPNAME, DESTINATION_COUNT_DEFAULT);
- defaults.setPropertyIfNull(TIMEOUT_PROPNAME, TIMEOUT_DEFAULT);
- defaults.setPropertyIfNull(TX_BATCH_SIZE_PROPNAME, TX_BATCH_SIZE_DEFAULT);
- defaults.setPropertyIfNull(DURABLE_DESTS_PROPNAME, DURABLE_DESTS_DEFAULT);
- defaults.setPropertyIfNull(ACK_MODE_PROPNAME, ACK_MODE_DEFAULT);
- defaults.setPropertyIfNull(DURABLE_SUBSCRIPTION_PROPNAME, DURABLE_SUBSCRIPTION_DEFAULT);
- defaults.setPropertyIfNull(MAX_PENDING_PROPNAME, MAX_PENDING_DEFAULT);
- defaults.setPropertyIfNull(PREFECTH_PROPNAME, PREFETCH_DEFAULT);
- defaults.setPropertyIfNull(NO_LOCAL_PROPNAME, NO_LOCAL_DEFAULT);
- defaults.setPropertyIfNull(EXCLUSIVE_PROPNAME, EXCLUSIVE_DEFAULT);
- defaults.setPropertyIfNull(IMMEDIATE_PROPNAME, IMMEDIATE_DEFAULT);
- defaults.setPropertyIfNull(MANDATORY_PROPNAME, MANDATORY_DEFAULT);
- }
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/AMQPPublisher.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/AMQPPublisher.java
deleted file mode 100644
index 13465741bd..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/AMQPPublisher.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.test.framework;
-
-import org.apache.qpid.junit.extensions.util.ParsedProperties;
-
-/**
- * An AMQPPublisher represents the status of the publishing side of a test circuit that exposes AMQP specific features.
- * Its provides additional assertions not available through the plain JMS {@link Publisher} interface.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities
- * <tr><td> Provide assertion that the publishers received a no consumers error code on every message.
- * <tr><td> Provide assertion that the publishers received a no route error code on every message.
- * </table>
- */
-public interface AMQPPublisher extends Publisher
-{
- /**
- * Provides an assertion that the publisher got a no consumers exception on every message.
- *
- * @param testProps The test configuration properties.
- *
- * @return An assertion that the publisher got a no consumers exception on every message.
- */
- Assertion noConsumersAssertion(ParsedProperties testProps);
-
- /**
- * Provides an assertion that the publisher got a no rout exception on every message.
- *
- * @param testProps The test configuration properties.
- *
- * @return An assertion that the publisher got a no rout exception on every message.
- */
- Assertion noRouteAssertion(ParsedProperties testProps);
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/Assertion.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/Assertion.java
deleted file mode 100644
index 60d54f1f6f..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/Assertion.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.test.framework;
-
-/**
- * Assertion models an assertion on a test {@link Circuit}.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities
- * <tr><td> Indicate whether or not the assertion passes when applied.
- * </table>
- */
-public interface Assertion
-{
- /**
- * Applies the assertion.
- *
- * @return <tt>true</tt> if the assertion passes, <tt>false</tt> if it fails.
- */
- public boolean apply();
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/AssertionBase.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/AssertionBase.java
deleted file mode 100644
index 0bb4911d4c..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/AssertionBase.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.test.framework;
-
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * AssertionBase is a base class for implenmenting assertions. It provides a mechanism to store error messages, and
- * report all error messages when its {@link #toString()} method is called.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Collect error messages.
- * </table>
- */
-public abstract class AssertionBase implements Assertion
-{
- /** Holds the error messages. */
- List<String> errors = new LinkedList<String>();
-
- /**
- * Adds an error message to the assertion.
- *
- * @param error An error message to add to the assertion.
- */
- public void addError(String error)
- {
- errors.add(error);
- }
-
- /**
- * Prints all of the error messages in the assertion into a string.
- *
- * @return All of the error messages in the assertion as a string.
- */
- public String toString()
- {
- String result = "";
-
- for (String error : errors)
- {
- result += error;
- }
-
- return result;
- }
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/BrokerLifecycleAware.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/BrokerLifecycleAware.java
deleted file mode 100644
index 41614f92fc..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/BrokerLifecycleAware.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.test.framework;
-
-/**
- * BrokerLifecycleAware is an awareness interface implemented by test cases that can run control the life-cycle of
- * the brokers on which they run. Its purpose is to expose additional instrumentation of brokers during testing, that
- * enables tests to use an automated failure mechanism to simulate broker failures, and to re-start failed brokers.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Indicate whether or not a test case is using an in-vm broker.
- * <tr><td> Track which in-vm broker is currently in use.
- * <tr><td> Accept setting of a failure mechanism. <td> {@link CauseFailure}.
- * </table>
- *
- * @todo Need to think about how to present the brokers through this interface. Thinking numbering the available
- * brokers from 1 will do. Then can kill 1 and assume failing onto 2. Restart 1 and kill 2 and fail back onto
- * 1 again?
- */
-public interface BrokerLifecycleAware
-{
- public void setInVmBrokers();
-
- /**
- * Indicates whether or not a test case is using in-vm brokers.
- *
- * @return <tt>true</tt> if the test is using in-vm brokers, <tt>false</tt> otherwise.
- */
- public boolean usingInVmBroker();
-
- /**
- * Sets the currently live in-vm broker.
- *
- * @param i The currently live in-vm broker.
- */
- public void setLiveBroker(int i);
-
- /**
- * Reports the currently live in-vm broker.
- *
- * @return The currently live in-vm broker.
- */
- public int getLiveBroker();
-
- /**
- * Accepts a failure mechanism.
- *
- * @param failureMechanism The failure mechanism.
- */
- public void setFailureMechanism(CauseFailure failureMechanism);
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/CauseFailure.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/CauseFailure.java
deleted file mode 100644
index 9bdd5a72c5..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/CauseFailure.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.test.framework;
-
-/**
- * CauseFailure provides a method to cause a failure in a messaging broker, usually used in conjunction with fail-over
- * or other failure mode testing. In some cases failures may be automated, for example by shutting down an in-vm broker,
- * or by sending a special control signal to a broker over a network connection. In other cases, it may be preferable
- * to ask a user interactively to cause a failure scenario, in which case an implementation may display a prompt or
- * dialog box asking for notification once the failure has been caused. The purpose of this interface is to abstract
- * the exact cause and nature of a failure out of failure test cases.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities
- * <tr><td> Cause messaging broker failure.
- * </table>
- */
-public interface CauseFailure
-{
- /**
- * Causes the active message broker to fail.
- */
- void causeFailure();
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/CauseFailureUserPrompt.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/CauseFailureUserPrompt.java
deleted file mode 100644
index 118ddff48b..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/CauseFailureUserPrompt.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.test.framework;
-
-import java.io.IOException;
-
-/**
- * Causes a message broker failure by interactively prompting the user to cause it.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Cause messaging broker failure.
- * </table>
- */
-public class CauseFailureUserPrompt implements CauseFailure
-{
- /**
- * Causes the active message broker to fail.
- */
- public void causeFailure()
- {
- waitForUser("Cause a broker failure now, then press Return.");
- }
-
- /**
- * Outputs a prompt to the console and waits for the user to press return.
- *
- * @param prompt The prompt to display on the console.
- */
- private void waitForUser(String prompt)
- {
- System.out.println(prompt);
-
- try
- {
- System.in.read();
- }
- catch (IOException e)
- {
- // Ignored.
- }
-
- System.out.println("Continuing.");
- }
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/Circuit.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/Circuit.java
deleted file mode 100644
index 4f9ab1a273..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/Circuit.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.test.framework;
-
-import java.util.List;
-
-/**
- * A Circuit is the basic test unit against which test cases are to be written. A circuit consists of two 'ends', an
- * instigating 'publisher' end and a more passive 'receivers' end.
- *
- * <p/>Once created, the life-cycle of a circuit may be controlled by {@link #start()}ing it, or {@link #close()}ing it.
- * Once started, the circuit is ready to send messages over. Once closed the circuit can no longer be used.
- *
- * <p/>The state of the circuit may be taken with the {@link #check()} method, and asserted against by the
- * {@link #applyAssertions(java.util.List)} method.
- *
- * <p/>There is a default test procedure which may be performed against the circuit. The outline of this procedure is:
- *
- * <p/><pre>
- * Start the circuit.
- * Send test messages.
- * Request a status report.
- * Assert conditions on the publishing end of the circuit.
- * Assert conditions on the receiving end of the circuit.
- * Close the circuit.
- * Pass with no failed assertions or fail with a list of failed assertions.
- * </pre>
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities
- * <tr><td> Supply the publishing and receiving ends of a test messaging circuit.
- * <tr><td> Start the circuit running.
- * <tr><td> Close the circuit down.
- * <tr><td> Take a reading of the circuits state.
- * <tr><td> Apply assertions against the circuits state.
- * <tr><td> Send test messages over the circuit.
- * <tr><td> Perform the default test procedue on the circuit.
- * </table>
- */
-public interface Circuit
-{
- /**
- * Gets the interface on the publishing end of the circuit.
- *
- * @return The publishing end of the circuit.
- */
- public Publisher getPublisher();
-
- /**
- * Gets the interface on the receiving end of the circuit.
- *
- * @return The receiving end of the circuit.
- */
- public Receiver getReceiver();
-
- /**
- * Connects and starts the circuit. After this method is called the circuit is ready to send messages.
- */
- public void start();
-
- /**
- * Checks the test circuit. The effect of this is to gather the circuits state, for both ends of the circuit,
- * into a report, against which assertions may be checked.
- */
- public void check();
-
- /**
- * Closes the circuit. All associated resources are closed.
- */
- public void close();
-
- /**
- * Applied a list of assertions against the test circuit. The {@link #check()} method should be called before doing
- * this, to ensure that the circuit has gathered its state into a report to assert against.
- *
- * @param assertions The list of assertions to apply to the circuit.
- *
- * @return Any assertions that failed.
- */
- public List<Assertion> applyAssertions(List<Assertion> assertions);
-
- /**
- * Runs the default test procedure against the circuit, and checks that all of the specified assertions hold.
- *
- * @param numMessages The number of messages to send using the default test procedure.
- * @param assertions The list of assertions to apply.
- *
- * @return Any assertions that failed.
- */
- public List<Assertion> test(int numMessages, List<Assertion> assertions);
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/CircuitEnd.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/CircuitEnd.java
deleted file mode 100644
index ffde385cfc..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/CircuitEnd.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.test.framework;
-
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-
-/**
- * A CircuitEnd is a pair consisting of one message producer and one message consumer, that represents one end of a
- * test circuit. It is a standard unit of connectivity allowing a full-duplex conversation to be held, provided both
- * the consumer and producer are instantiated and configured.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities
- * <tr><td> Provide a message producer for sending messages.
- * <tr><td> Provide a message consumer for receiving messages.
- * </table>
- *
- * @todo Update the {@link org.apache.qpid.test.utils.ConversationFactory} so that it accepts these as the basic conversation
- * connection units.
- */
-public interface CircuitEnd
-{
- /**
- * Gets the message producer at this circuit end point.
- *
- * @return The message producer at with this circuit end point.
- */
- public MessageProducer getProducer();
-
- /**
- * Gets the message consumer at this circuit end point.
- *
- * @return The message consumer at this circuit end point.
- */
- public MessageConsumer getConsumer();
-
- /**
- * Send the specified message over the producer at this end point.
- *
- * @param message The message to send.
- *
- * @throws JMSException Any JMS exception occuring during the send is allowed to fall through.
- */
- public void send(Message message) throws JMSException;
-
- /**
- * Gets the JMS Session associated with this circuit end point.
- *
- * @return The JMS Session associated with this circuit end point.
- */
- public Session getSession();
-
- /**
- * Closes the message producers and consumers and the sessions, associated with this circuit end point.
- *
- * @throws JMSException Any JMSExceptions occurring during the close are allowed to fall through.
- */
- public void close() throws JMSException;
-
- /**
- * Returns the message monitor for reporting on received messages on this circuit end.
- *
- * @return The message monitor for this circuit end.
- */
- public MessageMonitor getMessageMonitor();
-
- /**
- * Returns the exception monitor for reporting on exceptions received on this circuit end.
- *
- * @return The exception monitor for this circuit end.
- */
- public ExceptionMonitor getExceptionMonitor();
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/CircuitEndBase.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/CircuitEndBase.java
deleted file mode 100644
index 5730752eae..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/CircuitEndBase.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.test.framework;
-
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-
-/**
- * A CircuitEndBase is a pair consisting of one message producer and one message consumer, that represents one end of a
- * test circuit. It is a standard unit of connectivity allowing a full-duplex conversation to be held, provided both
- * the consumer and producer are instantiated and configured.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities
- * <tr><td> Provide a message producer for sending messages.
- * <tr><td> Provide a message consumer for receiving messages.
- * </table>
- */
-public class CircuitEndBase implements CircuitEnd
-{
- /** Holds the single message producer. */
- MessageProducer producer;
-
- /** Holds the single message consumer. */
- MessageConsumer consumer;
-
- /** Holds the controlSession for the circuit end. */
- Session session;
-
- /** Holds the message monitor for the circuit end. */
- MessageMonitor messageMonitor;
-
- /** Holds the exception monitor for the circuit end. */
- ExceptionMonitor exceptionMonitor;
-
- /**
- * Creates a circuit end point on the specified producer, consumer and controlSession. Monitors are also configured
- * for messages and exceptions received by the circuit end.
- *
- * @param producer The message producer for the circuit end point.
- * @param consumer The message consumer for the circuit end point.
- * @param session The controlSession for the circuit end point.
- * @param messageMonitor The monitor to notify of all messages received by the circuit end.
- * @param exceptionMonitor The monitor to notify of all exceptions received by the circuit end.
- */
- public CircuitEndBase(MessageProducer producer, MessageConsumer consumer, Session session, MessageMonitor messageMonitor,
- ExceptionMonitor exceptionMonitor)
- {
- this.producer = producer;
- this.consumer = consumer;
- this.session = session;
-
- this.messageMonitor = messageMonitor;
- this.exceptionMonitor = exceptionMonitor;
- }
-
- /**
- * Gets the message producer at this circuit end point.
- *
- * @return The message producer at with this circuit end point.
- */
- public MessageProducer getProducer()
- {
- return producer;
- }
-
- /**
- * Gets the message consumer at this circuit end point.
- *
- * @return The message consumer at this circuit end point.
- */
- public MessageConsumer getConsumer()
- {
- return consumer;
- }
-
- /**
- * Send the specified message over the producer at this end point.
- *
- * @param message The message to send.
- * @throws javax.jms.JMSException Any JMS exception occuring during the send is allowed to fall through.
- */
- public void send(Message message) throws JMSException
- {
- producer.send(message);
- }
-
- /**
- * Gets the JMS Session associated with this circuit end point.
- *
- * @return The JMS Session associated with this circuit end point.
- */
- public Session getSession()
- {
- return session;
- }
-
- /**
- * Closes the message producers and consumers and the sessions, associated with this circuit end point.
- *
- * @throws javax.jms.JMSException Any JMSExceptions occurring during the close are allowed to fall through.
- */
- public void close() throws JMSException
- {
- if (producer != null)
- {
- producer.close();
- }
-
- if (consumer != null)
- {
- consumer.close();
- }
- }
-
- /**
- * Returns the message monitor for reporting on received messages on this circuit end.
- *
- * @return The message monitor for this circuit end.
- */
- public MessageMonitor getMessageMonitor()
- {
- return messageMonitor;
- }
-
- /**
- * Returns the exception monitor for reporting on exceptions received on this circuit end.
- *
- * @return The exception monitor for this circuit end.
- */
- public ExceptionMonitor getExceptionMonitor()
- {
- return exceptionMonitor;
- }
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/DropInTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/DropInTest.java
deleted file mode 100644
index 78b5a72c1f..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/DropInTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.test.framework;
-
-import javax.jms.JMSException;
-import javax.jms.Message;
-
-/**
- * A DropIn test is a test case that can accept late joining test clients into a running test. This can be usefull,
- * for interactive experimentation.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities
- * <tr><td> Accept late joining test clients.
- * </table>
- */
-public interface DropInTest
-{
- /**
- * Should accept a late joining client into a running test case. The client will be enlisted with a control message
- * with the 'CONTROL_TYPE' field set to the value 'LATEJOIN'. It should also provide values for the fields:
- *
- * <p/><table>
- * <tr><td> CLIENT_NAME <td> A unique name for the new client.
- * <tr><td> CLIENT_PRIVATE_CONTROL_KEY <td> The key for the route on which the client receives its control messages.
- * </table>
- *
- * @param message The late joiners join message.
- *
- * @throws JMSException Any JMS Exception are allowed to fall through, indicating that the join failed.
- */
- public void lateJoin(Message message) throws JMSException;
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/ExceptionMonitor.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/ExceptionMonitor.java
deleted file mode 100644
index afb7b5bc5b..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/ExceptionMonitor.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.test.framework;
-
-import org.apache.log4j.Logger;
-
-import javax.jms.ExceptionListener;
-import javax.jms.JMSException;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * An exception monitor, listens for JMS exception on a connection or consumer. It record all exceptions that it receives
- * and provides methods to test the number and type of exceptions received.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Record all exceptions received.
- * </table>
- */
-public class ExceptionMonitor implements ExceptionListener
-{
- /** Used for debugging. */
- private final Logger log = Logger.getLogger(ExceptionMonitor.class);
-
- /** Holds the received exceptions. */
- private List<Exception> exceptions = new ArrayList<Exception>();
-
- /**
- * Receives incoming exceptions.
- *
- * @param e The exception to record.
- */
- public synchronized void onException(JMSException e)
- {
- log.debug("public void onException(JMSException e): called", e);
-
- exceptions.add(e);
- }
-
- /**
- * Checks that no exceptions have been received.
- *
- * @return <tt>true</tt> if no exceptions have been received, <tt>false</tt> otherwise.
- */
- public synchronized boolean assertNoExceptions()
- {
- return exceptions.isEmpty();
- }
-
- /**
- * Checks that exactly one exception has been received.
- *
- * @return <tt>true</tt> if exactly one exception been received, <tt>false</tt> otherwise.
- */
- public synchronized boolean assertOneJMSException()
- {
- return exceptions.size() == 1;
- }
-
- /**
- * Checks that exactly one exception, with a linked cause of the specified type, has been received.
- *
- * @param aClass The type of the linked cause.
- *
- * @return <tt>true</tt> if exactly one exception, with a linked cause of the specified type, been received,
- * <tt>false</tt> otherwise.
- */
- public synchronized boolean assertOneJMSExceptionWithLinkedCause(Class aClass)
- {
- if (exceptions.size() == 1)
- {
- Exception e = exceptions.get(0);
-
- if (e instanceof JMSException)
- {
- JMSException jmse = (JMSException) e;
-
- Exception linkedCause = jmse.getLinkedException();
-
- if ((linkedCause != null) && aClass.isInstance(linkedCause))
- {
- return true;
- }
- }
- }
-
- return false;
- }
-
- /**
- * Checks that at least one exception of the the specified type, has been received.
- *
- * @param exceptionClass The type of the exception.
- *
- * @return <tt>true</tt> if at least one exception of the specified type has been received, <tt>false</tt> otherwise.
- */
- public synchronized boolean assertExceptionOfType(Class exceptionClass)
- {
- // Start by assuming that the exception has no been received.
- boolean passed = false;
-
- // Scan all the exceptions for a match.
- for (Exception e : exceptions)
- {
- if (exceptionClass.isInstance(e))
- {
- passed = true;
-
- break;
- }
- }
-
- return passed;
- }
-
- /**
- * Reports the number of exceptions held by this monitor.
- *
- * @return The number of exceptions held by this monitor.
- */
- public synchronized int size()
- {
- return exceptions.size();
- }
-
- /**
- * Clears the record of received exceptions.
- */
- public synchronized void reset()
- {
- exceptions = new ArrayList<Exception>();
- }
-
- /**
- * Provides a dump of the stack traces of all exceptions that this exception monitor was notified of. Mainly
- * use for debugging/test failure reporting purposes.
- *
- * @return A string containing a dump of the stack traces of all exceptions.
- */
- public synchronized String toString()
- {
- String result = "ExceptionMonitor: holds " + exceptions.size() + " exceptions.\n\n";
-
- for (Exception ex : exceptions)
- {
- result += getStackTrace(ex) + "\n";
- }
-
- return result;
- }
-
- /**
- * Prints an exception stack trace into a string.
- *
- * @param t The throwable to get the stack trace from.
- *
- * @return A string containing the throwables stack trace.
- */
- public static String getStackTrace(Throwable t)
- {
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw, true);
- t.printStackTrace(pw);
- pw.flush();
- sw.flush();
-
- return sw.toString();
- }
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/FrameworkBaseCase.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/FrameworkBaseCase.java
deleted file mode 100644
index ecbb710a6b..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/FrameworkBaseCase.java
+++ /dev/null
@@ -1,299 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.test.framework;
-
-import org.apache.log4j.Logger;
-import org.apache.log4j.NDC;
-
-import org.apache.qpid.junit.extensions.SetupTaskAware;
-import org.apache.qpid.junit.extensions.SetupTaskHandler;
-import org.apache.qpid.junit.extensions.util.ParsedProperties;
-import org.apache.qpid.junit.extensions.util.TestContextProperties;
-import org.apache.qpid.test.framework.sequencers.CircuitFactory;
-import org.apache.qpid.test.utils.QpidBrokerTestCase;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * FrameworkBaseCase provides a starting point for writing test cases against the test framework. Its main purpose is
- * to provide some convenience methods for testing.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Create and clean up in-vm brokers on every test case.
- * <tr><td> Produce lists of assertions from assertion creation calls.
- * <tr><td> Produce JUnit failures from assertion failures.
- * <tr><td> Convert failed assertions to error messages.
- * </table>
- */
-public class FrameworkBaseCase extends QpidBrokerTestCase implements FrameworkTestContext, SetupTaskAware,
- BrokerLifecycleAware
-{
- /** Used for debugging purposes. */
- private static final Logger log = Logger.getLogger(FrameworkBaseCase.class);
-
- private CircuitFactory circuitFactory = new LocalAMQPCircuitFactory();
-
- private ParsedProperties testProps;
-
- private SetupTaskHandler taskHandler = new SetupTaskHandler();
-
- private boolean isUsingInVM;
-
- private CauseFailure failureMechanism = new CauseFailureUserPrompt();
-
- /**
- * Creates a new test case with the specified name.
- *
- * @param name The test case name.
- */
- public FrameworkBaseCase(String name)
- {
- super(name);
- }
-
- /** Holds the test sequencer to create and run test circuits with. */ /**
- * Returns the test case sequencer that provides test circuit, and test sequence implementations. The sequencer
- * that this base case returns by default is suitable for running a test circuit with both circuit ends colocated
- * on the same JVM.
- *
- * @return The test case sequencer.
- */
- protected CircuitFactory getCircuitFactory()
- {
- return circuitFactory;
- }
-
- /**
- * Overrides the default test circuit factory. Test decorators can use this to supply distributed test sequencers or
- * other test circuit factory specializations.
- *
- * @param circuitFactory The new test circuit factory.
- */
- public void setCircuitFactory(CircuitFactory circuitFactory)
- {
- this.circuitFactory = circuitFactory;
- }
-
- /**
- * Reports the current test case name.
- *
- * @return The current test case name.
- */
- public TestCaseVector getTestCaseVector()
- {
- return new TestCaseVector(this.getName(), 0);
- }
-
- /**
- * Reports the current test case parameters.
- *
- * @return The current test case parameters.
- */
- public MessagingTestConfigProperties getTestParameters()
- {
- return new MessagingTestConfigProperties(testProps);
- }
-
- /**
- * Creates a list of assertions.
- *
- * @param asserts The assertions to compile in a list.
- *
- * @return A list of assertions.
- */
- protected List<Assertion> assertionList(Assertion... asserts)
- {
- List<Assertion> result = new ArrayList<Assertion>();
-
- for (Assertion assertion : asserts)
- {
- result.add(assertion);
- }
-
- return result;
- }
-
- /**
- * Generates a JUnit assertion exception (failure) if any assertions are passed into this method, also concatenating
- * all of the error messages in the assertions together to form an error message to diagnose the test failure with.
- *
- * @param asserts The list of failed assertions.
- */
- protected static void assertNoFailures(List<Assertion> asserts)
- {
- log.debug("protected void assertNoFailures(List<Assertion> asserts = " + asserts + "): called");
-
- // Check if there are no assertion failures, and return without doing anything if so.
- if ((asserts == null) || asserts.isEmpty())
- {
- return;
- }
-
- // Compile all of the assertion failure messages together.
- String errorMessage = assertionsToString(asserts);
-
- // Fail with the error message from all of the assertions.
- fail(errorMessage);
- }
-
- /**
- * Converts a list of failed assertions into an error message.
- *
- * @param asserts The failed assertions.
- *
- * @return The error message.
- */
- protected static String assertionsToString(List<Assertion> asserts)
- {
- String errorMessage = "";
-
- for (Assertion assertion : asserts)
- {
- errorMessage += assertion.toString() + "\n";
- }
-
- return errorMessage;
- }
-
- /**
- * Ensures that the in-vm broker is created and initialized.
- *
- * @throws Exception Any exceptions allowed to fall through and fail the test.
- */
- protected void setUp() throws Exception
- {
- super.setUp();
- NDC.push(getName());
-
- testProps = TestContextProperties.getInstance(MessagingTestConfigProperties.defaults);
- }
-
- /**
- * Ensures that the in-vm broker is cleaned up after each test run.
- */
- protected void tearDown()
- {
- NDC.pop();
-
- // Process all optional tear down tasks. This may include in-vm broker clean up, if a decorator has added it.
- taskHandler.runTearDownTasks();
- }
-
- /**
- * Adds the specified task to the tests setup.
- *
- * @param task The task to add to the tests setup.
- */
- public void chainSetupTask(Runnable task)
- {
- taskHandler.chainSetupTask(task);
- }
-
- /**
- * Adds the specified task to the tests tear down.
- *
- * @param task The task to add to the tests tear down.
- */
- public void chainTearDownTask(Runnable task)
- {
- taskHandler.chainTearDownTask(task);
- }
-
- /**
- * Should provide a translation from the junit method name of a test to its test case name as known to the test
- * clients that will run the test. The purpose of this is to convert the JUnit method name into the correct test
- * case name to place into the test invite. For example the method "testP2P" might map onto the interop test case
- * name "TC2_BasicP2P".
- *
- * @param methodName The name of the JUnit test method.
- *
- * @return The name of the corresponding interop test case.
- */
- public String getTestCaseNameForTestMethod(String methodName)
- {
- return methodName;
- }
-
- public void setInVmBrokers()
- {
- isUsingInVM = true;
- }
-
- /**
- * Indicates whether or not a test case is using in-vm brokers.
- *
- * @return <tt>true</tt> if the test is using in-vm brokers, <tt>false</tt> otherwise.
- */
- public boolean usingInVmBroker()
- {
- return isUsingInVM;
- }
-
- /**
- * Sets the currently live in-vm broker.
- *
- * @param i The currently live in-vm broker.
- */
- public void setLiveBroker(int i)
- { }
-
- /**
- * Reports the currently live in-vm broker.
- *
- * @return The currently live in-vm broker.
- */
- public int getLiveBroker()
- {
- return 0;
- }
-
- /**
- * Accepts a failure mechanism.
- *
- * @param failureMechanism The failure mechanism.
- */
- public void setFailureMechanism(CauseFailure failureMechanism)
- {
- this.failureMechanism = failureMechanism;
- }
-
- protected ParsedProperties getTestProps()
- {
- return testProps;
- }
-
- protected void setTestProps(ParsedProperties testProps)
- {
- this.testProps = testProps;
- }
-
- protected SetupTaskHandler getTaskHandler()
- {
- return taskHandler;
- }
-
- protected CauseFailure getFailureMechanism()
- {
- return failureMechanism;
- }
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/FrameworkTestContext.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/FrameworkTestContext.java
deleted file mode 100644
index 9a4668e86f..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/FrameworkTestContext.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.test.framework;
-
-/**
- * A FrameworkTestContext provides context information to test code about the current test case being run; its name, its
- * parameters.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Provide the name of the current test case.
- * <tr><td> Provide the test parameters.
- * </table>
- */
-public interface FrameworkTestContext
-{
- /**
- * Reports the current test case name.
- *
- * @return The current test case name.
- */
- TestCaseVector getTestCaseVector();
-
- /**
- * Reports the current test case parameters.
- *
- * @return The current test case parameters.
- */
- MessagingTestConfigProperties getTestParameters();
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/LocalAMQPCircuitFactory.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/LocalAMQPCircuitFactory.java
deleted file mode 100644
index 899a808bdd..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/LocalAMQPCircuitFactory.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.test.framework;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.client.AMQSession;
-import org.apache.qpid.junit.extensions.util.ParsedProperties;
-import org.apache.qpid.test.framework.localcircuit.LocalAMQPPublisherImpl;
-import org.apache.qpid.test.framework.localcircuit.LocalPublisherImpl;
-
-import javax.jms.Connection;
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.Topic;
-
-/**
- * LocalAMQPCircuitFactory is a test sequencer that creates test circuits with publishing and receiving ends rooted
- * on the same JVM, allowing AMQP/Qpid specific options to be applied to the circuit.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Provide a standard test procedure over a test circuit.
- * <tr><td> Construct test circuits appropriate to a tests context.
- * <tr><td> Construct test circuits the support AMQP specific options.
- * </table>
- */
-public class LocalAMQPCircuitFactory extends LocalCircuitFactory
-{
- /** Used for debugging. */
- private static final Logger log = Logger.getLogger(LocalAMQPCircuitFactory.class);
-
- /**
- * Builds a circuit end suitable for the publishing side of a test circuit, from standard test parameters.
- *
- * @param connection The connection to build the circuit end on.
- * @param testProps The test parameters to configure the circuit end construction.
- * @param uniqueId A unique number to being numbering destinations from, to make this circuit unique.
- *
- * @return A circuit end suitable for the publishing side of a test circuit.
- *
- * @throws javax.jms.JMSException Any underlying JMSExceptions are allowed to fall through and fail the creation.
- */
- public CircuitEndBase createPublisherCircuitEnd(Connection connection, ParsedProperties testProps, long uniqueId)
- throws JMSException
- {
- log.debug(
- "public CircuitEndBase createPublisherCircuitEnd(Connection connection, ParsedProperties testProps, long uniqueId = "
- + uniqueId + "): called");
-
- // Cast the test properties into a typed interface for convenience.
- MessagingTestConfigProperties props = new MessagingTestConfigProperties(testProps);
-
- Session session = connection.createSession(props.getPublisherTransacted(), props.getAckMode());
-
- Destination destination =
- props.getPubsub() ? session.createTopic(props.getSendDestinationNameRoot() + "_" + uniqueId)
- : session.createQueue(props.getSendDestinationNameRoot() + "_" + uniqueId);
-
- MessageProducer producer =
- props.getPublisherProducerBind()
- ? ((props.getImmediate() || props.getMandatory())
- ? ((AMQSession) session).createProducer(destination, props.getMandatory(), props.getImmediate())
- : session.createProducer(destination)) : null;
-
- MessageConsumer consumer =
- props.getPublisherConsumerBind()
- ? session.createConsumer(session.createQueue(props.getReceiveDestinationNameRoot() + "_" + uniqueId)) : null;
-
- MessageMonitor messageMonitor = new MessageMonitor();
-
- if (consumer != null)
- {
- consumer.setMessageListener(messageMonitor);
- }
-
- ExceptionMonitor exceptionMonitor = new ExceptionMonitor();
- connection.setExceptionListener(exceptionMonitor);
-
- if (!props.getPublisherConsumerActive() && (consumer != null))
- {
- consumer.close();
- }
-
- return new CircuitEndBase(producer, consumer, session, messageMonitor, exceptionMonitor);
- }
-
- /**
- * Builds a circuit end suitable for the receiving side of a test circuit, from standard test parameters.
- *
- * @param connection The connection to build the circuit end on.
- * @param testProps The test parameters to configure the circuit end construction.
- * @param uniqueId A unique number to being numbering destinations from, to make this circuit unique.
- *
- * @return A circuit end suitable for the receiving side of a test circuit.
- *
- * @throws JMSException Any underlying JMSExceptions are allowed to fall through and fail the creation.
- */
- public CircuitEndBase createReceiverCircuitEnd(Connection connection, ParsedProperties testProps, long uniqueId)
- throws JMSException
- {
- log.debug(
- "public CircuitEndBase createReceiverCircuitEnd(Connection connection, ParsedProperties testProps, long uniqueId = "
- + uniqueId + "): called");
-
- // Cast the test properties into a typed interface for convenience.
- MessagingTestConfigProperties props = new MessagingTestConfigProperties(testProps);
-
- Session session = connection.createSession(props.getPublisherTransacted(), props.getAckMode());
-
- MessageProducer producer =
- props.getReceiverProducerBind()
- ? session.createProducer(session.createQueue(props.getReceiveDestinationNameRoot() + "_" + uniqueId)) : null;
-
- Destination destination =
- props.getPubsub() ? session.createTopic(props.getSendDestinationNameRoot() + "_" + uniqueId)
- : session.createQueue(props.getSendDestinationNameRoot() + "_" + uniqueId);
-
- MessageConsumer consumer =
- props.getReceiverConsumerBind()
- ? ((props.getDurableSubscription() && props.getPubsub())
- ? session.createDurableSubscriber((Topic) destination, "testsub") : session.createConsumer(destination))
- : null;
-
- MessageMonitor messageMonitor = new MessageMonitor();
-
- if (consumer != null)
- {
- consumer.setMessageListener(messageMonitor);
- }
-
- if (!props.getReceiverConsumerActive() && (consumer != null))
- {
- consumer.close();
- }
-
- return new CircuitEndBase(producer, consumer, session, messageMonitor, null);
- }
-
- /**
- * Creates a local {@link Publisher} from a {@link CircuitEnd}. The publisher implementation provides AMQP
- * specific assertion methods, for testing beyond JMS.
- *
- * @param publisherEnd The publishing circuit end.
- *
- * @return A {@link Receiver}.
- */
- protected LocalPublisherImpl createPublisherFromCircuitEnd(CircuitEndBase publisherEnd)
- {
- return new LocalAMQPPublisherImpl(publisherEnd);
- }
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/LocalCircuitFactory.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/LocalCircuitFactory.java
deleted file mode 100644
index b8fd4cc7e7..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/LocalCircuitFactory.java
+++ /dev/null
@@ -1,320 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.test.framework;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.junit.extensions.util.ParsedProperties;
-import org.apache.qpid.test.framework.localcircuit.LocalCircuitImpl;
-import org.apache.qpid.test.framework.localcircuit.LocalPublisherImpl;
-import org.apache.qpid.test.framework.localcircuit.LocalReceiverImpl;
-import org.apache.qpid.test.framework.sequencers.CircuitFactory;
-import org.apache.qpid.test.utils.ConversationFactory;
-
-import javax.jms.Connection;
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.Topic;
-import java.util.List;
-import java.util.Properties;
-import java.util.concurrent.atomic.AtomicLong;
-
-/**
- * LocalCircuitFactory is a circuit factory that creates test circuits with publishing and receiving ends rooted
- * on the same JVM. The ends of the circuit are presented as {@link Publisher} and {@link Receiver} interfaces, which
- * in turn provide methods to apply assertions to the circuit. The creation of the circuit ends, and the presentation
- * of the ends as publisher/receiver interfaces, are designed to be overriden, so that circuits and assertions that
- * use messaging features not available in JMS can be written. This provides an extension point for writing tests
- * against proprietary features of JMS implementations.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Provide a standard test procedure over a test circuit.
- * <tr><td> Construct test circuits appropriate to a tests context.
- * </table>
- */
-public class LocalCircuitFactory implements CircuitFactory
-{
- /** Used for debugging. */
- private static final Logger log = Logger.getLogger(LocalCircuitFactory.class);
-
- /** Used to create unique destination names for each test. */
- protected static AtomicLong uniqueDestsId = new AtomicLong();
-
- /**
- * Holds a test coordinating conversation with the test clients. This should consist of assigning the test roles,
- * begining the test and gathering the test reports from the participants.
- *
- * @param testCircuit The test circuit.
- * @param assertions The list of assertions to apply to the test circuit.
- * @param testProperties The test case definition.
- */
- public void sequenceTest(Circuit testCircuit, List<Assertion> assertions, Properties testProperties)
- {
- if (testCircuit != null)
- {
- FrameworkBaseCase.assertNoFailures(testCircuit.test(1, assertions));
- }
- }
-
- /**
- * Creates a test circuit for the test, configered by the test parameters specified.
- *
- * @param testProperties The test parameters.
- *
- * @return A test circuit.
- */
- public Circuit createCircuit(Connection connection, ParsedProperties testProperties)
- {
- Circuit result;
-
- // Cast the test properties into a typed interface for convenience.
- MessagingTestConfigProperties props = new MessagingTestConfigProperties(testProperties);
-
- // Create a standard publisher/receivers test client pair on a shared connection, individual sessions.
- try
- {
- // Get a unique offset to append to destination names to make them unique to the connection.
- long uniqueId = uniqueDestsId.incrementAndGet();
-
- // Add the connection exception listener to assert on exception conditions with.
- // ExceptionMonitor exceptionMonitor = new ExceptionMonitor();
- // connection.setExceptionListener(exceptionMonitor);
-
- // Set up the publisher.
- CircuitEndBase publisherEnd = createPublisherCircuitEnd(connection, props, uniqueId);
-
- // Set up the receiver.
- CircuitEndBase receiverEnd = createReceiverCircuitEnd(connection, props, uniqueId);
-
- // Start listening for incoming messages.
- connection.start();
-
- // Package everything up.
- LocalPublisherImpl publisher = createPublisherFromCircuitEnd(publisherEnd);
- LocalReceiverImpl receiver = createReceiverFromCircuitEnd(receiverEnd);
-
- result = new LocalCircuitImpl(testProperties, publisher, receiver, connection, publisher.getExceptionMonitor());
- }
- catch (JMSException e)
- {
- throw new RuntimeException("Could not create publisher/receivers pair due to a JMSException.", e);
- }
-
- return result;
- }
-
- /**
- * Creates a local {@link Receiver} from a {@link CircuitEnd}. Sub-classes may override this to provide more
- * specialized receivers if necessary.
- *
- * @param receiverEnd The receiving circuit end.
- *
- * @return A {@link Receiver}.
- */
- protected LocalReceiverImpl createReceiverFromCircuitEnd(CircuitEndBase receiverEnd)
- {
- return new LocalReceiverImpl(receiverEnd);
- }
-
- /**
- * Creates a local {@link Publisher} from a {@link CircuitEnd}. Sub-classes may override this to provide more
- * specialized receivers if necessary.
- *
- * @param publisherEnd The publishing circuit end.
- *
- * @return A {@link Receiver}.
- */
- protected LocalPublisherImpl createPublisherFromCircuitEnd(CircuitEndBase publisherEnd)
- {
- return new LocalPublisherImpl(publisherEnd);
- }
-
- /**
- * Builds a circuit end suitable for the publishing side of a test circuit, from standard test parameters.
- *
- * @param connection The connection to build the circuit end on.
- * @param testProps The test parameters to configure the circuit end construction.
- * @param uniqueId A unique number to being numbering destinations from, to make this circuit unique.
- *
- * @return A circuit end suitable for the publishing side of a test circuit.
- *
- * @throws JMSException Any underlying JMSExceptions are allowed to fall through and fail the creation.
- */
- public CircuitEndBase createPublisherCircuitEnd(Connection connection, ParsedProperties testProps, long uniqueId)
- throws JMSException
- {
- log.debug(
- "public CircuitEndBase createPublisherCircuitEnd(Connection connection, ParsedProperties testProps, long uniqueId = "
- + uniqueId + "): called");
-
- // Cast the test properties into a typed interface for convenience.
- MessagingTestConfigProperties props = new MessagingTestConfigProperties(testProps);
-
- // Check that the test properties do not contain AMQP/Qpid specific settings, and fail if they do.
- if (props.getImmediate() || props.getMandatory())
- {
- throw new RuntimeException(
- "Cannot create a pure JMS circuit as the test properties require AMQP specific options.");
- }
-
- Session session = connection.createSession(props.getPublisherTransacted(), props.getAckMode());
-
- Destination destination =
- props.getPubsub() ? session.createTopic(props.getSendDestinationNameRoot() + "_" + uniqueId)
- : session.createQueue(props.getSendDestinationNameRoot() + "_" + uniqueId);
-
- MessageProducer producer = props.getPublisherProducerBind() ? session.createProducer(destination) : null;
-
- MessageConsumer consumer =
- props.getPublisherConsumerBind()
- ? session.createConsumer(session.createQueue(props.getReceiveDestinationNameRoot() + "_" + uniqueId)) : null;
-
- MessageMonitor messageMonitor = new MessageMonitor();
-
- if (consumer != null)
- {
- consumer.setMessageListener(messageMonitor);
- }
-
- ExceptionMonitor exceptionMonitor = new ExceptionMonitor();
- connection.setExceptionListener(exceptionMonitor);
-
- if (!props.getPublisherConsumerActive() && (consumer != null))
- {
- consumer.close();
- }
-
- return new CircuitEndBase(producer, consumer, session, messageMonitor, exceptionMonitor);
- }
-
- /**
- * Builds a circuit end suitable for the receiving side of a test circuit, from standard test parameters.
- *
- * @param connection The connection to build the circuit end on.
- * @param testProps The test parameters to configure the circuit end construction.
- * @param uniqueId A unique number to being numbering destinations from, to make this circuit unique.
- *
- * @return A circuit end suitable for the receiving side of a test circuit.
- *
- * @throws JMSException Any underlying JMSExceptions are allowed to fall through and fail the creation.
- */
- public CircuitEndBase createReceiverCircuitEnd(Connection connection, ParsedProperties testProps, long uniqueId)
- throws JMSException
- {
- log.debug(
- "public CircuitEndBase createReceiverCircuitEnd(Connection connection, ParsedProperties testProps, long uniqueId = "
- + uniqueId + "): called");
-
- // Cast the test properties into a typed interface for convenience.
- MessagingTestConfigProperties props = new MessagingTestConfigProperties(testProps);
-
- // Check that the test properties do not contain AMQP/Qpid specific settings, and fail if they do.
- if (props.getImmediate() || props.getMandatory())
- {
- throw new RuntimeException(
- "Cannot create a pure JMS circuit as the test properties require AMQP specific options.");
- }
-
- Session session = connection.createSession(props.getPublisherTransacted(), props.getAckMode());
-
- MessageProducer producer =
- props.getReceiverProducerBind()
- ? session.createProducer(session.createQueue(props.getReceiveDestinationNameRoot() + "_" + uniqueId)) : null;
-
- Destination destination =
- props.getPubsub() ? session.createTopic(props.getSendDestinationNameRoot() + "_" + uniqueId)
- : session.createQueue(props.getSendDestinationNameRoot() + "_" + uniqueId);
-
- MessageConsumer consumer =
- props.getReceiverConsumerBind()
- ? ((props.getDurableSubscription() && props.getPubsub())
- ? session.createDurableSubscriber((Topic) destination, "testsub") : session.createConsumer(destination))
- : null;
-
- MessageMonitor messageMonitor = new MessageMonitor();
-
- if (consumer != null)
- {
- consumer.setMessageListener(messageMonitor);
- }
-
- if (!props.getReceiverConsumerActive() && (consumer != null))
- {
- consumer.close();
- }
-
- return new CircuitEndBase(producer, consumer, session, messageMonitor, null);
- }
-
- /**
- * Sets the sender test client to coordinate the test with.
- *
- * @param sender The contact details of the sending client in the test.
- */
- public void setSender(TestClientDetails sender)
- {
- throw new RuntimeException("Not implemented.");
- }
-
- /**
- * Sets the receiving test client to coordinate the test with.
- *
- * @param receiver The contact details of the sending client in the test.
- */
- public void setReceiver(TestClientDetails receiver)
- {
- throw new RuntimeException("Not implemented.");
- }
-
- /**
- * Supplies the sending test client.
- *
- * @return The sending test client.
- */
- public TestClientDetails getSender()
- {
- throw new RuntimeException("Not implemented.");
- }
-
- /**
- * Supplies the receiving test client.
- *
- * @return The receiving test client.
- */
- public List<TestClientDetails> getReceivers()
- {
- throw new RuntimeException("Not implemented.");
- }
-
- /**
- * Accepts the conversation factory over which to hold the test coordinating conversation.
- *
- * @param conversationFactory The conversation factory to coordinate the test over.
- */
- public void setConversationFactory(ConversationFactory conversationFactory)
- {
- throw new RuntimeException("Not implemented.");
- }
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/MessageIdentityVector.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/MessageIdentityVector.java
deleted file mode 100644
index 397c4e9fbd..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/MessageIdentityVector.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.test.framework;
-
-/**
- * MessageIdentityVector provides a message identification scheme, that matches individual messages with test cases.
- * Test messages are being sent by a number of test clients, sending messages over a set of routes, and being received
- * by another set of test clients. Each test is itself, being run within a test cycle, of which there could be many. It
- * is the job of the test coordinator to request and receive reports from the available test clients, on what has been
- * sent, what has been received, and what errors may have occurred, and to reconcile this information against the
- * assertions being applied by the test case. In order to be able to figure out which messages belong to which test,
- * there needs to be an identification scheme, that the coordinator can use to correlate messages in senders and
- * receiver reports. Every message sent in a test can be associated with this information.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Identify a test case, a handling client id, a circuit end within the client, and a test cycle number.
- * </table>
- */
-public class MessageIdentityVector
-{
- /** Holds the test case vector component of the message identity vector. */
- private TestCaseVector testCaseVector;
-
- /** The unique client id. */
- private String clientId;
-
- /** The unique circuit end number within the client id. */
- private int circuitEndId;
-
- /**
- * Creates a new identity vector for test messages.
- *
- * @param testCase The name of the test case generating the messages.
- * @param clientId The unique id of the client implementing a circuit end that is handling the messages.
- * @param circuitEndId The unique id number of the circuit end within the client.
- * @param testCycleNumber The cycle iteration number of the test case.
- */
- public MessageIdentityVector(String testCase, String clientId, int circuitEndId, int testCycleNumber)
- {
- this.testCaseVector = new TestCaseVector(testCase, testCycleNumber);
- this.clientId = clientId;
- this.circuitEndId = circuitEndId;
- }
-
- /**
- * Reports the test case vector component of the message identity vector.
- *
- * @return The test case vector component of the message identity vector.
- */
- public TestCaseVector getTestCaseVector()
- {
- return testCaseVector;
- }
-
- /**
- * Reports the name of the test case.
- *
- * @return The name of the test case.
- */
- public String getTestCase()
- {
- return testCaseVector.getTestCase();
- }
-
- /**
- * Reports the test iteration cycle number within the test case.
- *
- * @return The test iteration cycle number within the test case.
- */
- public int getTestCycleNumber()
- {
- return testCaseVector.getTestCycleNumber();
- }
-
- /**
- * Resports the client id.
- *
- * @return The client id.
- */
- public String getClientId()
- {
- return clientId;
- }
-
- /**
- * Reports the circuit end number within the test client.
- *
- * @return The circuit end number within the test client.
- */
- public int getCircuitEndId()
- {
- return circuitEndId;
- }
-
- /**
- * Compares this identity vector with another for equality. All fields must match.
- *
- * @param o The identity vector to compare with.
- *
- * @return <tt>true</tt> if the identity vector is identical to this one by all fields, <tt>false</tt> otherwise.
- */
- public boolean equals(Object o)
- {
- if (this == o)
- {
- return true;
- }
-
- if ((o == null) || (getClass() != o.getClass()))
- {
- return false;
- }
-
- MessageIdentityVector that = (MessageIdentityVector) o;
-
- if (circuitEndId != that.circuitEndId)
- {
- return false;
- }
-
- if ((clientId != null) ? (!clientId.equals(that.clientId)) : (that.clientId != null))
- {
- return false;
- }
-
- if ((testCaseVector != null) ? (!testCaseVector.equals(that.testCaseVector)) : (that.testCaseVector != null))
- {
- return false;
- }
-
- return true;
- }
-
- /**
- * Computes a hash code for this identity vector based on all fields.
- *
- * @return A hash code for this identity vector based on all fields.
- */
- public int hashCode()
- {
- int result;
- result = ((testCaseVector != null) ? testCaseVector.hashCode() : 0);
- result = (31 * result) + ((clientId != null) ? clientId.hashCode() : 0);
- result = (31 * result) + circuitEndId;
-
- return result;
- }
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/MessageMonitor.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/MessageMonitor.java
deleted file mode 100644
index 5265c0416f..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/MessageMonitor.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.test.framework;
-
-import org.apache.log4j.Logger;
-
-import javax.jms.Message;
-import javax.jms.MessageListener;
-import java.util.concurrent.atomic.AtomicInteger;
-
-/**
- * MessageMonitor is used to record information about messages received. This will provide methods to check various
- * properties, such as the type, number and content of messages received in order to verify the correct behaviour of
- * tests.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Count incoming messages.
- * <tr><td> Record time ellapsed since the arrival of the first message.
- * <tr><td> Reset all counts and timings.
- * </table>
- */
-public class MessageMonitor implements MessageListener
-{
- /** Used for debugging. */
- private final Logger log = Logger.getLogger(MessageMonitor.class);
-
- /** Holds the count of messages received since the last query. */
- protected AtomicInteger numMessages = new AtomicInteger();
-
- /** Holds the time of arrival of the first message. */
- protected Long firstMessageTime = null;
-
- /**
- * Handles received messages. Does Nothing.
- *
- * @param message The message. Ignored.
- */
- public void onMessage(Message message)
- {
- // log.debug("public void onMessage(Message message): called");
-
- numMessages.getAndIncrement();
- }
-
- /**
- * Gets the count of messages.
- *
- * @return The count of messages.
- */
- public int getNumMessage()
- {
- if (firstMessageTime == null)
- {
- firstMessageTime = System.nanoTime();
- }
-
- return numMessages.get();
- }
-
- /**
- * Gets the time elapsed since the first message arrived, in nanos, or zero if no messages have arrived yet.
- *
- * @return The time elapsed since the first message arrived, in nanos, or zero if no messages have arrived yet.
- */
- public long getTime()
- {
- if (firstMessageTime != null)
- {
- return System.nanoTime() - firstMessageTime;
- }
- else
- {
- return 0L;
- }
- }
-
- /**
- * Resets the message count and timer to zero.
- */
- public void reset()
- {
- numMessages.set(0);
- firstMessageTime = null;
- }
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/MessagingTestConfigProperties.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/MessagingTestConfigProperties.java
deleted file mode 100644
index ceece2dae2..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/MessagingTestConfigProperties.java
+++ /dev/null
@@ -1,684 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.test.framework;
-
-import org.apache.qpid.junit.extensions.util.ParsedProperties;
-
-import javax.jms.Session;
-import java.util.Properties;
-
-/**
- * MessagingTestConfigProperties defines a set of property names and default values for specifying a messaging topology,
- * and test parameters for running a messaging test over that topology. A Properties object holding some of these
- * properties, superimposed onto the defaults, is used to establish test topologies and control test behaviour.
- *
- * <p/>A complete list of the parameters, default values and comments on their usage is provided here:
- *
- * <p/><table><caption>Parameters</caption>
- * <tr><th> Parameter <th> Default <th> Comments
- * <tr><td> messageSize <td> 0 <td> Message size in bytes. Not including any headers.
- * <tr><td> destinationName <td> ping <td> The root name to use to generate destination names to ping.
- * <tr><td> persistent <td> false <td> Determines whether peristent delivery is used.
- * <tr><td> transacted <td> false <td> Determines whether messages are sent/received in transactions.
- * <tr><td> broker <td> tcp://localhost:5672 <td> Determines the broker to connect to.
- * <tr><td> virtualHost <td> test <td> Determines the virtual host to send all ping over.
- * <tr><td> rate <td> 0 <td> The maximum rate (in hertz) to send messages at. 0 means no limit.
- * <tr><td> verbose <td> false <td> The verbose flag for debugging. Prints to console on every message.
- * <tr><td> pubsub <td> false <td> Whether to ping topics or queues. Uses p2p by default.
- * <tr><td> username <td> guest <td> The username to access the broker with.
- * <tr><td> password <td> guest <td> The password to access the broker with.
- * <tr><td> selector <td> null <td> Not used. Defines a message selector to filter pings with.
- * <tr><td> destinationCount <td> 1 <td> The number of receivers listening to the pings.
- * <tr><td> timeout <td> 30000 <td> In milliseconds. The timeout to stop waiting for replies.
- * <tr><td> commitBatchSize <td> 1 <td> The number of messages per transaction in transactional mode.
- * <tr><td> uniqueDests <td> true <td> Whether each receivers only listens to one ping destination or all.
- * <tr><td> durableDests <td> false <td> Whether or not durable destinations are used.
- * <tr><td> ackMode <td> AUTO_ACK <td> The message acknowledgement mode. Possible values are:
- * 0 - SESSION_TRANSACTED
- * 1 - AUTO_ACKNOWLEDGE
- * 2 - CLIENT_ACKNOWLEDGE
- * 3 - DUPS_OK_ACKNOWLEDGE
- * 257 - NO_ACKNOWLEDGE
- * 258 - PRE_ACKNOWLEDGE
- * <tr><td> maxPending <td> 0 <td> The maximum size in bytes, of messages sent but not yet received.
- * Limits the volume of messages currently buffered on the client
- * or broker. Can help scale test clients by limiting amount of buffered
- * data to avoid out of memory errors.
- * </table>
- *
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Provide the names and defaults of all test parameters.
- * </table>
- *
- * @todo Put a type-safe wrapper around these properties, but continue to store the parameters as properties. This is
- * simply to ensure that it is a simple matter to serialize/deserialize string/string pairs onto messages.
- */
-public class MessagingTestConfigProperties extends ParsedProperties
-{
- // ====================== Connection Properties ==================================
-
- /** Holds the name of the default connection configuration. */
- public static final String CONNECTION_NAME = "broker";
-
- /** Holds the name of the property to get the initial context factory name from. */
- public static final String INITIAL_CONTEXT_FACTORY_PROPNAME = "java.naming.factory.initial";
-
- /** Defines the class to use as the initial context factory by default. */
- public static final String INITIAL_CONTEXT_FACTORY_DEFAULT = "org.apache.qpid.jndi.PropertiesFileInitialContextFactory";
-
- /** Holds the name of the property to get the test broker url from. */
- public static final String BROKER_PROPNAME = "qpid.test.broker";
-
- /** Holds the default broker url for the test. */
- public static final String BROKER_DEFAULT = "vm://:1";
-
- /** Holds the name of the property to get the test broker virtual path. */
- public static final String VIRTUAL_HOST_PROPNAME = "virtualHost";
-
- /** Holds the default virtual path for the test. */
- public static final String VIRTUAL_HOST_DEFAULT = "test";
-
- /** Holds the name of the property to get the broker access username from. */
- public static final String USERNAME_PROPNAME = "username";
-
- /** Holds the default broker log on username. */
- public static final String USERNAME_DEFAULT = "guest";
-
- /** Holds the name of the property to get the broker access password from. */
- public static final String PASSWORD_PROPNAME = "password";
-
- /** Holds the default broker log on password. */
- public static final String PASSWORD_DEFAULT = "guest";
-
- // ====================== Messaging Topology Properties ==========================
-
- /** Holds the name of the property to get the bind publisher procuder flag from. */
- public static final String PUBLISHER_PRODUCER_BIND_PROPNAME = "publisherProducerBind";
-
- /** Holds the default value of the publisher producer flag. */
- public static final boolean PUBLISHER_PRODUCER_BIND_DEFAULT = true;
-
- /** Holds the name of the property to get the bind publisher procuder flag from. */
- public static final String PUBLISHER_CONSUMER_BIND_PROPNAME = "publisherConsumerBind";
-
- /** Holds the default value of the publisher consumer flag. */
- public static final boolean PUBLISHER_CONSUMER_BIND_DEFAULT = false;
-
- /** Holds the name of the property to get the bind receivers procuder flag from. */
- public static final String RECEIVER_PRODUCER_BIND_PROPNAME = "receiverProducerBind";
-
- /** Holds the default value of the receivers producer flag. */
- public static final boolean RECEIVER_PRODUCER_BIND_DEFAULT = false;
-
- /** Holds the name of the property to get the bind receivers procuder flag from. */
- public static final String RECEIVER_CONSUMER_BIND_PROPNAME = "receiverConsumerBind";
-
- /** Holds the default value of the receivers consumer flag. */
- public static final boolean RECEIVER_CONSUMER_BIND_DEFAULT = true;
-
- /** Holds the name of the property to get the publishers consumer active flag from. */
- public static final String PUBLISHER_CONSUMER_ACTIVE_PROPNAME = "publisherConsumerActive";
-
- /** Holds the default value of the publishers consumer active flag. */
- public static final boolean PUBLISHER_CONSUMER_ACTIVE_DEFAULT = true;
-
- /** Holds the name of the property to get the receivers consumer active flag from. */
- public static final String RECEIVER_CONSUMER_ACTIVE_PROPNAME = "receiverConsumerActive";
-
- /** Holds the default value of the receivers consumer active flag. */
- public static final boolean RECEIVER_CONSUMER_ACTIVE_DEFAULT = true;
-
- /** Holds the name of the property to get the destination name root from. */
- public static final String SEND_DESTINATION_NAME_ROOT_PROPNAME = "sendDestinationRoot";
-
- /** Holds the root of the name of the default destination to send to. */
- public static final String SEND_DESTINATION_NAME_ROOT_DEFAULT = "sendTo";
-
- /** Holds the name of the property to get the destination name root from. */
- public static final String RECEIVE_DESTINATION_NAME_ROOT_PROPNAME = "receiveDestinationRoot";
-
- /** Holds the root of the name of the default destination to send to. */
- public static final String RECEIVE_DESTINATION_NAME_ROOT_DEFAULT = "receiveFrom";
-
- /** Holds the name of the proeprty to get the destination count from. */
- public static final String DESTINATION_COUNT_PROPNAME = "destinationCount";
-
- /** Defines the default number of destinations to ping. */
- public static final int DESTINATION_COUNT_DEFAULT = 1;
-
- /** Holds the name of the property to get the p2p or pub/sub messaging mode from. */
- public static final String PUBSUB_PROPNAME = "pubsub";
-
- /** Holds the pub/sub mode default, true means ping a topic, false means ping a queue. */
- public static final boolean PUBSUB_DEFAULT = false;
-
- // ====================== JMS Options and Flags =================================
-
- /** Holds the name of the property to get the test delivery mode from. */
- public static final String PERSISTENT_MODE_PROPNAME = "persistent";
-
- /** Holds the message delivery mode to use for the test. */
- public static final boolean PERSISTENT_MODE_DEFAULT = false;
-
- /** Holds the name of the property to get the test transactional mode from. */
- public static final String TRANSACTED_PUBLISHER_PROPNAME = "transactedPublisher";
-
- /** Holds the transactional mode to use for the test. */
- public static final boolean TRANSACTED_PUBLISHER_DEFAULT = false;
-
- /** Holds the name of the property to get the test transactional mode from. */
- public static final String TRANSACTED_RECEIVER_PROPNAME = "transactedReceiver";
-
- /** Holds the transactional mode to use for the test. */
- public static final boolean TRANSACTED_RECEIVER_DEFAULT = false;
-
- /** Holds the name of the property to set the no local flag from. */
- public static final String NO_LOCAL_PROPNAME = "noLocal";
-
- /** Defines the default value of the no local flag to use when consuming messages. */
- public static final boolean NO_LOCAL_DEFAULT = false;
-
- /** Holds the name of the property to get the message acknowledgement mode from. */
- public static final String ACK_MODE_PROPNAME = "ackMode";
-
- /** Defines the default message acknowledgement mode. */
- public static final int ACK_MODE_DEFAULT = Session.AUTO_ACKNOWLEDGE;
-
- /** Holds the name of the property to get the durable subscriptions flag from, when doing pub/sub messaging. */
- public static final String DURABLE_SUBSCRIPTION_PROPNAME = "durableSubscription";
-
- /** Defines the default value of the durable subscriptions flag. */
- public static final boolean DURABLE_SUBSCRIPTION_DEFAULT = false;
-
- // ====================== Qpid/AMQP Options and Flags ================================
-
- /** Holds the name of the property to set the exclusive flag from. */
- public static final String EXCLUSIVE_PROPNAME = "exclusive";
-
- /** Defines the default value of the exclusive flag to use when consuming messages. */
- public static final boolean EXCLUSIVE_DEFAULT = false;
-
- /** Holds the name of the property to set the immediate flag from. */
- public static final String IMMEDIATE_PROPNAME = "immediate";
-
- /** Defines the default value of the immediate flag to use when sending messages. */
- public static final boolean IMMEDIATE_DEFAULT = false;
-
- /** Holds the name of the property to set the mandatory flag from. */
- public static final String MANDATORY_PROPNAME = "mandatory";
-
- /** Defines the default value of the mandatory flag to use when sending messages. */
- public static final boolean MANDATORY_DEFAULT = false;
-
- /** Holds the name of the property to get the durable destinations flag from. */
- public static final String DURABLE_DESTS_PROPNAME = "durableDests";
-
- /** Default value for the durable destinations flag. */
- public static final boolean DURABLE_DESTS_DEFAULT = false;
-
- /** Holds the name of the property to set the prefetch size from. */
- public static final String PREFETCH_PROPNAME = "prefetch";
-
- /** Defines the default prefetch size to use when consuming messages. */
- public static final int PREFETCH_DEFAULT = 100;
-
- // ====================== Common Test Parameters ================================
-
- /** Holds the name of the property to get the test message size from. */
- public static final String MESSAGE_SIZE_PROPNAME = "messageSize";
-
- /** Used to set up a default message size. */
- public static final int MESSAGE_SIZE_DEAFULT = 0;
-
- /** Holds the name of the property to get the message rate from. */
- public static final String RATE_PROPNAME = "rate";
-
- /** Defines the default rate (in pings per second) to send pings at. 0 means as fast as possible, no restriction. */
- public static final int RATE_DEFAULT = 0;
-
- /** Holds the name of the proeprty to get the. */
- public static final String SELECTOR_PROPNAME = "selector";
-
- /** Holds the default message selector. */
- public static final String SELECTOR_DEFAULT = "";
-
- /** Holds the name of the property to get the waiting timeout for response messages. */
- public static final String TIMEOUT_PROPNAME = "timeout";
-
- /** Default time to wait before assuming that a ping has timed out. */
- public static final long TIMEOUT_DEFAULT = 30000;
-
- /** Holds the name of the property to get the commit batch size from. */
- public static final String TX_BATCH_SIZE_PROPNAME = "commitBatchSize";
-
- /** Defines the default number of pings to send in each transaction when running transactionally. */
- public static final int TX_BATCH_SIZE_DEFAULT = 1;
-
- /** Holds the name of the property to set the maximum amount of pending message data for a producer to hold. */
- public static final String MAX_PENDING_PROPNAME = "maxPending";
-
- /** Defines the default maximum quantity of pending message data to allow producers to hold. */
- public static final int MAX_PENDING_DEFAULT = 0;
-
- /** Holds the name of the property to get the publisher rollback flag from. */
- public static final String ROLLBACK_PUBLISHER_PROPNAME = "rollbackPublisher";
-
- /** Holds the default publisher roll back setting. */
- public static final boolean ROLLBACK_PUBLISHER_DEFAULT = false;
-
- /** Holds the name of the property to get the publisher rollback flag from. */
- public static final String ROLLBACK_RECEIVER_PROPNAME = "rollbackReceiver";
-
- /** Holds the default publisher roll back setting. */
- public static final boolean ROLLBACK_RECEIVER_DEFAULT = false;
-
- // ====================== Options that control the bahviour of the test framework. =========================
-
- /** Holds the name of the property to get the behavioural mode of not applicable assertions. */
- public static final String NOT_APPLICABLE_ASSERTION_PROPNAME = "notApplicableAssertion";
-
- /** Holds the default behavioral mode of not applicable assertions, which is logging them as a warning. */
- public static final String NOT_APPLICABLE_ASSERTION_DEFAULT = "warn";
-
- /** Holds the name of the property to get the verbose mode proeprty from. */
- public static final String VERBOSE_PROPNAME = "verbose";
-
- /** Holds the default verbose mode. */
- public static final boolean VERBOSE_DEFAULT = false;
-
- /** Holds the default configuration properties. */
- public static ParsedProperties defaults = new ParsedProperties();
-
- static
- {
- defaults.setPropertyIfNull(INITIAL_CONTEXT_FACTORY_PROPNAME, INITIAL_CONTEXT_FACTORY_DEFAULT);
- defaults.setPropertyIfNull(BROKER_PROPNAME, BROKER_DEFAULT);
- defaults.setPropertyIfNull(VIRTUAL_HOST_PROPNAME, VIRTUAL_HOST_DEFAULT);
- defaults.setPropertyIfNull(USERNAME_PROPNAME, USERNAME_DEFAULT);
- defaults.setPropertyIfNull(PASSWORD_PROPNAME, PASSWORD_DEFAULT);
-
- defaults.setPropertyIfNull(PUBLISHER_PRODUCER_BIND_PROPNAME, PUBLISHER_PRODUCER_BIND_DEFAULT);
- defaults.setPropertyIfNull(PUBLISHER_CONSUMER_BIND_PROPNAME, PUBLISHER_CONSUMER_BIND_DEFAULT);
- defaults.setPropertyIfNull(RECEIVER_PRODUCER_BIND_PROPNAME, RECEIVER_PRODUCER_BIND_DEFAULT);
- defaults.setPropertyIfNull(RECEIVER_CONSUMER_BIND_PROPNAME, RECEIVER_CONSUMER_BIND_DEFAULT);
- defaults.setPropertyIfNull(PUBLISHER_CONSUMER_ACTIVE_PROPNAME, PUBLISHER_CONSUMER_ACTIVE_DEFAULT);
- defaults.setPropertyIfNull(RECEIVER_CONSUMER_ACTIVE_PROPNAME, RECEIVER_CONSUMER_ACTIVE_DEFAULT);
- defaults.setPropertyIfNull(SEND_DESTINATION_NAME_ROOT_PROPNAME, SEND_DESTINATION_NAME_ROOT_DEFAULT);
- defaults.setPropertyIfNull(RECEIVE_DESTINATION_NAME_ROOT_PROPNAME, RECEIVE_DESTINATION_NAME_ROOT_DEFAULT);
- defaults.setPropertyIfNull(DESTINATION_COUNT_PROPNAME, DESTINATION_COUNT_DEFAULT);
- defaults.setPropertyIfNull(PUBSUB_PROPNAME, PUBSUB_DEFAULT);
-
- defaults.setPropertyIfNull(PERSISTENT_MODE_PROPNAME, PERSISTENT_MODE_DEFAULT);
- defaults.setPropertyIfNull(TRANSACTED_PUBLISHER_PROPNAME, TRANSACTED_PUBLISHER_DEFAULT);
- defaults.setPropertyIfNull(TRANSACTED_RECEIVER_PROPNAME, TRANSACTED_RECEIVER_DEFAULT);
- defaults.setPropertyIfNull(NO_LOCAL_PROPNAME, NO_LOCAL_DEFAULT);
- defaults.setPropertyIfNull(ACK_MODE_PROPNAME, ACK_MODE_DEFAULT);
- defaults.setPropertyIfNull(DURABLE_SUBSCRIPTION_PROPNAME, DURABLE_SUBSCRIPTION_DEFAULT);
-
- defaults.setPropertyIfNull(EXCLUSIVE_PROPNAME, EXCLUSIVE_DEFAULT);
- defaults.setPropertyIfNull(IMMEDIATE_PROPNAME, IMMEDIATE_DEFAULT);
- defaults.setPropertyIfNull(MANDATORY_PROPNAME, MANDATORY_DEFAULT);
- defaults.setPropertyIfNull(DURABLE_DESTS_PROPNAME, DURABLE_DESTS_DEFAULT);
- defaults.setPropertyIfNull(PREFETCH_PROPNAME, PREFETCH_DEFAULT);
-
- defaults.setPropertyIfNull(MESSAGE_SIZE_PROPNAME, MESSAGE_SIZE_DEAFULT);
- defaults.setPropertyIfNull(RATE_PROPNAME, RATE_DEFAULT);
- defaults.setPropertyIfNull(SELECTOR_PROPNAME, SELECTOR_DEFAULT);
- defaults.setPropertyIfNull(TIMEOUT_PROPNAME, TIMEOUT_DEFAULT);
- defaults.setPropertyIfNull(TX_BATCH_SIZE_PROPNAME, TX_BATCH_SIZE_DEFAULT);
- defaults.setPropertyIfNull(MAX_PENDING_PROPNAME, MAX_PENDING_DEFAULT);
- defaults.setPropertyIfNull(ROLLBACK_PUBLISHER_PROPNAME, ROLLBACK_PUBLISHER_DEFAULT);
- defaults.setPropertyIfNull(ROLLBACK_RECEIVER_PROPNAME, ROLLBACK_RECEIVER_DEFAULT);
-
- defaults.setPropertyIfNull(NOT_APPLICABLE_ASSERTION_PROPNAME, NOT_APPLICABLE_ASSERTION_DEFAULT);
- defaults.setPropertyIfNull(VERBOSE_PROPNAME, VERBOSE_DEFAULT);
- }
-
- /**
- * Creates a test configuration based on the defaults.
- */
- public MessagingTestConfigProperties()
- {
- super(defaults);
- }
-
- /**
- * Creates a test configuration based on the supplied properties.
- *
- * @param properties The test configuration.
- */
- public MessagingTestConfigProperties(Properties properties)
- {
- super(properties);
- }
-
- /**
- * The size of test messages to send.
- *
- * @return The size of test messages to send.
- */
- public int getMessageSize()
- {
- return getPropertyAsInteger(MESSAGE_SIZE_PROPNAME);
- }
-
- /**
- * Flag to indicate that the publishing producer should be set up to publish to a destination.
- *
- * @return Flag to indicate that the publishing producer should be set up to publish to a destination.
- */
- public boolean getPublisherProducerBind()
- {
- return getPropertyAsBoolean(PUBLISHER_PRODUCER_BIND_PROPNAME);
- }
-
- /**
- * Flag to indicate that the publishing consumer should be set up to receive from a destination.
- *
- * @return Flag to indicate that the publishing consumer should be set up to receive from a destination.
- */
- public boolean getPublisherConsumerBind()
- {
- return getPropertyAsBoolean(PUBLISHER_CONSUMER_BIND_PROPNAME);
- }
-
- /**
- * Flag to indicate that the receiving producer should be set up to publish to a destination.
- *
- * @return Flag to indicate that the receiving producer should be set up to publish to a destination.
- */
- public boolean getReceiverProducerBind()
- {
- return getPropertyAsBoolean(RECEIVER_PRODUCER_BIND_PROPNAME);
- }
-
- /**
- * Flag to indicate that the receiving consumer should be set up to receive from a destination.
- *
- * @return Flag to indicate that the receiving consumer should be set up to receive from a destination.
- */
- public boolean getReceiverConsumerBind()
- {
- return getPropertyAsBoolean(RECEIVER_CONSUMER_BIND_PROPNAME);
- }
-
- /**
- * Flag to indicate that the publishing consumer should be created and actively listening.
- *
- * @return Flag to indicate that the publishing consumer should be created.
- */
- public boolean getPublisherConsumerActive()
- {
- return getPropertyAsBoolean(PUBLISHER_CONSUMER_ACTIVE_PROPNAME);
- }
-
- /**
- * Flag to indicate that the receiving consumers should be created and actively listening.
- *
- * @return Flag to indicate that the receiving consumers should be created and actively listening.
- */
- public boolean getReceiverConsumerActive()
- {
- return getPropertyAsBoolean(RECEIVER_CONSUMER_ACTIVE_PROPNAME);
- }
-
- /**
- * A root to create all test destination names from.
- *
- * @return A root to create all test destination names from.
- */
- public String getSendDestinationNameRoot()
- {
- return getProperty(SEND_DESTINATION_NAME_ROOT_PROPNAME);
- }
-
- /**
- * A root to create all receiving destination names from.
- *
- * @return A root to create all receiving destination names from.
- */
- public String getReceiveDestinationNameRoot()
- {
- return getProperty(RECEIVE_DESTINATION_NAME_ROOT_PROPNAME);
- }
-
- /**
- * Flag to indicate that persistent messages should be used.
- *
- * @return Flag to indicate that persistent messages should be used.
- */
- public boolean getPersistentMode()
- {
- return getPropertyAsBoolean(PERSISTENT_MODE_PROPNAME);
- }
-
- /**
- * Flag to indicate that transactional messages should be sent by the publisher.
- *
- * @return Flag to indicate that transactional messages should be sent by the publisher.
- */
- public boolean getPublisherTransacted()
- {
- return getPropertyAsBoolean(TRANSACTED_PUBLISHER_PROPNAME);
- }
-
- /**
- * Flag to indicate that transactional receives should be used by the receiver.
- *
- * @return Flag to indicate that transactional receives should be used by the receiver.
- */
- public boolean getReceiverTransacted()
- {
- return getPropertyAsBoolean(TRANSACTED_PUBLISHER_PROPNAME);
- }
-
- /**
- * The name of the virtual host to run all tests over.
- *
- * @return The name of the virtual host to run all tests over.
- */
- public String getVirtualHost()
- {
- return getProperty(VIRTUAL_HOST_PROPNAME);
- }
-
- /**
- * Limiting rate for each sender in messages per second, or zero for unlimited.
- *
- * @return Limiting rate for each sender in messages per second, or zero for unlimited.
- */
- public String getRate()
- {
- return getProperty(RATE_PROPNAME);
- }
-
- /**
- * Flag to indicate that test messages should be received publish/subscribe style by all receivers.
- *
- * @return Flag to indicate that test messages should be received publish/subscribe style by all receivers.
- */
- public boolean getPubsub()
- {
- return getPropertyAsBoolean(PUBSUB_PROPNAME);
- }
-
- /**
- * The username credentials to run tests with.
- *
- * @return The username credentials to run tests with.
- */
- public String getUsername()
- {
- return getProperty(USERNAME_PROPNAME);
- }
-
- /**
- * The password credentials to run tests with.
- *
- * @return The password credentials to run tests with.
- */
- public String getPassword()
- {
- return getProperty(PASSWORD_PROPNAME);
- }
-
- /**
- * The timeout duration to fail tests on, should they receive no messages within it.
- *
- * @return The timeout duration to fail tests on, should they receive no messages within it.
- */
- public long getTimeout()
- {
- return getPropertyAsLong(TIMEOUT_PROPNAME);
- }
-
- /**
- * The number of messages to batch into each transaction in transational tests.
- *
- * @return The number of messages to batch into each transaction in transational tests.
- */
- public int getTxBatchSize()
- {
- return getPropertyAsInteger(TX_BATCH_SIZE_PROPNAME);
- }
-
- /**
- * Flag to indicate that tests should use durable destinations.
- *
- * @return Flag to indicate that tests should use durable destinations.
- */
- public boolean getDurableDests()
- {
- return getPropertyAsBoolean(DURABLE_DESTS_PROPNAME);
- }
-
- /**
- * The ack mode for message receivers to use.
- *
- * @return The ack mode for message receivers to use.
- */
- public int getAckMode()
- {
- return getPropertyAsInteger(ACK_MODE_PROPNAME);
- }
-
- /**
- * Flag to indicate that tests should use durable subscriptions.
- *
- * @return Flag to indicate that tests should use durable subscriptions.
- */
- public boolean getDurableSubscription()
- {
- return getPropertyAsBoolean(DURABLE_SUBSCRIPTION_PROPNAME);
- }
-
- /**
- * The maximum amount of in-flight data, in bytes, that tests should send at any time.
- *
- * @return The maximum amount of in-flight data, in bytes, that tests should send at any time.
- */
- public int getMaxPending()
- {
- return getPropertyAsInteger(MAX_PENDING_PROPNAME);
- }
-
- /**
- * The size of the prefetch queue to use.
- *
- * @return The size of the prefetch queue to use.
- */
- public int getPrefetch()
- {
- return getPropertyAsInteger(PREFETCH_PROPNAME);
- }
-
- /**
- * Flag to indicate that subscriptions should be no-local.
- *
- * @return Flag to indicate that subscriptions should be no-local.
- */
- public boolean getNoLocal()
- {
- return getPropertyAsBoolean(NO_LOCAL_PROPNAME);
- }
-
- /**
- * Flag to indicate that subscriptions should be exclusive.
- *
- * @return Flag to indicate that subscriptions should be exclusive.
- */
- public boolean getExclusive()
- {
- return getPropertyAsBoolean(EXCLUSIVE_PROPNAME);
- }
-
- /**
- * Flag to indicate that messages must be delivered immediately.
- *
- * @return Flag to indicate that messages must be delivered immediately.
- */
- public boolean getImmediate()
- {
- return getPropertyAsBoolean(IMMEDIATE_PROPNAME);
- }
-
- /**
- * Flag to indicate that messages must be routable.
- *
- * @return Flag to indicate that messages must be routable.
- */
- public boolean getMandatory()
- {
- return getPropertyAsBoolean(MANDATORY_PROPNAME);
- }
-
- /**
- * Gets the value of a flag to indicate that the publisher should rollback all messages sent.
- *
- * @return A flag to indicate that the publisher should rollback all messages sent.
- */
- public boolean getRollbackPublisher()
- {
- return getPropertyAsBoolean(ROLLBACK_PUBLISHER_PROPNAME);
- }
-
- /**
- * Gets the value of a flag to indicate that the receiver should rollback all messages received, then receive them
- * again.
- *
- * @return A flag to indicate that the publisher should rollback all messages received.
- */
- public boolean getRollbackReceiver()
- {
- return getPropertyAsBoolean(ROLLBACK_RECEIVER_PROPNAME);
- }
-
- /**
- * Gets the behavioural mode of not applicable assertions. Should be one of 'quiet', 'warn' or 'fail'.
- *
- * @return The behavioural mode of not applicable assertions.
- */
- public String getNotApplicableAssertionMode()
- {
- return getProperty(NOT_APPLICABLE_ASSERTION_PROPNAME);
- }
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/NotApplicableAssertion.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/NotApplicableAssertion.java
deleted file mode 100644
index 2a20be12d6..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/NotApplicableAssertion.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.test.framework;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.junit.extensions.util.ParsedProperties;
-
-/**
- * NotApplicableAssertion is a messaging assertion that can be used when an assertion requested by a test-case is not
- * applicable to the testing scenario. For example an assertion may relate to AMQP functionality, but a test case may be
- * being run over a non-AMQP JMS implementation, in which case the request to create the assertion may return this
- * instead of the proper assertion. The test framework is configurable to quietly drop these assertions, log them
- * as warnings to the console, or raise them as test failures.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Quitely pass.
- * <tr><td> Log a warning.
- * <tr><td> Raise a test failure.
- * </table>
- */
-public class NotApplicableAssertion implements Assertion
-{
- /** Used for logging to the console. */
- private static final Logger console = Logger.getLogger("CONSOLE." + NotApplicableAssertion.class.getName());
-
- /** The possible behavioural modes of this assertion. */
- private enum Mode
- {
- /** Quietly ignore the assertion by passing. */
- Quiet,
-
- /** Ignore the assertion by passing but log a warning about it. */
- Warn,
-
- /** Fail the assertion. */
- Fail;
- }
-
- /** The behavioural mode of the assertion. */
- private Mode mode;
-
- /**
- * Creates an assertion that is driven by the value of the 'notApplicableAssertion' property of the test
- * configuration. Its value should match one of 'quiet', 'warn' or 'fail' and if it does not it is automatically
- * read as 'fail'.
- *
- * @param testProperties The test configuration properties.
- */
- public NotApplicableAssertion(ParsedProperties testProperties)
- {
- // Cast the test properties into a typed interface for convenience.
- MessagingTestConfigProperties props = new MessagingTestConfigProperties(testProperties);
-
- String modeName = props.getNotApplicableAssertionMode();
-
- if ("quiet".equals(modeName))
- {
- mode = Mode.Quiet;
- }
- else if ("warn".equals(modeName))
- {
- mode = Mode.Warn;
- }
- else
- {
- mode = Mode.Fail;
- }
- }
-
- /**
- * Applies the assertion.
- *
- * @return <tt>true</tt> if the assertion passes, <tt>false</tt> if it fails.
- */
- public boolean apply()
- {
- switch (mode)
- {
- case Quiet:
- return true;
-
- case Warn:
- console.warn("Warning: Not applicable assertion being ignored.");
-
- return true;
-
- case Fail:
- default:
- return false;
- }
- }
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/Publisher.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/Publisher.java
deleted file mode 100644
index 2c8be4f787..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/Publisher.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.test.framework;
-
-import org.apache.qpid.junit.extensions.util.ParsedProperties;
-
-/**
- * A Publisher represents the status of the publishing side of a test circuit. Its main purpose is to provide assertions
- * that can be applied to test the behaviour of the publishers.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities
- * <tr><td> Provide assertion that the publishers received no exceptions.
- * </table>
- *
- * @todo There are mixtures of AMQP and JMS assertions in this interface. Either keep them here, but quietly (or with a
- * warning or error) drop them from test cases where they are not relevant, or push them down into sub-classes.
- * I am tempted to go with the dropping/warning/error approach, that would imply that it makes sense to pull
- * the assertions back from AMQPPublisher to here.
- */
-public interface Publisher
-{
- // Assertions that are meaningfull to AMQP and to JMS.
-
- /**
- * Provides an assertion that the publisher encountered no exceptions.
- *
- * @param testProps The test configuration properties.
- *
- * @return An assertion that the publisher encountered no exceptions.
- */
- public Assertion noExceptionsAssertion(ParsedProperties testProps);
-
- // Assertions that are meaningfull only to AMQP.
-
- /**
- * Provides an assertion that the AMQP channel was forcibly closed by an error condition.
- *
- * @param testProps The test configuration properties.
- *
- * @return An assertion that the AMQP channel was forcibly closed by an error condition.
- */
- public Assertion channelClosedAssertion(ParsedProperties testProps);
-
- // Assertions that are meaningfull only to Java/JMS.
-
- /**
- * Provides an assertion that the publisher got a given exception during the test.
- *
- * @param testProps The test configuration properties.
- * @param exceptionClass The exception class to check for.
- *
- * @return An assertion that the publisher got a given exception during the test.
- */
- public Assertion exceptionAssertion(ParsedProperties testProps, Class<? extends Exception> exceptionClass);
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/Receiver.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/Receiver.java
deleted file mode 100644
index 19dc4d90e7..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/Receiver.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.test.framework;
-
-import org.apache.qpid.junit.extensions.util.ParsedProperties;
-
-/**
- * A Receiver is a {@link CircuitEnd} that represents the status of the receiving side of a test circuit. Its main
- * purpose is to provide assertions that can be applied to check the behaviour of the receivers.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities
- * <tr><td> Provide assertion that the receivers received no exceptions.
- * <tr><td> Provide assertion that the receivers received all test messages sent to it.
- * </table>
- *
- * @todo There are mixtures of AMQP and JMS assertions in this interface. Either keep them here, but quietly (or with a
- * warning or error) drop them from test cases where they are not relevant, or push them down into sub-classes.
- * I am tempted to go with the dropping/warning/error approach.
- */
-public interface Receiver
-{
- // Assertions that are meaningfull to AMQP and to JMS.
-
- /**
- * Provides an assertion that the receivers encountered no exceptions.
- *
- * @param testProps The test configuration properties.
- *
- * @return An assertion that the receivers encountered no exceptions.
- */
- public Assertion noExceptionsAssertion(ParsedProperties testProps);
-
- /**
- * Provides an assertion that the receivers got all messages that were sent to it.
- *
- * @param testProps The test configuration properties.
- *
- * @return An assertion that the receivers got all messages that were sent to it.
- */
- public Assertion allMessagesReceivedAssertion(ParsedProperties testProps);
-
- /**
- * Provides an assertion that the receivers got none of the messages that were sent to it.
- *
- * @param testProps The test configuration properties.
- *
- * @return An assertion that the receivers got none of the messages that were sent to it.
- */
- public Assertion noMessagesReceivedAssertion(ParsedProperties testProps);
-
- // Assertions that are meaningfull only to AMQP.
-
- /**
- * Provides an assertion that the AMQP channel was forcibly closed by an error condition.
- *
- * @param testProps The test configuration properties.
- *
- * @return An assertion that the AMQP channel was forcibly closed by an error condition.
- */
- public Assertion channelClosedAssertion(ParsedProperties testProps);
-
- // Assertions that are meaningfull only to Java/JMS.
-
- /**
- * Provides an assertion that the receiver got a given exception during the test.
- *
- * @param testProps The test configuration properties.
- * @param exceptionClass The exception class to check for.
- *
- * @return An assertion that the receiver got a given exception during the test.
- */
- public Assertion exceptionAssertion(ParsedProperties testProps, Class<? extends Exception> exceptionClass);
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/TestCaseVector.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/TestCaseVector.java
deleted file mode 100644
index ad1e70f6f7..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/TestCaseVector.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.test.framework;
-
-/**
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td>
- * </table>
- */
-public class TestCaseVector
-{
- /** The test case name. */
- private String testCase;
-
- /** The test cycle number within the test case. */
- private int testCycleNumber;
-
- public TestCaseVector(String testCase, int testCycleNumber)
- {
- this.testCase = testCase;
- this.testCycleNumber = testCycleNumber;
- }
-
- public String getTestCase()
- {
- return testCase;
- }
-
- public int getTestCycleNumber()
- {
- return testCycleNumber;
- }
-
- public boolean equals(Object o)
- {
- if (this == o)
- {
- return true;
- }
-
- if ((o == null) || (getClass() != o.getClass()))
- {
- return false;
- }
-
- TestCaseVector that = (TestCaseVector) o;
-
- if (testCycleNumber != that.testCycleNumber)
- {
- return false;
- }
-
- if ((testCase != null) ? (!testCase.equals(that.testCase)) : (that.testCase != null))
- {
- return false;
- }
-
- return true;
- }
-
- public int hashCode()
- {
- int result;
- result = ((testCase != null) ? testCase.hashCode() : 0);
- result = (31 * result) + testCycleNumber;
-
- return result;
- }
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/TestClientDetails.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/TestClientDetails.java
deleted file mode 100644
index 7498f2b6b5..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/TestClientDetails.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.test.framework;
-
-/**
- * TestClientDetails is used to encapsulate information about an interop test client. It pairs together the unique
- * name of the client, and the route on which it listens to its control messages.
- *
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Record test clients control addresses together with their names.
- * </table>
- */
-public class TestClientDetails
-{
- /** The test clients name. */
- public String clientName;
-
- /* The test clients unique sequence number. Not currently used. */
-
- /** The routing key of the test clients control topic. */
- public String privateControlKey;
-
- /**
- * Two TestClientDetails are considered to be equal, iff they have the same client name.
- *
- * @param o The object to compare to.
- *
- * @return <tt>If the object to compare to is a TestClientDetails equal to this one, <tt>false</tt> otherwise.
- */
- public boolean equals(Object o)
- {
- if (this == o)
- {
- return true;
- }
-
- if (!(o instanceof TestClientDetails))
- {
- return false;
- }
-
- final TestClientDetails testClientDetails = (TestClientDetails) o;
-
- return !((clientName != null) ? (!clientName.equals(testClientDetails.clientName))
- : (testClientDetails.clientName != null));
- }
-
- /**
- * Computes a hash code compatible with the equals method; based on the client name alone.
- *
- * @return A hash code for this.
- */
- public int hashCode()
- {
- return ((clientName != null) ? clientName.hashCode() : 0);
- }
-
- /**
- * Outputs the client name and address details. Mostly used for debugging purposes.
- *
- * @return The client name and address.
- */
- public String toString()
- {
- return "TestClientDetails: [ clientName = " + clientName + ", privateControlKey = " + privateControlKey + " ]";
- }
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/TestUtils.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/TestUtils.java
deleted file mode 100644
index 919faa4754..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/TestUtils.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.test.framework;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.junit.extensions.util.ParsedProperties;
-
-import static org.apache.qpid.test.framework.MessagingTestConfigProperties.BROKER_PROPNAME;
-import static org.apache.qpid.test.framework.MessagingTestConfigProperties.CONNECTION_NAME;
-import static org.apache.qpid.test.framework.MessagingTestConfigProperties.PASSWORD_PROPNAME;
-import static org.apache.qpid.test.framework.MessagingTestConfigProperties.USERNAME_PROPNAME;
-import static org.apache.qpid.test.framework.MessagingTestConfigProperties.VIRTUAL_HOST_PROPNAME;
-
-import javax.jms.BytesMessage;
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.Session;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import java.util.Map;
-
-/**
- * TestUtils provides static helper methods that are usefull for writing tests against QPid.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Create connections from test properties. <td> {@link MessagingTestConfigProperties}
- * <tr><td> Create test messages.
- * <tr><td> Inject a short pause in a test.
- * <tr><td> Serialize properties into a message.
- * </table>
- */
-public class TestUtils
-{
- /** Used for debugging. */
- private static Logger log = Logger.getLogger(TestUtils.class);
-
- /** Some dummy data to stuff all test messages with. */
- private static final byte[] MESSAGE_DATA_BYTES =
- "Test Message -- Test Message -- Test Message -- Test Message -- Test Message -- Test Message -- Test Message -- "
- .getBytes();
-
- /**
- * Establishes a JMS connection using a set of properties and qpids built in JNDI implementation. This is a simple
- * convenience method for code that does not anticipate handling connection failures. All exceptions that indicate
- * that the connection has failed, are wrapped as rutime exceptions, presumably handled by a top level failure
- * handler.
- *
- * <p/>This utility makes use of the following test parameters from {@link MessagingTestConfigProperties} to control
- * the connection creation:
- *
- * <p/><table>
- * <tr><td> {@link MessagingTestConfigProperties#USERNAME_PROPNAME} <td> The username.
- * <tr><td> {@link MessagingTestConfigProperties#PASSWORD_PROPNAME} <td> The password.
- * <tr><td> {@link MessagingTestConfigProperties#VIRTUAL_HOST_PROPNAME} <td> The virtual host name.
- * <tr><td> {@link MessagingTestConfigProperties#BROKER_PROPNAME} <td> The broker URL.
- * <tr><td> {@link MessagingTestConfigProperties#CONNECTION_NAME} <td> The broker name in the initial context.
- *
- * @param messagingProps Connection properties as defined in {@link MessagingTestConfigProperties}.
- *
- * @return A JMS conneciton.
- */
- public static Connection createConnection(ParsedProperties messagingProps)
- {
- log.debug("public static Connection createConnection(ParsedProperties messagingProps = " + messagingProps
- + "): called");
-
- try
- {
- // Extract the configured connection properties from the test configuration.
- String conUsername = messagingProps.getProperty(USERNAME_PROPNAME);
- String conPassword = messagingProps.getProperty(PASSWORD_PROPNAME);
- String virtualHost = messagingProps.getProperty(VIRTUAL_HOST_PROPNAME);
- String brokerUrl = messagingProps.getProperty(BROKER_PROPNAME);
-
- // Create the broker connection url.
- String connectionString =
- "amqp://" + conUsername + ":" + conPassword + "@clientid/" + ((virtualHost != null) ? virtualHost : "")
- + "?brokerlist='" + brokerUrl + "'";
-
- // Create properties to create the initial context from, and inject the connection factory configuration
- // for the defined connection name into it.
- messagingProps.setProperty("connectionfactory." + CONNECTION_NAME, connectionString);
-
- Context ctx = new InitialContext(messagingProps);
-
- ConnectionFactory cf = (ConnectionFactory) ctx.lookup(CONNECTION_NAME);
-
- return cf.createConnection();
- }
- catch (NamingException e)
- {
- throw new RuntimeException("Got JNDI NamingException whilst looking up the connection factory.", e);
- }
- catch (JMSException e)
- {
- throw new RuntimeException("Could not establish connection due to JMSException.", e);
- }
- }
-
- /**
- * Creates a test message of the specified size, on the given JMS session.
- *
- * @param session The JMS session.
- * @param size The size of the message in bytes.
- *
- * @return A bytes message, of the specified size, filled with dummy data.
- *
- * @throws JMSException Any underlying JMSExceptions are allowed to fall through.
- */
- public static Message createTestMessageOfSize(Session session, int size) throws JMSException
- {
- BytesMessage message = session.createBytesMessage();
-
- if (size > 0)
- {
- int div = size / MESSAGE_DATA_BYTES.length;
- int mod = size % MESSAGE_DATA_BYTES.length;
-
- for (int i = 0; i < div; i++)
- {
- message.writeBytes(MESSAGE_DATA_BYTES);
- }
-
- if (mod != 0)
- {
- message.writeBytes(MESSAGE_DATA_BYTES, 0, mod);
- }
- }
-
- return message;
- }
-
- /**
- * Pauses for the specified length of time. In the event of failing to pause for at least that length of time
- * due to interuption of the thread, a RutimeException is raised to indicate the failure. The interupted status
- * of the thread is restores in that case. This method should only be used when it is expected that the pause
- * will be succesfull, for example in test code that relies on inejecting a pause.
- *
- * @param t The minimum time to pause for in milliseconds.
- */
- public static void pause(long t)
- {
- try
- {
- Thread.sleep(t);
- }
- catch (InterruptedException e)
- {
- // Restore the interrupted status
- Thread.currentThread().interrupt();
-
- throw new RuntimeException("Failed to generate the requested pause length.", e);
- }
- }
-
- /**
- * Sets properties of different types on a JMS Message.
- *
- * @param message The message to set properties on.
- * @param properties The property name/value pairs to set.
- *
- * @throws javax.jms.JMSException All underlying JMSExceptions are allowed to fall through.
- *
- * @todo Move this helper method somewhere else. For example, TestUtils.
- */
- public static void setPropertiesOnMessage(Message message, Map<Object, Object> properties) throws JMSException
- {
- for (Map.Entry<Object, Object> entry : properties.entrySet())
- {
- String name = entry.getKey().toString();
- Object value = entry.getValue();
-
- message.setObjectProperty(name, value);
- }
- }
-}
-
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/clocksynch/ClockSynchFailureException.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/clocksynch/ClockSynchFailureException.java
deleted file mode 100644
index 00cc2d8966..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/clocksynch/ClockSynchFailureException.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.test.framework.clocksynch;
-
-/**
- * ClockSynchFailureException represents failure of a {@link ClockSynchronizer} to achieve synchronization. For example,
- * this could be because a reference signal is not available, or because a desired accurracy cannot be attained.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Represent failure to achieve synchronization.
- * </table>
- */
-public class ClockSynchFailureException extends Exception
-{
- /**
- * Creates a clock synch failure exception.
- *
- * @param message The detail message (which is saved for later retrieval by the {@link #getMessage()} method).
- * @param cause The cause (which is saved for later retrieval by the {@link #getCause()} method). (A <tt>null</tt>
- * value is permitted, and indicates that the cause is nonexistent or unknown.)
- */
- public ClockSynchFailureException(String message, Throwable cause)
- {
- super(message, cause);
- }
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/clocksynch/ClockSynchThread.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/clocksynch/ClockSynchThread.java
deleted file mode 100644
index 3d4c4f7d12..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/clocksynch/ClockSynchThread.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.test.framework.clocksynch;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.junit.extensions.ShutdownHookable;
-import org.apache.qpid.junit.extensions.Throttle;
-
-/**
- * ClockSynchThread is a convenient utility for running a thread that periodically synchronizes the clock against
- * a reference. Supply it with a {@link ClockSynchronizer} and a {@link Throttle} and it will continually keep the
- * clock up-to-date at a rate determined by the throttle.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Continually sychronize the clock at a throttled rate.
- * </table>
- */
-public class ClockSynchThread extends Thread implements ShutdownHookable
-{
- /** Used for debugging. */
- private static final Logger log = Logger.getLogger(ClockSynchThread.class);
-
- /** Holds the clock syncher for the synch thread. */
- private ClockSynchronizer clockSyncher;
-
- /** Holds the throttle to limit the synch rate. */
- private Throttle throttle;
-
- /** Flag to indicate that the periodic clock syncher should keep running. */
- boolean doSynch = true;
-
- /**
- * Creates a clock synchronizer thread from a clock synchronizer and a throttle.
- *
- * @param syncher The clock synchronizer.
- * @param throttle The throttle.
- */
- public ClockSynchThread(ClockSynchronizer syncher, Throttle throttle)
- {
- this.clockSyncher = syncher;
- this.throttle = throttle;
- }
-
- /**
- * Terminates the synchronization thread.
- */
- public void terminate()
- {
- doSynch = false;
- }
-
- /**
- * Continually updates the clock, until {@link #terminate()} is called.
- */
- public void run()
- {
- while (doSynch)
- {
- // Perform a clock clockSynch.
- try
- {
- // Wait controlled by the throttle before doing the next synch.
- throttle.throttle();
-
- clockSyncher.synch();
- log.debug("Clock synched, delta = " + clockSyncher.getDelta() + ", epsilon = " + clockSyncher.getEpsilon()
- + ".");
- }
- // Terminate the synch thread if the synchronization cannot be achieved.
- catch (ClockSynchFailureException e)
- {
- log.debug("Cannot synchronize the clock (reference service may be down). Terminating the synch thread.");
- doSynch = false;
- }
- }
- }
-
- /**
- * Gets the clock synchronizer that is kept continually up to date.
- *
- * @return The clock synchronizer that is kept continually up to date.
- */
- public ClockSynchronizer getClockSyncher()
- {
- return clockSyncher;
- }
-
- /**
- * Supplies a shutdown hook, that terminates the synching thread.
- *
- * @return The shut down hook.
- */
- public Thread getShutdownHook()
- {
- return new Thread(new Runnable()
- {
- public void run()
- {
- doSynch = false;
- }
- });
- }
-}
-
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/clocksynch/ClockSynchronizer.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/clocksynch/ClockSynchronizer.java
deleted file mode 100644
index a92c551bc2..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/clocksynch/ClockSynchronizer.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.test.framework.clocksynch;
-
-/**
- * ClockSynchronizer provides an interface through which two nodes may synchronize their clocks. It is expected that one
- * node will act as the reference clock, to which no delta need be applied, and the other node will act as the slave,
- * and which must apply a delta to its local clock to get a clock synchronized with the reference.
- *
- * <p/>The slave side will initiate the computation of a clock delta by calling the {@link #synch} method. This method
- * will not return until the delta has been computed, at which point there is a method to return its value, as well as
- * an estimate of the likely error (usually one standard deviation), in the synchronization. For convenience there is a
- * {@link #nanoTime} method to return the value of System.nanoTime() with the delta added in.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Trigger a clock synchronization.
- * <tr><td> Compute a clock delta to apply to the local clock.
- * <tr><td> Estimate the error in the synchronzation.
- * </table>
- */
-public interface ClockSynchronizer
-{
- /**
- * The slave side should call this to copute a clock delta with the reference.
- *
- * @throws ClockSynchFailureException If synchronization cannot be achieved.
- */
- public void synch() throws ClockSynchFailureException;
-
- /**
- * Gets the clock delta in nano seconds.
- *
- * @return The clock delta in nano seconds.
- */
- public long getDelta();
-
- /**
- * Gets an estimate of the clock error in nan seconds.
- *
- * @return An estimate of the clock error in nan seconds.
- */
- public long getEpsilon();
-
- /**
- * Gets the local clock time with any computed delta added in.
- *
- * @return The local clock time with any computed delta added in.
- */
- public long nanoTime();
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/clocksynch/LocalClockSynchronizer.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/clocksynch/LocalClockSynchronizer.java
deleted file mode 100644
index f448d5f23c..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/clocksynch/LocalClockSynchronizer.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.test.framework.clocksynch;
-
-/**
- * LocalClockSynchronizer is a fake {@link ClockSynchronizer} that simply calls System.nanoTime(). It exists so that
- * the same tests can be run distributed or locally, taking timings against the ClockSynchronizer interface without
- * being aware of how they are being run.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Supply the local clock with no delta.
- * </table>
- */
-public class LocalClockSynchronizer implements ClockSynchronizer
-{
- /**
- * The slave side should call this to copute a clock delta with the reference.
- *
- * @throws org.apache.qpid.test.framework.clocksynch.ClockSynchFailureException
- * If synchronization cannot be achieved.
- */
- public void synch() throws ClockSynchFailureException
- { }
-
- /**
- * Gets the clock delta in nano seconds.
- *
- * @return The clock delta in nano seconds.
- */
- public long getDelta()
- {
- return 0L;
- }
-
- /**
- * Gets an estimate of the clock error in nan seconds.
- *
- * @return An estimate of the clock error in nan seconds.
- */
- public long getEpsilon()
- {
- return 0L;
- }
-
- /**
- * Gets the local clock time with any computed delta added in.
- *
- * @return The local clock time with any computed delta added in.
- */
- public long nanoTime()
- {
- return System.nanoTime();
- }
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/clocksynch/UDPClockReference.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/clocksynch/UDPClockReference.java
deleted file mode 100644
index 8ee8d82636..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/clocksynch/UDPClockReference.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.test.framework.clocksynch;
-
-import org.apache.qpid.junit.extensions.ShutdownHookable;
-
-import java.io.IOException;
-import java.net.DatagramPacket;
-import java.net.DatagramSocket;
-import java.net.InetAddress;
-import java.net.SocketException;
-import java.net.SocketTimeoutException;
-import java.nio.ByteBuffer;
-
-/**
- * UDPClockReference supplies a refernce clock signal (generated from System.nanoTime()).
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Supply a reference clock signal.
- * </table>
- *
- * @todo Port hard coded. Make configurable.
- *
- * @todo Errors rethrown as runtimes, or silently terminate the service. Could add better error handling if needed.
- */
-public class UDPClockReference implements Runnable, ShutdownHookable
-{
- /** Used for debugging. */
- // private static final Logger log = Logger.getLogger(UDPClockReference.class);
-
- /** Defines the timeout to use when polling the socket for time requests. */
- private static final int TIMEOUT = 200;
-
- /** Defines the port to run the clock reference on. */
- public static final int REFERENCE_PORT = 4444;
-
- /** Holds the socket to receive clock reference requests on. */
- protected DatagramSocket socket = null;
-
- /** Flag used to indicate that the time server should keep running. Set to false to terminate. */
- protected boolean publish = true;
-
- /**
- * Creates a clock reference service on the standard port.
- */
- public UDPClockReference()
- {
- try
- {
- socket = new DatagramSocket(REFERENCE_PORT);
- socket.setSoTimeout(TIMEOUT);
- }
- catch (SocketException e)
- {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * Implements the run loop for this reference time server. This waits for incoming time requests, and replies to
- * any, with a message with the local time stamp in it. Periodically (controlled by {@link #TIMEOUT}), the run
- * loop will check if the {@link #publish} flag has been cleared, and terminate the reference time service if so.
- */
- public void run()
- {
- byte[] buf = new byte[256];
- ByteBuffer bbuf = ByteBuffer.wrap(buf);
-
- while (publish)
- {
- try
- {
- // Wait for a reference time request.
- DatagramPacket packet = new DatagramPacket(buf, buf.length);
- boolean timedOut = false;
-
- try
- {
- socket.receive(packet);
- }
- catch (SocketTimeoutException e)
- {
- timedOut = true;
- }
-
- if (!timedOut)
- {
- // Work out from the received packet, where to reply to.
- InetAddress address = packet.getAddress();
- int port = packet.getPort();
-
- // Respond to the time request by sending back the local clock as the reference time.
- bbuf.putLong(System.nanoTime());
- bbuf.flip();
- packet = new DatagramPacket(bbuf.array(), bbuf.capacity(), address, port);
-
- socket.send(packet);
- }
- }
- catch (IOException e)
- {
- publish = false;
- }
- }
-
- socket.close();
- }
-
- /**
- * Supplies a shutdown hook.
- *
- * @return The shut down hook.
- */
- public Thread getShutdownHook()
- {
- return new Thread(new Runnable()
- {
- public void run()
- {
- publish = false;
- }
- });
- }
-
- /**
- * For testing purposes. Runs a reference clock on the default port.
- *
- * @param args None.
- */
- public static void main(String[] args)
- {
- try
- {
- // Create the clock reference service.
- UDPClockReference clock = new UDPClockReference();
-
- // Set up a shutdown hook for it.
- Runtime.getRuntime().addShutdownHook(clock.getShutdownHook());
-
- // Start the service.
- clock.run();
- }
- catch (Exception e)
- {
- e.printStackTrace();
- System.exit(1);
- }
- }
-}
-
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/clocksynch/UDPClockSynchronizer.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/clocksynch/UDPClockSynchronizer.java
deleted file mode 100644
index 226c84611d..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/clocksynch/UDPClockSynchronizer.java
+++ /dev/null
@@ -1,468 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.test.framework.clocksynch;
-
-import org.apache.qpid.junit.extensions.util.CommandLineParser;
-import org.apache.qpid.junit.extensions.util.ParsedProperties;
-
-import java.io.IOException;
-import java.net.DatagramPacket;
-import java.net.DatagramSocket;
-import java.net.InetAddress;
-import java.net.SocketException;
-import java.net.SocketTimeoutException;
-import java.net.UnknownHostException;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-
-/**
- * UDPClockSynchronizer is a {@link ClockSynchronizer} that sends pings as UDP datagrams, and uses the following simple
- * algorithm to perform clock synchronization:
- *
- * <ol>
- * <li>Slave initiates synchronization with a Reference clock.</li>
- * <li>Slave stamps current local time on a "time request" message and sends to the Reference.</li>
- * <li>Upon receipt by Reference, Reference stamps Reference-time and returns.</li>
- * <li>Upon receipt by Slave, Slave subtracts current time from sent time and divides by two to compute latency. It
- * subtracts current time from Reference time to determine Slave-Reference time delta and adds in the
- * half-latency to get the correct clock delta.</li>
- * <li>The first result is immediately used to update the clock since it will get the local clock into at least
- * the right ballpark.</li>
- * <li>The Slave repeats steps 2 through 4, 15 more times.</li>
- * <li>The results of the packet receipts are accumulated and sorted in lowest-latency to highest-latency order. The
- * median latency is determined by picking the mid-point sample from this ordered list.</li>
- * <li>All samples outside 1 standard-deviation from the median are discarded and the remaining samples
- * are averaged using an arithmetic mean.</li>
- * </ol>
- *
- * <p/>The use of UDP datagrams, instead of TCP based communication eliminates the hidden delays that TCP can introduce,
- * as it can transparently re-order or re-send packets, or introduce delays as packets are naggled.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Trigger a clock synchronziation.
- * <tr><td> Compute a clock delta to apply to the local clock.
- * <tr><td> Estimate the error in the synchronzation.
- * </table>
- */
-public class UDPClockSynchronizer implements ClockSynchronizer
-{
- /** Used for debugging. */
- // private static final Logger log = Logger.getLogger(UDPClockSynchronizer.class);
-
- /** Defines the timeout to use when waiting for responses to time requests. */
- private static final int TIMEOUT = 50;
-
- /** The clock delta. */
- private long delta = 0L;
-
- /** Holds an estimate of the clock error relative to the reference clock. */
- private long epsilon = 0L;
-
- /** Holds the address of the reference clock. */
- private InetAddress referenceAddress;
-
- /** Holds the socket to communicate with the reference service over. */
- private DatagramSocket socket;
-
- /** Used to control the shutdown in the main test loop. */
- private static boolean doSynch = true;
-
- /**
- * Creates a clock synchronizer against the specified address for the reference.
- *
- * @param address The address of the reference service.
- */
- public UDPClockSynchronizer(String address)
- {
- try
- {
- referenceAddress = InetAddress.getByName(address);
- }
- catch (UnknownHostException e)
- {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * The slave side should call this to compute a clock delta with the reference.
- *
- * @throws ClockSynchFailureException If synchronization cannot be achieved, due to unavailability of the reference
- * time service.
- */
- public void synch() throws ClockSynchFailureException
- {
- try
- {
- socket = new DatagramSocket();
- socket.setSoTimeout(TIMEOUT);
-
- // Synchronize on a single ping, to get the clock into the right ball-park.
- synch(1);
-
- // Synchronize on 15 pings.
- synch(15);
-
- // And again, for greater accuracy, on 31.
- synch(31);
-
- socket.close();
- }
- catch (SocketException e)
- {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * Updates the synchronization delta by performing the specified number of reference clock requests.
- *
- * @param n The number of reference clock request cycles to perform.
- *
- * @throws ClockSynchFailureException If synchronization cannot be achieved, due to unavailability of the reference
- * time service.
- */
- protected void synch(int n) throws ClockSynchFailureException
- {
- // log.debug("protected void synch(int n = " + n + "): called");
-
- // Create an array of deltas by performing n reference pings.
- long[] delta = new long[n];
-
- for (int i = 0; i < n; i++)
- {
- delta[i] = ping();
- }
-
- // Reject any deltas that are larger than 1 s.d. above the median.
- long median = median(delta);
- long sd = standardDeviation(delta);
-
- // log.debug("median = " + median);
- // log.debug("sd = " + sd);
-
- long[] tempDeltas = new long[n];
- int count = 0;
-
- for (int i = 0; i < n; i++)
- {
- if ((delta[i] <= (median + sd)) && (delta[i] >= (median - sd)))
- {
- tempDeltas[count] = delta[i];
- count++;
- }
- else
- {
- // log.debug("Rejected: " + delta[i]);
- }
- }
-
- System.arraycopy(tempDeltas, 0, delta, 0, count);
-
- // Estimate the delta as the mean of the remaining deltas.
- this.delta += mean(delta);
-
- // Estimate the error as the standard deviation of the remaining deltas.
- this.epsilon = standardDeviation(delta);
-
- // log.debug("this.delta = " + this.delta);
- // log.debug("this.epsilon = " + this.epsilon);
- }
-
- /**
- * Performs a single reference clock request cycle and returns the estimated delta relative to the local clock.
- * This is computed as the half-latency of the requst cycle, plus the reference clock, minus the local clock.
- *
- * @return The estimated clock delta.
- *
- * @throws ClockSynchFailureException If the reference service is not responding.
- */
- protected long ping() throws ClockSynchFailureException
- {
- // log.debug("protected long ping(): called");
-
- try
- {
- byte[] buf = new byte[256];
-
- boolean timedOut = false;
- long start = 0L;
- long refTime = 0L;
- long localTime = 0L;
- long latency = 0L;
- int failCount = 0;
-
- // Keep trying the ping until it gets a response, or 10 tries in a row all time out.
- do
- {
- // Start timing the request latency.
- start = nanoTime();
-
- // Get the reference time.
- DatagramPacket packet =
- new DatagramPacket(buf, buf.length, referenceAddress, UDPClockReference.REFERENCE_PORT);
- socket.send(packet);
- packet = new DatagramPacket(buf, buf.length);
-
- timedOut = false;
-
- try
- {
- socket.receive(packet);
- }
- catch (SocketTimeoutException e)
- {
- timedOut = true;
- failCount++;
-
- continue;
- }
-
- ByteBuffer bbuf = ByteBuffer.wrap(packet.getData());
- refTime = bbuf.getLong();
-
- // Stop timing the request latency.
- localTime = nanoTime();
- latency = localTime - start;
-
- // log.debug("refTime = " + refTime);
- // log.debug("localTime = " + localTime);
- // log.debug("start = " + start);
- // log.debug("latency = " + latency);
- // log.debug("delta = " + ((latency / 2) + (refTime - localTime)));
-
- }
- while (timedOut && (failCount < 10));
-
- // Fail completely if the fail count is too high.
- if (failCount >= 10)
- {
- throw new ClockSynchFailureException("Clock reference not responding.", null);
- }
-
- // Estimate delta as (ref clock + half-latency) - local clock.
- return (latency / 2) + (refTime - localTime);
- }
- catch (IOException e)
- {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * Gets the clock delta in nano seconds.
- *
- * @return The clock delta in nano seconds.
- */
- public long getDelta()
- {
- return delta;
- }
-
- /**
- * Gets an estimate of the clock error in nan seconds.
- *
- * @return An estimate of the clock error in nan seconds.
- */
- public long getEpsilon()
- {
- return epsilon;
- }
-
- /**
- * Gets the local clock time with any computed delta added in.
- *
- * @return The local clock time with any computed delta added in.
- */
- public long nanoTime()
- {
- return System.nanoTime() + delta;
- }
-
- /**
- * Computes the median of a series of values.
- *
- * @param values The values.
- *
- * @return The median.
- */
- public static long median(long[] values)
- {
- // log.debug("public static long median(long[] values = " + Arrays.toString(values) + "): called");
-
- long median;
-
- // Order the list of values.
- long[] orderedValues = new long[values.length];
- System.arraycopy(values, 0, orderedValues, 0, values.length);
- Arrays.sort(orderedValues);
-
- // Check if the median is computed from a pair of middle value.
- if ((orderedValues.length % 2) == 0)
- {
- int middle = orderedValues.length / 2;
-
- median = (orderedValues[middle] + orderedValues[middle - 1]) / 2;
- }
- // The median is computed from a single middle value.
- else
- {
- median = orderedValues[orderedValues.length / 2];
- }
-
- // log.debug("median = " + median);
-
- return median;
- }
-
- /**
- * Computes the mean of a series of values.
- *
- * @param values The values.
- *
- * @return The mean.
- */
- public static long mean(long[] values)
- {
- // log.debug("public static long mean(long[] values = " + Arrays.toString(values) + "): called");
-
- long total = 0L;
-
- for (long value : values)
- {
- total += value;
- }
-
- long mean = total / values.length;
-
- // log.debug("mean = " + mean);
-
- return mean;
- }
-
- /**
- * Computes the variance of series of values.
- *
- * @param values The values.
- *
- * @return The variance of the values.
- */
- public static long variance(long[] values)
- {
- // log.debug("public static long variance(long[] values = " + Arrays.toString(values) + "): called");
-
- long mean = mean(values);
-
- long totalVariance = 0;
-
- for (long value : values)
- {
- long diff = (value - mean);
- totalVariance += diff * diff;
- }
-
- long variance = totalVariance / values.length;
-
- // log.debug("variance = " + variance);
-
- return variance;
- }
-
- /**
- * Computes the standard deviation of a series of values.
- *
- * @param values The values.
- *
- * @return The standard deviation.
- */
- public static long standardDeviation(long[] values)
- {
- // log.debug("public static long standardDeviation(long[] values = " + Arrays.toString(values) + "): called");
-
- long sd = Double.valueOf(Math.sqrt(variance(values))).longValue();
-
- // log.debug("sd = " + sd);
-
- return sd;
- }
-
- /**
- * For testing purposes. Supply address of reference clock as arg 1.
- *
- * @param args Address of reference clock as arg 1.
- */
- public static void main(String[] args)
- {
- ParsedProperties options =
- new ParsedProperties(CommandLineParser.processCommandLine(args,
- new CommandLineParser(
- new String[][]
- {
- { "1", "Address of clock reference service.", "address", "true" }
- }), System.getProperties()));
-
- String address = options.getProperty("1");
-
- // Create a clock synchronizer.
- UDPClockSynchronizer clockSyncher = new UDPClockSynchronizer(address);
-
- // Set up a shutdown hook for it.
- Runtime.getRuntime().addShutdownHook(new Thread(new Runnable()
- {
- public void run()
- {
- doSynch = false;
- }
- }));
-
- // Repeat the clock synching until the user kills the progam.
- while (doSynch)
- {
- // Perform a clock clockSynch.
- try
- {
- clockSyncher.synch();
-
- // Print out the clock delta and estimate of the error.
- System.out.println("Delta = " + clockSyncher.getDelta());
- System.out.println("Epsilon = " + clockSyncher.getEpsilon());
-
- try
- {
- Thread.sleep(250);
- }
- catch (InterruptedException e)
- {
- // Restore the interrupted status and terminate the loop.
- Thread.currentThread().interrupt();
- doSynch = false;
- }
- }
- // Terminate if the reference time service is unavailable.
- catch (ClockSynchFailureException e)
- {
- doSynch = false;
- }
- }
- }
-}
-
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedcircuit/DistributedCircuitImpl.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedcircuit/DistributedCircuitImpl.java
deleted file mode 100644
index 6c950fc307..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedcircuit/DistributedCircuitImpl.java
+++ /dev/null
@@ -1,472 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.test.framework.distributedcircuit;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.junit.extensions.TimingController;
-import org.apache.qpid.junit.extensions.TimingControllerAware;
-import org.apache.qpid.junit.extensions.util.ParsedProperties;
-import org.apache.qpid.test.framework.Assertion;
-import org.apache.qpid.test.framework.Circuit;
-import org.apache.qpid.test.framework.Publisher;
-import org.apache.qpid.test.framework.Receiver;
-import org.apache.qpid.test.framework.TestClientDetails;
-import org.apache.qpid.test.framework.TestUtils;
-import org.apache.qpid.test.utils.ConversationFactory;
-
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.Session;
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * DistributedCircuitImpl is a distributed implementation of the test {@link Circuit}. Many publishers and receivers
- * accross multiple machines may be combined to form a single test circuit. The test circuit extracts reports from
- * all of its publishers and receivers, and applies its assertions to these reports.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Supply the publishing and receiving ends of a test messaging circuit.
- * <tr><td> Start the circuit running.
- * <tr><td> Close the circuit down.
- * <tr><td> Take a reading of the circuits state.
- * <tr><td> Apply assertions against the circuits state.
- * <tr><td> Send test messages over the circuit.
- * <tr><td> Perform the default test procedue on the circuit.
- * </table>
- *
- * @todo There is a short pause after receiving sender reports before asking for receiver reports, because receivers may
- * not have finished receiving all their test messages before the report request arrives. This is going to be a
- * problem for taking test timings and needs to be eliminiated. Suggested solution: have receiver send back reports
- * asynchronously, on test batch size boundaries, and do so automatically rather than having to have the report
- * request sent to them. Number each test run, or otherwise uniquely identify it, when a receiver does not get
- * any more messages on a test run for more than a timeout, it can assume the test is complete and send a final
- * report. On the coordinator end a future will need to be created to wait for all final reports to come in, and
- * to register results and timings for the test. This must work in such a way that a new test cycle can be started
- * without waiting for the results of the old one to come in.
- *
- * @todo Add in setting of timing controller, from timing aware test cases.
- */
-public class DistributedCircuitImpl implements Circuit, TimingControllerAware
-{
- /** Used for debugging purposes. */
- private static final Logger log = Logger.getLogger(DistributedCircuitImpl.class);
-
- /** Holds the conversation factory over which to coordinate the test. */
- protected ConversationFactory conversationFactory;
-
- /** Holds the controlSession over which to hold the control conversation. */
- protected Session controlSession;
-
- /** Holds the sender nodes in the test circuit. */
- protected List<TestClientDetails> senders;
-
- /** Holds the receiver nodes in the test circuit. */
- protected List<TestClientDetails> receivers;
-
- /** Holds the sender control conversations. */
- protected ConversationFactory.Conversation[] senderConversation;
-
- /** Holds the receiver control conversations. */
- protected ConversationFactory.Conversation[] receiverConversation;
-
- /** Holds the control topics for the senders in the test circuit. */
- protected Destination[] senderControlTopic;
-
- /** Holds the control topics for the receivers in the test circuit. */
- protected Destination[] receiverControlTopic;
-
- /** Holds the number of messages to send per test run. */
- protected int numMessages;
-
- /**
- * Holds the timing controller for the circuit. This is used to log test times asynchronously, when reciever nodes
- * return their reports after senders have completed a test case.
- */
- TimingController timingController;
-
- /**
- * Creates a distributed test circuit on the specified senders and receivers.
- *
- * @param session The controlSession for all control conversations.
- * @param senders The senders.
- * @param receivers The receivers.
- * @param senderConversation A control conversation with the senders.
- * @param receiverConversation A control conversation with the receivers.
- * @param senderControlTopic The senders control topic.
- * @param receiverControlTopic The receivers control topic.
- */
- protected DistributedCircuitImpl(Session session, List<TestClientDetails> senders, List<TestClientDetails> receivers,
- ConversationFactory.Conversation[] senderConversation, ConversationFactory.Conversation[] receiverConversation,
- Destination[] senderControlTopic, Destination[] receiverControlTopic)
- {
- this.controlSession = session;
- this.senders = senders;
- this.receivers = receivers;
- this.senderConversation = senderConversation;
- this.receiverConversation = receiverConversation;
- this.senderControlTopic = senderControlTopic;
- this.receiverControlTopic = receiverControlTopic;
- }
-
- /**
- * Creates a distributed test circuit from the specified test parameters, on the senders and receivers
- * given.
- *
- * @param testProps The test parameters.
- * @param senders The sender ends in the test circuit.
- * @param receivers The receiver ends in the test circuit.
- * @param conversationFactory A conversation factory for creating the control conversations with senders and receivers.
- *
- * @return A connected and ready to start, test circuit.
- */
- public static Circuit createCircuit(ParsedProperties testProps, List<TestClientDetails> senders,
- List<TestClientDetails> receivers, ConversationFactory conversationFactory)
- {
- log.debug("public static Circuit createCircuit(ParsedProperties testProps, List<TestClientDetails> senders, "
- + " List<TestClientDetails> receivers, ConversationFactory conversationFactory)");
-
- try
- {
- Session session = conversationFactory.getSession();
-
- // Create control conversations with each of the senders.
- ConversationFactory.Conversation[] senderConversation = new ConversationFactory.Conversation[senders.size()];
- Destination[] senderControlTopic = new Destination[senders.size()];
-
- for (int i = 0; i < senders.size(); i++)
- {
- TestClientDetails sender = senders.get(i);
-
- senderControlTopic[i] = session.createTopic(sender.privateControlKey);
- senderConversation[i] = conversationFactory.startConversation();
- }
-
- log.debug("Sender conversations created.");
-
- // Create control conversations with each of the receivers.
- ConversationFactory.Conversation[] receiverConversation = new ConversationFactory.Conversation[receivers.size()];
- Destination[] receiverControlTopic = new Destination[receivers.size()];
-
- for (int i = 0; i < receivers.size(); i++)
- {
- TestClientDetails receiver = receivers.get(i);
-
- receiverControlTopic[i] = session.createTopic(receiver.privateControlKey);
- receiverConversation[i] = conversationFactory.startConversation();
- }
-
- log.debug("Receiver conversations created.");
-
- // Assign the sender role to each of the sending test clients.
- for (int i = 0; i < senders.size(); i++)
- {
- TestClientDetails sender = senders.get(i);
-
- Message assignSender = conversationFactory.getSession().createMessage();
- TestUtils.setPropertiesOnMessage(assignSender, testProps);
- assignSender.setStringProperty("CONTROL_TYPE", "ASSIGN_ROLE");
- assignSender.setStringProperty("ROLE", "SENDER");
-
- senderConversation[i].send(senderControlTopic[i], assignSender);
- }
-
- log.debug("Sender role assignments sent.");
-
- // Assign the receivers role to each of the receiving test clients.
- for (int i = 0; i < receivers.size(); i++)
- {
- TestClientDetails receiver = receivers.get(i);
-
- Message assignReceiver = session.createMessage();
- TestUtils.setPropertiesOnMessage(assignReceiver, testProps);
- assignReceiver.setStringProperty("CONTROL_TYPE", "ASSIGN_ROLE");
- assignReceiver.setStringProperty("ROLE", "RECEIVER");
-
- receiverConversation[i].send(receiverControlTopic[i], assignReceiver);
- }
-
- log.debug("Receiver role assignments sent.");
-
- // Wait for the senders and receivers to confirm their roles.
- for (int i = 0; i < senders.size(); i++)
- {
- senderConversation[i].receive();
- }
-
- log.debug("Got all sender role confirmations");
-
- for (int i = 0; i < receivers.size(); i++)
- {
- receiverConversation[i].receive();
- }
-
- log.debug("Got all receiver role confirmations");
-
- // Package everything up as a circuit.
- return new DistributedCircuitImpl(session, senders, receivers, senderConversation, receiverConversation,
- senderControlTopic, receiverControlTopic);
- }
- catch (JMSException e)
- {
- throw new RuntimeException("JMSException not handled.");
- }
- }
-
- /**
- * Used by tests cases that can supply a {@link org.apache.qpid.junit.extensions.TimingController} to set the
- * controller on an aware test.
- *
- * @param controller The timing controller.
- */
- public void setTimingController(TimingController controller)
- {
- this.timingController = controller;
- }
-
- /**
- * Gets the interface on the publishing end of the circuit.
- *
- * @return The publishing end of the circuit.
- */
- public Publisher getPublisher()
- {
- throw new RuntimeException("Not Implemented.");
- }
-
- /**
- * Gets the interface on the receiving end of the circuit.
- *
- * @return The receiving end of the circuit.
- */
- public Receiver getReceiver()
- {
- throw new RuntimeException("Not Implemented.");
- }
-
- /**
- * Connects and starts the circuit. After this method is called the circuit is ready to send messages.
- */
- public void start()
- {
- log.debug("public void start(): called");
-
- try
- {
- // Start the test on each of the senders.
- Message start = controlSession.createMessage();
- start.setStringProperty("CONTROL_TYPE", "START");
- start.setIntProperty("MESSAGE_COUNT", numMessages);
-
- for (int i = 0; i < senders.size(); i++)
- {
- senderConversation[i].send(senderControlTopic[i], start);
- }
-
- log.debug("All senders told to start their tests.");
- }
- catch (JMSException e)
- {
- throw new RuntimeException("Unhandled JMSException.", e);
- }
- }
-
- /**
- * Checks the test circuit. The effect of this is to gather the circuits state, for both ends of the circuit,
- * into a report, against which assertions may be checked.
- *
- * @todo Replace the asynch receiver report thread with a choice of direct or asynch executor, so that asynch
- * or synch logging of test timings is optional. Also need to provide an onMessage method that is capable
- * of receiving timing reports that receivers will generate during an ongoing test, on the test sample
- * size boundaries. The message timing logging code should be factored out as a common method that can
- * be called in response to the final report responses, or the onMessage method. Another alternative is
- * to abandon the final report request altogether and just use the onMessage method? I think the two
- * differ though, as the final report is used to apply assertions, and the ongoing report is just for
- * periodic timing results... In which case, maybe there needs to be a way for the onMessage method
- * to process just some of the incoming messages, and forward the rest on to the conversion helper, as
- * a sort of pre-conversation helper filter? Make conversation expose its onMessage method (it should
- * already) and allow another delivery thread to filter the incoming messages to the conversation.
- */
- public void check()
- {
- log.debug("public void check(): called");
-
- try
- {
- // Wait for all the test senders to return their reports.
- for (int i = 0; i < senders.size(); i++)
- {
- Message senderReport = senderConversation[i].receive();
- log.debug("Sender " + senderReport.getStringProperty("CLIENT_NAME") + " reports message count: "
- + senderReport.getIntProperty("MESSAGE_COUNT"));
- log.debug("Sender " + senderReport.getStringProperty("CLIENT_NAME") + " reports message time: "
- + senderReport.getLongProperty("TEST_TIME"));
- }
-
- log.debug("Got all sender test reports.");
-
- // Apply sender assertions to pass/fail the tests.
-
- // Inject a short pause to give the receivers time to finish receiving their test messages.
- TestUtils.pause(500);
-
- // Ask the receivers for their reports.
- Message statusRequest = controlSession.createMessage();
- statusRequest.setStringProperty("CONTROL_TYPE", "STATUS_REQUEST");
-
- for (int i = 0; i < receivers.size(); i++)
- {
- receiverConversation[i].send(receiverControlTopic[i], statusRequest);
- }
-
- log.debug("All receiver test reports requested.");
-
- // Wait for all receiver reports to come in, but do so asynchronously.
- Runnable gatherAllReceiverReports =
- new Runnable()
- {
- public void run()
- {
- try
- {
- // Wait for all the receivers to send their reports.
- for (int i = 0; i < receivers.size(); i++)
- {
- Message receiverReport = receiverConversation[i].receive();
-
- String clientName = receiverReport.getStringProperty("CLIENT_NAME");
- int messageCount = receiverReport.getIntProperty("MESSAGE_COUNT");
- long testTime = receiverReport.getLongProperty("TEST_TIME");
-
- log.debug("Receiver " + clientName + " reports message count: " + messageCount);
- log.debug("Receiver " + receiverReport.getStringProperty("CLIENT_NAME")
- + " reports message time: " + testTime);
-
- // Apply receiver assertions to pass/fail the tests.
-
- // Log the test timings on the asynchronous test timing controller.
- /*try
- {
- timingController.completeTest(true, messageCount, testTime);
- }
- // The timing controll can throw InterruptedException is the current test is to be
- // interrupted.
- catch (InterruptedException e)
- {
- e.printStackTrace();
- }*/
- }
-
- log.debug("All receiver test reports received.");
- }
- catch (JMSException e)
- {
- throw new RuntimeException(e);
- }
- }
- };
-
- Thread receiverReportsThread = new Thread(gatherAllReceiverReports);
- receiverReportsThread.start();
-
- // return new Message[] { senderReport, receiverReport };
-
- }
- catch (JMSException e)
- {
- throw new RuntimeException("Unhandled JMSException.", e);
- }
- }
-
- /**
- * Closes the circuit. All associated resources are closed.
- */
- public void close()
- {
- log.debug("public void close(): called");
-
- // End the current test on all senders and receivers.
- }
-
- /**
- * Applies a list of assertions against the test circuit. The {@link #check()} method should be called before doing
- * this, to ensure that the circuit has gathered its state into a report to assert against.
- *
- * @param assertions The list of assertions to apply.
- *
- * @return Any assertions that failed.
- */
- public List<Assertion> applyAssertions(List<Assertion> assertions)
- {
- log.debug("public List<Assertion> applyAssertions(List<Assertion> assertions = " + assertions + "): called");
-
- List<Assertion> failures = new LinkedList<Assertion>();
-
- for (Assertion assertion : assertions)
- {
- if (!assertion.apply())
- {
- failures.add(assertion);
- }
- }
-
- return failures;
- }
-
- /**
- * Runs the default test procedure against the circuit, and checks that all of the specified assertions hold.
- *
- * @param numMessages The number of messages to send using the default test procedure.
- * @param assertions The list of assertions to apply.
- *
- * @return Any assertions that failed.
- *
- * @todo From check onwards needs to be handled as a future. The future must call back onto the test case to
- * report results asynchronously.
- */
- public List<Assertion> test(int numMessages, List<Assertion> assertions)
- {
- log.debug("public List<Assertion> test(int numMessages = " + numMessages + ", List<Assertion> assertions = "
- + assertions + "): called");
-
- // Keep the number of messages to send per test run, where the send method can reference it.
- this.numMessages = numMessages;
-
- // Start the test running on all sender circuit ends.
- start();
-
- // Request status reports to be handed in.
- check();
-
- // Assert conditions on the publishing end of the circuit.
- // Assert conditions on the receiving end of the circuit.
- List<Assertion> failures = applyAssertions(assertions);
-
- // Close the circuit ending the current test case.
- close();
-
- // Pass with no failed assertions or fail with a list of failed assertions.
- return failures;
- }
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedcircuit/DistributedPublisherImpl.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedcircuit/DistributedPublisherImpl.java
deleted file mode 100644
index 130e908b0e..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedcircuit/DistributedPublisherImpl.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.test.framework.distributedcircuit;
-
-import org.apache.qpid.junit.extensions.util.ParsedProperties;
-import org.apache.qpid.test.framework.Assertion;
-import org.apache.qpid.test.framework.Publisher;
-
-/**
- * DistributedPublisherImpl represents the status of the publishing side of a test circuit. Its main purpose is to
- * provide assertions that can be applied to verify the behaviour of a non-local publisher.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Provide assertion that the publishers received no exceptions.
- * <tr><td> Provide assertion that the publishers received a no consumers error code on every message.
- * <tr><td> Provide assertion that the publishers received a no route error code on every message.
- * </table>
- */
-public class DistributedPublisherImpl implements Publisher
-{
- /**
- * Provides an assertion that the publisher encountered no exceptions.
- *
- * @return An assertion that the publisher encountered no exceptions.
- * @param testProps
- */
- public Assertion noExceptionsAssertion(ParsedProperties testProps)
- {
- throw new RuntimeException("Not implemented.");
- }
-
- /**
- * Provides an assertion that the publisher got a no consumers exception on every message.
- *
- * @return An assertion that the publisher got a no consumers exception on every message.
- */
- public Assertion noConsumersAssertion()
- {
- throw new RuntimeException("Not implemented.");
- }
-
- /**
- * Provides an assertion that the publisher got a no rout exception on every message.
- *
- * @return An assertion that the publisher got a no rout exception on every message.
- */
- public Assertion noRouteAssertion()
- {
- throw new RuntimeException("Not implemented.");
- }
-
- /**
- * Provides an assertion that the AMQP channel was forcibly closed by an error condition.
- *
- * @param testProps The test configuration properties.
- * @return An assertion that the AMQP channel was forcibly closed by an error condition.
- */
- public Assertion channelClosedAssertion(ParsedProperties testProps)
- {
- throw new RuntimeException("Not implemented.");
- }
-
- /**
- * Provides an assertion that the publisher got a given exception during the test.
- *
- * @param testProps The test configuration properties.
- * @param exceptionClass The exception class to check for.
- * @return An assertion that the publisher got a given exception during the test.
- */
- public Assertion exceptionAssertion(ParsedProperties testProps, Class<? extends Exception> exceptionClass)
- {
- throw new RuntimeException("Not implemented.");
- }
-}
-
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedcircuit/DistributedReceiverImpl.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedcircuit/DistributedReceiverImpl.java
deleted file mode 100644
index 4b801e7b66..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedcircuit/DistributedReceiverImpl.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.test.framework.distributedcircuit;
-
-import org.apache.qpid.junit.extensions.util.ParsedProperties;
-import org.apache.qpid.test.framework.Assertion;
-import org.apache.qpid.test.framework.Receiver;
-
-/**
- * DistributedReceiverImpl represents the status of the receiving side of a test circuit. Its main purpose is to
- * provide assertions that can be applied to verify the behaviour of a non-local receiver.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Provide assertion that the receivers received no exceptions.
- * <tr><td> Provide assertion that the receivers received all test messages sent to it.
- * </table>
- */
-public class DistributedReceiverImpl implements Receiver
-{
- /**
- * Provides an assertion that the receivers encountered no exceptions.
- *
- * @return An assertion that the receivers encountered no exceptions.
- * @param testProps
- */
- public Assertion noExceptionsAssertion(ParsedProperties testProps)
- {
- throw new RuntimeException("Not implemented.");
- }
-
- /**
- * Provides an assertion that the receivers got all messages that were sent to it.
- *
- * @return An assertion that the receivers got all messages that were sent to it.
- * @param testProps
- */
- public Assertion allMessagesReceivedAssertion(ParsedProperties testProps)
- {
- throw new RuntimeException("Not implemented.");
- }
-
- /**
- * Provides an assertion that the receivers got none of the messages that were sent to it.
- *
- * @return An assertion that the receivers got none of the messages that were sent to it.
- * @param testProps
- */
- public Assertion noMessagesReceivedAssertion(ParsedProperties testProps)
- {
- throw new RuntimeException("Not implemented.");
- }
-
- /**
- * Provides an assertion that the AMQP channel was forcibly closed by an error condition.
- *
- * @param testProps The test configuration properties.
- * @return An assertion that the AMQP channel was forcibly closed by an error condition.
- */
- public Assertion channelClosedAssertion(ParsedProperties testProps)
- {
- throw new RuntimeException("Not implemented.");
- }
-
- /**
- * Provides an assertion that the receiver got a given exception during the test.
- *
- * @param testProps
- *@param exceptionClass The exception class to check for. @return An assertion that the receiver got a given exception during the test.
- */
- public Assertion exceptionAssertion(ParsedProperties testProps, Class<? extends Exception> exceptionClass)
- {
- throw new RuntimeException("Not implemented.");
- }
-}
-
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedcircuit/TestClientCircuitEnd.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedcircuit/TestClientCircuitEnd.java
deleted file mode 100644
index 09bcf24da5..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedcircuit/TestClientCircuitEnd.java
+++ /dev/null
@@ -1,333 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.test.framework.distributedcircuit;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.junit.extensions.util.ParsedProperties;
-import org.apache.qpid.junit.extensions.util.TestContextProperties;
-import org.apache.qpid.test.framework.CircuitEnd;
-import org.apache.qpid.test.framework.ExceptionMonitor;
-import org.apache.qpid.test.framework.LocalCircuitFactory;
-import org.apache.qpid.test.framework.MessageMonitor;
-import org.apache.qpid.test.framework.MessagingTestConfigProperties;
-import org.apache.qpid.test.framework.TestUtils;
-import org.apache.qpid.test.framework.distributedtesting.TestClientControlledTest;
-
-import javax.jms.Connection;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-
-/**
- * A TestClientCircuitEnd is a {@link CircuitEnd} that may be controlled from a
- * {@link org.apache.qpid.test.framework.distributedtesting.TestClient}, and that forms a single publishing or
- * receiving end point in a distributed test {@link org.apache.qpid.test.framework.Circuit}.
- *
- * <p/>When operating in the SENDER role, this circuit end is capable of acting as part of the default circuit test
- * procedure (described in the class comment for {@link org.apache.qpid.test.framework.Circuit}). That is, it will
- * send the number of test messages required, using the test configuration parameters given in the test invite, and
- * return a report on its activities to the circuit controller.
- *
- * <p/>When operation in the RECEIVER role, this circuit end acts as part of the default circuit test procedure. It will
- * receive test messages, on the setup specified in the test configuration parameters, and keep count of the messages
- * received, and time taken to receive them. When requested by the circuit controller to provide a report, it will
- * return this report of its activities.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Provide a message producer for sending messages.
- * <td> {@link CircuitEnd}, {@link LocalCircuitFactory}, {@link TestUtils}
- * <tr><td> Provide a message consumer for receiving messages.
- * <td> {@link CircuitEnd}, {@link LocalCircuitFactory}, {@link TestUtils}
- * <tr><td> Supply the name of the test case that this implements.
- * <tr><td> Accept/Reject invites based on test parameters. <td> {@link MessagingTestConfigProperties}
- * <tr><td> Adapt to assigned roles. <td> {@link TestClientControlledTest.Roles}
- * <tr><td> Perform test case actions. <td> {@link MessageMonitor}
- * <tr><td> Generate test reports. <td> {@link MessageMonitor}
- * </table>
- */
-public class TestClientCircuitEnd implements CircuitEnd, TestClientControlledTest
-{
- /** Used for debugging. */
- private static final Logger log = Logger.getLogger(TestClientCircuitEnd.class);
-
- /** Holds the test parameters. */
- ParsedProperties testProps;
-
- /** The number of test messages to send. */
- private int numMessages;
-
- /** The role to be played by the test. */
- private Roles role;
-
- /** The connection to send the test messages on. */
- private Connection connection;
-
- /** Holds the circuit end for this test. */
- CircuitEnd circuitEnd;
-
- /**
- * Holds a message monitor for this circuit end, either the monitor on the consumer when in RECEIVER more, or
- * a monitor updated on every message sent, when acting as a SENDER.
- */
- MessageMonitor messageMonitor;
-
- /**
- * Should provide the name of the test case that this class implements. The exact names are defined in the
- * interop testing spec.
- *
- * @return The name of the test case that this implements.
- */
- public String getName()
- {
- return "DEFAULT_CIRCUIT_TEST";
- }
-
- /**
- * Determines whether the test invite that matched this test case is acceptable.
- *
- * @param inviteMessage The invitation to accept or reject.
- * @return <tt>true</tt> to accept the invitation, <tt>false</tt> to reject it.
- *
- * @throws JMSException Any JMSException resulting from reading the message are allowed to fall through.
- */
- public boolean acceptInvite(Message inviteMessage) throws JMSException
- {
- log.debug("public boolean acceptInvite(Message inviteMessage): called");
-
- // Populate the test parameters from the invitation.
- testProps = TestContextProperties.getInstance(MessagingTestConfigProperties.defaults);
-
- for (Object key : testProps.keySet())
- {
- String propName = (String) key;
-
- // If the test parameters is overridden by the invitation, use it instead.
- String inviteValue = inviteMessage.getStringProperty(propName);
-
- if (inviteValue != null)
- {
- testProps.setProperty(propName, inviteValue);
- log.debug("Test invite supplied override to " + propName + " of " + inviteValue);
- }
-
- }
-
- // Accept the invitation.
- return true;
- }
-
- /**
- * Assigns the role to be played by this test case. The test parameters are fully specified in the
- * assignment message. When this method return the test case will be ready to execute.
- *
- * @param role The role to be played; sender or receivers.
- * @param assignRoleMessage The role assingment message, contains the full test parameters.
- *
- * @throws JMSException Any JMSException resulting from reading the message are allowed to fall through.
- */
- public void assignRole(Roles role, Message assignRoleMessage) throws JMSException
- {
- log.debug("public void assignRole(Roles role, Message assignRoleMessage): called");
-
- // Take note of the role to be played.
- this.role = role;
-
- // Extract and retain the test parameters.
- numMessages = 1; // assignRoleMessage.getIntProperty("NUM_MESSAGES");
-
- // Connect using the test parameters.
- connection = TestUtils.createConnection(testProps);
-
- // Create a circuit end that matches the assigned role and test parameters.
- LocalCircuitFactory circuitFactory = new LocalCircuitFactory();
-
- switch (role)
- {
- // Check if the sender role is being assigned, and set up a message producer if so.
- case SENDER:
-
- // Set up the publisher.
- circuitEnd = circuitFactory.createPublisherCircuitEnd(connection, testProps, 0L);
-
- // Create a custom message monitor that will be updated on every message sent.
- messageMonitor = new MessageMonitor();
-
- break;
-
- // Otherwise the receivers role is being assigned, so set this up to listen for messages.
- case RECEIVER:
-
- // Set up the receiver.
- circuitEnd = circuitFactory.createReceiverCircuitEnd(connection, testProps, 0L);
-
- // Use the message monitor from the consumer for stats.
- messageMonitor = getMessageMonitor();
-
- break;
- }
-
- // Reset all messaging stats for the report.
- messageMonitor.reset();
-
- connection.start();
- }
-
- /**
- * Performs the test case actions. Returning from here, indicates that the sending role has completed its test.
- *
- * @param numMessages The number of test messages to send.
- *
- * @throws JMSException Any JMSException resulting from reading the message are allowed to fall through.
- *
- * @todo Add round robin on destinations where multiple destinations being used.
- *
- * @todo Add rate limiting when rate limit specified on publishers.
- *
- * @todo Add Max pending message size protection. The receiver will have to send back some acks once in a while,
- * to notify the publisher that its messages are being consumed. This makes the safety valve harder to
- * implement than in the single VM case. For example, if the limit is 1000 messages, might want to get back
- * an ack every 500, to notify the publisher that it can keep sending. What about pub/sub tests? Will it be
- * necessary to wait for an ack from every receiver? This will have the effect of rate limiting to slow
- * consumers too.
- *
- * @todo Add commits on every commit batch size boundary.
- */
- public void start(int numMessages) throws JMSException
- {
- log.debug("public void start(): called");
-
- // If in the SENDER role, send the specified number of test messages to the circuit destinations.
- if (role.equals(Roles.SENDER))
- {
- Message testMessage = getSession().createMessage();
-
- for (int i = 0; i < numMessages; i++)
- {
- getProducer().send(testMessage);
-
- // Increment the message count and timings.
- messageMonitor.onMessage(testMessage);
- }
- }
- }
-
- /**
- * Gets a report on the actions performed by the test case in its assigned role.
- *
- * @param session The controlSession to create the report message in.
- * @return The report message.
- *
- * @throws JMSException Any JMSExceptions resulting from creating the report are allowed to fall through.
- */
- public Message getReport(Session session) throws JMSException
- {
- Message report = session.createMessage();
- report.setStringProperty("CONTROL_TYPE", "REPORT");
-
- // Add the count of messages sent/received to the report.
- report.setIntProperty("MESSAGE_COUNT", messageMonitor.getNumMessage());
-
- // Add the time to send/receive messages to the report.
- report.setLongProperty("TEST_TIME", messageMonitor.getTime());
-
- // Add any exceptions detected to the report.
-
- return report;
- }
-
- /**
- * Gets the message producer at this circuit end point.
- *
- * @return The message producer at with this circuit end point.
- */
- public MessageProducer getProducer()
- {
- return circuitEnd.getProducer();
- }
-
- /**
- * Gets the message consumer at this circuit end point.
- *
- * @return The message consumer at this circuit end point.
- */
- public MessageConsumer getConsumer()
- {
- return circuitEnd.getConsumer();
- }
-
- /**
- * Send the specified message over the producer at this end point.
- *
- * @param message The message to send.
- *
- * @throws JMSException Any JMS exception occuring during the send is allowed to fall through.
- */
- public void send(Message message) throws JMSException
- {
- // Send the message on the circuit ends producer.
- circuitEnd.send(message);
- }
-
- /**
- * Gets the JMS Session associated with this circuit end point.
- *
- * @return The JMS Session associated with this circuit end point.
- */
- public Session getSession()
- {
- return circuitEnd.getSession();
- }
-
- /**
- * Closes the message producers and consumers and the sessions, associated with this circuit end point.
- *
- * @throws JMSException Any JMSExceptions occurring during the close are allowed to fall through.
- */
- public void close() throws JMSException
- {
- // Close the producer and consumer.
- circuitEnd.close();
- }
-
- /**
- * Returns the message monitor for reporting on received messages on this circuit end.
- *
- * @return The message monitor for this circuit end.
- */
- public MessageMonitor getMessageMonitor()
- {
- return circuitEnd.getMessageMonitor();
- }
-
- /**
- * Returns the exception monitor for reporting on exceptions received on this circuit end.
- *
- * @return The exception monitor for this circuit end.
- */
- public ExceptionMonitor getExceptionMonitor()
- {
- return circuitEnd.getExceptionMonitor();
- }
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/Coordinator.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/Coordinator.java
deleted file mode 100644
index e07b141cb5..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/Coordinator.java
+++ /dev/null
@@ -1,546 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.test.framework.distributedtesting;
-
-import junit.framework.Test;
-import junit.framework.TestResult;
-import junit.framework.TestSuite;
-import org.apache.log4j.Logger;
-import org.apache.log4j.NDC;
-
-import org.apache.qpid.junit.extensions.TKTestRunner;
-import org.apache.qpid.junit.extensions.WrappedSuiteTestDecorator;
-import org.apache.qpid.junit.extensions.util.CommandLineParser;
-import org.apache.qpid.junit.extensions.util.MathUtils;
-import org.apache.qpid.junit.extensions.util.ParsedProperties;
-import org.apache.qpid.junit.extensions.util.TestContextProperties;
-import org.apache.qpid.test.framework.FrameworkBaseCase;
-import org.apache.qpid.test.framework.MessagingTestConfigProperties;
-import org.apache.qpid.test.framework.TestClientDetails;
-import org.apache.qpid.test.framework.TestUtils;
-import org.apache.qpid.test.framework.clocksynch.UDPClockReference;
-import org.apache.qpid.test.utils.ConversationFactory;
-
-import javax.jms.Connection;
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.Session;
-import java.net.InetAddress;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.LinkedBlockingQueue;
-
-/**
- * <p/>Implements the coordinator client described in the interop testing specification
- * (http://cwiki.apache.org/confluence/display/qpid/Interop+Testing+Specification). This coordinator is built on
- * top of the JUnit testing framework.
- *
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Find out what test clients are available. <td> {@link ConversationFactory}
- * <tr><td> Decorate available tests to run on all available clients. <td> {@link DistributedTestDecorator}
- * <tr><td> Attach XML test result logger.
- * <tr><td> Terminate the interop testing framework.
- * </table>
- *
- * @todo Should accumulate failures over all tests, and return with success or fail code based on all results. May need
- * to write a special TestResult to do this properly. At the moment only the last one used will be tested for
- * errors, as the start method creates a fresh one for each test case run.
- */
-public class Coordinator extends TKTestRunner
-{
- /** Used for debugging. */
- private static final Logger log = Logger.getLogger(Coordinator.class);
-
- /** Used for reporting to the console. */
- private static final Logger console = Logger.getLogger("CONSOLE");
-
- /** Defines the possible distributed test engines available to run coordinated test cases with. */
- public enum TestEngine
- {
- /** Specifies the interop test engine. This tests all available clients in pairs. */
- INTEROP,
-
- /** Specifies the fanout test engine. This sets up one publisher role, and many reciever roles. */
- FANOUT
- }
-
- /**
- * Holds the test context properties that provides the default test parameters, plus command line overrides.
- * This is initialized with the default test parameters, to which command line overrides may be applied.
- */
- protected static ParsedProperties testContextProperties =
- TestContextProperties.getInstance(MessagingTestConfigProperties.defaults);
-
- /** Holds the URL of the broker to coordinate the tests on. */
- protected String brokerUrl;
-
- /** Holds the virtual host to coordinate the tests on. If <tt>null</tt>, then the default virtual host is used. */
- protected String virtualHost;
-
- /** Holds the list of all clients that enlisted, when the compulsory invite was issued. */
- protected Set<TestClientDetails> enlistedClients = new HashSet<TestClientDetails>();
-
- /** Holds the conversation helper for the control conversation. */
- protected ConversationFactory conversationFactory;
-
- /** Holds the connection that the coordinating messages are sent over. */
- protected Connection connection;
-
- /** Holds the path of the directory to output test results too, if one is defined. */
- protected String reportDir;
-
- /** Holds the coordinating test engine type to run the tests through. */
- protected TestEngine engine;
-
- /** Flag that indicates that all test clients should be terminated upon completion of the test cases. */
- protected boolean terminate;
-
- /**
- * Creates an interop test coordinator on the specified broker and virtual host.
- *
- * @param repetitions The number of times to repeat the test, or test batch size.
- * @param duration The length of time to run the tests for. -1 means no duration has been set.
- * @param threads The concurrency levels to ramp up to.
- * @param delay A delay in milliseconds between test runs.
- * @param params The sets of 'size' parameters to pass to test.
- * @param testCaseName The name of the test case to run.
- * @param reportDir The directory to output the test results to.
- * @param runName The name of the test run; used to name the output file.
- * @param verbose Whether to print comments during test run.
- * @param brokerUrl The URL of the broker to connect to.
- * @param virtualHost The virtual host to run all tests on. Optional, may be <tt>null</tt>.
- * @param engine The distributed test engine type to run the tests with.
- * @param terminate <tt>true</tt> if test client nodes should be terminated at the end of the tests.
- * @param csv <tt>true</tt> if the CSV results listener should be attached.
- * @param xml <tt>true</tt> if the XML results listener should be attached.
- * @param decoratorFactories List of factories for user specified decorators.
- */
- public Coordinator(Integer repetitions, Long duration, int[] threads, int delay, int[] params, String testCaseName,
- String reportDir, String runName, boolean verbose, String brokerUrl, String virtualHost, TestEngine engine,
- boolean terminate, boolean csv, boolean xml, List<TestDecoratorFactory> decoratorFactories)
- {
- super(repetitions, duration, threads, delay, params, testCaseName, reportDir, runName, csv, xml, decoratorFactories);
-
- log.debug("public Coordinator(Integer repetitions = " + repetitions + " , Long duration = " + duration
- + ", int[] threads = " + Arrays.toString(threads) + ", int delay = " + delay + ", int[] params = "
- + Arrays.toString(params) + ", String testCaseName = " + testCaseName + ", String reportDir = " + reportDir
- + ", String runName = " + runName + ", boolean verbose = " + verbose + ", String brokerUrl = " + brokerUrl
- + ", String virtualHost =" + virtualHost + ", TestEngine engine = " + engine + ", boolean terminate = "
- + terminate + ", boolean csv = " + csv + ", boolean xml = " + xml + "): called");
-
- // Retain the connection parameters.
- this.brokerUrl = brokerUrl;
- this.virtualHost = virtualHost;
- this.reportDir = reportDir;
- this.engine = engine;
- this.terminate = terminate;
- }
-
- /**
- * The entry point for the interop test coordinator. This client accepts the following command line arguments:
- *
- * <p/><table>
- * <tr><td> -b <td> The broker URL. <td> Mandatory.
- * <tr><td> -h <td> The virtual host. <td> Optional.
- * <tr><td> -o <td> The directory to output test results to. <td> Optional.
- * <tr><td> -e <td> The type of test distribution engine to use. <td> Optional. One of: interop, fanout.
- * <tr><td> ... <td> Free arguments. The distributed test cases to run.
- * <td> Mandatory. At least one must be defined.
- * <tr><td> name=value <td> Trailing argument define name/value pairs. Added to the test contenxt properties.
- * <td> Optional.
- * </table>
- *
- * @param args The command line arguments.
- */
- public static void main(String[] args)
- {
- NDC.push("coordinator");
- log.debug("public static void main(String[] args = " + Arrays.toString(args) + "): called");
- console.info("Qpid Distributed Test Coordinator.");
-
- // Override the default broker url to be localhost:5672.
- testContextProperties.setProperty(MessagingTestConfigProperties.BROKER_PROPNAME, "tcp://localhost:5672");
-
- try
- {
- // Use the command line parser to evaluate the command line with standard handling behaviour (print errors
- // and usage then exist if there are errors).
- // Any options and trailing name=value pairs are also injected into the test context properties object,
- // to override any defaults that may have been set up.
- ParsedProperties options =
- new ParsedProperties(CommandLineParser.processCommandLine(args,
- new CommandLineParser(
- new String[][]
- {
- { "b", "The broker URL.", "broker", "false" },
- { "h", "The virtual host to use.", "virtual host", "false" },
- { "o", "The name of the directory to output test timings to.", "dir", "false" },
- {
- "e", "The test execution engine to use. Default is interop.", "engine", "interop",
- "^interop$|^fanout$", "true"
- },
- { "t", "Terminate test clients on completion of tests.", null, "false" },
- { "-csv", "Output test results in CSV format.", null, "false" },
- { "-xml", "Output test results in XML format.", null, "false" },
- {
- "-trefaddr", "To specify an alternative to hostname for time singal reference.",
- "address", "false"
- },
- {
- "c", "The number of tests to run concurrently.", "num", "false",
- MathUtils.SEQUENCE_REGEXP
- },
- { "r", "The number of times to repeat each test.", "num", "false" },
- {
- "d", "The length of time to run the tests for.", "duration", "false",
- MathUtils.DURATION_REGEXP
- },
- {
- "f", "The maximum rate to call the tests at.", "frequency", "false",
- "^([1-9][0-9]*)/([1-9][0-9]*)$"
- },
- { "s", "The size parameter to run tests with.", "size", "false", MathUtils.SEQUENCE_REGEXP },
- { "v", "Verbose mode.", null, "false" },
- { "n", "A name for this test run, used to name the output file.", "name", "true" },
- {
- "X:decorators", "A list of additional test decorators to wrap the tests in.",
- "\"class.name[:class.name]*\"", "false"
- }
- }), testContextProperties));
-
- // Extract the command line options.
- String brokerUrl = options.getProperty("b");
- String virtualHost = options.getProperty("h");
- String reportDir = options.getProperty("o");
- reportDir = (reportDir == null) ? "." : reportDir;
- String testEngine = options.getProperty("e");
- TestEngine engine = "fanout".equals(testEngine) ? TestEngine.FANOUT : TestEngine.INTEROP;
- boolean terminate = options.getPropertyAsBoolean("t");
- boolean csvResults = options.getPropertyAsBoolean("-csv");
- boolean xmlResults = options.getPropertyAsBoolean("-xml");
- String threadsString = options.getProperty("c");
- Integer repetitions = options.getPropertyAsInteger("r");
- String durationString = options.getProperty("d");
- String paramsString = options.getProperty("s");
- boolean verbose = options.getPropertyAsBoolean("v");
- String testRunName = options.getProperty("n");
- String decorators = options.getProperty("X:decorators");
-
- int[] threads = (threadsString == null) ? null : MathUtils.parseSequence(threadsString);
- int[] params = (paramsString == null) ? null : MathUtils.parseSequence(paramsString);
- Long duration = (durationString == null) ? null : MathUtils.parseDuration(durationString);
-
- // If broker or virtual host settings were specified as command line options, override the defaults in the
- // test context properties with them.
-
- // Collection all of the test cases to be run.
- Collection<Class<? extends FrameworkBaseCase>> testCaseClasses =
- new ArrayList<Class<? extends FrameworkBaseCase>>();
-
- // Create a list of test decorator factories for use specified decorators to be applied.
- List<TestDecoratorFactory> decoratorFactories = parseDecorators(decorators);
-
- // Scan for available test cases using a classpath scanner.
- // ClasspathScanner.getMatches(DistributedTestCase.class, "^Test.*", true);
-
- // Hard code the test classes till the classpath scanner is fixed.
- // Collections.addAll(testCaseClasses, InteropTestCase1DummyRun.class, InteropTestCase2BasicP2P.class,
- // InteropTestCase3BasicPubSub.class);
-
- // Parse all of the free arguments as test cases to run.
- for (int i = 1; true; i++)
- {
- String nextFreeArg = options.getProperty(Integer.toString(i));
-
- // Terminate the loop once all free arguments have been consumed.
- if (nextFreeArg == null)
- {
- break;
- }
-
- try
- {
- Class nextClass = Class.forName(nextFreeArg);
-
- if (FrameworkBaseCase.class.isAssignableFrom(nextClass))
- {
- testCaseClasses.add(nextClass);
- console.info("Found distributed test case: " + nextFreeArg);
- }
- }
- catch (ClassNotFoundException e)
- {
- console.info("Unable to instantiate the test case: " + nextFreeArg + ".");
- }
- }
-
- // Check that some test classes were actually found.
- if (testCaseClasses.isEmpty())
- {
- throw new RuntimeException(
- "No test cases implementing FrameworkBaseCase were specified on the command line.");
- }
-
- // Extract the names of all the test classes, to pass to the start method.
- int i = 0;
- String[] testClassNames = new String[testCaseClasses.size()];
-
- for (Class testClass : testCaseClasses)
- {
- testClassNames[i++] = testClass.getName();
- }
-
- // Create a coordinator and begin its test procedure.
- Coordinator coordinator =
- new Coordinator(repetitions, duration, threads, 0, params, null, reportDir, testRunName, verbose, brokerUrl,
- virtualHost, engine, terminate, csvResults, xmlResults, decoratorFactories);
-
- TestResult testResult = coordinator.start(testClassNames);
-
- // Return different error codes, depending on whether or not there were test failures.
- if (testResult.failureCount() > 0)
- {
- System.exit(FAILURE_EXIT);
- }
- else
- {
- System.exit(SUCCESS_EXIT);
- }
- }
- catch (Exception e)
- {
- log.debug("Top level handler caught execption.", e);
- console.info(e.getMessage());
- e.printStackTrace();
- System.exit(EXCEPTION_EXIT);
- }
- }
-
- /**
- * Starts all of the test classes to be run by this coordinator.
- *
- * @param testClassNames An array of all the coordinating test case implementations.
- *
- * @return A JUnit TestResult to run the tests with.
- *
- * @throws Exception Any underlying exceptions are allowed to fall through, and fail the test process.
- */
- public TestResult start(String[] testClassNames) throws Exception
- {
- log.debug("public TestResult start(String[] testClassNames = " + Arrays.toString(testClassNames) + ": called");
-
- // Connect to the broker.
- connection = TestUtils.createConnection(TestContextProperties.getInstance());
- Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- Destination controlTopic = session.createTopic("iop.control");
- Destination responseQueue = session.createQueue("coordinator");
-
- conversationFactory = new ConversationFactory(connection, responseQueue, LinkedBlockingQueue.class);
- ConversationFactory.Conversation conversation = conversationFactory.startConversation();
-
- connection.start();
-
- // Broadcast the compulsory invitation to find out what clients are available to test.
- Message invite = session.createMessage();
- invite.setStringProperty("CONTROL_TYPE", "INVITE");
- invite.setJMSReplyTo(responseQueue);
-
- conversation.send(controlTopic, invite);
-
- // Wait for a short time, to give test clients an opportunity to reply to the invitation.
- Collection<Message> enlists = conversation.receiveAll(0, 500);
- enlistedClients = extractEnlists(enlists);
-
- for (TestClientDetails client : enlistedClients)
- {
- log.debug("Got enlisted test client: " + client);
- console.info("Test node " + client.clientName + " available.");
- }
-
- // Start the clock reference service running.
- UDPClockReference clockReference = new UDPClockReference();
- Thread clockRefThread = new Thread(clockReference);
- registerShutdownHook(clockReference);
- clockRefThread.start();
-
- // Broadcast to all clients to synchronize their clocks against the coordinators clock reference.
- Message clockSynchRequest = session.createMessage();
- clockSynchRequest.setStringProperty("CONTROL_TYPE", "CLOCK_SYNCH");
-
- String localAddress = InetAddress.getByName(InetAddress.getLocalHost().getHostName()).getHostAddress();
- clockSynchRequest.setStringProperty("ADDRESS", localAddress);
-
- conversation.send(controlTopic, clockSynchRequest);
-
- // Run the test in the suite using JUnit.
- TestResult result = null;
-
- for (String testClassName : testClassNames)
- {
- // Record the current test class, so that the test results can be output to a file incorporating this name.
- this.currentTestClassName = testClassName;
-
- result = super.start(new String[] { testClassName });
- }
-
- // At this point in time, all tests have completed. Broadcast the shutdown message, if the termination option
- // was set on the command line.
- if (terminate)
- {
- Message terminate = session.createMessage();
- terminate.setStringProperty("CONTROL_TYPE", "TERMINATE");
-
- conversation.send(controlTopic, terminate);
- }
-
- return result;
- }
-
- /**
- * For a collection of enlist messages, this method pulls out of the client details for the enlisting clients.
- *
- * @param enlists The enlist messages.
- *
- * @return A set of enlisting clients, extracted from the enlist messages.
- *
- * @throws JMSException Any underlying JMSException is allowed to fall through.
- */
- public static Set<TestClientDetails> extractEnlists(Collection<Message> enlists) throws JMSException
- {
- log.debug("public static Set<TestClientDetails> extractEnlists(Collection<Message> enlists = " + enlists
- + "): called");
-
- Set<TestClientDetails> enlistedClients = new HashSet<TestClientDetails>();
-
- // Retain the list of all available clients.
- for (Message enlist : enlists)
- {
- TestClientDetails clientDetails = new TestClientDetails();
- clientDetails.clientName = enlist.getStringProperty("CLIENT_NAME");
- clientDetails.privateControlKey = enlist.getStringProperty("CLIENT_PRIVATE_CONTROL_KEY");
-
- String replyType = enlist.getStringProperty("CONTROL_TYPE");
-
- if ("ENLIST".equals(replyType))
- {
- enlistedClients.add(clientDetails);
- }
- else if ("DECLINE".equals(replyType))
- {
- log.debug("Test client " + clientDetails.clientName + " declined the invite.");
- }
- else
- {
- log.warn("Got an unknown reply type, " + replyType + ", to the invite.");
- }
- }
-
- return enlistedClients;
- }
-
- /**
- * Runs a test or suite of tests, using the super class implemenation. This method wraps the test to be run
- * in any test decorators needed to add in the coordinators ability to invite test clients to participate in
- * tests.
- *
- * @param test The test to run.
- * @param wait Undocumented. Nothing in the JUnit javadocs to say what this is for.
- *
- * @return The results of the test run.
- */
- public TestResult doRun(Test test, boolean wait)
- {
- log.debug("public TestResult doRun(Test \"" + test + "\", boolean " + wait + "): called");
-
- // Wrap all tests in the test suite with WrappedSuiteTestDecorators. This is quite ugly and a bit baffling,
- // but the reason it is done is because the JUnit implementation of TestDecorator has some bugs in it.
- WrappedSuiteTestDecorator targetTest = null;
-
- if (test instanceof TestSuite)
- {
- log.debug("targetTest is a TestSuite");
-
- TestSuite suite = (TestSuite)test;
-
- int numTests = suite.countTestCases();
- log.debug("There are " + numTests + " in the suite.");
-
- for (int i = 0; i < numTests; i++)
- {
- Test nextTest = suite.testAt(i);
- log.debug("suite.testAt(" + i + ") = " + nextTest);
-
- if (nextTest instanceof FrameworkBaseCase)
- {
- log.debug("nextTest is a FrameworkBaseCase");
- }
- }
-
- targetTest = new WrappedSuiteTestDecorator(suite);
- log.debug("Wrapped with a WrappedSuiteTestDecorator.");
- }
-
- // Apply any optional user specified decorators.
- targetTest = applyOptionalUserDecorators(targetTest);
-
- // Wrap the tests in a suitable distributed test decorator, to perform the invite/test cycle.
- targetTest = newTestDecorator(targetTest, enlistedClients, conversationFactory, connection);
-
- // TestSuite suite = new TestSuite();
- // suite.addTest(targetTest);
-
- // Wrap the tests in a scaled test decorator to them them as a 'batch' in one thread.
- // targetTest = new ScaledTestDecorator(targetTest, new int[] { 1 });
-
- return super.doRun(targetTest, wait);
- }
-
- /**
- * Creates a wrapped test decorator, that is capable of inviting enlisted clients to participate in a specified
- * test. This is the test engine that sets up the roles and sequences a distributed test case.
- *
- * @param targetTest The test decorator to wrap.
- * @param enlistedClients The enlisted clients available to run the test.
- * @param conversationFactory The conversation factory used to build conversation helper over the specified connection.
- * @param connection The connection to talk to the enlisted clients over.
- *
- * @return An invititing test decorator, that invites all the enlisted clients to participate in tests, in pairs.
- */
- protected DistributedTestDecorator newTestDecorator(WrappedSuiteTestDecorator targetTest,
- Set<TestClientDetails> enlistedClients, ConversationFactory conversationFactory, Connection connection)
- {
- switch (engine)
- {
- case FANOUT:
- return new FanOutTestDecorator(targetTest, enlistedClients, conversationFactory, connection);
- case INTEROP:
- default:
- return new InteropTestDecorator(targetTest, enlistedClients, conversationFactory, connection);
- }
- }
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/DistributedTestDecorator.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/DistributedTestDecorator.java
deleted file mode 100644
index 49a01d3127..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/DistributedTestDecorator.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.test.framework.distributedtesting;
-
-import junit.framework.TestResult;
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.junit.extensions.WrappedSuiteTestDecorator;
-import org.apache.qpid.test.framework.FrameworkBaseCase;
-import org.apache.qpid.test.framework.TestClientDetails;
-import org.apache.qpid.test.framework.sequencers.CircuitFactory;
-import org.apache.qpid.test.utils.ConversationFactory;
-
-import javax.jms.Connection;
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import java.util.Collection;
-import java.util.Set;
-
-/**
- * DistributedTestDecorator is a base class for writing test decorators that invite test clients to participate in
- * distributed test cases. It provides a helper method, {@link #signupClients}, that broadcasts an invitation and
- * returns the set of test clients that are available to particiapte in the test.
- *
- * <p/>When used to wrap a {@link FrameworkBaseCase} test, it replaces the default {@link CircuitFactory} implementations
- * with a suitable circuit factory for distributed tests. Concrete implementations can use this to configure the sending
- * and receiving roles on the test.
- *
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Broadcast test invitations and collect enlists. <td> {@link ConversationFactory}.
- * </table>
- */
-public abstract class DistributedTestDecorator extends WrappedSuiteTestDecorator
-{
- /** Used for debugging. */
- private static final Logger log = Logger.getLogger(DistributedTestDecorator.class);
-
- /** Holds the contact information for all test clients that are available and that may take part in the test. */
- Set<TestClientDetails> allClients;
-
- /** Holds the conversation helper for the control level conversation for coordinating the test through. */
- ConversationFactory conversationFactory;
-
- /** Holds the connection that the control conversation is held over. */
- Connection connection;
-
- /** Holds the underlying test suite that this decorator wraps. */
- WrappedSuiteTestDecorator testSuite;
-
- /** Holds the control topic, on which test invitations are broadcast. */
- protected Destination controlTopic;
-
- /**
- * Creates a wrapped suite test decorator from another one.
- *
- * @param suite The test suite.
- * @param availableClients The list of all clients that responded to the compulsory invite.
- * @param controlConversation The conversation helper for the control level, test coordination conversation.
- * @param controlConnection The connection that the coordination messages are sent over.
- */
- public DistributedTestDecorator(WrappedSuiteTestDecorator suite, Set<TestClientDetails> availableClients,
- ConversationFactory controlConversation, Connection controlConnection)
- {
- super(suite);
-
- log.debug("public DistributedTestDecorator(WrappedSuiteTestDecorator suite, Set<TestClientDetails> allClients = "
- + availableClients + ", ConversationHelper controlConversation = " + controlConversation + "): called");
-
- testSuite = suite;
- allClients = availableClients;
- conversationFactory = controlConversation;
- connection = controlConnection;
-
- // Set up the test control topic.
- try
- {
- controlTopic = conversationFactory.getSession().createTopic("iop.control");
- }
- catch (JMSException e)
- {
- throw new RuntimeException("Unable to create the coordinating control topic to broadcast test invites on.", e);
- }
- }
-
- /**
- * Should run all of the tests in the wrapped test suite.
- *
- * @param testResult The the results object to monitor the test results with.
- */
- public abstract void run(TestResult testResult);
-
- /**
- * Should provide the distributed test sequencer to pass to {@link org.apache.qpid.test.framework.FrameworkBaseCase}
- * tests.
- *
- * @return A distributed test sequencer.
- */
- public abstract CircuitFactory getTestSequencer();
-
- /**
- * Broadcasts an invitation to participate in a coordinating test case to find out what clients are available to
- * run the test case.
- *
- * @param coordTest The coordinating test case to broadcast an inviate for.
- *
- * @return A set of test clients that accepted the invitation.
- */
- protected Set<TestClientDetails> signupClients(FrameworkBaseCase coordTest)
- {
- // Broadcast the invitation to find out what clients are available to test.
- Set<TestClientDetails> enlists;
- try
- {
- Message invite = conversationFactory.getSession().createMessage();
-
- ConversationFactory.Conversation conversation = conversationFactory.startConversation();
-
- invite.setStringProperty("CONTROL_TYPE", "INVITE");
- invite.setStringProperty("TEST_NAME", coordTest.getTestCaseNameForTestMethod(coordTest.getName()));
-
- conversation.send(controlTopic, invite);
-
- // Wait for a short time, to give test clients an opportunity to reply to the invitation.
- Collection<Message> replies = conversation.receiveAll(allClients.size(), 500);
- enlists = Coordinator.extractEnlists(replies);
- }
- catch (JMSException e)
- {
- throw new RuntimeException("There was a JMSException during the invite/enlist conversation.", e);
- }
-
- return enlists;
- }
-
- /**
- * Prints a string summarizing this test decorator, mainly for debugging purposes.
- *
- * @return String representation for debugging purposes.
- */
- public String toString()
- {
- return "DistributedTestDecorator: [ testSuite = " + testSuite + " ]";
- }
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/FanOutTestDecorator.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/FanOutTestDecorator.java
deleted file mode 100644
index 809bb1dd2f..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/FanOutTestDecorator.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.test.framework.distributedtesting;
-
-import junit.framework.Test;
-import junit.framework.TestResult;
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.junit.extensions.WrappedSuiteTestDecorator;
-import org.apache.qpid.test.framework.DropInTest;
-import org.apache.qpid.test.framework.FrameworkBaseCase;
-import org.apache.qpid.test.framework.TestClientDetails;
-import org.apache.qpid.test.framework.sequencers.CircuitFactory;
-import org.apache.qpid.test.framework.sequencers.FanOutCircuitFactory;
-import org.apache.qpid.test.utils.ConversationFactory;
-
-import javax.jms.Connection;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageListener;
-import java.util.Iterator;
-import java.util.Set;
-
-/**
- * FanOutTestDecorator is an {@link DistributedTestDecorator} that runs one test client in the sender role, and the remainder
- * in the receivers role. It also has the capability to listen for new test cases joining the test beyond the initial start
- * point. This feature can be usefull when experimenting with adding more load, in the form of more test clients, to assess
- * its impact on a running test.
- *
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Execute coordinated test cases. <td> {@link FrameworkBaseCase}
- * <tr><td> Accept test clients joining a running test.
- * </table>
- */
-public class FanOutTestDecorator extends DistributedTestDecorator implements MessageListener
-{
- /** Used for debugging. */
- private static final Logger log = Logger.getLogger(FanOutTestDecorator.class);
-
- /** Holds the currently running test case. */
- private FrameworkBaseCase currentTest = null;
-
- /**
- * Creates a wrapped suite test decorator from another one.
- *
- * @param suite The test suite.
- * @param availableClients The list of all clients that responded to the compulsory invite.
- * @param controlConversation The conversation helper for the control level, test coordination conversation.
- * @param controlConnection The connection that the coordination messages are sent over.
- */
- public FanOutTestDecorator(WrappedSuiteTestDecorator suite, Set<TestClientDetails> availableClients,
- ConversationFactory controlConversation, Connection controlConnection)
- {
- super(suite, availableClients, controlConversation, controlConnection);
-
- log.debug("public DistributedTestDecorator(WrappedSuiteTestDecorator suite, Set<TestClientDetails> allClients = "
- + availableClients + ", ConversationHelper controlConversation = " + controlConversation + "): called");
-
- testSuite = suite;
- allClients = availableClients;
- conversationFactory = controlConversation;
- connection = controlConnection;
-
- // Sign available clients up to the test.
- for (Test test : getAllUnderlyingTests())
- {
- FrameworkBaseCase coordTest = (FrameworkBaseCase) test;
-
- // Get all of the clients able to participate in the test.
- Set<TestClientDetails> enlists = signupClients(coordTest);
-
- // Check that there were some clients available.
- if (enlists.size() == 0)
- {
- throw new RuntimeException("No clients to test with");
- }
-
- // Create a distributed test circuit factory for the test.
- CircuitFactory circuitFactory = getTestSequencer();
-
- // Set up the first client in the sender role, and the remainder in the receivers role.
- Iterator<TestClientDetails> clients = enlists.iterator();
- circuitFactory.setSender(clients.next());
-
- while (clients.hasNext())
- {
- // Set the sending and receiving client details on the test case.
- circuitFactory.setReceiver(clients.next());
- }
-
- // Pass down the connection to hold the coordinating conversation over.
- circuitFactory.setConversationFactory(conversationFactory);
-
- // If the current test case is a drop-in test, set it up as the currently running test for late joiners to
- // add in to. Otherwise the current test field is set to null, to indicate that late joiners are not allowed.
- currentTest = (coordTest instanceof DropInTest) ? coordTest : null;
-
- // Execute the test case.
- coordTest.setCircuitFactory(circuitFactory);
- }
- }
-
- /**
- * Broadcasts a test invitation and accepts enlists from participating clients. The wrapped test cases are run
- * with one test client in the sender role, and the remaining test clients in the receiving role.
- *
- * <p/>Any JMSExceptions during the invite/enlist conversation will be allowed to fall through as runtime
- * exceptions, resulting in the non-completion of the test run.
- *
- * @param testResult The the results object to monitor the test results with.
- *
- * @todo Better error recovery for failure of the invite/enlist conversation could be added.
- */
- public void run(TestResult testResult)
- {
- log.debug("public void run(TestResult testResult): called");
-
- // Listen for late joiners on the control topic.
- try
- {
- conversationFactory.getSession().createConsumer(controlTopic).setMessageListener(this);
- }
- catch (JMSException e)
- {
- throw new RuntimeException("Unable to set up the message listener on the control topic.", e);
- }
-
- // Run all of the test cases in the test suite.
- /*for (Test test : getAllUnderlyingTests())
- {
- FrameworkBaseCase coordTest = (FrameworkBaseCase) test;
-
- // Get all of the clients able to participate in the test.
- Set<TestClientDetails> enlists = signupClients(coordTest);
-
- // Check that there were some clients available.
- if (enlists.size() == 0)
- {
- throw new RuntimeException("No clients to test with");
- }
-
- // Create a distributed test circuit factory for the test.
- CircuitFactory circuitFactory = getTestSequencer();
-
- // Set up the first client in the sender role, and the remainder in the receivers role.
- Iterator<TestClientDetails> clients = enlists.iterator();
- circuitFactory.setSender(clients.next());
-
- while (clients.hasNext())
- {
- // Set the sending and receiving client details on the test case.
- circuitFactory.setReceiver(clients.next());
- }
-
- // Pass down the connection to hold the coordinating conversation over.
- circuitFactory.setConversationFactory(conversationFactory);
-
- // If the current test case is a drop-in test, set it up as the currently running test for late joiners to
- // add in to. Otherwise the current test field is set to null, to indicate that late joiners are not allowed.
- currentTest = (coordTest instanceof DropInTest) ? coordTest : null;
-
- // Execute the test case.
- coordTest.setCircuitFactory(circuitFactory);
- }*/
-
- // Run all of the test cases in the test suite.
- for (Test test : getAllUnderlyingTests())
- {
- FrameworkBaseCase coordTest = (FrameworkBaseCase) test;
-
- coordTest.run(testResult);
-
- currentTest = null;
- }
- }
-
- /**
- * Should provide the distributed test sequencer to pass to {@link org.apache.qpid.test.framework.FrameworkBaseCase}
- * tests.
- *
- * @return A distributed test sequencer.
- */
- public CircuitFactory getTestSequencer()
- {
- return new FanOutCircuitFactory();
- }
-
- /**
- * Listens to incoming messages on the control topic. If the messages are 'join' messages, signalling a new
- * test client wishing to join the current test, then the new client will be added to the current test in the
- * receivers role.
- *
- * @param message The incoming control message.
- */
- public void onMessage(Message message)
- {
- try
- {
- // Check if the message is from a test client attempting to join a running test, and join it to the current
- // test case if so.
- if (message.getStringProperty("CONTROL_TYPE").equals("JOIN") && (currentTest != null))
- {
- ((DropInTest) currentTest).lateJoin(message);
- }
- }
- // There is not a lot can be done with this error, so it is deliberately ignored.
- catch (JMSException e)
- {
- log.debug("Unable to process message:" + message);
- }
- }
-
- /**
- * Prints a string summarizing this test decorator, mainly for debugging purposes.
- *
- * @return String representation for debugging purposes.
- */
- public String toString()
- {
- return "FanOutTestDecorator: [ testSuite = " + testSuite + " ]";
- }
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/InteropTestDecorator.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/InteropTestDecorator.java
deleted file mode 100644
index dd5007090b..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/InteropTestDecorator.java
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.test.framework.distributedtesting;
-
-import junit.framework.Test;
-import junit.framework.TestResult;
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.junit.extensions.WrappedSuiteTestDecorator;
-import org.apache.qpid.test.framework.FrameworkBaseCase;
-import org.apache.qpid.test.framework.TestClientDetails;
-import org.apache.qpid.test.framework.sequencers.CircuitFactory;
-import org.apache.qpid.test.framework.sequencers.InteropCircuitFactory;
-import org.apache.qpid.test.utils.ConversationFactory;
-
-import javax.jms.Connection;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-/**
- * DistributedTestDecorator is a test decorator, written to implement the interop test specification. Given a list
- * of enlisted test clients, that are available to run interop tests, this decorator invites them to participate
- * in each test in the wrapped test suite. Amongst all the clients that respond to the invite, all pairs are formed,
- * and each pairing (in both directions, but excluding the reflexive pairings) is split into a sender and receivers
- * role and a test case run between them. Any enlisted combinations that do not accept a test invite are automatically
- * failed.
- *
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Broadcast test invitations and collect enlists. <td> {@link org.apache.qpid.test.utils.ConversationFactory}.
- * <tr><td> Output test failures for clients unwilling to run the test case. <td> {@link Coordinator}
- * <tr><td> Execute distributed test cases. <td> {@link FrameworkBaseCase}
- * <tr><td> Fail non-participating pairings. <td> {@link OptOutTestCase}
- * </table>
- */
-public class InteropTestDecorator extends DistributedTestDecorator
-{
- /** Used for debugging. */
- private static final Logger log = Logger.getLogger(InteropTestDecorator.class);
-
- /**
- * Creates a wrapped suite test decorator from another one.
- *
- * @param suite The test suite.
- * @param availableClients The list of all clients that responded to the compulsory invite.
- * @param controlConversation The conversation helper for the control level, test coordination conversation.
- * @param controlConnection The connection that the coordination messages are sent over.
- */
- public InteropTestDecorator(WrappedSuiteTestDecorator suite, Set<TestClientDetails> availableClients,
- ConversationFactory controlConversation, Connection controlConnection)
- {
- super(suite, availableClients, controlConversation, controlConnection);
- }
-
- /**
- * Broadcasts a test invitation and accetps enlisting from participating clients. The wrapped test case is
- * then repeated for every combination of test clients (provided the wrapped test case extends
- * {@link FrameworkBaseCase}.
- *
- * <p/>Any JMSExceptions during the invite/enlist conversation will be allowed to fall through as runtime exceptions,
- * resulting in the non-completion of the test run.
- *
- * @todo Better error recovery for failure of the invite/enlist conversation could be added.
- *
- * @param testResult The the results object to monitor the test results with.
- */
- public void run(TestResult testResult)
- {
- log.debug("public void run(TestResult testResult): called");
-
- Collection<Test> tests = testSuite.getAllUnderlyingTests();
-
- for (Test test : getAllUnderlyingTests())
- {
- FrameworkBaseCase coordTest = (FrameworkBaseCase) test;
-
- // Broadcast the invitation to find out what clients are available to test.
- Set<TestClientDetails> enlists = signupClients(coordTest);
-
- // Compare the list of willing clients to the list of all available.
- Set<TestClientDetails> optOuts = new HashSet<TestClientDetails>(allClients);
- optOuts.removeAll(enlists);
-
- // Output test failures for clients that will not particpate in the test.
- Set<List<TestClientDetails>> failPairs = allPairs(optOuts, allClients);
-
- for (List<TestClientDetails> failPair : failPairs)
- {
- // Create a distributed test circuit factory for the test.
- CircuitFactory circuitFactory = getTestSequencer();
-
- // Create an automatic failure test for the opted out test pair.
- FrameworkBaseCase failTest = new OptOutTestCase("testOptOut");
- circuitFactory.setSender(failPair.get(0));
- circuitFactory.setReceiver(failPair.get(1));
- failTest.setCircuitFactory(circuitFactory);
-
- failTest.run(testResult);
- }
-
- // Loop over all combinations of clients, willing to run the test.
- Set<List<TestClientDetails>> enlistedPairs = allPairs(enlists, enlists);
-
- for (List<TestClientDetails> enlistedPair : enlistedPairs)
- {
- // Create a distributed test circuit factory for the test.
- CircuitFactory circuitFactory = getTestSequencer();
-
- // Set the sending and receiving client details on the test circuitFactory.
- circuitFactory.setSender(enlistedPair.get(0));
- circuitFactory.setReceiver(enlistedPair.get(1));
-
- // Pass down the connection to hold the coordination conversation over.
- circuitFactory.setConversationFactory(conversationFactory);
-
- // Execute the test case.
- coordTest.setCircuitFactory(circuitFactory);
- coordTest.run(testResult);
- }
- }
- }
-
- /**
- * Should provide the distributed test sequencer to pass to {@link org.apache.qpid.test.framework.FrameworkBaseCase}
- * tests.
- *
- * @return A distributed test sequencer.
- */
- public CircuitFactory getTestSequencer()
- {
- return new InteropCircuitFactory();
- }
-
- /**
- * Produces all pairs of combinations of elements from two sets. The ordering of the elements in the pair is
- * important, that is the pair <l, r> is distinct from <r, l>; both pairs are generated. For any element, i, in
- * both the left and right sets, the reflexive pair <i, i> is not generated.
- *
- * @param left The left set.
- * @param right The right set.
- * @param <E> The type of the content of the pairs.
- *
- * @return All pairs formed from the permutations of all elements of the left and right sets.
- */
- private <E> Set<List<E>> allPairs(Set<E> left, Set<E> right)
- {
- log.debug("private <E> Set<List<E>> allPairs(Set<E> left = " + left + ", Set<E> right = " + right + "): called");
-
- Set<List<E>> results = new HashSet<List<E>>();
-
- // Form all pairs from left to right.
- // Form all pairs from right to left.
- for (E le : left)
- {
- for (E re : right)
- {
- if (!le.equals(re))
- {
- results.add(new Pair<E>(le, re));
- results.add(new Pair<E>(re, le));
- }
- }
- }
-
- log.debug("results = " + results);
-
- return results;
- }
-
- /**
- * A simple implementation of a pair, using a list.
- */
- private class Pair<T> extends ArrayList<T>
- {
- /**
- * Creates a new pair of elements.
- *
- * @param first The first element.
- * @param second The second element.
- */
- public Pair(T first, T second)
- {
- super();
- super.add(first);
- super.add(second);
- }
- }
-}
-
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/OptOutTestCase.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/OptOutTestCase.java
deleted file mode 100644
index 229c6a34da..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/OptOutTestCase.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.test.framework.distributedtesting;
-
-import org.apache.qpid.test.framework.FrameworkBaseCase;
-import org.apache.qpid.test.framework.sequencers.CircuitFactory;
-
-/**
- * An OptOutTestCase is a test case that automatically fails. It is used when a list of test clients has been generated
- * from a compulsory invite, but only some of those clients have responded to a specific test case invite. The clients
- * that did not respond, may automatically be given a fail for some tests.
- *
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Fail the test with a suitable reason.
- * </table>
- */
-public class OptOutTestCase extends FrameworkBaseCase
-{
- /**
- * Creates a new coordinating test case with the specified name.
- *
- * @param name The test case name.
- */
- public OptOutTestCase(String name)
- {
- super(name);
- }
-
- /** Generates an appropriate test failure assertion. */
- public void testOptOut()
- {
- CircuitFactory circuitFactory = getCircuitFactory();
-
- fail("One of " + circuitFactory.getSender() + " and " + getCircuitFactory().getReceivers()
- + " opted out of the test.");
- }
-
- /**
- * Should provide a translation from the junit method name of a test to its test case name as defined in the
- * interop testing specification. For example the method "testP2P" might map onto the interop test case name
- * "TC2_BasicP2P".
- *
- * @param methodName The name of the JUnit test method.
- * @return The name of the corresponding interop test case.
- */
- public String getTestCaseNameForTestMethod(String methodName)
- {
- return "OptOutTest";
- }
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/TestClient.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/TestClient.java
deleted file mode 100644
index f9b8cbb898..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/TestClient.java
+++ /dev/null
@@ -1,510 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.test.framework.distributedtesting;
-
-import org.apache.log4j.Logger;
-import org.apache.log4j.NDC;
-
-import org.apache.qpid.junit.extensions.SleepThrottle;
-import org.apache.qpid.junit.extensions.util.ParsedProperties;
-import org.apache.qpid.junit.extensions.util.TestContextProperties;
-import org.apache.qpid.test.framework.MessagingTestConfigProperties;
-import org.apache.qpid.test.framework.TestUtils;
-import org.apache.qpid.test.framework.clocksynch.ClockSynchThread;
-import org.apache.qpid.test.framework.clocksynch.UDPClockSynchronizer;
-import org.apache.qpid.test.utils.ReflectionUtils;
-import org.apache.qpid.test.utils.ReflectionUtilsException;
-
-import javax.jms.Connection;
-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.jms.Topic;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Implements a test client as described in the interop testing spec
- * (http://cwiki.apache.org/confluence/display/qpid/Interop+Testing+Specification). A test client is an agent that
- * reacts to control message sequences send by the test {@link Coordinator}.
- *
- * <p/><table><caption>Messages Handled by TestClient</caption>
- * <tr><th> Message <th> Action
- * <tr><td> Invite(compulsory) <td> Reply with Enlist.
- * <tr><td> Invite(test case) <td> Reply with Enlist if test case available.
- * <tr><td> AssignRole(test case) <td> Reply with Accept Role if matches an enlisted test. Keep test parameters.
- * <tr><td> Start <td> Send test messages defined by test parameters. Send report on messages sent.
- * <tr><td> Status Request <td> Send report on messages received.
- * <tr><td> Terminate <td> Terminate the test client.
- * <tr><td> ClockSynch <td> Synch clock against the supplied UDP address.
- * </table>
- *
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Handle all incoming control messages. <td> {@link TestClientControlledTest}
- * <tr><td> Configure and look up test cases by name. <td> {@link TestClientControlledTest}
- * </table>
- */
-public class TestClient implements MessageListener
-{
- /** Used for debugging. */
- private static final Logger log = Logger.getLogger(TestClient.class);
-
- /** Used for reporting to the console. */
- private static final Logger console = Logger.getLogger("CONSOLE");
-
- /** Holds the default identifying name of the test client. */
- public static final String CLIENT_NAME = "java";
-
- /**
- * Holds the test context properties that provides the default test parameters, plus command line overrides.
- * This is initialized with the default test parameters, to which command line overrides may be applied.
- */
- public static ParsedProperties testContextProperties =
- TestContextProperties.getInstance(MessagingTestConfigProperties.defaults);
-
- /** Holds all the test cases loaded from the classpath. */
- Map<String, TestClientControlledTest> testCases = new HashMap<String, TestClientControlledTest>();
-
- /** Holds the test case currently being run by this client. */
- protected TestClientControlledTest currentTestCase;
-
- /** Holds the connection to the broker that the test is being coordinated on. */
- protected Connection connection;
-
- /** Holds the message producer to hold the test coordination over. */
- protected MessageProducer producer;
-
- /** Holds the JMS controlSession for the test coordination. */
- protected Session session;
-
- /** Holds the name of this client, with a default value. */
- protected String clientName = CLIENT_NAME;
-
- /** This flag indicates that the test client should attempt to join the currently running test case on start up. */
- protected boolean join;
-
- /** Holds the clock synchronizer for the test node. */
- ClockSynchThread clockSynchThread;
-
- /**
- * Creates a new interop test client, listenting to the specified broker and virtual host, with the specified client
- * identifying name.
- *
- * @param pBrokerUrl The url of the broker to connect to.
- * @param pVirtualHost The virtual host to conect to.
- * @param clientName The client name to use.
- * @param join Flag to indicate that this client should attempt to join running tests.
- */
- public TestClient(String pBrokerUrl, String pVirtualHost, String clientName, boolean join)
- {
- log.debug("public TestClient(String pBrokerUrl = " + pBrokerUrl + ", String pVirtualHost = " + pVirtualHost
- + ", String clientName = " + clientName + ", boolean join = " + join + "): called");
-
- // Retain the connection parameters.
- this.clientName = clientName;
- this.join = join;
-
- // Save properies from command line to defaults
- if (pBrokerUrl != null)
- {
- testContextProperties.setProperty(MessagingTestConfigProperties.BROKER_PROPNAME, pBrokerUrl);
- }
- if (pVirtualHost != null)
- {
- testContextProperties.setProperty(MessagingTestConfigProperties.VIRTUAL_HOST_PROPNAME, pVirtualHost);
- }
- }
-
- /**
- * The entry point for the interop test coordinator. This client accepts the following command line arguments:
- *
- * <p/><table>
- * <tr><td> -b <td> The broker URL. <td> Optional.
- * <tr><td> -h <td> The virtual host. <td> Optional.
- * <tr><td> -n <td> The test client name. <td> Optional.
- * <tr><td> name=value <td> Trailing argument define name/value pairs. Added to system properties. <td> Optional.
- * </table>
- *
- * @param args The command line arguments.
- */
- public static void main(String[] args)
- {
- log.debug("public static void main(String[] args = " + Arrays.toString(args) + "): called");
- console.info("Qpid Distributed Test Client.");
-
- // Override the default broker url to be localhost:5672.
- testContextProperties.setProperty(MessagingTestConfigProperties.BROKER_PROPNAME, "tcp://localhost:5672");
-
- // Use the command line parser to evaluate the command line with standard handling behaviour (print errors
- // and usage then exist if there are errors).
- // Any options and trailing name=value pairs are also injected into the test context properties object,
- // to override any defaults that may have been set up.
- ParsedProperties options =
- new ParsedProperties(org.apache.qpid.junit.extensions.util.CommandLineParser.processCommandLine(args,
- new org.apache.qpid.junit.extensions.util.CommandLineParser(
- new String[][]
- {
- { "b", "The broker URL.", "broker", "false" },
- { "h", "The virtual host to use.", "virtual host", "false" },
- { "o", "The name of the directory to output test timings to.", "dir", "false" },
- { "n", "The name of the test client.", "name", "false" },
- { "j", "Join this test client to running test.", "false" }
- }), testContextProperties));
-
- // Extract the command line options.
- String brokerUrl = options.getProperty("b");
- String virtualHost = options.getProperty("h");
- String clientName = options.getProperty("n");
- clientName = (clientName == null) ? CLIENT_NAME : clientName;
- boolean join = options.getPropertyAsBoolean("j");
-
- // To distinguish logging output set up an NDC on the client name.
- NDC.push(clientName);
-
- // Create a test client and start it running.
- TestClient client = new TestClient(brokerUrl, virtualHost, clientName, join);
-
- // Use a class path scanner to find all the interop test case implementations.
- // Hard code the test classes till the classpath scanner is fixed.
- Collection<Class<? extends TestClientControlledTest>> testCaseClasses =
- new ArrayList<Class<? extends TestClientControlledTest>>();
- // ClasspathScanner.getMatches(TestClientControlledTest.class, "^TestCase.*", true);
- testCaseClasses.addAll(loadTestCases("org.apache.qpid.interop.clienttestcases.TestCase1DummyRun",
- "org.apache.qpid.interop.clienttestcases.TestCase2BasicP2P",
- "org.apache.qpid.interop.clienttestcases.TestCase3BasicPubSub",
- "org.apache.qpid.interop.clienttestcases.TestCase4P2PMessageSize",
- "org.apache.qpid.interop.clienttestcases.TestCase5PubSubMessageSize",
- "org.apache.qpid.test.framework.distributedcircuit.TestClientCircuitEnd"));
-
- try
- {
- client.start(testCaseClasses);
- }
- catch (Exception e)
- {
- log.error("The test client was unable to start.", e);
- console.info(e.getMessage());
- System.exit(1);
- }
- }
-
- /**
- * Parses a list of class names, and loads them if they are available on the class path.
- *
- * @param classNames The names of the classes to load.
- *
- * @return A list of the loaded test case classes.
- */
- public static List<Class<? extends TestClientControlledTest>> loadTestCases(String... classNames)
- {
- List<Class<? extends TestClientControlledTest>> testCases =
- new LinkedList<Class<? extends TestClientControlledTest>>();
-
- for (String className : classNames)
- {
- try
- {
- Class<?> cls = ReflectionUtils.forName(className);
- testCases.add((Class<? extends TestClientControlledTest>) cls);
- }
- catch (ReflectionUtilsException e)
- {
- // Ignore, class could not be found, so test not available.
- console.warn("Requested class " + className + " cannot be found, ignoring it.");
- }
- catch (ClassCastException e)
- {
- // Ignore, class was not of correct type to be a test case.
- console.warn("Requested class " + className + " is not an instance of TestClientControlledTest.");
- }
- }
-
- return testCases;
- }
-
- /**
- * Starts the interop test client running. This causes it to start listening for incoming test invites.
- *
- * @param testCaseClasses The classes of the available test cases. The test case names from these are used to
- * matchin incoming test invites against.
- *
- * @throws JMSException Any underlying JMSExceptions are allowed to fall through.
- */
- protected void start(Collection<Class<? extends TestClientControlledTest>> testCaseClasses) throws JMSException
- {
- log.debug("protected void start(Collection<Class<? extends TestClientControlledTest>> testCaseClasses = "
- + testCaseClasses + "): called");
-
- // Create all the test case implementations and index them by the test names.
- for (Class<? extends TestClientControlledTest> nextClass : testCaseClasses)
- {
- try
- {
- TestClientControlledTest testCase = nextClass.newInstance();
- testCases.put(testCase.getName(), testCase);
- }
- catch (InstantiationException e)
- {
- log.warn("Could not instantiate test case class: " + nextClass.getName(), e);
- // Ignored.
- }
- catch (IllegalAccessException e)
- {
- log.warn("Could not instantiate test case class due to illegal access: " + nextClass.getName(), e);
- // Ignored.
- }
- }
-
- // Open a connection to communicate with the coordinator on.
- connection = TestUtils.createConnection(testContextProperties);
- session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- // Set this up to listen for control messages.
- Topic privateControlTopic = session.createTopic("iop.control." + clientName);
- MessageConsumer consumer = session.createConsumer(privateControlTopic);
- consumer.setMessageListener(this);
-
- Topic controlTopic = session.createTopic("iop.control");
- MessageConsumer consumer2 = session.createConsumer(controlTopic);
- consumer2.setMessageListener(this);
-
- // Create a producer to send replies with.
- producer = session.createProducer(null);
-
- // If the join flag was set, then broadcast a join message to notify the coordinator that a new test client
- // is available to join the current test case, if it supports it. This message may be ignored, or it may result
- // in this test client receiving a test invite.
- if (join)
- {
- Message joinMessage = session.createMessage();
-
- joinMessage.setStringProperty("CONTROL_TYPE", "JOIN");
- joinMessage.setStringProperty("CLIENT_NAME", clientName);
- joinMessage.setStringProperty("CLIENT_PRIVATE_CONTROL_KEY", "iop.control." + clientName);
- producer.send(controlTopic, joinMessage);
- }
-
- // Start listening for incoming control messages.
- connection.start();
- }
-
- /**
- * Handles all incoming control messages.
- *
- * @param message The incoming message.
- */
- public void onMessage(Message message)
- {
- NDC.push(clientName);
- log.debug("public void onMessage(Message message = " + message + "): called");
-
- try
- {
- String controlType = message.getStringProperty("CONTROL_TYPE");
- String testName = message.getStringProperty("TEST_NAME");
-
- log.debug("Received control of type '" + controlType + "' for the test '" + testName + "'");
-
- // Check if the message is a test invite.
- if ("INVITE".equals(controlType))
- {
- // Flag used to indicate that an enlist should be sent. Only enlist to compulsory invites or invites
- // for which test cases exist.
- boolean enlist = false;
-
- if (testName != null)
- {
- log.debug("Got an invite to test: " + testName);
-
- // Check if the requested test case is available.
- TestClientControlledTest testCase = testCases.get(testName);
-
- if (testCase != null)
- {
- log.debug("Found implementing class for test '" + testName + "', enlisting for it.");
-
- // Check if the test case will accept the invitation.
- enlist = testCase.acceptInvite(message);
-
- log.debug("The test case "
- + (enlist ? " accepted the invite, enlisting for it."
- : " did not accept the invite, not enlisting."));
-
- // Make the requested test case the current test case.
- currentTestCase = testCase;
- }
- else
- {
- log.debug("Received an invite to the test '" + testName + "' but this test is not known.");
- }
- }
- else
- {
- log.debug("Got a compulsory invite, enlisting for it.");
-
- enlist = true;
- }
-
- if (enlist)
- {
- // Reply with the client name in an Enlist message.
- Message enlistMessage = session.createMessage();
- enlistMessage.setStringProperty("CONTROL_TYPE", "ENLIST");
- enlistMessage.setStringProperty("CLIENT_NAME", clientName);
- enlistMessage.setStringProperty("CLIENT_PRIVATE_CONTROL_KEY", "iop.control." + clientName);
- enlistMessage.setJMSCorrelationID(message.getJMSCorrelationID());
-
- log.debug("Sending enlist message '" + enlistMessage.getJMSMessageID() + "' to " + message.getJMSReplyTo());
-
- producer.send(message.getJMSReplyTo(), enlistMessage);
- }
- else
- {
- // Reply with the client name in an Decline message.
- Message enlistMessage = session.createMessage();
- enlistMessage.setStringProperty("CONTROL_TYPE", "DECLINE");
- enlistMessage.setStringProperty("CLIENT_NAME", clientName);
- enlistMessage.setStringProperty("CLIENT_PRIVATE_CONTROL_KEY", "iop.control." + clientName);
- enlistMessage.setJMSCorrelationID(message.getJMSCorrelationID());
-
- log.debug("Sending decline message '" + enlistMessage.getJMSMessageID() + "' to " + message.getJMSReplyTo());
-
- producer.send(message.getJMSReplyTo(), enlistMessage);
- }
- }
- else if ("ASSIGN_ROLE".equals(controlType))
- {
- // Assign the role to the current test case.
- String roleName = message.getStringProperty("ROLE");
-
- log.debug("Got a role assignment to role: " + roleName);
-
- TestClientControlledTest.Roles role = Enum.valueOf(TestClientControlledTest.Roles.class, roleName);
-
- currentTestCase.assignRole(role, message);
-
- // Reply by accepting the role in an Accept Role message.
- Message acceptRoleMessage = session.createMessage();
- acceptRoleMessage.setStringProperty("CLIENT_NAME", clientName);
- acceptRoleMessage.setStringProperty("CONTROL_TYPE", "ACCEPT_ROLE");
- acceptRoleMessage.setJMSCorrelationID(message.getJMSCorrelationID());
-
- log.debug("Sending accept role message '" + acceptRoleMessage.getJMSMessageID() + "' to " + message.getJMSReplyTo());
-
- producer.send(message.getJMSReplyTo(), acceptRoleMessage);
- }
- else if ("START".equals(controlType) || "STATUS_REQUEST".equals(controlType))
- {
- if ("START".equals(controlType))
- {
- log.debug("Got a start notification.");
-
- // Extract the number of test messages to send from the start notification.
- int numMessages;
-
- try
- {
- numMessages = message.getIntProperty("MESSAGE_COUNT");
- }
- catch (NumberFormatException e)
- {
- // If the number of messages is not specified, use the default of one.
- numMessages = 1;
- }
-
- // Start the current test case.
- currentTestCase.start(numMessages);
- }
- else
- {
- log.debug("Got a status request.");
- }
-
- // Generate the report from the test case and reply with it as a Report message.
- Message reportMessage = currentTestCase.getReport(session);
- reportMessage.setStringProperty("CLIENT_NAME", clientName);
- reportMessage.setStringProperty("CONTROL_TYPE", "REPORT");
- reportMessage.setJMSCorrelationID(message.getJMSCorrelationID());
-
- log.debug("Sending report message '" + reportMessage.getJMSMessageID() + "' to " + message.getJMSReplyTo());
-
- producer.send(message.getJMSReplyTo(), reportMessage);
- }
- else if ("TERMINATE".equals(controlType))
- {
- console.info("Received termination instruction from coordinator.");
-
- // Is a cleaner shutdown needed?
- connection.close();
- System.exit(0);
- }
- else if ("CLOCK_SYNCH".equals(controlType))
- {
- log.debug("Received clock synch command.");
- String address = message.getStringProperty("ADDRESS");
-
- log.debug("address = " + address);
-
- // Re-create (if necessary) and start the clock synch thread to synch the clock every ten seconds.
- if (clockSynchThread != null)
- {
- clockSynchThread.terminate();
- }
-
- SleepThrottle throttle = new SleepThrottle();
- throttle.setRate(0.1f);
-
- clockSynchThread = new ClockSynchThread(new UDPClockSynchronizer(address), throttle);
- clockSynchThread.start();
- }
- else
- {
- // Log a warning about this but otherwise ignore it.
- log.warn("Got an unknown control message, controlType = " + controlType + ", message = " + message);
- }
- }
- catch (JMSException e)
- {
- // Log a warning about this, but otherwise ignore it.
- log.warn("Got JMSException whilst handling message: " + message, e);
- }
- // Log any runtimes that fall through this message handler. These are fatal errors for the test client.
- catch (RuntimeException e)
- {
- log.error("The test client message handler got an unhandled exception: ", e);
- console.info("The message handler got an unhandled exception, terminating the test client.");
- System.exit(1);
- }
- finally
- {
- NDC.pop();
- }
- }
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/TestClientControlledTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/TestClientControlledTest.java
deleted file mode 100644
index 2e64c9ca2d..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/distributedtesting/TestClientControlledTest.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.test.framework.distributedtesting;
-
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.Session;
-
-/**
- * TestClientControlledTest provides an interface that classes implementing test cases to run on a {@link TestClient}
- * node can use. Implementations must be Java beans, that is, to provide a default constructor and to implement the
- * {@link #getName} method.
- *
- * <p/>The methods specified in this interface are called when the {@link TestClient} receives control instructions to
- * apply to the test. There are control instructions to present the test case with the test invite, so that it may
- * choose whether or not to participate in the test, assign the test to play the sender or receiver role, start the
- * test and obtain the test status report.
- *
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities
- * <tr><td> Supply the name of the test case that this implements.
- * <tr><td> Accept/Reject invites based on test parameters.
- * <tr><td> Adapt to assigned roles.
- * <tr><td> Perform test case actions.
- * <tr><td> Generate test reports.
- * </table>
- */
-public interface TestClientControlledTest
-{
- /** Defines the possible test case roles that an interop test case can take on. */
- public enum Roles
- {
- /** Specifies the sender role. */
- SENDER,
-
- /** Specifies the receivers role. */
- RECEIVER
- }
-
- /**
- * Should provide the name of the test case that this class implements. The exact names are defined in the
- * interop testing spec.
- *
- * @return The name of the test case that this implements.
- */
- public String getName();
-
- /**
- * Determines whether the test invite that matched this test case is acceptable.
- *
- * @param inviteMessage The invitation to accept or reject.
- *
- * @return <tt>true</tt> to accept the invitation, <tt>false</tt> to reject it.
- *
- * @throws JMSException Any JMSException resulting from reading the message are allowed to fall through.
- */
- public boolean acceptInvite(Message inviteMessage) throws JMSException;
-
- /**
- * Assigns the role to be played by this test case. The test parameters are fully specified in the
- * assignment message. When this method return the test case will be ready to execute.
- *
- * @param role The role to be played; sender or receivers.
- * @param assignRoleMessage The role assingment message, contains the full test parameters.
- *
- * @throws JMSException Any JMSException resulting from reading the message are allowed to fall through.
- */
- public void assignRole(Roles role, Message assignRoleMessage) throws JMSException;
-
- /**
- * Performs the test case actions. Returning from here, indicates that the sending role has completed its test.
- *
- * @param numMessages The number of test messages to send.
- *
- * @throws JMSException Any JMSException resulting from reading the message are allowed to fall through.
- */
- public void start(int numMessages) throws JMSException;
-
- /**
- * Gets a report on the actions performed by the test case in its assigned role.
- *
- * @param session The controlSession to create the report message in.
- *
- * @return The report message.
- *
- * @throws JMSException Any JMSExceptions resulting from creating the report are allowed to fall through.
- */
- public Message getReport(Session session) throws JMSException;
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/listeners/XMLTestListener.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/listeners/XMLTestListener.java
deleted file mode 100644
index ad2c196adb..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/listeners/XMLTestListener.java
+++ /dev/null
@@ -1,414 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.test.framework.listeners;
-
-import junit.framework.AssertionFailedError;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.junit.extensions.ShutdownHookable;
-import org.apache.qpid.junit.extensions.listeners.TKTestListener;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-/**
- * Listens for test results for a named test and outputs these in the standard JUnit XML format to the specified
- * writer.
- *
- * <p/>The API for this listener accepts notifications about different aspects of a tests results through different
- * methods, so some assumption needs to be made as to which test result a notification refers to. For example
- * {@link #startTest} will be called, then possibly {@link #timing} will be called, even though the test instance is
- * passed in both cases, it is not enough to distinguish a particular run of the test, as the test case instance may
- * be being shared between multiple threads, or being run a repeated number of times, and can therfore be re-used
- * between calls. The listeners make the assumption that, for every test, a unique thread will call {@link #startTest}
- * and {@link #endTest} to delimit each test. All calls to set test parameters, timings, state and so on, will occur
- * between the start and end and will be given with the same thread id as the start and end, so the thread id provides
- * a unqiue value to identify a particular test run against.
- *
- * <p><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Listen to test lifecycle notifications.
- * <tr><td> Listen to test errors and failures.
- * <tr><td> Listen to test timings.
- * <tr><td> Listen to test memory usages.
- * <tr><td> Listen to parameterized test parameters.
- * <tr><th> Responsibilities
- * </table>
- *
- * @todo Merge this class with CSV test listener, making the collection of results common to both, and only factoring
- * out the results printing code into sub-classes. Provide a simple XML results formatter with the same format as
- * the ant XML formatter, and a more structured one for outputing results with timings and summaries from
- * performance tests.
- */
-public class XMLTestListener implements TKTestListener, ShutdownHookable
-{
- /** Used for debugging. */
- private static final Logger log = Logger.getLogger(XMLTestListener.class);
-
- /** The results file writer. */
- protected Writer writer;
-
- /** Holds the results for individual tests. */
- // protected Map<Result, Result> results = new LinkedHashMap<Result, Result>();
- // protected List<Result> results = new ArrayList<Result>();
-
- /**
- * Map for holding results on a per thread basis as they come in. A ThreadLocal is not used as sometimes an
- * explicit thread id must be used, where notifications come from different threads than the ones that called
- * the test method.
- */
- Map<Long, Result> threadLocalResults = Collections.synchronizedMap(new LinkedHashMap<Long, Result>());
-
- /**
- * Holds results for tests that have ended. Transferring these results here from the per-thread results map, means
- * that the thread id is freed for the thread to generate more results.
- */
- List<Result> results = new ArrayList<Result>();
-
- /** Holds the overall error count. */
- protected int errors = 0;
-
- /** Holds the overall failure count. */
- protected int failures = 0;
-
- /** Holds the overall tests run count. */
- protected int runs = 0;
-
- /** Holds the name of the class that tests are being run for. */
- String testClassName;
-
- /**
- * Creates a new XML results output listener that writes to the specified location.
- *
- * @param writer The location to write results to.
- * @param testClassName The name of the test class to include in the test results.
- */
- public XMLTestListener(Writer writer, String testClassName)
- {
- log.debug("public XMLTestListener(Writer writer, String testClassName = " + testClassName + "): called");
-
- this.writer = writer;
- this.testClassName = testClassName;
- }
-
- /**
- * Resets the test results to the default state of time zero, memory usage zero, parameter zero, test passed.
- *
- * @param test The test to resest any results for.
- * @param threadId Optional thread id if not calling from thread that started the test method. May be null.
- */
- public void reset(Test test, Long threadId)
- {
- log.debug("public void reset(Test test = " + test + ", Long threadId = " + threadId + "): called");
-
- XMLTestListener.Result r =
- (threadId == null) ? threadLocalResults.get(Thread.currentThread().getId()) : threadLocalResults.get(threadId);
-
- r.error = null;
- r.failure = null;
-
- }
-
- /**
- * Notification that a test started.
- *
- * @param test The test that started.
- */
- public void startTest(Test test)
- {
- log.debug("public void startTest(Test test = " + test + "): called");
-
- Result newResult = new Result(test.getClass().getName(), ((TestCase) test).getName());
-
- // Initialize the thread local test results.
- threadLocalResults.put(Thread.currentThread().getId(), newResult);
- runs++;
- }
-
- /**
- * Should be called every time a test completes with the run time of that test.
- *
- * @param test The name of the test.
- * @param nanos The run time of the test in nanoseconds.
- * @param threadId Optional thread id if not calling from thread that started the test method. May be null.
- */
- public void timing(Test test, long nanos, Long threadId)
- { }
-
- /**
- * Optionally called every time a test completes with the second timing test.
- *
- * @param test The name of the test.
- * @param nanos The second timing information of the test in nanoseconds.
- * @param threadId Optional thread id if not calling from thread that started the test method. May be null.
- */
- public void timing2(Test test, Long nanos, Long threadId)
- { }
-
- /**
- * Should be called every time a test completed with the amount of memory used before and after the test was run.
- *
- * @param test The test which memory was measured for.
- * @param memStart The total JVM memory used before the test was run.
- * @param memEnd The total JVM memory used after the test was run.
- * @param threadId Optional thread id if not calling from thread that started the test method. May be null.
- */
- public void memoryUsed(Test test, long memStart, long memEnd, Long threadId)
- { }
-
- /**
- * Should be called every time a parameterized test completed with the int value of its test parameter.
- *
- * @param test The test which memory was measured for.
- * @param parameter The int parameter value.
- * @param threadId Optional thread id if not calling from thread that started the test method. May be null.
- */
- public void parameterValue(Test test, int parameter, Long threadId)
- { }
-
- /**
- * Should be called every time a test completes with the current number of test threads running.
- *
- * @param test The test for which the measurement is being generated.
- * @param threads The number of tests being run concurrently.
- * @param threadId Optional thread id if not calling from thread that started the test method. May be null.
- */
- public void concurrencyLevel(Test test, int threads, Long threadId)
- { }
-
- /**
- * Notifies listeners of the tests read/set properties.
- *
- * @param properties The tests read/set properties.
- */
- public void properties(Properties properties)
- { }
-
- /**
- * Notification that a test ended.
- *
- * @param test The test that ended.
- */
- public void endTest(Test test)
- {
- log.debug("public void endTest(Test test = " + test + "): called");
-
- // Move complete test results into the completed tests list.
- Result r = threadLocalResults.get(Thread.currentThread().getId());
- results.add(r);
-
- // Clear all the test results for the thread.
- threadLocalResults.remove(Thread.currentThread().getId());
- }
-
- /**
- * Called when a test completes. Success, failure and errors. This method should be used when registering an
- * end test from a different thread than the one that started the test.
- *
- * @param test The test which completed.
- * @param threadId Optional thread id if not calling from thread that started the test method. May be null.
- */
- public void endTest(Test test, Long threadId)
- {
- log.debug("public void endTest(Test test = " + test + ", Long threadId = " + threadId + "): called");
-
- // Move complete test results into the completed tests list.
- Result r =
- (threadId == null) ? threadLocalResults.get(Thread.currentThread().getId()) : threadLocalResults.get(threadId);
- results.add(r);
-
- // Clear all the test results for the thread.
- threadLocalResults.remove(Thread.currentThread().getId());
- }
-
- /**
- * An error occurred.
- *
- * @param test The test in which the error occurred.
- * @param t The throwable that resulted from the error.
- */
- public void addError(Test test, Throwable t)
- {
- log.debug("public void addError(Test test = " + test + ", Throwable t = " + t + "): called");
-
- Result r = threadLocalResults.get(Thread.currentThread().getId());
- r.error = t;
- errors++;
- }
-
- /**
- * A failure occurred.
- *
- * @param test The test in which the failure occurred.
- * @param t The JUnit assertions that led to the failure.
- */
- public void addFailure(Test test, AssertionFailedError t)
- {
- log.debug("public void addFailure(Test test = " + test + ", AssertionFailedError t = " + t + "): called");
-
- Result r = threadLocalResults.get(Thread.currentThread().getId());
- r.failure = t;
- failures++;
- }
-
- /**
- * Called when a test completes to mark it as a test fail. This method should be used when registering a
- * failure from a different thread than the one that started the test.
- *
- * @param test The test which failed.
- * @param e The assertion that failed the test.
- * @param threadId Optional thread id if not calling from thread that started the test method. May be null.
- */
- public void addFailure(Test test, AssertionFailedError e, Long threadId)
- {
- log.debug("public void addFailure(Test test, AssertionFailedError e, Long threadId): called");
-
- Result r =
- (threadId == null) ? threadLocalResults.get(Thread.currentThread().getId()) : threadLocalResults.get(threadId);
- r.failure = e;
- failures++;
- }
-
- /**
- * Notifies listeners of the start of a complete run of tests.
- */
- public void startBatch()
- {
- log.debug("public void startBatch(): called");
-
- // Reset all results counts.
- threadLocalResults = Collections.synchronizedMap(new HashMap<Long, Result>());
- errors = 0;
- failures = 0;
- runs = 0;
-
- // Write out the file header.
- try
- {
- writer.write("<?xml version=\"1.0\" ?>\n");
- }
- catch (IOException e)
- {
- throw new RuntimeException("Unable to write the test results.", e);
- }
- }
-
- /**
- * Notifies listeners of the end of a complete run of tests.
- *
- * @param parameters The optional test parameters to log out with the batch results.
- */
- public void endBatch(Properties parameters)
- {
- log.debug("public void endBatch(Properties parameters = " + parameters + "): called");
-
- // Write out the results.
- try
- {
- // writer.write("<?xml version=\"1.0\" ?>\n");
- writer.write("<testsuite errors=\"" + errors + "\" failures=\"" + failures + "\" tests=\"" + runs + "\" name=\""
- + testClassName + "\">\n");
-
- for (Result result : results)
- {
- writer.write(" <testcase classname=\"" + result.testClass + "\" name=\"" + result.testName + "\">\n");
-
- if (result.error != null)
- {
- writer.write(" <error type=\"" + result.error.getClass() + "\">");
- result.error.printStackTrace(new PrintWriter(writer));
- writer.write(" </error>");
- }
- else if (result.failure != null)
- {
- writer.write(" <failure type=\"" + result.failure.getClass() + "\">");
- result.failure.printStackTrace(new PrintWriter(writer));
- writer.write(" </failure>");
- }
-
- writer.write(" </testcase>\n");
- }
-
- writer.write("</testsuite>\n");
- writer.flush();
- }
- catch (IOException e)
- {
- throw new RuntimeException("Unable to write the test results.", e);
- }
- }
-
- /**
- * Supplies the shutdown hook.
- *
- * @return The shut down hook.
- */
- public Thread getShutdownHook()
- {
- return new Thread(new Runnable()
- {
- public void run()
- {
- log.debug("XMLTestListener::ShutdownHook: called");
- }
- });
- }
-
- /**
- * Used to capture the results of a particular test run.
- */
- protected static class Result
- {
- /** Holds the name of the test class. */
- public String testClass;
-
- /** Holds the name of the test method. */
- public String testName;
-
- /** Holds the exception that caused error in this test. */
- public Throwable error;
-
- /** Holds the assertion exception that caused failure in this test. */
- public AssertionFailedError failure;
-
- /**
- * Creates a placeholder for the results of a test.
- *
- * @param testClass The test class.
- * @param testName The name of the test that was run.
- */
- public Result(String testClass, String testName)
- {
- this.testClass = testClass;
- this.testName = testName;
- }
- }
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/localcircuit/LocalAMQPPublisherImpl.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/localcircuit/LocalAMQPPublisherImpl.java
deleted file mode 100644
index 6a0e8cba4b..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/localcircuit/LocalAMQPPublisherImpl.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.test.framework.localcircuit;
-
-import org.apache.qpid.client.AMQNoConsumersException;
-import org.apache.qpid.client.AMQNoRouteException;
-import org.apache.qpid.junit.extensions.util.ParsedProperties;
-import org.apache.qpid.test.framework.AMQPPublisher;
-import org.apache.qpid.test.framework.Assertion;
-import org.apache.qpid.test.framework.AssertionBase;
-import org.apache.qpid.test.framework.CircuitEndBase;
-import org.apache.qpid.test.framework.ExceptionMonitor;
-import org.apache.qpid.test.framework.MessageMonitor;
-
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-
-/**
- * LocalAMQPPublisherImpl is an extension of {@link LocalPublisherImpl} that adds AMQP specific features. Specifically
- * extra assertions for AMQP features not available through generic JMS.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td>
- * </table>
- */
-public class LocalAMQPPublisherImpl extends LocalPublisherImpl implements AMQPPublisher
-{
- /**
- * Creates a circuit end point on the specified producer, consumer and controlSession. Monitors are also configured
- * for messages and exceptions received by the circuit end.
- *
- * @param producer The message producer for the circuit end point.
- * @param consumer The message consumer for the circuit end point.
- * @param session The controlSession for the circuit end point.
- * @param messageMonitor The monitor to notify of all messages received by the circuit end.
- * @param exceptionMonitor The monitor to notify of all exceptions received by the circuit end.
- */
- public LocalAMQPPublisherImpl(MessageProducer producer, MessageConsumer consumer, Session session,
- MessageMonitor messageMonitor, ExceptionMonitor exceptionMonitor)
- {
- super(producer, consumer, session, messageMonitor, exceptionMonitor);
- }
-
- /**
- * Creates a circuit end point from the producer, consumer and controlSession in a circuit end base implementation.
- *
- * @param end The circuit end base implementation to take producers and consumers from.
- */
- public LocalAMQPPublisherImpl(CircuitEndBase end)
- {
- super(end);
- }
-
- /**
- * Provides an assertion that the publisher got a no consumers exception on every message.
- *
- * @param testProps The test configuration properties.
- *
- * @return An assertion that the publisher got a no consumers exception on every message.
- */
- public Assertion noConsumersAssertion(ParsedProperties testProps)
- {
- return new AssertionBase()
- {
- public boolean apply()
- {
- boolean passed = true;
- ExceptionMonitor connectionExceptionMonitor = circuit.getConnectionExceptionMonitor();
-
- if (!connectionExceptionMonitor.assertOneJMSExceptionWithLinkedCause(AMQNoConsumersException.class))
- {
- passed = false;
-
- addError("Was expecting linked exception type " + AMQNoConsumersException.class.getName()
- + " on the connection.\n");
- addError((connectionExceptionMonitor.size() > 0)
- ? ("Actually got the following exceptions on the connection, " + connectionExceptionMonitor)
- : "Got no exceptions on the connection.");
- }
-
- return passed;
- }
- };
- }
-
- /**
- * Provides an assertion that the publisher got a no rout exception on every message.
- *
- * @param testProps The test configuration properties.
- *
- * @return An assertion that the publisher got a no rout exception on every message.
- */
- public Assertion noRouteAssertion(ParsedProperties testProps)
- {
- return new AssertionBase()
- {
- public boolean apply()
- {
- boolean passed = true;
- ExceptionMonitor connectionExceptionMonitor = circuit.getConnectionExceptionMonitor();
-
- if (!connectionExceptionMonitor.assertOneJMSExceptionWithLinkedCause(AMQNoRouteException.class))
- {
- passed = false;
-
- addError("Was expecting linked exception type " + AMQNoRouteException.class.getName()
- + " on the connection.\n");
- addError((connectionExceptionMonitor.size() > 0)
- ? ("Actually got the following exceptions on the connection, " + connectionExceptionMonitor)
- : "Got no exceptions on the connection.");
- }
-
- return passed;
- }
- };
- }
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/localcircuit/LocalCircuitImpl.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/localcircuit/LocalCircuitImpl.java
deleted file mode 100644
index dc9ee0ac28..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/localcircuit/LocalCircuitImpl.java
+++ /dev/null
@@ -1,313 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.test.framework.localcircuit;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.junit.extensions.util.ParsedProperties;
-import org.apache.qpid.test.framework.Assertion;
-import org.apache.qpid.test.framework.Circuit;
-import org.apache.qpid.test.framework.CircuitEnd;
-import org.apache.qpid.test.framework.ExceptionMonitor;
-import org.apache.qpid.test.framework.MessagingTestConfigProperties;
-import org.apache.qpid.test.framework.Publisher;
-import org.apache.qpid.test.framework.Receiver;
-import org.apache.qpid.test.framework.TestUtils;
-
-import javax.jms.Connection;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * LocalCircuitImpl provides an implementation of the test circuit. This is a local only circuit implementation that
- * supports a single producer/consumer on each end of the circuit, with both ends of the circuit on the same JVM.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Supply the publishing and receiving ends of a test messaging circuit.
- * <td> {@link LocalPublisherImpl}, {@link LocalReceiverImpl}
- * <tr><td> Start the circuit running.
- * <tr><td> Close the circuit down.
- * <tr><td> Take a reading of the circuits state.
- * <tr><td> Apply assertions against the circuits state. <td> {@link Assertion}
- * <tr><td> Send test messages over the circuit.
- * <tr><td> Perform the default test procedure on the circuit.
- * <tr><td> Provide access to connection and controlSession exception monitors. <td> {@link ExceptionMonitor}
- * </table>
- */
-public class LocalCircuitImpl implements Circuit
-{
- /** Used for debugging. */
- private static final Logger log = Logger.getLogger(LocalCircuitImpl.class);
-
- /** Holds the test configuration for the circuit. */
- private ParsedProperties testProps;
-
- /** Holds the publishing end of the circuit. */
- private LocalPublisherImpl publisher;
-
- /** Holds the receiving end of the circuit. */
- private LocalReceiverImpl receiver;
-
- /** Holds the connection for the publishing end of the circuit. */
- private Connection connection;
-
- /** Holds the exception listener for the connection on the publishing end of the circuit. */
- private ExceptionMonitor connectionExceptionMonitor;
-
- /** Holds the exception listener for the controlSession on the publishing end of the circuit. */
- private ExceptionMonitor exceptionMonitor;
-
- /**
- * Creates a test circuit using the specified test parameters. The publisher, receivers, connection and
- * connection monitor must already have been created, to assemble the circuit.
- *
- * @param testProps The test parameters.
- * @param publisher The test publisher.
- * @param receiver The test receivers.
- * @param connection The connection.
- * @param connectionExceptionMonitor The connection exception monitor.
- */
- public LocalCircuitImpl(ParsedProperties testProps, LocalPublisherImpl publisher, LocalReceiverImpl receiver,
- Connection connection, ExceptionMonitor connectionExceptionMonitor)
- {
- this.testProps = testProps;
- this.publisher = publisher;
- this.receiver = receiver;
- this.connection = connection;
- this.connectionExceptionMonitor = connectionExceptionMonitor;
- this.exceptionMonitor = new ExceptionMonitor();
-
- // Set this as the parent circuit on the publisher and receivers.
- publisher.setCircuit(this);
- receiver.setCircuit(this);
- }
-
- /**
- * Gets the interface on the publishing end of the circuit.
- *
- * @return The publishing end of the circuit.
- */
- public Publisher getPublisher()
- {
- return publisher;
- }
-
- /**
- * Gets the local publishing circuit end, for direct manipulation.
- *
- * @return The local publishing circuit end.
- */
- public CircuitEnd getLocalPublisherCircuitEnd()
- {
- return publisher;
- }
-
- /**
- * Gets the interface on the receiving end of the circuit.
- *
- * @return The receiving end of the circuit.
- */
- public Receiver getReceiver()
- {
- return receiver;
- }
-
- /**
- * Gets the local receiving circuit end, for direct manipulation.
- *
- * @return The local receiving circuit end.
- */
- public CircuitEnd getLocalReceiverCircuitEnd()
- {
- return receiver;
- }
-
- /**
- * Checks the test circuit. The effect of this is to gather the circuits state, for both ends of the circuit,
- * into a report, against which assertions may be checked.
- */
- public void check()
- { }
-
- /**
- * Applied a list of assertions against the test circuit. The {@link #check()} method should be called before doing
- * this, to ensure that the circuit has gathered its state into a report to assert against.
- *
- * @param assertions The list of assertions to apply.
- * @return Any assertions that failed.
- */
- public List<Assertion> applyAssertions(List<Assertion> assertions)
- {
- List<Assertion> failures = new LinkedList<Assertion>();
-
- for (Assertion assertion : assertions)
- {
- if (!assertion.apply())
- {
- failures.add(assertion);
- }
- }
-
- return failures;
- }
-
- /**
- * Connects and starts the circuit. After this method is called the circuit is ready to send messages.
- */
- public void start()
- { }
-
- /**
- * Closes the circuit. All associated resources are closed.
- */
- public void close()
- {
- try
- {
- publisher.close();
- receiver.close();
- connection.close();
- }
- catch (JMSException e)
- {
- throw new RuntimeException("Got JMSException during close:" + e.getMessage(), e);
- }
- }
-
- /**
- * Sends a message on the test circuit. The exact nature of the message sent is controlled by the test parameters.
- */
- protected void send()
- {
- // Cast the test properties into a typed interface for convenience.
- MessagingTestConfigProperties props = new MessagingTestConfigProperties(testProps);
-
- boolean transactional = props.getPublisherTransacted();
- boolean rollback = props.getRollbackPublisher();
-
- // Send a message through the publisher and log any exceptions raised.
- try
- {
- CircuitEnd end = getLocalPublisherCircuitEnd();
-
- end.send(createTestMessage(end));
-
- if (rollback)
- {
- end.getSession().rollback();
- }
- else if (transactional)
- {
- end.getSession().commit();
- }
- }
- catch (JMSException e)
- {
- exceptionMonitor.onException(e);
- }
- }
-
- /**
- * Runs the default test procedure against the circuit, and checks that all of the specified assertions hold. The
- * outline of the default test procedure is:
- *
- * <p/><pre>
- * Start the circuit.
- * Send test messages.
- * Request a status report.
- * Assert conditions on the publishing end of the circuit.
- * Assert conditions on the receiving end of the circuit.
- * Close the circuit.
- * Pass with no failed assertions or fail with a list of failed assertions.
- * </pre>
- *
- * @param numMessages The number of messages to send using the default test procedure.
- * @param assertions The list of assertions to apply.
- * @return Any assertions that failed.
- */
- public List<Assertion> test(int numMessages, List<Assertion> assertions)
- {
- // Start the test circuit.
- start();
-
- // Send the requested number of test messages.
- for (int i = 0; i < numMessages; i++)
- {
- send();
- }
-
- // Inject a short pause to allow time for exceptions to come back asynchronously.
- TestUtils.pause(500L);
-
- // Request a status report.
- check();
-
- // Clean up the publisher/receivers/controlSession/connections.
- close();
-
- // Apply all of the requested assertions, keeping record of any that fail.
- List<Assertion> failures = applyAssertions(assertions);
-
- // Return any failed assertions to the caller.
- return failures;
- }
-
- /**
- * Creates a message with the properties defined as per the test parameters.
- *
- * @param client The circuit end to create the message on.
- *
- * @return The test message.
- *
- * @throws JMSException Any JMSException occurring during creation of the message is allowed to fall through.
- */
- private Message createTestMessage(CircuitEnd client) throws JMSException
- {
- // Cast the test properties into a typed interface for convenience.
- MessagingTestConfigProperties props = new MessagingTestConfigProperties(testProps);
-
- return TestUtils.createTestMessageOfSize(client.getSession(), props.getMessageSize());
- }
-
- /**
- * Gets the exception monitor for the publishing ends connection.
- *
- * @return The exception monitor for the publishing ends connection.
- */
- public ExceptionMonitor getConnectionExceptionMonitor()
- {
- return connectionExceptionMonitor;
- }
-
- /**
- * Gets the exception monitor for the publishing ends controlSession.
- *
- * @return The exception monitor for the publishing ends controlSession.
- */
- public ExceptionMonitor getExceptionMonitor()
- {
- return exceptionMonitor;
- }
-}
-
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/localcircuit/LocalPublisherImpl.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/localcircuit/LocalPublisherImpl.java
deleted file mode 100644
index 9920be003a..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/localcircuit/LocalPublisherImpl.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.test.framework.localcircuit;
-
-import org.apache.qpid.junit.extensions.util.ParsedProperties;
-import org.apache.qpid.test.framework.Assertion;
-import org.apache.qpid.test.framework.AssertionBase;
-import org.apache.qpid.test.framework.CircuitEnd;
-import org.apache.qpid.test.framework.CircuitEndBase;
-import org.apache.qpid.test.framework.ExceptionMonitor;
-import org.apache.qpid.test.framework.MessageMonitor;
-import org.apache.qpid.test.framework.NotApplicableAssertion;
-import org.apache.qpid.test.framework.Publisher;
-
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-
-/**
- * Provides an implementation of the {@link Publisher} interface and wraps a single message producer and consumer on
- * a single controlSession, as a {@link CircuitEnd}. A local publisher also acts as a circuit end, because for a locally
- * located circuit the assertions may be applied directly, there does not need to be any inter-process messaging
- * between the publisher and its single circuit end, in order to ascertain its status.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Provide a message producer for sending messages.
- * <tr><td> Provide a message consumer for receiving messages.
- * <tr><td> Provide assertion that the publisher received no exceptions.
- * <tr><td> Provide assertion that the publisher received a no consumers error code.
- * <tr><td> Provide assertion that the publisher received a no route error code.
- * </table>
- */
-public class LocalPublisherImpl extends CircuitEndBase implements Publisher
-{
- /** Holds a reference to the containing circuit. */
- protected LocalCircuitImpl circuit;
-
- /**
- * Creates a circuit end point on the specified producer, consumer and controlSession. Monitors are also configured
- * for messages and exceptions received by the circuit end.
- *
- * @param producer The message producer for the circuit end point.
- * @param consumer The message consumer for the circuit end point.
- * @param session The controlSession for the circuit end point.
- * @param messageMonitor The monitor to notify of all messages received by the circuit end.
- * @param exceptionMonitor The monitor to notify of all exceptions received by the circuit end.
- */
- public LocalPublisherImpl(MessageProducer producer, MessageConsumer consumer, Session session,
- MessageMonitor messageMonitor, ExceptionMonitor exceptionMonitor)
- {
- super(producer, consumer, session, messageMonitor, exceptionMonitor);
- }
-
- /**
- * Creates a circuit end point from the producer, consumer and controlSession in a circuit end base implementation.
- *
- * @param end The circuit end base implementation to take producers and consumers from.
- */
- public LocalPublisherImpl(CircuitEndBase end)
- {
- super(end.getProducer(), end.getConsumer(), end.getSession(), end.getMessageMonitor(), end.getExceptionMonitor());
- }
-
- /**
- * Provides an assertion that the publisher encountered no exceptions.
- *
- * @param testProps
- *
- * @return An assertion that the publisher encountered no exceptions.
- */
- public Assertion noExceptionsAssertion(ParsedProperties testProps)
- {
- return new AssertionBase()
- {
- public boolean apply()
- {
- boolean passed = true;
- ExceptionMonitor sessionExceptionMonitor = circuit.getExceptionMonitor();
- ExceptionMonitor connectionExceptionMonitor = circuit.getConnectionExceptionMonitor();
-
- if (!connectionExceptionMonitor.assertNoExceptions())
- {
- passed = false;
-
- addError("Was expecting no exceptions.\n");
- addError("Got the following exceptions on the connection, "
- + circuit.getConnectionExceptionMonitor());
- }
-
- if (!sessionExceptionMonitor.assertNoExceptions())
- {
- passed = false;
-
- addError("Was expecting no exceptions.\n");
- addError("Got the following exceptions on the producer, " + circuit.getExceptionMonitor());
- }
-
- return passed;
- }
- };
- }
-
- /**
- * Provides an assertion that the AMQP channel was forcibly closed by an error condition.
- *
- * @param testProps The test configuration properties.
- *
- * @return An assertion that the AMQP channel was forcibly closed by an error condition.
- */
- public Assertion channelClosedAssertion(ParsedProperties testProps)
- {
- return new NotApplicableAssertion(testProps);
- }
-
- /**
- * Provides an assertion that the publisher got a given exception during the test.
- *
- * @param testProps The test configuration properties.
- * @param exceptionClass The exception class to check for.
- *
- * @return An assertion that the publisher got a given exception during the test.
- */
- public Assertion exceptionAssertion(ParsedProperties testProps, final Class<? extends Exception> exceptionClass)
- {
- return new AssertionBase()
- {
- public boolean apply()
- {
- boolean passed = true;
- ExceptionMonitor connectionExceptionMonitor = circuit.getConnectionExceptionMonitor();
-
- if (!connectionExceptionMonitor.assertExceptionOfType(exceptionClass))
- {
- passed = false;
-
- addError("Was expecting linked exception type " + exceptionClass.getName()
- + " on the connection.\n");
- addError((connectionExceptionMonitor.size() > 0)
- ? ("Actually got the following exceptions on the connection, " + connectionExceptionMonitor)
- : "Got no exceptions on the connection.");
- }
-
- return passed;
- }
- };
- }
-
- /**
- * Sets the contianing circuit.
- *
- * @param circuit The containing circuit.
- */
- public void setCircuit(LocalCircuitImpl circuit)
- {
- this.circuit = circuit;
- }
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/localcircuit/LocalReceiverImpl.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/localcircuit/LocalReceiverImpl.java
deleted file mode 100644
index bb242faf90..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/localcircuit/LocalReceiverImpl.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.test.framework.localcircuit;
-
-import org.apache.qpid.junit.extensions.util.ParsedProperties;
-import org.apache.qpid.test.framework.Assertion;
-import org.apache.qpid.test.framework.CircuitEnd;
-import org.apache.qpid.test.framework.CircuitEndBase;
-import org.apache.qpid.test.framework.ExceptionMonitor;
-import org.apache.qpid.test.framework.MessageMonitor;
-import org.apache.qpid.test.framework.NotApplicableAssertion;
-import org.apache.qpid.test.framework.Receiver;
-
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-
-/**
- * Provides an implementation of the {@link Receiver} interface that wraps a single message producer and consumer on
- * a single controlSession, as a {@link CircuitEnd}. A local receiver also acts as a circuit end, because for a locally
- * located circuit the assertions may be applied directly, there does not need to be any inter process messaging
- * between the publisher and its single circuit end, in order to ascertain its status.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Provide a message producer for sending messages.
- * <tr><td> Provide a message consumer for receiving messages.
- * <tr><td> Provide assertion that the receivers received no exceptions.
- * <tr><td> Provide assertion that the receivers received all test messages sent to it.
- * </table>
- */
-public class LocalReceiverImpl extends CircuitEndBase implements Receiver
-{
- /** Holds a reference to the containing circuit. */
- private LocalCircuitImpl circuit;
-
- /**
- * Creates a circuit end point on the specified producer, consumer and controlSession. Monitors are also configured
- * for messages and exceptions received by the circuit end.
- *
- * @param producer The message producer for the circuit end point.
- * @param consumer The message consumer for the circuit end point.
- * @param session The controlSession for the circuit end point.
- * @param messageMonitor The monitor to notify of all messages received by the circuit end.
- * @param exceptionMonitor The monitor to notify of all exceptions received by the circuit end.
- */
- public LocalReceiverImpl(MessageProducer producer, MessageConsumer consumer, Session session,
- MessageMonitor messageMonitor, ExceptionMonitor exceptionMonitor)
- {
- super(producer, consumer, session, messageMonitor, exceptionMonitor);
- }
-
- /**
- * Creates a circuit end point from the producer, consumer and controlSession in a circuit end base implementation.
- *
- * @param end The circuit end base implementation to take producers and consumers from.
- */
- public LocalReceiverImpl(CircuitEndBase end)
- {
- super(end.getProducer(), end.getConsumer(), end.getSession(), end.getMessageMonitor(), end.getExceptionMonitor());
- }
-
- /**
- * Provides an assertion that the receivers encountered no exceptions.
- *
- * @param testProps The test configuration properties.
- *
- * @return An assertion that the receivers encountered no exceptions.
- */
- public Assertion noExceptionsAssertion(ParsedProperties testProps)
- {
- return new NotApplicableAssertion(testProps);
- }
-
- /**
- * Provides an assertion that the AMQP channel was forcibly closed by an error condition.
- *
- * @param testProps The test configuration properties.
- *
- * @return An assertion that the AMQP channel was forcibly closed by an error condition.
- */
- public Assertion channelClosedAssertion(ParsedProperties testProps)
- {
- return new NotApplicableAssertion(testProps);
- }
-
- /**
- * Provides an assertion that the receivers got all messages that were sent to it.
- *
- * @param testProps The test configuration properties.
- *
- * @return An assertion that the receivers got all messages that were sent to it.
- */
- public Assertion allMessagesReceivedAssertion(ParsedProperties testProps)
- {
- return new NotApplicableAssertion(testProps);
- }
-
- /**
- * Provides an assertion that the receivers got none of the messages that were sent to it.
- *
- * @param testProps The test configuration properties.
- *
- * @return An assertion that the receivers got none of the messages that were sent to it.
- */
- public Assertion noMessagesReceivedAssertion(ParsedProperties testProps)
- {
- return new NotApplicableAssertion(testProps);
- }
-
- /**
- * Provides an assertion that the receiver got a given exception during the test.
- *
- * @param testProps The test configuration properties.
- * @param exceptionClass The exception class to check for. @return An assertion that the receiver got a given exception during the test.
- */
- public Assertion exceptionAssertion(ParsedProperties testProps, Class<? extends Exception> exceptionClass)
- {
- return new NotApplicableAssertion(testProps);
- }
-
- /**
- * Sets the contianing circuit.
- *
- * @param circuit The containing circuit.
- */
- public void setCircuit(LocalCircuitImpl circuit)
- {
- this.circuit = circuit;
- }
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/package.html b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/package.html
deleted file mode 100644
index ac4e30d312..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/package.html
+++ /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.
-
--->
-
-<html>
-<body>
-<p/>A framework for testing Qpid, built around a standard 'test circuit' design. The idea behind this framework is the
-use of a test circuit which is configured by a set of test parameters, that may be projected onto a topology of
-test nodes, with tests scripted to run over test circuits, making as few assumptions as possible about the underlying
-topology. The standardization of the design, whilst limiting in some respectes, allows a large variety of test
-scenarios to be written with minimal amounts of coding.
-
-<p/>The standard consruction block for a test, is a test circuit. This consists of a publisher, and a receiver. The
-publisher and receiver may reside on the same machine, or may be distributed. Will use a standard set of properties to
-define the desired circuit topology.
-
-<p/>Tests are always to be controlled from the publishing side only. The receiving end of the circuit is to be exposed
-to the test code through an interface, that abstracts as much as possible the receiving end of the test. The interface
-exposes a set of 'assertions' that may be applied to the receiving end of the test circuit.
-
-<p/>In the case where the receiving end of the circuit resides on the same JVM, the assertions will call the receivers
-code locally. Where the receiving end is distributed accross one or more machines, the assertions will be applied to a
-test report gethered from all of the receivers. Test code will be written to the assertions making as few assumptions
-as possible about the exact test topology.
-</body>
-</html>
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/BaseCircuitFactory.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/BaseCircuitFactory.java
deleted file mode 100644
index bd27fc3d90..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/BaseCircuitFactory.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.test.framework.sequencers;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.test.framework.Circuit;
-import org.apache.qpid.test.framework.TestClientDetails;
-import org.apache.qpid.test.utils.ConversationFactory;
-
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Properties;
-
-/**
- * BaseCircuitFactory provides some functionality common to all {@link CircuitFactory}s, such as the details of
- * all {@link org.apache.qpid.test.framework.distributedtesting.TestClient}s that make up the end-points of
- * the circuits that the factory creates, and an active {@link ConversationFactory} that can be used to generate
- * control conversations with those circuit end-points.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Hold the details of the sending and receiving end-points to create circuits from.
- * <tr><td> Provide a conversation factory to create control conversations with the end-points.
- * </table>
- */
-public abstract class BaseCircuitFactory implements CircuitFactory
-{
-
- /** Used for debugging. */
- private final Logger log = Logger.getLogger(BaseCircuitFactory.class);
-
- /** Holds the contact details for the sending test client. */
- protected TestClientDetails sender;
-
- /** Holds the contact details for the receving test client. */
- protected List<TestClientDetails> receivers = new LinkedList<TestClientDetails>();
-
- /** Holds the conversation factory over which to coordinate the test. */
- protected ConversationFactory conversationFactory;
-
- /**
- * Creates a test circuit for the test, configered by the test parameters specified.
- *
- * @param testProperties The test parameters.
- * @return A test circuit.
- */
- public Circuit createCircuit(Properties testProperties)
- {
- throw new RuntimeException("Not implemented.");
- }
-
- /**
- * Sets the sender test client to coordinate the test with.
- *
- * @param sender The contact details of the sending client in the test.
- */
- public void setSender(TestClientDetails sender)
- {
- log.debug("public void setSender(TestClientDetails sender = " + sender + "): called");
-
- this.sender = sender;
- }
-
- /**
- * Sets the receiving test client to coordinate the test with.
- *
- * @param receiver The contact details of the sending client in the test.
- */
- public void setReceiver(TestClientDetails receiver)
- {
- log.debug("public void setReceiver(TestClientDetails receivers = " + receiver + "): called");
-
- this.receivers.add(receiver);
- }
-
- /**
- * Supplies the sending test client.
- *
- * @return The sending test client.
- */
- public TestClientDetails getSender()
- {
- return sender;
- }
-
- /**
- * Supplies the receiving test client.
- *
- * @return The receiving test client.
- */
- public List<TestClientDetails> getReceivers()
- {
- return receivers;
- }
-
- /**
- * Accepts the conversation factory over which to hold the test coordinating conversation.
- *
- * @param conversationFactory The conversation factory to coordinate the test over.
- */
- public void setConversationFactory(ConversationFactory conversationFactory)
- {
- this.conversationFactory = conversationFactory;
- }
-
- /**
- * Provides the conversation factory for providing the distributed test sequencing conversations over the test
- * connection.
- *
- * @return The conversation factory to create test sequencing conversations with.
- */
- public ConversationFactory getConversationFactory()
- {
- return conversationFactory;
- }
-}
-
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/CircuitFactory.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/CircuitFactory.java
deleted file mode 100644
index 9b5d40fd48..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/CircuitFactory.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.test.framework.sequencers;
-
-import org.apache.qpid.junit.extensions.util.ParsedProperties;
-import org.apache.qpid.test.framework.Assertion;
-import org.apache.qpid.test.framework.Circuit;
-import org.apache.qpid.test.framework.TestClientDetails;
-import org.apache.qpid.test.utils.ConversationFactory;
-
-import javax.jms.Connection;
-import java.util.List;
-import java.util.Properties;
-
-/**
- * A CircuitFactory is responsibile for creating test circuits appropriate to the context that a test case is
- * running in, and providing an implementation of a standard test procedure over a test circuit.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities
- * <tr><td> Provide a standard test procedure over a test circuit.
- * <tr><td> Construct test circuits appropriate to a tests context.
- * </table>
- */
-public interface CircuitFactory
-{
- /**
- * Holds a test coordinating conversation with the test clients. This should consist of assigning the test roles,
- * begining the test, gathering the test reports from the participants, and checking for assertion failures against
- * the test reports.
- *
- * @param testCircuit The test circuit.
- * @param assertions The list of assertions to apply to the test circuit.
- * @param testProperties The test case definition.
- *
- * @deprecated Use test circuits and Circuit.test instead.
- */
- public void sequenceTest(Circuit testCircuit, List<Assertion> assertions, Properties testProperties);
-
- /**
- * Creates a test circuit for the test, configered by the test parameters specified.
- *
- * @param testProperties The test parameters.
- *
- * @return A test circuit.
- */
- public Circuit createCircuit(Connection connection, ParsedProperties testProperties);
-
- /**
- * Sets the sender test client to coordinate the test with.
- *
- * @param sender The contact details of the sending client in the test.
- */
- public void setSender(TestClientDetails sender);
-
- /**
- * Sets the receiving test client to coordinate the test with.
- *
- * @param receiver The contact details of the sending client in the test.
- */
- public void setReceiver(TestClientDetails receiver);
-
- /**
- * Supplies the sending test client.
- *
- * @return The sending test client.
- */
- public TestClientDetails getSender();
-
- /**
- * Supplies the receiving test client.
- *
- * @return The receiving test client.
- */
- public List<TestClientDetails> getReceivers();
-
- /**
- * Accepts the conversation factory over which to hold the test coordinating conversation.
- *
- * @param conversationFactory The conversation factory to coordinate the test over.
- */
- public void setConversationFactory(ConversationFactory conversationFactory);
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/FanOutCircuitFactory.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/FanOutCircuitFactory.java
deleted file mode 100644
index 833f5fb674..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/FanOutCircuitFactory.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.test.framework.sequencers;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.junit.extensions.util.ParsedProperties;
-import org.apache.qpid.test.framework.Assertion;
-import org.apache.qpid.test.framework.Circuit;
-import org.apache.qpid.test.framework.TestClientDetails;
-import org.apache.qpid.test.framework.TestUtils;
-import org.apache.qpid.test.framework.distributedcircuit.DistributedCircuitImpl;
-import org.apache.qpid.test.utils.ConversationFactory;
-
-import javax.jms.Connection;
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.Session;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Properties;
-
-/**
- * FanOutCircuitFactory is a circuit factory that creates distributed test circuits. Given a set of participating
- * test client nodes, it assigns one node to the SENDER role and the remainder to the RECEIVER role.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Create distributed circuits from one to many test nodes, for fanout style testing.
- * </table>
- *
- * @todo Adapt this to be an n*m topology circuit factory. Need to add circuit topology definitions to the test
- * parameters. Place n senders onto the available test clients, and m receivers. Where n or m is larger than
- * the available nodes, start stacking multiple test clients on each node. There will also be an option that
- * indicates whether nodes can play both roles, and how many nodes out of all available may be assigned to
- * each role.
- *
- * @todo The createCircuit methods on this and InteropCircuitFactory are going to be identical. This is because the
- * partitioning into senders and receivers is already done by the test decorators. Either eliminate these factories
- * as unnesesary, or move the partitioning functionality into the factories, in which case the test decorators
- * can probably be merged or eliminated. There is confusion over the placement of responsibilities between the
- * factories and the test decorators... although the test decorators may well do more than just circuit creation
- * in the future. For example, there may have to be a special decorator for test repetition that does one circuit
- * creation, but the runs many tests over it, in which case the handling of responsibilities becomes clearer.
- */
-public class FanOutCircuitFactory extends BaseCircuitFactory
-{
- /** Used for debugging. */
- private Logger log = Logger.getLogger(FanOutCircuitFactory.class);
-
- /**
- * Creates a test circuit for the test, configered by the test parameters specified.
- *
- * @param testProperties The test parameters.
- * @return A test circuit.
- */
- public Circuit createCircuit(Connection connection, ParsedProperties testProperties)
- {
- log.debug("public Circuit createCircuit(ParsedProperties testProperties): called");
-
- List<TestClientDetails> senders = new LinkedList<TestClientDetails>();
- senders.add(getSender());
- List<TestClientDetails> receivers = getReceivers();
- ConversationFactory conversationFactory = getConversationFactory();
-
- return DistributedCircuitImpl.createCircuit(testProperties, senders, receivers, conversationFactory);
- }
-
- /**
- * Holds a test coordinating conversation with the test clients. This should consist of assigning the test roles,
- * begining the test, gathering the test reports from the participants, and checking for assertion failures against
- * the test reports.
- *
- * @param testCircuit The test circuit.
- * @param assertions The list of assertions to apply to the test circuit.
- * @param testProperties The test case definition.
- *
- * @deprecated Scheduled for removal once existing tests converted over to use test circuits.
- */
- public void sequenceTest(Circuit testCircuit, List<Assertion> assertions, Properties testProperties)
- {
- log.debug("protected Message[] sequenceTest(Object... testProperties = " + testProperties + "): called");
-
- TestClientDetails sender = getSender();
- List<TestClientDetails> receivers = getReceivers();
- ConversationFactory conversationFactory = getConversationFactory();
-
- try
- {
- // Create a conversation on the sender clients private control route.
- Session session = conversationFactory.getSession();
- Destination senderControlTopic = session.createTopic(sender.privateControlKey);
- ConversationFactory.Conversation senderConversation = conversationFactory.startConversation();
-
- // Assign the sender role to the sending test client.
- Message assignSender = conversationFactory.getSession().createMessage();
- TestUtils.setPropertiesOnMessage(assignSender, testProperties);
- assignSender.setStringProperty("CONTROL_TYPE", "ASSIGN_ROLE");
- assignSender.setStringProperty("ROLE", "SENDER");
- assignSender.setStringProperty("CLIENT_NAME", "Sustained_SENDER");
-
- senderConversation.send(senderControlTopic, assignSender);
-
- // Wait for the sender to confirm its role.
- senderConversation.receive();
-
- // Assign the receivers roles.
- for (TestClientDetails receiver : receivers)
- {
- assignReceiverRole(receiver, testProperties, true);
- }
-
- // Start the test on the sender.
- Message start = session.createMessage();
- start.setStringProperty("CONTROL_TYPE", "START");
-
- senderConversation.send(senderControlTopic, start);
-
- // Wait for the test sender to return its report.
- Message senderReport = senderConversation.receive();
- TestUtils.pause(500);
-
- // Ask the receivers for their reports.
- Message statusRequest = session.createMessage();
- statusRequest.setStringProperty("CONTROL_TYPE", "STATUS_REQUEST");
-
- // Gather the reports from all of the receiving clients.
-
- // Return all of the test reports, the senders report first.
- // return new Message[] { senderReport };
- }
- catch (JMSException e)
- {
- throw new RuntimeException("Unhandled JMSException.");
- }
- }
-
- /**
- * Assigns the receivers role to the specified test client that is to act as a receivers during the test. This method
- * does not always wait for the receiving clients to confirm their role assignments. This is because this method
- * may be called from an 'onMessage' method, when a client is joining the test at a later point in time, and it
- * is not possible to do a synchronous receive during an 'onMessage' method. There is a flag to indicate whether
- * or not to wait for role confirmations.
- *
- * @param receiver The test client to assign the receivers role to.
- * @param testProperties The test parameters.
- * @param confirm Indicates whether role confirmation should be waited for.
- *
- * @throws JMSException Any JMSExceptions occurring during the conversation are allowed to fall through.
- *
- * @deprecated Scheduled for removal once existing tests converted over to use test circuits.
- */
- protected void assignReceiverRole(TestClientDetails receiver, Properties testProperties, boolean confirm)
- throws JMSException
- {
- log.info("assignReceiverRole(TestClientDetails receivers = " + receiver + ", Map<String, Object> testProperties = "
- + testProperties + "): called");
-
- ConversationFactory conversationFactory = getConversationFactory();
-
- // Create a conversation with the receiving test client.
- Session session = conversationFactory.getSession();
- Destination receiverControlTopic = session.createTopic(receiver.privateControlKey);
- ConversationFactory.Conversation receiverConversation = conversationFactory.startConversation();
-
- // Assign the receivers role to the receiving client.
- Message assignReceiver = session.createMessage();
- TestUtils.setPropertiesOnMessage(assignReceiver, testProperties);
- assignReceiver.setStringProperty("CONTROL_TYPE", "ASSIGN_ROLE");
- assignReceiver.setStringProperty("ROLE", "RECEIVER");
- assignReceiver.setStringProperty("CLIENT_NAME", receiver.clientName);
-
- receiverConversation.send(receiverControlTopic, assignReceiver);
-
- // Wait for the role confirmation to come back.
- if (confirm)
- {
- receiverConversation.receive();
- }
- }
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/InteropCircuitFactory.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/InteropCircuitFactory.java
deleted file mode 100644
index a4c6888d68..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/sequencers/InteropCircuitFactory.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.test.framework.sequencers;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.junit.extensions.util.ParsedProperties;
-import org.apache.qpid.test.framework.Assertion;
-import org.apache.qpid.test.framework.Circuit;
-import org.apache.qpid.test.framework.TestClientDetails;
-import org.apache.qpid.test.framework.TestUtils;
-import org.apache.qpid.test.framework.distributedcircuit.DistributedCircuitImpl;
-import org.apache.qpid.test.utils.ConversationFactory;
-
-import javax.jms.Connection;
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.Session;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Properties;
-
-/**
- * InteropCircuitFactory is a circuit factory that creates distributed test circuits. Given a set of participating
- * test client nodes, it assigns one node to the SENDER role and one the RECEIVER role.
- *
- * <p/><table id="crc"><caption>CRC Card</caption>
- * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Create distributed circuits from pairs of test nodes, for interop style testing.
- * </table>
- *
- * @todo The partitioning of a set of nodes into sender and receiver roles is actually done by the interop test
- * decorator. See the todo comment in FanOutCircuitFactory about merging the factories with the decorators, or
- * more carefully dividing up responsibilities between them.
- *
- * @todo The squenceTest code is deprecated, but currently still used by the interop tests. It will be removed once it
- * have been fully replaced by the default test procedure.
- */
-public class InteropCircuitFactory extends BaseCircuitFactory
-{
- /** Used for debugging. */
- private Logger log = Logger.getLogger(InteropCircuitFactory.class);
-
- /**
- * Creates a test circuit for the test, configered by the test parameters specified.
- *
- * @param testProperties The test parameters.
- * @return A test circuit.
- */
- public Circuit createCircuit(Connection connection, ParsedProperties testProperties)
- {
- log.debug("public Circuit createCircuit(ParsedProperties testProperties): called");
-
- List<TestClientDetails> senders = new LinkedList<TestClientDetails>();
- senders.add(getSender());
- List<TestClientDetails> receivers = getReceivers();
- ConversationFactory conversationFactory = getConversationFactory();
-
- return DistributedCircuitImpl.createCircuit(testProperties, senders, receivers, conversationFactory);
- }
-
- /**
- * Holds a test coordinating conversation with the test clients. This should consist of assigning the test roles,
- * begining the test, gathering the test reports from the participants, and checking for assertion failures against
- * the test reports.
- *
- * @param testCircuit The test circuit.
- * @param assertions The list of assertions to apply to the test circuit.
- * @param testProperties The test case definition.
- */
- public void sequenceTest(Circuit testCircuit, List<Assertion> assertions, Properties testProperties)
- {
- log.debug("protected Message[] sequenceTest(Object... testProperties = " + testProperties + "): called");
-
- TestClientDetails sender = getSender();
- List<TestClientDetails> receivers = getReceivers();
- ConversationFactory conversationFactory = getConversationFactory();
-
- try
- {
- Session session = conversationFactory.getSession();
- Destination senderControlTopic = session.createTopic(sender.privateControlKey);
- Destination receiverControlTopic = session.createTopic(receivers.get(0).privateControlKey);
-
- ConversationFactory.Conversation senderConversation = conversationFactory.startConversation();
- ConversationFactory.Conversation receiverConversation = conversationFactory.startConversation();
-
- Message assignSender = conversationFactory.getSession().createMessage();
- TestUtils.setPropertiesOnMessage(assignSender, testProperties);
- assignSender.setStringProperty("CONTROL_TYPE", "ASSIGN_ROLE");
- assignSender.setStringProperty("ROLE", "SENDER");
-
- senderConversation.send(senderControlTopic, assignSender);
-
- // Assign the receivers role the receiving client.
- Message assignReceiver = session.createMessage();
- TestUtils.setPropertiesOnMessage(assignReceiver, testProperties);
- assignReceiver.setStringProperty("CONTROL_TYPE", "ASSIGN_ROLE");
- assignReceiver.setStringProperty("ROLE", "RECEIVER");
-
- receiverConversation.send(receiverControlTopic, assignReceiver);
-
- // Wait for the senders and receivers to confirm their roles.
- senderConversation.receive();
- receiverConversation.receive();
-
- // Start the test.
- Message start = session.createMessage();
- start.setStringProperty("CONTROL_TYPE", "START");
-
- senderConversation.send(senderControlTopic, start);
-
- // Wait for the test sender to return its report.
- Message senderReport = senderConversation.receive();
- TestUtils.pause(500);
-
- // Ask the receivers for its report.
- Message statusRequest = session.createMessage();
- statusRequest.setStringProperty("CONTROL_TYPE", "STATUS_REQUEST");
-
- receiverConversation.send(receiverControlTopic, statusRequest);
-
- // Wait for the receivers to send its report.
- Message receiverReport = receiverConversation.receive();
-
- // return new Message[] { senderReport, receiverReport };
-
- // Apply assertions.
- }
- catch (JMSException e)
- {
- throw new RuntimeException("JMSException not handled.");
- }
- }
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/close/CloseBeforeAckTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/close/CloseBeforeAckTest.java
deleted file mode 100644
index 4da9a1db29..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/close/CloseBeforeAckTest.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.test.unit.close;
-
-import junit.framework.Assert;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.qpid.junit.concurrency.TestRunnable;
-import org.apache.qpid.junit.concurrency.ThreadTestCoordinator;
-import org.apache.qpid.test.utils.QpidBrokerTestCase;
-
-import javax.jms.Connection;
-import javax.jms.Message;
-import javax.jms.MessageListener;
-import javax.jms.Session;
-
-/**
- * This test forces the situation where a session is closed whilst a message consumer is still in its onMessage method.
- * Running in AUTO_ACK mode, the close call ought to wait until the onMessage method completes, and the ack is sent
- * before closing the connection.
- *
- * <p><table id="crc"><caption>CRC Card</caption> <tr><th> Responsibilities <th> Collaborations <tr><td> Check that
- * closing a connection whilst handling a message, blocks till completion of the handler. </table>
- */
-public class CloseBeforeAckTest extends QpidBrokerTestCase
-{
- private static final Logger log = LoggerFactory.getLogger(CloseBeforeAckTest.class);
-
- private Connection connection;
- private Session session;
- public static final String TEST_QUEUE_NAME = "TestQueue";
- private int TEST_COUNT = 25;
-
- class TestThread1 extends TestRunnable implements MessageListener
- {
- public void runWithExceptions() throws Exception
- {
- // Set this up to listen for message on the test session.
- session.createConsumer(session.createQueue(TEST_QUEUE_NAME)).setMessageListener(this);
- }
-
- public void onMessage(Message message)
- {
- // Give thread 2 permission to close the session.
- allow(new int[] { 1 });
-
- // Wait until thread 2 has closed the connection, or is blocked waiting for this to complete.
- waitFor(new int[] { 1 }, true);
- }
- }
-
- private TestThread1 testThread1 = new TestThread1();
-
- private TestRunnable testThread2 =
- new TestRunnable()
- {
- public void runWithExceptions() throws Exception
- {
- // Send a message to be picked up by thread 1.
- session.createProducer(null).send(session.createQueue(TEST_QUEUE_NAME),
- session.createTextMessage("Hi there thread 1!"));
-
- // Wait for thread 1 to pick up the message and give permission to continue.
- waitFor(new int[] { 0 }, false);
-
- // Close the connection.
- session.close();
-
- // Allow thread 1 to continue to completion, if it is erronously still waiting.
- allow(new int[] { 1 });
- }
- };
-
- public void testCloseBeforeAutoAck_QPID_397() throws Exception
- {
- // Create a session in auto acknowledge mode. This problem shows up in auto acknowledge if the client acks
- // message at the end of the onMessage method, after a close has been sent.
- session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- ThreadTestCoordinator tt = new ThreadTestCoordinator(2);
-
- tt.addTestThread(testThread1, 0);
- tt.addTestThread(testThread2, 1);
- tt.setDeadlockTimeout(500);
- tt.run();
-
- String errorMessage = tt.joinAndRetrieveMessages();
-
- // Print any error messages or exceptions.
- log.debug(errorMessage);
-
- if (!tt.getExceptions().isEmpty())
- {
- for (Exception e : tt.getExceptions())
- {
- log.debug("Exception thrown during test thread: ", e);
- }
- }
-
- Assert.assertTrue(errorMessage, "".equals(errorMessage));
- }
-
- public void closeBeforeAutoAckManyTimes() throws Exception
- {
- for (int i = 0; i < TEST_COUNT; i++)
- {
- testCloseBeforeAutoAck_QPID_397();
- }
- }
-
- protected void setUp() throws Exception
- {
- super.setUp();
- connection = getConnection("guest", "guest");
- }
-
- protected void tearDown() throws Exception
- {
- super.tearDown();
- }
-}