summaryrefslogtreecommitdiff
path: root/qpid/java
diff options
context:
space:
mode:
authorMartin Ritchie <ritchiem@apache.org>2007-01-26 08:52:20 +0000
committerMartin Ritchie <ritchiem@apache.org>2007-01-26 08:52:20 +0000
commitc65e1d0d6266da7b9f78a22b559788dfcd8e8176 (patch)
treee0e9ee67764523c4ecaf3e91c5235f7f0ae56ef9 /qpid/java
parentf70f6e828ee07dcd537441051425f3d44405bb5f (diff)
downloadqpid-python-c65e1d0d6266da7b9f78a22b559788dfcd8e8176.tar.gz
Hand patched revisions:
Revision: 499781 Author: ritchiem Date: 13:08:05, 25 January 2007 Message: Fixed race condition that would cause duplicate batch data to be logged. ---- Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/ping/PingAsyncTestPerf.java Revision: 499764 Author: rgreig Date: 12:46:22, 25 January 2007 Message: (Submitted by Rupert Smith) Class has been documented. ---- Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/AbstractPingClient.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/AbstractPingProducer.java Revision: 499757 Author: rgreig Date: 12:13:44, 25 January 2007 Message: (Submitted by Rupert Smith) Class has been documented. ---- Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/AbstractPingClient.java Revision: 499756 Author: rgreig Date: 12:08:17, 25 January 2007 Message: (Submitted by Rupert Smith) Class has been documented. ---- Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/AbstractPingClient.java Revision: 499733 Author: ritchiem Date: 10:59:36, 25 January 2007 Message: Refactored to use CountDownLatch as using local count was wrong in multi threaded case. ---- Modified : /incubator/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/ping/PingAsyncTestPerf.java Revision: 499716 Author: ritchiem Date: 10:04:52, 25 January 2007 Message: Race condition fixed fro AsyncTestPerf ---- Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/ping/PingAsyncTestPerf.java Revision: 499468 Author: ritchiem Date: 16:30:50, 24 January 2007 Message: Changed default MessageSize to 1024 ---- Modified : /incubator/qpid/trunk/qpid/java/perftests/pom.xml Modified : /incubator/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/ping/PingTestPerf.java Revision: 499461 Author: bhupendrab Date: 16:14:36, 24 January 2007 Message: added some constant values ---- Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingItself.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java Revision: 499456 Author: ritchiem Date: 16:08:12, 24 January 2007 Message: Changed default BatchSize to 1000. ---- Modified : /incubator/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/ping/PingTestPerf.java Revision: 499429 Author: ritchiem Date: 15:08:13, 24 January 2007 Message: Added commit calls for the received messages. ---- Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/ping/PingAsyncTestPerf.java Revision: 499427 Author: rgreig Date: 15:04:06, 24 January 2007 Message: (Patch submitted by Rupert Smith) Cleans up the countdown latch used to count expected number of messages. Not clearing it from the map of countdowns by message correlation id causes a memory leak as the map is long lived over many tests. ---- Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java Revision: 499426 Author: bhupendrab Date: 15:02:07, 24 January 2007 Message: ---- Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingItself.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongBouncer.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/topic/Config.java Revision: 499394 Author: ritchiem Date: 13:20:05, 24 January 2007 Message: Updated test scripts ---- Modified : /incubator/qpid/trunk/qpid/java/perftests/pom.xml Revision: 499392 Author: ritchiem Date: 13:16:08, 24 January 2007 Message: Updated Async Test for destinations and for signalling completed runs when there is only 1 queue. ---- Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/AbstractPingProducer.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingItself.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongBouncer.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/ping/PingAsyncTestPerf.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/ping/PingTestPerf.java Revision: 499371 Author: bhupendrab Date: 11:48:05, 24 January 2007 Message: ---- Modified : /incubator/qpid/trunk/qpid/java/perftests/pom.xml Revision: 499356 Author: bhupendrab Date: 11:05:35, 24 January 2007 Message: updated the test classes to be used with Topics as well as Queues ---- Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/client/message/TestMessageFactory.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/AbstractPingClient.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/AbstractPingProducer.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingItself.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongBouncer.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/topic/Config.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/ping/PingTestPerf.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/requestreply/PingPongTestPerf.java Revision: 499170 Author: ritchiem Date: 22:41:41, 23 January 2007 Message: Removed references to code not yet available via mvn ---- Modified : /incubator/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/ping/PingAsyncTestPerf.java Revision: 499166 Author: ritchiem Date: 22:34:25, 23 January 2007 Message: Updated perftests to include an Asynchronous ping sender ---- Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/AbstractPingProducer.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingItself.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/perftests.log4j Added : /incubator/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/ping/PingAsyncTestPerf.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/ping/PingTestPerf.java Revision: 499083 Author: rgreig Date: 17:08:03, 23 January 2007 Message: (Patch submitted by Rupert Smith) Added the ability to limit the rate at which messages are sent by the ping tests. ---- Modified : /incubator/qpid/trunk/qpid/java/perftests/pom.xml Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/AbstractPingProducer.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingItself.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingProducer.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/Throttle.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongBouncer.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/topic/Config.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/ping/PingTestPerf.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/requestreply/PingPongTestPerf.java Modified : /incubator/qpid/trunk/qpid/java/pom.xml Revision: 499036 Author: bhupendrab Date: 14:41:33, 23 January 2007 Message: updated the test for testing with multiple threads ---- Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingItself.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/ping/PingTestPerf.java Revision: 498984 Author: ritchiem Date: 10:55:00, 23 January 2007 Message: FailOver added flag FAIL_ONCE so that only the first call is stopped for failover.. the default. Updated POM with Failover Tests ---- Modified : /incubator/qpid/trunk/qpid/java/perftests/pom.xml Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/AbstractPingProducer.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingItself.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingProducer.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/ping/PingTestPerf.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/requestreply/PingPongTestPerf.java Revision: 498974 Author: bhupendrab Date: 10:15:24, 23 January 2007 Message: Test modified to take arguments with - options ---- Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingItself.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/topic/Config.java Revision: 498970 Author: ritchiem Date: 09:56:29, 23 January 2007 Message: Added addtional loggers for testing ---- Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/perftests.log4j Revision: 498965 Author: ritchiem Date: 09:39:56, 23 January 2007 Message: Added ability to cause failover before/after commit/sends Added batch size ability. ---- Modified : /incubator/qpid/trunk/qpid/java/perftests/distribution/pom.xml Modified : /incubator/qpid/trunk/qpid/java/perftests/distribution/src/main/assembly/performance.xml Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/AbstractPingClient.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/AbstractPingProducer.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingClient.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingItself.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingProducer.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/ping/PingTestPerf.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/requestreply/PingPongTestPerf.java Revision: 498720 Author: rgreig Date: 17:30:29, 22 January 2007 Message: (Patch submitted by Rupert Smith) Added configurations for all performance test setups to the pom. Commented out to not break build. Waiting on junit-toolkit-maven-plugin being added to maven repository. Create a throttle utility class and tests for it. ---- Modified : /incubator/qpid/trunk/qpid/java/perftests/pom.xml Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/AbstractPingProducer.java Added : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/Throttle.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/ping/PingTestPerf.java Added : /incubator/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/ping/ThrottleTestPerf.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/requestreply/PingPongTestPerf.java Revision: 498687 Author: bhupendrab Date: 16:41:23, 22 January 2007 Message: performance Ping tests modified for scalability test. Now tests with multiple queues can be performed. ---- Modified : /incubator/qpid/trunk/qpid/java/perftests/bin/serviceRequestingClient-createLogFile.sh Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/AbstractPingProducer.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingItself.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/ping/PingTestPerf.java Revision: 498593 Author: ritchiem Date: 11:55:17, 22 January 2007 Message: Stopped tests forking so we can get a stack trace from hung processes ---- Modified : /incubator/qpid/trunk/qpid/java/pom.xml Revision: 498589 Author: rgreig Date: 11:48:29, 22 January 2007 Message: (Patch submitted by Rupert Smith) Fix broken distribution by rolling back assembly plugin to version 2.1. 2.2-SNAPSHOT is used in the perftests pom only. ---- Modified : /incubator/qpid/trunk/qpid/java/perftests/pom.xml Modified : /incubator/qpid/trunk/qpid/java/pom.xml Revision: 497878 Author: bhupendrab Date: 17:02:11, 19 January 2007 Message: Added class to ping itself and a junit test for it. ---- Added : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingItself.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/ping/PingTestPerf.java Revision: 497872 Author: marnie Date: 16:53:20, 19 January 2007 Message: QPID-309 fix for incorrect filemodes as pointed out by Steve ---- Modified : /incubator/qpid/trunk/qpid/java/distribution/src/main/assembly/bin-test.xml Modified : /incubator/qpid/trunk/qpid/java/distribution/src/main/assembly/bin.xml Revision: 497786 Author: marnie Date: 12:07:28, 19 January 2007 Message: JMSException logged as error ---- Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingSubscriber.java Revision: 497784 Author: marnie Date: 12:04:42, 19 January 2007 Message: JMSException logged as error ---- Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingProducer.java Revision: 497781 Author: marnie Date: 11:54:26, 19 January 2007 Message: Upgraded logging for JMSException to error as we always want to know afaik ---- Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingClient.java Revision: 497776 Author: marnie Date: 11:11:10, 19 January 2007 Message: Corrected file modes from 493 to 473, problem detected after move to 2.2-SNAPSHOT version of assembly plugin which threw an exception on invalid file modes ---- Modified : /incubator/qpid/trunk/qpid/java/distribution/src/main/assembly/bin-test.xml Modified : /incubator/qpid/trunk/qpid/java/distribution/src/main/assembly/bin.xml Revision: 497766 Author: bhupendrab Date: 10:28:50, 19 January 2007 Message: refactored the constructor to allow subclasses use the super constructor ---- Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java Revision: 497498 Author: rgreig Date: 16:58:35, 18 January 2007 Message: (Pacth by Rupert Smith) Fixed mistake in PingPongProducer, it was creating its message counter after sending messages, so sometimes the onMessage loop had already received mesages before the counter was created. ---- Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongBouncer.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/ping/PingTestPerf.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/requestreply/PingPongTestPerf.java Revision: 497482 Author: rgreig Date: 16:13:34, 18 January 2007 Message: (Build fix - Rupert Smith) Sorry, I checked in a file with a missing dependency. Fixed now. ---- Modified : /incubator/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/requestreply/PingPongTestPerf.java Revision: 497425 Author: rgreig Date: 13:11:39, 18 January 2007 Message: (Patch submitted by Rupert Smith) Restructured the ping tests, they now share common base classes to avoid cut and paste coding. ---- Added : /incubator/qpid/trunk/qpid/java/etc Added : /incubator/qpid/trunk/qpid/java/etc/log4j.xml Added : /incubator/qpid/trunk/qpid/java/perftests/jar-with-dependencies.xml Modified : /incubator/qpid/trunk/qpid/java/perftests/pom.xml Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/AbstractPingClient.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/AbstractPingProducer.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingClient.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingProducer.java Added : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongBouncer.java Deleted : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongClient.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java Added : /incubator/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/ping Added : /incubator/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/ping/PingTestPerf.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/requestreply/PingPongTestPerf.java Modified : /incubator/qpid/trunk/qpid/java/pom.xml Revision: 496996 Author: bhupendrab Date: 11:24:41, 17 January 2007 Message: ---- Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/ServiceRequestingClient.java Revision: 496991 Author: bhupendrab Date: 11:16:41, 17 January 2007 Message: added timer for callbackHandler to wait for next message before exiting ---- Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/ServiceRequestingClient.java Revision: 496833 Author: rgreig Date: 19:38:51, 16 January 2007 Message: Fix to broken build due to missing file. ---- Added : /incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/util/concurrent Added : /incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/util/concurrent/BooleanLatch.java Modified : /incubator/qpid/trunk/qpid/java/perftests/pom.xml Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java Revision: 496753 Author: rgreig Date: 16:44:17, 16 January 2007 Message: (Patch submitted by Rupert Smith) Refactored the test ping classes to share common code. Made them runnable from the command line (the same as they already were). Also made it possible to instantiate them in other code more easily. A unit test class has been added that performs a ping. This is so that it can be run with the TKTestRunner to scale it up and take performance measurements. Junit-toolkit added as a dependency to the maven build system. ---- Modified : /incubator/qpid/trunk/qpid/java/perftests/bin/testPingClient.sh Modified : /incubator/qpid/trunk/qpid/java/perftests/bin/testPingProducer.sh Modified : /incubator/qpid/trunk/qpid/java/perftests/pom.xml Added : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/AbstractPingClient.java Added : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/AbstractPingProducer.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingClient.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingProducer.java Added : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongClient.java Added : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java Added : /incubator/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/requestreply/PingPongTestPerf.java Modified : /incubator/qpid/trunk/qpid/java/pom.xml Revision: 496751 Author: rgreig Date: 16:41:11, 16 January 2007 Message: Added folders. ---- Added : /incubator/qpid/trunk/qpid/java/perftests/src/test Added : /incubator/qpid/trunk/qpid/java/perftests/src/test/java Added : /incubator/qpid/trunk/qpid/java/perftests/src/test/java/org Added : /incubator/qpid/trunk/qpid/java/perftests/src/test/java/org/apache Added : /incubator/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid Added : /incubator/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/pingpong Added : /incubator/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/requestreply Revision: 496731 Author: bhupendrab Date: 15:34:03, 16 January 2007 Message: Tests under this directory are actually ping tests -Comment from Rupert ---- Added : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping(Copy from path: /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/pingpong, Revision, 496662 Deleted : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/pingpong Revision: 496649 Author: bhupendrab Date: 10:05:51, 16 January 2007 Message: ---- Deleted : /incubator/qpid/trunk/qpid/java/perftests/bin/serviceRequestReply-createLogFile.sh Revision: 496648 Author: bhupendrab Date: 10:04:57, 16 January 2007 Message: ---- Added : /incubator/qpid/trunk/qpid/java/perftests/bin/serviceRequestingClient-createLogFile.sh(Copy from path: /incubator/qpid/trunk/qpid/java/perftests/bin/serviceRequestReply-createLogFile.sh, Revision, 496322 Revision: 496414 Author: rgreig Date: 17:29:32, 15 January 2007 Message: (Patch submitted by Rupert Smith) QPID-297 There were junit exclusions in the POM files that were causing junit to not be found when compiling tests. This may be a maven bug, but a better solution is to exclude stuff in assembly descriptors instead. ---- Modified : /incubator/qpid/trunk/qpid/java/broker/pom.xml Modified : /incubator/qpid/trunk/qpid/java/client/pom.xml Modified : /incubator/qpid/trunk/qpid/java/perftests/distribution/src/main/assembly/performance.xml Modified : /incubator/qpid/trunk/qpid/java/perftests/pom.xml Modified : /incubator/qpid/trunk/qpid/java/pom.xml Revision: 496276 Author: bhupendrab Date: 11:21:13, 15 January 2007 Message: ---- Modified : /incubator/qpid/trunk/qpid/java/distribution/src/main/assembly/management-eclipse-plugin-unix.xml Revision: 496270 Author: bhupendrab Date: 10:31:01, 15 January 2007 Message: ---- Modified : /incubator/qpid/trunk/qpid/java/perftests/distribution/src/main/assembly/performance.xml Revision: 496263 Author: bhupendrab Date: 09:46:51, 15 January 2007 Message: ---- Added : /incubator/qpid/trunk/qpid/java/perftests/bin/serviceRequestReply-createLogFile.sh Deleted : /incubator/qpid/trunk/qpid/java/perftests/bin/volumetestServiceRequestingClient.sh Revision: 496260 Author: bhupendrab Date: 09:39:38, 15 January 2007 Message: checking for the AMQ MessageID of received message in ServiceRequestingClient.java ---- Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/ServiceProvidingClient.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/ServiceRequestingClient.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/perftests.log4j Revision: 495652 Author: bhupendrab Date: 17:31:41, 12 January 2007 Message: patch provided by Nuno Santos QPID-279 ---- Modified : /incubator/qpid/trunk/qpid/java/distribution/src/main/assembly/management-eclipse-plugin-unix.xml Revision: 495639 Author: ritchiem Date: 16:57:58, 12 January 2007 Message: QPID-285 Added MultipleClients script that allows the specification of the number of clients to run. The output from this is not very clear as all clients write to a file and the Provider doesn't quit automatically so it is set to quit after a set time based on the number of messages. ---- Added : /incubator/qpid/trunk/qpid/java/perftests/bin/serviceRequestReply-MultipleClients.sh Modified : /incubator/qpid/trunk/qpid/java/perftests/bin/serviceRequestReply-QuickTest.sh Revision: 495584 Author: ritchiem Date: 14:44:20, 12 January 2007 Message: QPID-283 Documented topic test Updated perftests.log4j to include log level in output to make it clear when there is a non test output Fixed bug in Publisher where batches of 2 would result in a div by zero error. scripts created and edited to use the amqj.test.logging.level. ---- Modified : /incubator/qpid/trunk/qpid/java/perftests/RunningPerformanceTests.txt Modified : /incubator/qpid/trunk/qpid/java/perftests/bin/serviceRequestReply-QuickTest.sh Added : /incubator/qpid/trunk/qpid/java/perftests/bin/topic-QuickTest.sh Modified : /incubator/qpid/trunk/qpid/java/perftests/bin/topicListener.sh Modified : /incubator/qpid/trunk/qpid/java/perftests/bin/topicPublisher.sh Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/topic/Publisher.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/perftests.log4j Revision: 495561 Author: bhupendrab Date: 12:23:20, 12 January 2007 Message: added the README.txt ---- Modified : /incubator/qpid/trunk/qpid/java/distribution/src/main/assembly/management-eclipse-plugin-unix.xml Modified : /incubator/qpid/trunk/qpid/java/distribution/src/main/assembly/management-eclipse-plugin.xml Revision: 495559 Author: bhupendrab Date: 12:11:56, 12 January 2007 Message: updated with latest information ---- Modified : /incubator/qpid/trunk/qpid/java/management/eclipse-plugin/README.txt Revision: 495554 Author: ritchiem Date: 11:10:48, 12 January 2007 Message: QPID-278 broker distribution - modified to allow assembly:directory builds broker/pom.xml - moved slf4j to common/pom.xml QPID-283 Provided better feedback from shell scripts. Provided QuickTest shell script that runs the RequestReply tests. perftests distribution - modified to allow assembly:directory builds Moved Resource Readme content relating to Tests to RunningPerformanceTests.txt ---- Added : /incubator/qpid/trunk/qpid/java/perftests/RunningPerformanceTests.txt Modified : /incubator/qpid/trunk/qpid/java/perftests/bin/serviceProvidingClient.sh Added : /incubator/qpid/trunk/qpid/java/perftests/bin/serviceRequestReply-QuickTest.sh Modified : /incubator/qpid/trunk/qpid/java/perftests/bin/serviceRequestingClient.sh Modified : /incubator/qpid/trunk/qpid/java/perftests/bin/testPingClient.sh Modified : /incubator/qpid/trunk/qpid/java/perftests/bin/testPingProducer.sh Modified : /incubator/qpid/trunk/qpid/java/perftests/bin/testPingPublisher.sh Modified : /incubator/qpid/trunk/qpid/java/perftests/bin/testPingSubscriber.sh Modified : /incubator/qpid/trunk/qpid/java/perftests/distribution/pom.xml Modified : /incubator/qpid/trunk/qpid/java/perftests/distribution/src/main/assembly/performance.xml Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/ServiceProvidingClient.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/ServiceRequestingClient.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/perftests.log4j Revision: 495549 Author: ritchiem Date: 11:00:34, 12 January 2007 Message: QPID-278 broker distribution - modified to allow assembly:directory builds broker/pom.xml - moved slf4j to common/pom.xml ---- Modified : /incubator/qpid/trunk/qpid/java/broker/distribution/pom.xml Modified : /incubator/qpid/trunk/qpid/java/broker/pom.xml Modified : /incubator/qpid/trunk/qpid/java/common/pom.xml Revision: 495532 Author: bhupendrab Date: 09:43:09, 12 January 2007 Message: Adding a volume test script(volumetestServiceRequestingClient.sh) This script checks if all the messages were sent received back successfully. ServiceRequestingClient.java and ServiceProvidingClient.java modified to add a message identifier to match the request and response message. log4j file modified to create a log file ---- Modified : /incubator/qpid/trunk/qpid/java/perftests/bin/serviceRequestingClient.sh Added : /incubator/qpid/trunk/qpid/java/perftests/bin/volumetestServiceRequestingClient.sh Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/ServiceProvidingClient.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/ServiceRequestingClient.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/perftests.log4j Revision: 495525 Author: bhupendrab Date: 09:23:48, 12 January 2007 Message: keeping the management console in main distribution for now ---- Modified : /incubator/qpid/trunk/qpid/java/distribution/pom.xml Revision: 495461 Author: ritchiem Date: 01:26:05, 12 January 2007 Message: Fixed assembly:directory target issue in distribution pom ---- Modified : /incubator/qpid/trunk/qpid/java/distribution/pom.xml Revision: 495456 Author: ritchiem Date: 01:06:46, 12 January 2007 Message: Add new target directories to ignore list ---- Modified : /incubator/qpid/trunk/qpid/java/broker/distribution Modified : /incubator/qpid/trunk/qpid/java/client/distribution Modified : /incubator/qpid/trunk/qpid/java/perftests/distribution Modified : /incubator/qpid/trunk/qpid/java/systests/distribution Revision: 495455 Author: ritchiem Date: 01:03:21, 12 January 2007 Message: QPID-146 QPID-112 QPID-278 Summary Reworked a lot of the distribution work done by the build system. This ended up with me creating a reduced client distribution (hope that is ok Steve) Each module now has has a distribution directory (except common it may need a tests build later) This will build the individual components in to a distribution binary only, binary with tests and source. To build the binary with tests in the distribution directory use profile tests so $mvn -Ptests In all cases the dependencies have been reduced and correctly assigned to the correct scope. There were a couple of cases where a runtime dependency of one of our dependencies didn't make it in to the distributions so they were added explicitly. This should be looked at again. Specifics Broker: Three new assembly files are located in the distribution/src directory (broker-bin taking heavily from distribution - bin) these generate the three distributions. SimpleFilterManager.java removed slf4j reference broker/test directory removed as it was left over from the ant system Client: Added intelij files to ignore list. client/dist deleted as it was left over from the ant system client/distribution as for the broker three assemblies matching the three distributions Renamed log4j.properties to client.log4j to prevent issues when it is packaged into the jar. Removed old_test ping and requestreply1 as they have been moved to perftests Moved broker back to a test dependency. This required modifying AMQSession.java to remove reference to ExchangeBoundHandler.java Common: Added more common dependencies from broker and client here. Distribution: Reduced the assemblies to only build the full project binary, binary with tests and source. Perftests: Added building of perftests distribution so this can be bundled separately. Resources: Moved Resources from distribution project to root level this allows them to be easily incorporated in all projects. Systests: as with perftests now builds a separate distribution that can be used on an existing installation. renamed log4j.properties to systests.log4j to prevent logging problems. As systests is a module having the code under the test folder isn't accurate as it is the main code. Test code here should be testing the tests :D !! ---- Modified : /incubator/qpid/trunk/qpid/java/broker Added : /incubator/qpid/trunk/qpid/java/broker/distribution Added : /incubator/qpid/trunk/qpid/java/broker/distribution/pom.xml Added : /incubator/qpid/trunk/qpid/java/broker/distribution/src Added : /incubator/qpid/trunk/qpid/java/broker/distribution/src/main Added : /incubator/qpid/trunk/qpid/java/broker/distribution/src/main/assembly Added : /incubator/qpid/trunk/qpid/java/broker/distribution/src/main/assembly/broker-bin-tests.xml Added : /incubator/qpid/trunk/qpid/java/broker/distribution/src/main/assembly/broker-bin.xml Added : /incubator/qpid/trunk/qpid/java/broker/distribution/src/main/assembly/broker-src.xml Modified : /incubator/qpid/trunk/qpid/java/broker/pom.xml Modified : /incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/filter/SimpleFilterManager.java Deleted : /incubator/qpid/trunk/qpid/java/broker/test Modified : /incubator/qpid/trunk/qpid/java/client Deleted : /incubator/qpid/trunk/qpid/java/client/dist Added : /incubator/qpid/trunk/qpid/java/client/distribution Added : /incubator/qpid/trunk/qpid/java/client/distribution/pom.xml Added : /incubator/qpid/trunk/qpid/java/client/distribution/src Added : /incubator/qpid/trunk/qpid/java/client/distribution/src/main Added : /incubator/qpid/trunk/qpid/java/client/distribution/src/main/assembly Added : /incubator/qpid/trunk/qpid/java/client/distribution/src/main/assembly/client-bin-tests.xml Added : /incubator/qpid/trunk/qpid/java/client/distribution/src/main/assembly/client-bin.xml Added : /incubator/qpid/trunk/qpid/java/client/distribution/src/main/assembly/client-src.xml Modified : /incubator/qpid/trunk/qpid/java/client/pom.xml Deleted : /incubator/qpid/trunk/qpid/java/client/readme.txt Added : /incubator/qpid/trunk/qpid/java/client/src/main/java/client.log4j Deleted : /incubator/qpid/trunk/qpid/java/client/src/main/java/log4j.properties Modified : /incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java Deleted : /incubator/qpid/trunk/qpid/java/client/src/old_test/java/org/apache/qpid/ping Deleted : /incubator/qpid/trunk/qpid/java/client/src/old_test/java/org/apache/qpid/requestreply1 Modified : /incubator/qpid/trunk/qpid/java/common/pom.xml Modified : /incubator/qpid/trunk/qpid/java/distribution/pom.xml Added : /incubator/qpid/trunk/qpid/java/distribution/src/main/assembly/bin-test.xml(Copy from path: /incubator/qpid/trunk/qpid/java/distribution/src/main/assembly/bin.xml, Revision, 495160 Modified : /incubator/qpid/trunk/qpid/java/distribution/src/main/assembly/bin.xml Deleted : /incubator/qpid/trunk/qpid/java/distribution/src/main/assembly/client-bin.xml Deleted : /incubator/qpid/trunk/qpid/java/distribution/src/main/assembly/tests.xml Modified : /incubator/qpid/trunk/qpid/java/perftests/bin/setupclasspath.sh Added : /incubator/qpid/trunk/qpid/java/perftests/distribution Added : /incubator/qpid/trunk/qpid/java/perftests/distribution/pom.xml Added : /incubator/qpid/trunk/qpid/java/perftests/distribution/src Added : /incubator/qpid/trunk/qpid/java/perftests/distribution/src/main Added : /incubator/qpid/trunk/qpid/java/perftests/distribution/src/main/assembly Added : /incubator/qpid/trunk/qpid/java/perftests/distribution/src/main/assembly/performance.xml Modified : /incubator/qpid/trunk/qpid/java/perftests/pom.xml Modified : /incubator/qpid/trunk/qpid/java/pom.xml Added : /incubator/qpid/trunk/qpid/java/resources/DISCLAIMER(Copy from path: /incubator/qpid/trunk/qpid/java/distribution/src/main/release/DISCLAIMER, Revision, 495160 Added : /incubator/qpid/trunk/qpid/java/resources/LICENSE.txt(Copy from path: /incubator/qpid/trunk/qpid/java/distribution/src/main/release/LICENSE.txt, Revision, 495160 Added : /incubator/qpid/trunk/qpid/java/resources/NOTICE.txt(Copy from path: /incubator/qpid/trunk/qpid/java/distribution/src/main/release/NOTICE.txt, Revision, 495160 Added : /incubator/qpid/trunk/qpid/java/resources/README.txt(Copy from path: /incubator/qpid/trunk/qpid/java/distribution/src/main/release/README.txt, Revision, 495160 Added : /incubator/qpid/trunk/qpid/java/systests/distribution Added : /incubator/qpid/trunk/qpid/java/systests/distribution/pom.xml Added : /incubator/qpid/trunk/qpid/java/systests/distribution/src Added : /incubator/qpid/trunk/qpid/java/systests/distribution/src/main Added : /incubator/qpid/trunk/qpid/java/systests/distribution/src/main/assembly Added : /incubator/qpid/trunk/qpid/java/systests/distribution/src/main/assembly/systests.xml Modified : /incubator/qpid/trunk/qpid/java/systests/pom.xml Added : /incubator/qpid/trunk/qpid/java/systests/src/main(Copy from path: /incubator/qpid/trunk/qpid/java/systests/src/test, Revision, 495405 Replacing : /incubator/qpid/trunk/qpid/java/systests/src/main/java(Copy from path: /incubator/qpid/trunk/qpid/java/systests/src/test/java, Revision, 495453 Deleted : /incubator/qpid/trunk/qpid/java/systests/src/main/java/log4j.properties Added : /incubator/qpid/trunk/qpid/java/systests/src/main/java/systests.log4j(Copy from path: /incubator/qpid/trunk/qpid/java/systests/src/test/java/log4j.properties, Revision, 495422 Deleted : /incubator/qpid/trunk/qpid/java/systests/src/test Revision: 495161 Author: ritchiem Date: 09:19:29, 11 January 2007 Message: Added remaining intelij files to ignore list ---- Modified : /incubator/qpid/trunk/qpid/java Modified : /incubator/qpid/trunk/qpid/java/common Modified : /incubator/qpid/trunk/qpid/java/perftests Modified : /incubator/qpid/trunk/qpid/java/systests Revision: 495020 Author: rgreig Date: 22:44:42, 10 January 2007 Message: QPID-32 : Add option to run tests with persistent messages ---- Modified : /incubator/qpid/trunk/qpid/java/perftests/bin/serviceProvidingClient.sh Modified : /incubator/qpid/trunk/qpid/java/perftests/bin/serviceRequestingClient.sh Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/ServiceProvidingClient.java Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/ServiceRequestingClient.java Revision: 494907 Author: bhupendrab Date: 17:50:41, 10 January 2007 Message: QPID-277 adding perftests in distribution ---- Modified : /incubator/qpid/trunk/qpid/java/distribution/src/main/assembly/tests.xml Revision: 494861 Author: ritchiem Date: 15:47:18, 10 January 2007 Message: QPID-278 Add PerfTests into build and distribution perftests are now built as part of the main build. The resulting jar contains both class and java files. The binary distribution also includes a perftests folder in the bin directory which contains scripts to run the tests. ---- Modified : /incubator/qpid/trunk/qpid/java/distribution/pom.xml Modified : /incubator/qpid/trunk/qpid/java/distribution/src/main/assembly/bin.xml Modified : /incubator/qpid/trunk/qpid/java/perftests Modified : /incubator/qpid/trunk/qpid/java/perftests/bin/serviceProvidingClient.sh Modified : /incubator/qpid/trunk/qpid/java/perftests/bin/serviceRequestingClient.sh Modified : /incubator/qpid/trunk/qpid/java/perftests/bin/setupclasspath.sh Added : /incubator/qpid/trunk/qpid/java/perftests/bin/testPingClient.sh Added : /incubator/qpid/trunk/qpid/java/perftests/bin/testPingProducer.sh Added : /incubator/qpid/trunk/qpid/java/perftests/bin/testPingPublisher.sh Added : /incubator/qpid/trunk/qpid/java/perftests/bin/testPingSubscriber.sh Modified : /incubator/qpid/trunk/qpid/java/perftests/pom.xml Added : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/pingpong Added : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/pingpong/TestPingClient.java(Copy from path: /incubator/qpid/trunk/qpid/java/client/src/old_test/java/org/apache/qpid/ping/TestPingClient.java, Revision, 494425 Added : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/pingpong/TestPingProducer.java(Copy from path: /incubator/qpid/trunk/qpid/java/client/src/old_test/java/org/apache/qpid/ping/TestPingProducer.java, Revision, 494425 Added : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/pingpong/TestPingPublisher.java(Copy from path: /incubator/qpid/trunk/qpid/java/client/src/old_test/java/org/apache/qpid/ping/TestPingPublisher.java, Revision, 494425 Added : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/pingpong/TestPingSubscriber.java(Copy from path: /incubator/qpid/trunk/qpid/java/client/src/old_test/java/org/apache/qpid/ping/TestPingSubscriber.java, Revision, 494425 Modified : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/ServiceRequestingClient.java Added : /incubator/qpid/trunk/qpid/java/perftests/src/main/java/perftests.log4j Modified : /incubator/qpid/trunk/qpid/java/pom.xml Revision: 494800 Author: rgreig Date: 12:45:11, 10 January 2007 Message: Qpid-147 patch applied. ---- Modified : /incubator/qpid/trunk/qpid/java/pom.xml Revision: 494797 Author: bhupendrab Date: 12:35:04, 10 January 2007 Message: QPID-277 adding tests in distribution ---- Modified : /incubator/qpid/trunk/qpid/java/broker/pom.xml Modified : /incubator/qpid/trunk/qpid/java/client/pom.xml Modified : /incubator/qpid/trunk/qpid/java/distribution/pom.xml Added : /incubator/qpid/trunk/qpid/java/distribution/src/main/assembly/tests.xml Modified : /incubator/qpid/trunk/qpid/java/systests/pom.xml git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/perftesting@500188 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java')
-rw-r--r--qpid/java/broker/distribution/pom.xml153
-rw-r--r--qpid/java/broker/distribution/src/main/assembly/broker-bin-tests.xml116
-rw-r--r--qpid/java/broker/distribution/src/main/assembly/broker-bin.xml171
-rw-r--r--qpid/java/broker/distribution/src/main/assembly/broker-src.xml78
-rw-r--r--qpid/java/broker/pom.xml56
-rw-r--r--qpid/java/client/distribution/pom.xml155
-rw-r--r--qpid/java/client/distribution/src/main/assembly/client-bin-tests.xml107
-rw-r--r--qpid/java/client/distribution/src/main/assembly/client-bin.xml76
-rw-r--r--qpid/java/client/distribution/src/main/assembly/client-src.xml62
-rw-r--r--qpid/java/client/pom.xml85
-rw-r--r--qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java3
-rw-r--r--qpid/java/common/pom.xml31
-rw-r--r--qpid/java/distribution/pom.xml98
-rw-r--r--qpid/java/distribution/src/main/assembly/bin-test.xml169
-rw-r--r--qpid/java/distribution/src/main/assembly/bin.xml18
-rw-r--r--qpid/java/distribution/src/main/assembly/management-eclipse-plugin-unix.xml12
-rw-r--r--qpid/java/distribution/src/main/assembly/management-eclipse-plugin.xml7
-rw-r--r--qpid/java/perftests/RunningPerformanceTests.txt112
-rwxr-xr-xqpid/java/perftests/bin/serviceProvidingClient.sh14
-rwxr-xr-xqpid/java/perftests/bin/serviceRequestReply-MultipleClients.sh53
-rwxr-xr-xqpid/java/perftests/bin/serviceRequestReply-QuickTest.sh43
-rwxr-xr-xqpid/java/perftests/bin/serviceRequestingClient-createLogFile.sh38
-rwxr-xr-xqpid/java/perftests/bin/serviceRequestingClient.sh13
-rwxr-xr-xqpid/java/perftests/bin/setupclasspath.sh5
-rwxr-xr-xqpid/java/perftests/bin/testPingClient.sh33
-rwxr-xr-xqpid/java/perftests/bin/testPingProducer.sh33
-rwxr-xr-xqpid/java/perftests/bin/testPingPublisher.sh33
-rwxr-xr-xqpid/java/perftests/bin/testPingSubscriber.sh33
-rwxr-xr-xqpid/java/perftests/bin/topic-QuickTest.sh55
-rwxr-xr-xqpid/java/perftests/bin/topicListener.sh3
-rwxr-xr-xqpid/java/perftests/bin/topicPublisher.sh2
-rw-r--r--qpid/java/perftests/distribution/pom.xml127
-rw-r--r--qpid/java/perftests/distribution/src/main/assembly/performance.xml103
-rw-r--r--qpid/java/perftests/jar-with-dependencies.xml29
-rw-r--r--qpid/java/perftests/pom.xml245
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/client/message/TestMessageFactory.java118
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/ping/AbstractPingClient.java204
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/ping/AbstractPingProducer.java523
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingClient.java192
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingItself.java223
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingProducer.java249
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingPublisher.java197
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingSubscriber.java134
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/ping/Throttle.java67
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongBouncer.java300
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java806
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/ServiceProvidingClient.java80
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/ServiceRequestingClient.java263
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/topic/Config.java88
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/topic/Publisher.java31
-rw-r--r--qpid/java/perftests/src/main/java/perftests.log4j45
-rw-r--r--qpid/java/perftests/src/test/java/org/apache/qpid/ping/PingAsyncTestPerf.java310
-rw-r--r--qpid/java/perftests/src/test/java/org/apache/qpid/ping/PingTestPerf.java314
-rw-r--r--qpid/java/perftests/src/test/java/org/apache/qpid/ping/ThrottleTestPerf.java63
-rw-r--r--qpid/java/perftests/src/test/java/org/apache/qpid/requestreply/PingPongTestPerf.java296
-rw-r--r--qpid/java/pom.xml95
-rw-r--r--qpid/java/systests/distribution/pom.xml111
-rw-r--r--qpid/java/systests/distribution/src/main/assembly/systests.xml91
-rw-r--r--qpid/java/systests/pom.xml53
59 files changed, 6986 insertions, 238 deletions
diff --git a/qpid/java/broker/distribution/pom.xml b/qpid/java/broker/distribution/pom.xml
new file mode 100644
index 0000000000..9875e9bf2b
--- /dev/null
+++ b/qpid/java/broker/distribution/pom.xml
@@ -0,0 +1,153 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT 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 xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.qpid</groupId>
+ <artifactId>qpid-broker-distribution</artifactId>
+ <packaging>jar</packaging>
+ <version>1.0-incubating-M2-SNAPSHOT</version>
+ <name>Qpid Broker Distributions</name>
+ <url>http://cwiki.apache.org/confluence/display/qpid</url>
+
+ <parent>
+ <groupId>org.apache.qpid</groupId>
+ <artifactId>qpid</artifactId>
+ <version>1.0-incubating-M2-SNAPSHOT</version>
+ </parent>
+
+ <properties>
+ <topDirectoryLocation>..</topDirectoryLocation>
+ <java.source.version>1.5</java.source.version>
+ <qpid.version>${pom.version}</qpid.version>
+ <qpid.targetDir>${project.build.directory}</qpid.targetDir>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.qpid</groupId>
+ <artifactId>qpid-broker</artifactId>
+ <type>jar</type>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>${java.source.version}</source>
+ <target>${java.source.version}</target>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>${assembly.version}</version>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/assembly/broker-bin.xml</descriptor>
+ </descriptors>
+ <finalName>qpid-${pom.version}</finalName>
+ <outputDirectory>${qpid.targetDir}</outputDirectory>
+ <tarLongFileMode>gnu</tarLongFileMode>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <finalName>qpid-incubating</finalName>
+ <archive>
+ <manifest>
+ <addClasspath>true</addClasspath>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </pluginManagement>
+
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>distribution-package</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/assembly/broker-bin.xml</descriptor>
+ <descriptor>src/main/assembly/broker-src.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+
+ </build>
+
+ <profiles>
+ <profile>
+ <id>tests</id>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.qpid</groupId>
+ <artifactId>qpid-broker</artifactId>
+ <type>test-jar</type>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>distribution-package</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/assembly/broker-bin-tests.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+
+ </build>
+ </profile>
+ </profiles>
+</project>
diff --git a/qpid/java/broker/distribution/src/main/assembly/broker-bin-tests.xml b/qpid/java/broker/distribution/src/main/assembly/broker-bin-tests.xml
new file mode 100644
index 0000000000..fa017d6232
--- /dev/null
+++ b/qpid/java/broker/distribution/src/main/assembly/broker-bin-tests.xml
@@ -0,0 +1,116 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<assembly>
+ <id>java-broker-bin-with-tests</id>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <formats>
+ <format>tar.gz</format>
+ <format>zip</format>
+ </formats>
+
+ <fileSets>
+ <fileSet>
+ <!-- Apache license files -->
+ <directory>../../resources</directory>
+ <outputDirectory>qpid-${qpid.version}</outputDirectory>
+ <includes>
+ <include>DISCLAIMER</include>
+ <include>LICENSE.txt</include>
+ <include>NOTICE.txt</include>
+ <include>README.txt</include>
+ </includes>
+ </fileSet>
+
+ <fileSet>
+ <directory>../../release-docs</directory>
+ <outputDirectory>qpid-${qpid.version}/docs</outputDirectory>
+ <includes>
+ <include>RELEASE_NOTES.txt</include>
+ </includes>
+ </fileSet>
+
+ <!-- Include easy access to test source-->
+ <fileSet>
+ <directory>../src/test</directory>
+ <outputDirectory>qpid-${qpid.version}/src</outputDirectory>
+ <includes>
+ <include>**/*.java</include>
+ </includes>
+ </fileSet>
+
+ <!-- Execution Scripts -->
+ <fileSet>
+ <directory>../bin/</directory>
+ <outputDirectory>qpid-${qpid.version}/bin</outputDirectory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ <fileMode>777</fileMode> <!-- RWX -->
+ </fileSet>
+
+ <!-- Configuration -->
+ <fileSet>
+ <directory>../etc/</directory>
+ <outputDirectory>qpid-${qpid.version}/etc</outputDirectory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ <fileMode>420</fileMode>
+ </fileSet>
+
+ <!-- Metadata Jar -->
+ <fileSet>
+ <directory>target</directory>
+ <outputDirectory>qpid-${qpid.version}/lib</outputDirectory>
+ <includes>
+ <include>qpid-incubating.jar</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+
+
+ <files>
+ <!-- Common Run scripts -->
+ <file>
+ <source>../../common/bin/qpid-run</source>
+ <outputDirectory>qpid-${qpid.version}/bin</outputDirectory>
+ <destName>qpid-run</destName>
+ <fileMode>493</fileMode>
+ </file>
+
+ <!-- Common Configuration -->
+ <file>
+ <source>../../common/etc/qpid-run.conf</source>
+ <outputDirectory>qpid-${qpid.version}/etc</outputDirectory>
+ <destName>qpid-run.conf</destName>
+ <fileMode>420</fileMode>
+ </file>
+ </files>
+
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>qpid-${qpid.version}/lib</outputDirectory>
+ <unpack>false</unpack>
+ <excludes>
+ <exclude>org.apache.qpid:qpid-broker-distribution</exclude>
+ </excludes>
+ </dependencySet>
+ </dependencySets>
+</assembly>
diff --git a/qpid/java/broker/distribution/src/main/assembly/broker-bin.xml b/qpid/java/broker/distribution/src/main/assembly/broker-bin.xml
new file mode 100644
index 0000000000..4a7343660d
--- /dev/null
+++ b/qpid/java/broker/distribution/src/main/assembly/broker-bin.xml
@@ -0,0 +1,171 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<assembly>
+ <!-- id typically identifies the "type" (src vs bin etc) of the assembly -->
+ <id>java-broker-bin</id>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <formats>
+ <format>tar.gz</format>
+ <format>zip</format>
+ </formats>
+
+ <fileSets>
+ <!-- Apache Licensing -->
+ <fileSet>
+ <directory>../../resources</directory>
+ <outputDirectory>qpid-${qpid.version}</outputDirectory>
+ <includes>
+ <include>DISCLAIMER</include>
+ <include>LICENSE.txt</include>
+ <include>NOTICE.txt</include>
+ <include>README.txt</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>../..</directory>
+ <outputDirectory>qpid-${qpid.version}</outputDirectory>
+ <includes>
+ <include>*.txt</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>../../src/main/release-docs</directory>
+ <outputDirectory>qpid-${qpid.version}/docs</outputDirectory>
+ <includes>
+ <include>RELEASE_NOTES.txt</include>
+ </includes>
+ </fileSet>
+
+ <!-- Metadata Jar -->
+ <fileSet>
+ <directory>target</directory>
+ <outputDirectory>qpid-${qpid.version}/lib</outputDirectory>
+ <includes>
+ <include>qpid-incubating.jar</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+ <files>
+ <!-- due to a bug in the assembly plugin (MASSEMBLY-153) you have
+ to use decimal numbers to specify fileMode -->
+ <file>
+ <source>../../common/etc/qpid-run.conf</source>
+ <outputDirectory>qpid-${qpid.version}/etc</outputDirectory>
+ <destName>qpid-run.conf</destName>
+ <fileMode>420</fileMode>
+ </file>
+ <file>
+ <source>../etc/config.xml</source>
+ <outputDirectory>qpid-${qpid.version}/etc</outputDirectory>
+ <destName>config.xml</destName>
+ <fileMode>420</fileMode>
+ </file>
+ <file>
+ <source>../etc/log4j.xml</source>
+ <outputDirectory>qpid-${qpid.version}/etc</outputDirectory>
+ <destName>log4j.xml</destName>
+ <fileMode>420</fileMode>
+ </file>
+ <file>
+ <source>../etc/passwd</source>
+ <outputDirectory>qpid-${qpid.version}/etc</outputDirectory>
+ <destName>passwd</destName>
+ <fileMode>420</fileMode>
+ </file>
+ <file>
+ <source>../etc/qpid-server.conf</source>
+ <outputDirectory>qpid-${qpid.version}/etc</outputDirectory>
+ <destName>qpid-server.conf</destName>
+ <fileMode>420</fileMode>
+ </file>
+ <file>
+ <source>../etc/virtualhosts.xml</source>
+ <outputDirectory>qpid-${qpid.version}/etc</outputDirectory>
+ <destName>virtualhosts.xml</destName>
+ <fileMode>420</fileMode>
+ </file>
+ <file>
+ <source>../../common/bin/qpid-run</source>
+ <outputDirectory>qpid-${qpid.version}/bin</outputDirectory>
+ <destName>qpid-run</destName>
+ <fileMode>473</fileMode>
+ </file>
+ <file>
+ <source>../bin/qpid-server</source>
+ <outputDirectory>qpid-${qpid.version}/bin</outputDirectory>
+ <destName>qpid-server</destName>
+ <fileMode>473</fileMode>
+ </file>
+ <file>
+ <source>../bin/qpid-server.bat</source>
+ <outputDirectory>qpid-${qpid.version}/bin</outputDirectory>
+ <destName>qpid-server.bat</destName>
+ <fileMode>473</fileMode>
+ </file>
+ <file>
+ <source>../bin/run.bat</source>
+ <outputDirectory>qpid-${qpid.version}/bin</outputDirectory>
+ <destName>run.bat</destName>
+ <fileMode>473</fileMode>
+ </file>
+ <file>
+ <source>../bin/run.sh</source>
+ <outputDirectory>qpid-${qpid.version}/bin</outputDirectory>
+ <destName>run.sh</destName>
+ <fileMode>473</fileMode>
+ </file>
+ <file>
+ <source>../bin/runAll</source>
+ <outputDirectory>qpid-${qpid.version}/bin</outputDirectory>
+ <destName>runAll</destName>
+ <fileMode>473</fileMode>
+ </file>
+ </files>
+
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>qpid-${qpid.version}/lib</outputDirectory>
+ <unpack>false</unpack>
+ <!-- This needs to be tidied up QPID-280 -->
+ <excludes>
+ <exclude>org.apache.qpid:qpid-broker-distribution</exclude>
+ <exclude>org.apache.qpid.management:org.apache.qpid.management.ui</exclude>
+ <exclude>org.eclipse.core:org.eclipse.core.commands</exclude>
+ <exclude>org.eclipse.core:org.eclipse.core.contenttype</exclude>
+ <exclude>org.eclipse.core:org.eclipse.core.expressions</exclude>
+ <exclude>org.eclipse.core:org.eclipse.core.jobs</exclude>
+ <exclude>org.eclipse.core:org.eclipse.core.runtime</exclude>
+ <exclude>org.eclipse.core:org.eclipse.core.runtime.compatibility.auth</exclude>
+ <exclude>org.eclipse.core:org.eclipse.core.runtime.compatibility.registry</exclude>
+ <exclude>org.eclipse.equinox:org.eclipse.equinox.common</exclude>
+ <exclude>org.eclipse.equinox:org.eclipse.equinox.preferences</exclude>
+ <exclude>org.eclipse.equinox:org.eclipse.equinox.registry</exclude>
+ <exclude>org.eclipse.help:org.eclipse.help</exclude>
+ <exclude>org.eclipse.jface:org.eclipse.jface</exclude>
+ <exclude>org.eclipse.osgi:org.eclipse.osgi</exclude>
+ <exclude>org.eclipse.swt:org.eclipse.swt</exclude>
+ <exclude>org.eclipse.swt:org.eclipse.swt.win32.win32.x86</exclude>
+ <exclude>org.eclipse.ui:org.eclipse.ui</exclude>
+ <exclude>org.eclipse.ui:org.eclipse.ui.forms</exclude>
+ <exclude>org.eclipse.ui:org.eclipse.ui.workbench</exclude>
+ </excludes>
+ </dependencySet>
+ </dependencySets>
+</assembly>
diff --git a/qpid/java/broker/distribution/src/main/assembly/broker-src.xml b/qpid/java/broker/distribution/src/main/assembly/broker-src.xml
new file mode 100644
index 0000000000..28a22c3851
--- /dev/null
+++ b/qpid/java/broker/distribution/src/main/assembly/broker-src.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<assembly>
+ <!-- id typically identifies the "type" (src vs bin etc) of the assembly -->
+ <id>java-broker-src</id>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <formats>
+ <format>tar.gz</format>
+ <format>zip</format>
+ </formats>
+
+ <fileSets>
+ <!-- Apache Licensing -->
+ <fileSet>
+ <directory>../../resources</directory>
+ <outputDirectory>qpid-${qpid.version}-src</outputDirectory>
+ <includes>
+ <include>DISCLAIMER</include>
+ <include>LICENSE.txt</include>
+ <include>licenses/*.*</include>
+ <include>NOTICE.txt</include>
+ <include>README.txt</include>
+ <include>BUILDING.txt</include>
+ </includes>
+ </fileSet>
+ <!-- Broker source -->
+ <fileSet>
+ <directory>..</directory>
+ <outputDirectory>qpid-${qpid.version}-src</outputDirectory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ <!-- Tidy up wrt to QPID-280 -->
+ <excludes>
+ <exclude>build.xml</exclude>
+ <exclude>distribution/build.xml</exclude>
+ <exclude>benchmark</exclude>
+ <exclude>benchmark/**/*</exclude>
+ <exclude>**/target</exclude>
+ <exclude>**/target/**/*</exclude>
+ <exclude>**/build</exclude>
+ <exclude>**/build/**/*</exclude>
+ <exclude>**/.settings</exclude>
+ <exclude>**/.classpath</exclude>
+ <exclude>**/.project</exclude>
+ <exclude>**/.wtpmodules</exclude>
+ <exclude>**/surefire*</exclude>
+ <exclude>**/cobertura.ser</exclude>
+ <exclude>bin</exclude>
+ <exclude>bin/*</exclude>
+ <exclude>lib</exclude>
+ <exclude>lib/**/*</exclude>
+ <exclude>**/var/journal</exclude>
+ <exclude>**/build.out*</exclude>
+ <exclude>**/eclipse-plugin/bin/**</exclude>
+ <exclude>**/eclipse-plugin/plugins/**</exclude>
+ <exclude>**/eclipse-plugin/src/main/resources/**</exclude>
+ </excludes>
+ </fileSet>
+ </fileSets>
+</assembly>
diff --git a/qpid/java/broker/pom.xml b/qpid/java/broker/pom.xml
index 92a3d69060..2cf8a563f0 100644
--- a/qpid/java/broker/pom.xml
+++ b/qpid/java/broker/pom.xml
@@ -37,53 +37,44 @@
</properties>
<dependencies>
+
<dependency>
<groupId>org.apache.qpid</groupId>
<artifactId>qpid-common</artifactId>
</dependency>
+
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
</dependency>
+
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
</dependency>
+
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
</dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jms_1.1_spec</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.mina</groupId>
- <artifactId>mina-filter-ssl</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.mina</groupId>
- <artifactId>mina-java5</artifactId>
- </dependency>
- <dependency>
- <groupId>backport-util-concurrent</groupId>
- <artifactId>backport-util-concurrent</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- </dependency>
+
+ <!-- Test Dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
+ <scope>test</scope>
</dependency>
+
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymockclassextension</artifactId>
+ <scope>test</scope>
</dependency>
+
</dependencies>
<build>
+
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -128,7 +119,32 @@
</systemProperties>
</configuration>
</plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
+
+ <testResources>
+ <testResource>
+ <targetPath>src/</targetPath>
+ <filtering>false</filtering>
+ <directory>src/test/java</directory>
+ <includes>
+ <include>**/*.java</include>
+ </includes>
+ </testResource>
+ </testResources>
+
</build>
</project>
diff --git a/qpid/java/client/distribution/pom.xml b/qpid/java/client/distribution/pom.xml
new file mode 100644
index 0000000000..dfbe8b83c2
--- /dev/null
+++ b/qpid/java/client/distribution/pom.xml
@@ -0,0 +1,155 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT 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 xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.qpid</groupId>
+ <artifactId>qpid-client-distribution</artifactId>
+ <packaging>jar</packaging>
+ <version>1.0-incubating-M2-SNAPSHOT</version>
+ <name>Qpid Client Distributions</name>
+ <url>http://cwiki.apache.org/confluence/display/qpid</url>
+
+ <parent>
+ <groupId>org.apache.qpid</groupId>
+ <artifactId>qpid</artifactId>
+ <version>1.0-incubating-M2-SNAPSHOT</version>
+ </parent>
+
+ <properties>
+ <topDirectoryLocation>..</topDirectoryLocation>
+ <java.source.version>1.5</java.source.version>
+ <qpid.version>${pom.version}</qpid.version>
+ <qpid.targetDir>${project.build.directory}</qpid.targetDir>
+ <qpid.root>${basedir}/..</qpid.root>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.qpid</groupId>
+ <artifactId>qpid-client</artifactId>
+ <type>jar</type>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>${java.source.version}</source>
+ <target>${java.source.version}</target>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>${assembly.version}</version>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/assembly/client-bin.xml</descriptor>
+ </descriptors>
+ <finalName>qpid-${pom.version}</finalName>
+ <outputDirectory>${qpid.targetDir}</outputDirectory>
+ <tarLongFileMode>gnu</tarLongFileMode>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <finalName>qpid-incubating</finalName>
+ <archive>
+ <manifest>
+ <addClasspath>true</addClasspath>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </pluginManagement>
+
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>distribution-package</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/assembly/client-bin.xml</descriptor>
+ <descriptor>src/main/assembly/client-src.xml</descriptor>
+ </descriptors>
+ <finalName>qpid-${pom.version}</finalName>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+
+ </build>
+
+<profiles>
+ <profile>
+ <id>tests</id>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.qpid</groupId>
+ <artifactId>qpid-client</artifactId>
+ <type>test-jar</type>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>distribution-package</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/assembly/client-bin-tests.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+</profiles>
+
+</project>
diff --git a/qpid/java/client/distribution/src/main/assembly/client-bin-tests.xml b/qpid/java/client/distribution/src/main/assembly/client-bin-tests.xml
new file mode 100644
index 0000000000..ec4df1c9a7
--- /dev/null
+++ b/qpid/java/client/distribution/src/main/assembly/client-bin-tests.xml
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<assembly>
+ <id>java-client-bin-with-tests</id>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <formats>
+ <format>tar.gz</format>
+ <format>zip</format>
+ </formats>
+
+ <fileSets>
+ <fileSet>
+ <!-- Apache license files -->
+ <directory>../../resources</directory>
+ <outputDirectory>qpid-${qpid.version}</outputDirectory>
+ <includes>
+ <include>DISCLAIMER</include>
+ <include>LICENSE.txt</include>
+ <include>NOTICE.txt</include>
+ <include>README.txt</include>
+ </includes>
+ </fileSet>
+
+ <fileSet>
+ <directory>../../release-docs</directory>
+ <outputDirectory>qpid-${qpid.version}/docs</outputDirectory>
+ <includes>
+ <include>RELEASE_NOTES.txt</include>
+ </includes>
+ </fileSet>
+
+ <!-- Include easy access to test source-->
+ <fileSet>
+ <directory>../src/test</directory>
+ <outputDirectory>qpid-${qpid.version}/src</outputDirectory>
+ <includes>
+ <include>**/*.java</include>
+ </includes>
+ </fileSet>
+
+ <!-- fileSet> Client contains a readme.txt as does qpid root.
+ Which will cause problems on windows as the zip will
+ contain: readme.txt and README.txt
+ < Client local documentation>
+ <directory>..</directory>
+ <outputDirectory>qpid-${qpid.version}</outputDirectory>
+ <includes>
+ <include>*.txt</include>
+ </includes>
+ </fileSet-->
+
+ <!-- Configuration -->
+ <fileSet>
+ <directory>../test/etc</directory>
+ <outputDirectory>qpid-${qpid.version}/etc</outputDirectory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </fileSet>
+
+ <!-- Execution Scripts -->
+ <fileSet>
+ <directory>../test/bin</directory>
+ <outputDirectory>qpid-${qpid.version}/bin</outputDirectory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ <fileMode>777</fileMode> <!-- RWX -->
+ </fileSet>
+
+ <!-- Metadata Jar -->
+ <fileSet>
+ <directory>target</directory>
+ <outputDirectory>qpid-${qpid.version}/lib</outputDirectory>
+ <includes>
+ <include>qpid-incubating.jar</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>qpid-${qpid.version}/lib</outputDirectory>
+ <unpack>false</unpack>
+ <excludes>
+ <exclude>org.apache.qpid:qpid-client-distribution</exclude>
+ </excludes>
+ </dependencySet>
+ </dependencySets>
+</assembly>
diff --git a/qpid/java/client/distribution/src/main/assembly/client-bin.xml b/qpid/java/client/distribution/src/main/assembly/client-bin.xml
new file mode 100644
index 0000000000..962f084995
--- /dev/null
+++ b/qpid/java/client/distribution/src/main/assembly/client-bin.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<assembly>
+ <id>java-client-bin</id>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <formats>
+ <format>tar.gz</format>
+ <format>zip</format>
+ </formats>
+
+ <fileSets>
+ <fileSet>
+ <!-- Apache license files -->
+ <directory>../../resources</directory>
+ <outputDirectory>qpid-${qpid.version}</outputDirectory>
+ <includes>
+ <include>DISCLAIMER</include>
+ <include>LICENSE.txt</include>
+ <include>NOTICE.txt</include>
+ <include>README.txt</include>
+ </includes>
+ </fileSet>
+
+ <!--fileSet>
+ < Client local documentation>
+ <directory>..</directory>
+ <outputDirectory>qpid-${qpid.version}</outputDirectory>
+ <includes>
+ <include>*.txt</include>
+ </includes>
+ </fileSet-->
+
+ <fileSet>
+ <directory>../../release-docs</directory>
+ <outputDirectory>qpid-${qpid.version}/docs</outputDirectory>
+ <includes>
+ <include>RELEASE_NOTES.txt</include>
+ </includes>
+ </fileSet>
+
+ <fileSet>
+ <directory>target</directory>
+ <outputDirectory>qpid-${qpid.version}/lib</outputDirectory>
+ <includes>
+ <include>qpid-incubating.jar</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>qpid-${qpid.version}/lib</outputDirectory>
+ <unpack>false</unpack>
+ <excludes>
+ <exclude>org.apache.qpid:qpid-client-distribution</exclude>
+ </excludes>
+ </dependencySet>
+ </dependencySets>
+</assembly>
diff --git a/qpid/java/client/distribution/src/main/assembly/client-src.xml b/qpid/java/client/distribution/src/main/assembly/client-src.xml
new file mode 100644
index 0000000000..b5055f05d7
--- /dev/null
+++ b/qpid/java/client/distribution/src/main/assembly/client-src.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<assembly>
+ <!-- id typically identifies the "type" (src vs bin etc) of the assembly -->
+ <id>java-client-src</id>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <formats>
+ <format>tar.gz</format>
+ <format>zip</format>
+ </formats>
+
+ <fileSets>
+
+ <fileSet>
+ <!-- Apache license files -->
+ <directory>../../resources</directory>
+ <outputDirectory>qpid-${qpid.version}-src</outputDirectory>
+ <includes>
+ <include>DISCLAIMER</include>
+ <include>LICENSE.txt</include>
+ <include>NOTICE.txt</include>
+ <include>README.txt</include>
+ </includes>
+ </fileSet>
+
+ <fileSet>
+ <directory>..</directory>
+ <outputDirectory>qpid-${qpid.version}-src</outputDirectory>
+ <includes>
+ <include>src/main/**</include>
+ <include>src/test/**</include>
+ <include>test/main/**</include>
+ <include>test/test/**</include>
+ <include>pom.xml</include>
+ <include>distribution/**</include>
+ </includes>
+ <excludes>
+ <exclude>**/target</exclude>
+ <exclude>**/target/**/*</exclude>
+ <exclude>**/build</exclude>
+ <exclude>**/build/**/*</exclude>
+ </excludes>
+ </fileSet>
+ </fileSets>
+</assembly>
diff --git a/qpid/java/client/pom.xml b/qpid/java/client/pom.xml
index e45aad733d..854428fb39 100644
--- a/qpid/java/client/pom.xml
+++ b/qpid/java/client/pom.xml
@@ -35,40 +35,45 @@
<properties>
<topDirectoryLocation>..</topDirectoryLocation>
+ <java.source.version>1.5</java.source.version>
+ <qpid.version>${pom.version}</qpid.version>
+ <qpid.targetDir>${project.build.directory}</qpid.targetDir>
</properties>
<dependencies>
+
<dependency>
<groupId>org.apache.qpid</groupId>
<artifactId>qpid-common</artifactId>
</dependency>
- <dependency>
- <groupId>org.apache.qpid</groupId>
- <artifactId>qpid-broker</artifactId>
- </dependency>
-
- <dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- </dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jms_1.1_spec</artifactId>
</dependency>
+
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
</dependency>
+
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.mina</groupId>
<artifactId>mina-filter-ssl</artifactId>
</dependency>
+ <!-- Test Dependencies -->
+ <dependency> <!-- for inVm Broker -->
+ <groupId>org.apache.qpid</groupId>
+ <artifactId>qpid-broker</artifactId>
+ <scope>test</scope>
+ </dependency>
+
<dependency>
<groupId>jmscts</groupId>
<artifactId>jmscts</artifactId>
@@ -85,12 +90,14 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
+ <scope>test</scope>
</dependency>
+
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymockclassextension</artifactId>
+ <scope>test</scope>
</dependency>
-
</dependencies>
<build>
@@ -115,11 +122,67 @@
</property>
<property>
<name>log4j.configuration</name>
- <value>file:///${basedir}/src/main/java/log4j.properties</value>
+ <value>file:///${basedir}/src/main/java/client.log4j</value>
</property>
</systemProperties>
</configuration>
</plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
</plugins>
+
+<!-- The inclusion of this resource causes the build to hang. -->
+ <!--resources>
+ <resource>
+ <targetPath>META-INF/</targetPath>
+ <filtering>false</filtering>
+ <directory>../resources/META-INF</directory>
+ <includes>
+ <include>**</include>
+ </includes>
+ </resource>
+ </resources-->
+
+ <testResources>
+ <testResource>
+ <targetPath>META-INF/</targetPath>
+ <filtering>false</filtering>
+ <directory>../resources/META-INF</directory>
+ <includes>
+ <include>**</include>
+ </includes>
+ </testResource>
+ <testResource>
+ <targetPath>src/</targetPath>
+ <filtering>false</filtering>
+ <directory>src/test/java</directory>
+ <includes>
+ <include>**/*.java</include>
+ </includes>
+ </testResource>
+
+ <testResource>
+ <targetPath></targetPath>
+ <filtering>false</filtering>
+ <directory>src/main/java</directory>
+ <includes>
+ <include>client.log4j</include>
+ </includes>
+ </testResource>
+ </testResources>
+
</build>
+
</project>
diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java
index 59a871a6d6..394f356b77 100644
--- a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java
+++ b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java
@@ -37,7 +37,6 @@ import org.apache.qpid.exchange.ExchangeDefaults;
import org.apache.qpid.framing.*;
import org.apache.qpid.jms.Session;
import org.apache.qpid.protocol.AMQConstant;
-import org.apache.qpid.server.handler.ExchangeBoundHandler;
import org.apache.qpid.url.AMQBindingURL;
import org.apache.qpid.url.URLSyntaxException;
@@ -1626,7 +1625,7 @@ public class AMQSession extends Closeable implements Session, QueueSession, Topi
throw new JMSAMQException(e);
}
ExchangeBoundOkBody responseBody = (ExchangeBoundOkBody) response.getMethod();
- return (responseBody.replyCode == ExchangeBoundHandler.OK);
+ return (responseBody.replyCode == 0);//ExchangeBoundHandler.OK);
}
private void checkTransacted() throws JMSException
diff --git a/qpid/java/common/pom.xml b/qpid/java/common/pom.xml
index dc0db7f954..3a7d971173 100644
--- a/qpid/java/common/pom.xml
+++ b/qpid/java/common/pom.xml
@@ -68,21 +68,44 @@
</build>
<dependencies>
+
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>
+
+
+<!-- This is a mina dependency but it isn't being picked up-->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ </dependency>
+
<dependency>
<groupId>org.apache.mina</groupId>
- <artifactId>mina-core</artifactId>
+ <artifactId>mina-java5</artifactId>
</dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
+
+ <dependency>
+ <groupId>org.apache.mina</groupId>
+ <artifactId>mina-filter-ssl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.mina</groupId>
+ <artifactId>mina-core</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jms_1.1_spec</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
</dependencies>
</project>
diff --git a/qpid/java/distribution/pom.xml b/qpid/java/distribution/pom.xml
index ca91c222ee..366b478687 100644
--- a/qpid/java/distribution/pom.xml
+++ b/qpid/java/distribution/pom.xml
@@ -16,7 +16,10 @@
specific language governing permissions and limitations
under the License.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.qpid</groupId>
<artifactId>qpid-distribution</artifactId>
@@ -36,7 +39,7 @@
<qpid.version>${pom.version}</qpid.version>
<qpid.targetDir>${project.build.directory}</qpid.targetDir>
</properties>
-
+
<repositories>
<repository>
<id>repo1.maven.org</id>
@@ -48,18 +51,15 @@
<dependencies>
<dependency>
<groupId>${pom.groupId}</groupId>
- <artifactId>qpid-common</artifactId>
- <version>${pom.version}</version>
- </dependency>
- <dependency>
- <groupId>${pom.groupId}</groupId>
<artifactId>qpid-broker</artifactId>
<version>${pom.version}</version>
+ <type>jar</type>
</dependency>
<dependency>
<groupId>${pom.groupId}</groupId>
<artifactId>qpid-client</artifactId>
<version>${pom.version}</version>
+ <type>jar</type>
</dependency>
<dependency>
<groupId>${pom.groupId}.management</groupId>
@@ -85,7 +85,7 @@
<version>${assembly.version}</version>
<configuration>
<descriptors>
- <descriptor>src/main/assembly/bin.xml</descriptor>
+ <descriptor>src/main/assembly/bin.xml</descriptor>
</descriptors>
<finalName>qpid-${pom.version}</finalName>
<outputDirectory>${qpid.targetDir}</outputDirectory>
@@ -106,14 +106,7 @@
</plugin>
</plugins>
</pluginManagement>
- <resources>
- <resource>
- <directory>src/main/java</directory>
- <includes>
- <include>**/*</include>
- </includes>
- </resource>
- </resources>
+
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
@@ -127,7 +120,6 @@
<configuration>
<descriptors>
<descriptor>src/main/assembly/bin.xml</descriptor>
- <descriptor>src/main/assembly/client-bin.xml</descriptor>
<descriptor>src/main/assembly/src.xml</descriptor>
<descriptor>src/main/assembly/management-eclipse-plugin.xml</descriptor>
<descriptor>src/main/assembly/management-eclipse-plugin-unix.xml</descriptor>
@@ -139,4 +131,74 @@
</plugin>
</plugins>
</build>
-</project>
+
+ <profiles>
+ <profile>
+ <id>tests</id>
+
+ <dependencies>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>qpid-broker</artifactId>
+ <version>${pom.version}</version>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>qpid-broker</artifactId>
+ <version>${pom.version}</version>
+ <type>test-jar</type>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>qpid-client</artifactId>
+ <version>${pom.version}</version>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>qpid-client</artifactId>
+ <version>${pom.version}</version>
+ <type>test-jar</type>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>qpid-perftests</artifactId>
+ <version>${pom.version}</version>
+ <type>test-jar</type>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>qpid-systests</artifactId>
+ <version>${pom.version}</version>
+ <type>test-jar</type>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>distribution-package</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/assembly/bin-test.xml</descriptor>
+ </descriptors>
+ <finalName>qpid-${pom.version}</finalName>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ </profile>
+ </profiles>
+
+</project>
diff --git a/qpid/java/distribution/src/main/assembly/bin-test.xml b/qpid/java/distribution/src/main/assembly/bin-test.xml
new file mode 100644
index 0000000000..b7896bd697
--- /dev/null
+++ b/qpid/java/distribution/src/main/assembly/bin-test.xml
@@ -0,0 +1,169 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<assembly>
+ <!-- id typically identifies the "type" (src vs bin etc) of the assembly -->
+ <id>java-bin-with-tests</id>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <formats>
+ <format>tar.gz</format>
+ <format>zip</format>
+ </formats>
+
+ <fileSets>
+ <fileSet>
+ <directory>src/main/release</directory>
+ <outputDirectory>qpid-${qpid.version}</outputDirectory>
+ <includes>
+ <include>DISCLAIMER</include>
+ <include>LICENSE.txt</include>
+ <include>NOTICE.txt</include>
+ <include>README.txt</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>..</directory>
+ <outputDirectory>qpid-${qpid.version}</outputDirectory>
+ <includes>
+ <include>*.txt</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>src/main/release/etc</directory>
+ <outputDirectory>qpid-${qpid.version}/etc</outputDirectory>
+ <includes>
+ <include>logging.properties</include>
+ <include>log4j.properties</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>src/main/release/docs</directory>
+ <outputDirectory>qpid-${qpid.version}/docs</outputDirectory>
+ <includes>
+ <include>RELEASE_NOTES.txt</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>target</directory>
+ <outputDirectory>qpid-${qpid.version}/lib</outputDirectory>
+ <includes>
+ <include>qpid-incubating.jar</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+ <files>
+ <!-- due to a bug in the assembly plugin (MASSEMBLY-153) you have
+ to use decimal numbers to specify fileMode -->
+ <file>
+ <source>../common/etc/qpid-run.conf</source>
+ <outputDirectory>qpid-${qpid.version}/etc</outputDirectory>
+ <destName>qpid-run.conf</destName>
+ </file>
+ <file>
+ <source>../broker/etc/config.xml</source>
+ <outputDirectory>qpid-${qpid.version}/etc</outputDirectory>
+ <destName>config.xml</destName>
+ </file>
+ <file>
+ <source>../broker/etc/log4j.xml</source>
+ <outputDirectory>qpid-${qpid.version}/etc</outputDirectory>
+ <destName>log4j.xml</destName>
+ </file>
+ <file>
+ <source>../broker/etc/passwd</source>
+ <outputDirectory>qpid-${qpid.version}/etc</outputDirectory>
+ <destName>passwd</destName>
+ </file>
+ <file>
+ <source>../broker/etc/qpid-server.conf</source>
+ <outputDirectory>qpid-${qpid.version}/etc</outputDirectory>
+ <destName>qpid-server.conf</destName>
+ </file>
+ <file>
+ <source>../broker/etc/virtualhosts.xml</source>
+ <outputDirectory>qpid-${qpid.version}/etc</outputDirectory>
+ <destName>virtualhosts.xml</destName>
+ </file>
+ <file>
+ <source>../common/bin/qpid-run</source>
+ <outputDirectory>qpid-${qpid.version}/bin</outputDirectory>
+ <destName>qpid-run</destName>
+ <fileMode>0755</fileMode>
+ </file>
+ <file>
+ <source>../broker/bin/qpid-server</source>
+ <outputDirectory>qpid-${qpid.version}/bin</outputDirectory>
+ <destName>qpid-server</destName>
+ <fileMode>0755</fileMode>
+ </file>
+ <file>
+ <source>../broker/bin/qpid-server.bat</source>
+ <outputDirectory>qpid-${qpid.version}/bin</outputDirectory>
+ <destName>qpid-server.bat</destName>
+ <fileMode>0755</fileMode>
+ </file>
+ <file>
+ <source>../broker/bin/run.bat</source>
+ <outputDirectory>qpid-${qpid.version}/bin</outputDirectory>
+ <destName>run.bat</destName>
+ <fileMode>0755</fileMode>
+ </file>
+ <file>
+ <source>../broker/bin/run.sh</source>
+ <outputDirectory>qpid-${qpid.version}/bin</outputDirectory>
+ <destName>run.sh</destName>
+ <fileMode>0755</fileMode>
+ </file>
+ <file>
+ <source>../broker/bin/runAll</source>
+ <outputDirectory>qpid-${qpid.version}/bin</outputDirectory>
+ <destName>runAll</destName>
+ <fileMode>0755</fileMode>
+ </file>
+ </files>
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>qpid-${qpid.version}/lib</outputDirectory>
+ <unpack>false</unpack>
+ <excludes>
+ <exclude>org.apache.qpid:qpid-distribution</exclude>
+ <exclude>org.apache.qpid.management:org.apache.qpid.management.ui</exclude>
+ <exclude>org.eclipse.core:org.eclipse.core.commands</exclude>
+ <exclude>org.eclipse.core:org.eclipse.core.contenttype</exclude>
+ <exclude>org.eclipse.core:org.eclipse.core.expressions</exclude>
+ <exclude>org.eclipse.core:org.eclipse.core.jobs</exclude>
+ <exclude>org.eclipse.core:org.eclipse.core.runtime</exclude>
+ <exclude>org.eclipse.core:org.eclipse.core.runtime.compatibility.auth</exclude>
+ <exclude>org.eclipse.core:org.eclipse.core.runtime.compatibility.registry</exclude>
+ <exclude>org.eclipse.equinox:org.eclipse.equinox.common</exclude>
+ <exclude>org.eclipse.equinox:org.eclipse.equinox.preferences</exclude>
+ <exclude>org.eclipse.equinox:org.eclipse.equinox.registry</exclude>
+ <exclude>org.eclipse.help:org.eclipse.help</exclude>
+ <exclude>org.eclipse.jface:org.eclipse.jface</exclude>
+ <exclude>org.eclipse.osgi:org.eclipse.osgi</exclude>
+ <exclude>org.eclipse.swt:org.eclipse.swt</exclude>
+ <exclude>org.eclipse.swt:org.eclipse.swt.win32.win32.x86</exclude>
+ <exclude>org.eclipse.ui:org.eclipse.ui</exclude>
+ <exclude>org.eclipse.ui:org.eclipse.ui.forms</exclude>
+ <exclude>org.eclipse.ui:org.eclipse.ui.workbench</exclude>
+ </excludes>
+ <scope>runtime</scope>
+ </dependencySet>
+ </dependencySets>
+</assembly>
diff --git a/qpid/java/distribution/src/main/assembly/bin.xml b/qpid/java/distribution/src/main/assembly/bin.xml
index 00ffd86bd0..978ee4df82 100644
--- a/qpid/java/distribution/src/main/assembly/bin.xml
+++ b/qpid/java/distribution/src/main/assembly/bin.xml
@@ -74,73 +74,67 @@
<source>../common/etc/qpid-run.conf</source>
<outputDirectory>qpid-${qpid.version}/etc</outputDirectory>
<destName>qpid-run.conf</destName>
- <fileMode>420</fileMode>
</file>
<file>
<source>../broker/etc/config.xml</source>
<outputDirectory>qpid-${qpid.version}/etc</outputDirectory>
<destName>config.xml</destName>
- <fileMode>420</fileMode>
</file>
<file>
<source>../broker/etc/log4j.xml</source>
<outputDirectory>qpid-${qpid.version}/etc</outputDirectory>
<destName>log4j.xml</destName>
- <fileMode>420</fileMode>
</file>
<file>
<source>../broker/etc/passwd</source>
<outputDirectory>qpid-${qpid.version}/etc</outputDirectory>
<destName>passwd</destName>
- <fileMode>420</fileMode>
</file>
<file>
<source>../broker/etc/qpid-server.conf</source>
<outputDirectory>qpid-${qpid.version}/etc</outputDirectory>
<destName>qpid-server.conf</destName>
- <fileMode>420</fileMode>
</file>
<file>
<source>../broker/etc/virtualhosts.xml</source>
<outputDirectory>qpid-${qpid.version}/etc</outputDirectory>
<destName>virtualhosts.xml</destName>
- <fileMode>420</fileMode>
</file>
<file>
<source>../common/bin/qpid-run</source>
<outputDirectory>qpid-${qpid.version}/bin</outputDirectory>
<destName>qpid-run</destName>
- <fileMode>493</fileMode>
+ <fileMode>0755</fileMode>
</file>
<file>
<source>../broker/bin/qpid-server</source>
<outputDirectory>qpid-${qpid.version}/bin</outputDirectory>
<destName>qpid-server</destName>
- <fileMode>493</fileMode>
+ <fileMode>0755</fileMode>
</file>
<file>
<source>../broker/bin/qpid-server.bat</source>
<outputDirectory>qpid-${qpid.version}/bin</outputDirectory>
<destName>qpid-server.bat</destName>
- <fileMode>493</fileMode>
+ <fileMode>0755</fileMode>
</file>
<file>
<source>../broker/bin/run.bat</source>
<outputDirectory>qpid-${qpid.version}/bin</outputDirectory>
<destName>run.bat</destName>
- <fileMode>493</fileMode>
+ <fileMode>0755</fileMode>
</file>
<file>
<source>../broker/bin/run.sh</source>
<outputDirectory>qpid-${qpid.version}/bin</outputDirectory>
<destName>run.sh</destName>
- <fileMode>493</fileMode>
+ <fileMode>0755</fileMode>
</file>
<file>
<source>../broker/bin/runAll</source>
<outputDirectory>qpid-${qpid.version}/bin</outputDirectory>
<destName>runAll</destName>
- <fileMode>493</fileMode>
+ <fileMode>0755</fileMode>
</file>
</files>
<dependencySets>
diff --git a/qpid/java/distribution/src/main/assembly/management-eclipse-plugin-unix.xml b/qpid/java/distribution/src/main/assembly/management-eclipse-plugin-unix.xml
index 5ac131b12b..1318248b2a 100644
--- a/qpid/java/distribution/src/main/assembly/management-eclipse-plugin-unix.xml
+++ b/qpid/java/distribution/src/main/assembly/management-eclipse-plugin-unix.xml
@@ -19,11 +19,10 @@
-->
<assembly>
<!-- id typically identifies the "type" (src vs bin etc) of the assembly -->
- <id>eclipse-plugin-unix</id>
+ <id>management-console-unix</id>
<includeBaseDirectory>false</includeBaseDirectory>
<formats>
<format>tar.gz</format>
- <format>zip</format>
</formats>
<!--
<moduleSets>
@@ -75,10 +74,17 @@
</includes>
</fileSet>
<fileSet>
+ <directory>../management/eclipse-plugin</directory>
+ <outputDirectory>qpidmc</outputDirectory>
+ <includes>
+ <include>README.txt</include>
+ </includes>
+ </fileSet>
+ <fileSet>
<directory>../management/eclipse-plugin/bin</directory>
<outputDirectory>qpidmc/bin</outputDirectory>
<includes>
- <include>qpidmc.sh</include>
+ <include>qpidmc*.sh</include>
</includes>
<fileMode>777</fileMode>
</fileSet>
diff --git a/qpid/java/distribution/src/main/assembly/management-eclipse-plugin.xml b/qpid/java/distribution/src/main/assembly/management-eclipse-plugin.xml
index f6c2399785..5d89c55968 100644
--- a/qpid/java/distribution/src/main/assembly/management-eclipse-plugin.xml
+++ b/qpid/java/distribution/src/main/assembly/management-eclipse-plugin.xml
@@ -74,6 +74,13 @@
</includes>
</fileSet>
<fileSet>
+ <directory>../management/eclipse-plugin</directory>
+ <outputDirectory>qpidmc</outputDirectory>
+ <includes>
+ <include>README.txt</include>
+ </includes>
+ </fileSet>
+ <fileSet>
<directory>../management/eclipse-plugin/bin</directory>
<outputDirectory>qpidmc/bin</outputDirectory>
<includes>
diff --git a/qpid/java/perftests/RunningPerformanceTests.txt b/qpid/java/perftests/RunningPerformanceTests.txt
new file mode 100644
index 0000000000..ff3d5ef4f5
--- /dev/null
+++ b/qpid/java/perftests/RunningPerformanceTests.txt
@@ -0,0 +1,112 @@
+Running Performance Tests
+-------------------------
+
+This performance test suite contains a number of tests.
+
+- Service request-reply
+- Ping-Pong
+- Topic
+
+Service request-reply
+---------------------
+
+Description:
+This is the simplest test to ensure everything is working. This involves
+one client that is known as a "service provider" and it listens on a
+well-known queue for requests. Another client, known as the "service requester"
+creates a private (temporary) response queue, creates a message with the
+private response queue set as the "reply to" field and then publishes the
+message to the well known service queue. The test allows you to time how long
+it takes to send messages and receive the response back. It also allows varying
+of the message size.
+
+Quick Run:
+
+./serviceRequestReply-QuickTest.sh <brokerdetails> <number of messages>
+
+This provides a quick test to run everything against a running broker. Simply specify broker and number of messages to run.
+
+
+Detailed Run:
+
+You must start the service provider first:
+
+serviceProvidingClient.sh <brokerdetails> [<P[ersistent]|N[onPersistent]> <T[ransacted]|N[onTransacted]>] [selector]
+
+where Brokerdetails is the connection information to the broker you are running on; e.g. localhost or localhost:5670 or tcp://10.10.10.10:5677.
+By default Non Persistent, Non Transaction messages are used in the response. A selector may also be specified.
+
+
+To run the service requester:
+
+serviceRequestingClient.sh <Brokerdetails> <Number of Messages> [<Message Size>] [<P[ersistent]|N[onPersistent]> <T[ransacted]|N[onTransacted]>]
+
+This requests the <number of messages> of a <Message Size (default 4096 bytes>. By default the connection is Non Persistent and Non Transactional.
+
+After receiving all the messages the client outputs the rate it achieved.
+
+
+Ping-Pong
+---------
+
+Description:
+Quick Run:
+Detailed Run:
+
+Topic
+-------
+
+Description:
+A more realistic test is the topic test, which tests the
+performance of the topic exchange to a configurable number of clients (e.g. 50).
+A publisher sends batches of of messages to a topic that a number of clients are
+subscribed to. The clients recevie each all the messages and then send a response.
+
+The time taken to send all messages and receive a response from all clients is displayed.
+
+Quick Run:
+
+./topic-QuickTest.sh <host> <port> <messages> <clients> <batches>
+
+This provides a quick test to run everything against a running broker. Simply specify host, port, the number of messages, number of clients and number of batches to run this quick test.
+
+Detailed Run:
+
+You must run the listener processes first:
+
+run_many.sh 10 topic "topicListener.sh [-host <host> -port <port>]"
+
+In this command, the first argument means start 10 processes, the
+second is just a name use in the log files generated and the third
+argument is the command to run the specified number of times.
+
+The topicListener by default connects to localhost:5672 this can be changed using the above flags.
+
+Then run the publisher process:
+
+headersPublisher.sh [-host <host> -port <port> -messages <number> -clients <number> -batch <number>]
+
+The default is to connect to localhost:5672 and send 1 batch of 1000 messages expecting 1 client to respond.
+
+Note that before starting the publisher you should wait about 30
+seconds to ensure all the clients are registered with the broker (you
+can see this from the broker output). Otherwise the numbers will be
+slightly skewed.
+
+
+Additional parameters to scripts
+
+Publisher
+-payload <int> : specify the payload size (256b Default)
+-delay <long> : Number of seconds to send between batches (0 Default)
+-warmup <int> : Number of messages to send as a warm up (0 Default)
+-ack <int> : Acknowledgement mode
+ - 1 : Auto
+ - 2 : Client
+ - 3 : Dups_OK
+ - 257 : No (Default)
+ - 258 : Pre
+-factory <string> : ConnectionFactoryInitialiser class
+-persistent <"true"|other> : User persistent messages if string equals "true" (false Default)
+-clientId <string> : Set client id
+-subscriptionId <string> : set subscription id
diff --git a/qpid/java/perftests/bin/serviceProvidingClient.sh b/qpid/java/perftests/bin/serviceProvidingClient.sh
index 207e4439f1..0f4264be10 100755
--- a/qpid/java/perftests/bin/serviceProvidingClient.sh
+++ b/qpid/java/perftests/bin/serviceProvidingClient.sh
@@ -17,9 +17,17 @@
# specific language governing permissions and limitations
# under the License.
#
+# args supplied: <brokerdetails> <num messages>
+
+if [[ $# != 1 ]] ; then
+ echo "usage: ./serviceProvidingClient.sh <brokerdetails> [<P[ersistent]|N[onPersistent] (default N)> <T[ransacted]|N[onTransacted] (default N)>] [selector]"
+ exit 1
+fi
+
+thehosts=$1
+shift
-# XXX -Xms1024m -XX:NewSize=300m
. ./setupclasspath.sh
echo $CP
-# usage: just pass in the host(s)
-$JAVA_HOME/bin/java -cp $CP org.apache.qpid.requestreply.ServiceProvidingClient $1 guest guest /test serviceQ
+
+$JAVA_HOME/bin/java -cp $CP -Damqj.logging.level="warn" -Damqj.test.logging.level="info" -Dlog4j.configuration=src/perftests.log4j org.apache.qpid.requestreply.ServiceProvidingClient $thehosts guest guest /test serviceQ "$@"
diff --git a/qpid/java/perftests/bin/serviceRequestReply-MultipleClients.sh b/qpid/java/perftests/bin/serviceRequestReply-MultipleClients.sh
new file mode 100755
index 0000000000..81558c2c0b
--- /dev/null
+++ b/qpid/java/perftests/bin/serviceRequestReply-MultipleClients.sh
@@ -0,0 +1,53 @@
+#!/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.
+#
+# args supplied: <brokerdetails> <num messages> <num clients>
+
+if [[ $# < 3 ]] ; then
+ echo "usage: ./serviceRequestReply-QuickTest.sh <brokerdetails> <Number of messages> <number of clients> [<P[ersistent]|N[onPersistent] (default N)> <T[ransacted]|N[onTransacted] (default N)>]"
+ exit 1
+fi
+
+thehosts=$1
+shift
+
+numberofmessages=$1
+shift
+
+numberofclients=$1
+shift
+
+. ./setupclasspath.sh
+echo $CP
+
+$JAVA_HOME/bin/java -cp $CP -Damqj.logging.level="warn" -Damqj.test.logging.level="info" -Dlog4j.configuration=src/perftests.log4j org.apache.qpid.requestreply.ServiceProvidingClient $thehosts guest guest /test serviceQ "$@" &
+
+providingclient=$!
+
+./run_many.sh $numberofclients requestClients "./serviceRequestingClient.sh $thehosts $numberofmessages $@"
+
+sleeping=$(( numberofmessages * 1 / 10 ))
+
+echo "Sleeping for $sleeping secconds to completion"
+sleep $sleeping
+
+kill $providingclient
+
+echo "Results"
+cat requestClients.*.out \ No newline at end of file
diff --git a/qpid/java/perftests/bin/serviceRequestReply-QuickTest.sh b/qpid/java/perftests/bin/serviceRequestReply-QuickTest.sh
new file mode 100755
index 0000000000..31c5e9eb74
--- /dev/null
+++ b/qpid/java/perftests/bin/serviceRequestReply-QuickTest.sh
@@ -0,0 +1,43 @@
+#!/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.
+#
+# args supplied: <brokerdetails> <num messages>
+
+if [[ $# < 2 ]] ; then
+ echo "usage: ./serviceRequestReply-QuickTest.sh <brokerdetails> <Number of messages> [<P[ersistent]|N[onPersistent] (default N)> <T[ransacted]|N[onTransacted] (default N)>]"
+ exit 1
+fi
+
+thehosts=$1
+shift
+
+numberofmessages=$1
+shift
+
+. ./setupclasspath.sh
+echo $CP
+
+$JAVA_HOME/bin/java -cp $CP -Damqj.logging.level="warn" -Damqj.test.logging.level="info" -Dlog4j.configuration=src/perftests.log4j org.apache.qpid.requestreply.ServiceProvidingClient $thehosts guest guest /test serviceQ "$@" &
+
+providingclient=$!
+
+$JAVA_HOME/bin/java -cp $CP -Damqj.logging.level="warn" -Damqj.test.logging.level="info" -Dlog4j.configuration=src/perftests.log4j org.apache.qpid.requestreply.ServiceRequestingClient $thehosts guest guest /test serviceQ $numberofmessages "$@"
+
+kill $providingclient
+
diff --git a/qpid/java/perftests/bin/serviceRequestingClient-createLogFile.sh b/qpid/java/perftests/bin/serviceRequestingClient-createLogFile.sh
new file mode 100755
index 0000000000..c078caf7d1
--- /dev/null
+++ b/qpid/java/perftests/bin/serviceRequestingClient-createLogFile.sh
@@ -0,0 +1,38 @@
+#!/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.
+#
+
+##LOGDIR=$QPID_HOME/logs
+LOGDIR=../logs
+date=`date +"%y%m%d%H%M%S"`
+LOGFILE=$LOGDIR/perftest.log.$date
+
+## create the log dir
+if [ ! -d $LOGDIR ]; then
+ mkdir $LOGDIR
+fi
+
+echo "********** Running the test **************"
+echo "creating logfile $LOGFILE"
+echo
+
+./serviceRequestingClient.sh $@ 2>&1 | tee $LOGFILE
+
+echo "********** End of test ******************"
+echo \ No newline at end of file
diff --git a/qpid/java/perftests/bin/serviceRequestingClient.sh b/qpid/java/perftests/bin/serviceRequestingClient.sh
index 7dd3d63c27..c03cc519c6 100755
--- a/qpid/java/perftests/bin/serviceRequestingClient.sh
+++ b/qpid/java/perftests/bin/serviceRequestingClient.sh
@@ -17,11 +17,18 @@
# specific language governing permissions and limitations
# under the License.
#
-# args supplied: <host:port> <num messages>
+# usage: ./serviceRequestingClient.sh <brokerdetails> <number of messages> [<message size 4096b default>] [<P[ersistent]|N[onPersistent]> <T[ransacted]|N[onTransacted]>]
+
+if [[ $# < 2 ]] ; then
+ echo "usage: ./serviceRequestingClient.sh <brokerdetails> <number of messages> [<message size 4096b default>] [<P[ersistent]|N[onPersistent]> <T[ransacted]|N[onTransacted]>]"
+ exit 1
+fi
+
thehosts=$1
shift
-echo $thehosts
+
# XXX -Xms1024m -XX:NewSize=300m
. ./setupclasspath.sh
echo $CP
-$JAVA_HOME/bin/java -cp $CP -Damqj.logging.level="INFO" org.apache.qpid.requestreply.ServiceRequestingClient $thehosts guest guest /test serviceQ "$@"
+
+$JAVA_HOME/bin/java -cp $CP -Dlog.dir="$QPID_HOME/logs" -Damqj.logging.level="warn" -Damqj.test.logging.level="info" -Dlog4j.configuration=src/perftests.log4j org.apache.qpid.requestreply.ServiceRequestingClient $thehosts guest guest /test serviceQ "$@"
diff --git a/qpid/java/perftests/bin/setupclasspath.sh b/qpid/java/perftests/bin/setupclasspath.sh
index a660392e77..ef7a037c11 100755
--- a/qpid/java/perftests/bin/setupclasspath.sh
+++ b/qpid/java/perftests/bin/setupclasspath.sh
@@ -2,8 +2,11 @@ if [ -z $QPID_HOME ] ; then
echo "QPID_HOME must be set"
exit
fi
-CP=$QPID_HOME/lib/qpid-incubating.jar:../target/classes
+
+CP=../lib/qpid-performance.jar:$QPID_HOME/lib/qpid-incubating.jar
if [ `uname -o` == "Cygwin" ] ; then
CP=`cygpath --path --windows $CP`
fi
+
+
diff --git a/qpid/java/perftests/bin/testPingClient.sh b/qpid/java/perftests/bin/testPingClient.sh
new file mode 100755
index 0000000000..4eca4a7999
--- /dev/null
+++ b/qpid/java/perftests/bin/testPingClient.sh
@@ -0,0 +1,33 @@
+#!/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.
+#
+# args supplied: <host:port>
+#
+if [[ $# < 1 ]] ; then
+ echo "usage: ./testPingClient.sh <host details> [<selector>]"
+ exit 1
+fi
+
+thehosts=$1
+shift
+echo $thehosts
+# XXX -Xms1024m -XX:NewSize=300m
+. ./setupclasspath.sh
+echo $CP
+$JAVA_HOME/bin/java -cp $CP -Damqj.logging.level="warn" -Damqj.test.logging.level="info" -Dlog4j.configuration=src/perftests.log4j org.apache.qpid.ping.TestPingClient $thehosts guest guest /test "$@"
diff --git a/qpid/java/perftests/bin/testPingProducer.sh b/qpid/java/perftests/bin/testPingProducer.sh
new file mode 100755
index 0000000000..39ab487b60
--- /dev/null
+++ b/qpid/java/perftests/bin/testPingProducer.sh
@@ -0,0 +1,33 @@
+#!/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.
+#
+# args supplied: <host:port>
+#
+if [[ $# < 1 ]] ; then
+ echo "usage: ./testPingProducer.sh <host details> [<selector>]"
+ exit 1
+fi
+
+thehosts=$1
+shift
+echo $thehosts
+# XXX -Xms1024m -XX:NewSize=300m
+. ./setupclasspath.sh
+echo $CP
+$JAVA_HOME/bin/java -cp $CP -Damqj.logging.level="warn" -Damqj.test.logging.level="info" -Dlog4j.configuration=src/perftests.log4j org.apache.qpid.ping.TestPingProducer $thehosts /test
diff --git a/qpid/java/perftests/bin/testPingPublisher.sh b/qpid/java/perftests/bin/testPingPublisher.sh
new file mode 100755
index 0000000000..e8219e7612
--- /dev/null
+++ b/qpid/java/perftests/bin/testPingPublisher.sh
@@ -0,0 +1,33 @@
+#!/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.
+#
+# args supplied: <host:port>
+#
+if [[ $# < 1 ]] ; then
+ echo "usage: ./testPingPublisher.sh <host details>"
+ exit 1
+fi
+
+thehosts=$1
+shift
+echo $thehosts
+# XXX -Xms1024m -XX:NewSize=300m
+. ./setupclasspath.sh
+echo $CP
+$JAVA_HOME/bin/java -cp $CP -Damqj.logging.level="warn" -Damqj.test.logging.level="info" -Dlog4j.configuration=src/perftests.log4j org.apache.qpid.pingpong.TestPingPublisher $thehosts /test
diff --git a/qpid/java/perftests/bin/testPingSubscriber.sh b/qpid/java/perftests/bin/testPingSubscriber.sh
new file mode 100755
index 0000000000..a0520be093
--- /dev/null
+++ b/qpid/java/perftests/bin/testPingSubscriber.sh
@@ -0,0 +1,33 @@
+#!/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.
+#
+# args supplied: <host:port>
+#
+if [[ $# < 1 ]] ; then
+ echo "usage: ./testPingSubscriber.sh <host details> [<selector>]"
+ exit 1
+fi
+
+thehosts=$1
+shift
+echo $thehosts
+# XXX -Xms1024m -XX:NewSize=300m
+. ./setupclasspath.sh
+echo $CP
+$JAVA_HOME/bin/java -cp $CP -Damqj.logging.level="warn" -Damqj.test.logging.level="debug" -Dlog4j.configuration=src/perftests.log4j org.apache.qpid.pingpong.TestPingSubscriber $thehosts guest guest /test "$@"
diff --git a/qpid/java/perftests/bin/topic-QuickTest.sh b/qpid/java/perftests/bin/topic-QuickTest.sh
new file mode 100755
index 0000000000..931f102893
--- /dev/null
+++ b/qpid/java/perftests/bin/topic-QuickTest.sh
@@ -0,0 +1,55 @@
+#!/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.
+#
+# args supplied: <host> <port> <messages> <clients> <batches>
+
+if [[ $# < 5 ]] ; then
+ echo "usage: ./topic-QuickTest.sh <host> <port> <messages> <clients> <batches> [other params for both listener and publisher]"
+ exit 1
+fi
+
+host=$1
+shift
+
+port=$1
+shift
+
+nomessages=$1
+shift
+
+noclients=$1
+shift
+
+batches=$1
+shift
+
+sleeptime=$(( 2 * $noclients ))
+
+. ./setupclasspath.sh
+echo $CP
+
+./run_many.sh $noclients topic "$JAVA_HOME/bin/java -cp $CP -Damqj.logging.level='warn' -Damqj.test.logging.level='info' -Dlog4j.configuration=src/perftests.log4j org.apache.qpid.topic.Listener -host $host -port $port $@" &
+
+echo
+echo "Pausing for $sleeptime seconds to allow clients to connect"
+sleep $sleeptime
+
+$JAVA_HOME/bin/java -cp $CP -Damqj.logging.level="warn" -Damqj.test.logging.level="info" -Dlog4j.configuration=src/perftests.log4j org.apache.qpid.topic.Publisher -host $host -port $port -messages $nomessages -clients $noclients -batch $batches $@
+
+
diff --git a/qpid/java/perftests/bin/topicListener.sh b/qpid/java/perftests/bin/topicListener.sh
index 454efefe7d..757a8c9edb 100755
--- a/qpid/java/perftests/bin/topicListener.sh
+++ b/qpid/java/perftests/bin/topicListener.sh
@@ -22,4 +22,5 @@
# XXX -Xmx512m -Xms512m -XX:NewSize=150m
. ./setupclasspath.sh
echo $CP
-$JAVA_HOME/bin/java -cp $CP -Damqj.logging.level="INFO" org.apache.qpid.topic.Listener $*
+
+$JAVA_HOME/bin/java -cp $CP -Damqj.logging.level="warn" -Damqj.test.logging.level="info" -Dlog4j.configuration=src/perftests.log4j org.apache.qpid.topic.Listener $@
diff --git a/qpid/java/perftests/bin/topicPublisher.sh b/qpid/java/perftests/bin/topicPublisher.sh
index cc3a8736cc..8bcdaca3c4 100755
--- a/qpid/java/perftests/bin/topicPublisher.sh
+++ b/qpid/java/perftests/bin/topicPublisher.sh
@@ -20,4 +20,4 @@
# XXX -Xmx512m -Xms512m -XX:NewSize=150m
. ./setupclasspath.sh
-$JAVA_HOME/bin/java -cp $CP -Damqj.logging.level="INFO" org.apache.qpid.topic.Publisher $*
+$JAVA_HOME/bin/java -cp $CP -Damqj.logging.level="warn" -Damqj.test.logging.level="info" -Dlog4j.configuration=src/perftests.log4j org.apache.qpid.topic.Publisher $@
diff --git a/qpid/java/perftests/distribution/pom.xml b/qpid/java/perftests/distribution/pom.xml
new file mode 100644
index 0000000000..010f19c9f0
--- /dev/null
+++ b/qpid/java/perftests/distribution/pom.xml
@@ -0,0 +1,127 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT 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 xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.qpid</groupId>
+ <artifactId>qpid-perftests-distribution</artifactId>
+ <packaging>jar</packaging>
+ <version>1.0-incubating-M2-SNAPSHOT</version>
+ <name>Qpid Performance Tests Distribution</name>
+ <url>http://cwiki.apache.org/confluence/display/qpid</url>
+
+ <parent>
+ <groupId>org.apache.qpid</groupId>
+ <artifactId>qpid</artifactId>
+ <version>1.0-incubating-M2-SNAPSHOT</version>
+ </parent>
+
+ <properties>
+ <topDirectoryLocation>..</topDirectoryLocation>
+ <java.source.version>1.5</java.source.version>
+ <qpid.version>${pom.version}</qpid.version>
+ <qpid.targetDir>${project.build.directory}</qpid.targetDir>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.qpid</groupId>
+ <artifactId>qpid-perftests</artifactId>
+ <type>jar</type>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.qpid</groupId>
+ <artifactId>qpid-perftests</artifactId>
+ <type>test-jar</type>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>uk.co.thebadgerset</groupId>
+ <artifactId>junit-toolkit</artifactId>
+ <version>0.4</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>${java.source.version}</source>
+ <target>${java.source.version}</target>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>${assembly.version}</version>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/assembly/performance.xml</descriptor>
+ </descriptors>
+ <finalName>qpid-${pom.version}</finalName>
+ <outputDirectory>${qpid.targetDir}</outputDirectory>
+ <tarLongFileMode>gnu</tarLongFileMode>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <finalName>qpid-performance</finalName>
+ <archive>
+ <manifest>
+ <addClasspath>true</addClasspath>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>distribution-package</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/assembly/performance.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+
+ </build>
+
+</project>
diff --git a/qpid/java/perftests/distribution/src/main/assembly/performance.xml b/qpid/java/perftests/distribution/src/main/assembly/performance.xml
new file mode 100644
index 0000000000..a564261a24
--- /dev/null
+++ b/qpid/java/perftests/distribution/src/main/assembly/performance.xml
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<assembly>
+ <id>performance-test-java</id>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <formats>
+ <format>tar.gz</format>
+ <format>zip</format>
+ </formats>
+
+ <fileSets>
+ <!-- Apache Licensing -->
+ <fileSet>
+ <directory>../../resources</directory>
+ <outputDirectory>qpid-${qpid.version}</outputDirectory>
+ <includes>
+ <include>DISCLAIMER</include>
+ <include>LICENSE.txt</include>
+ <include>NOTICE.txt</include>
+ <include>README.txt</include>
+ </includes>
+ </fileSet>
+
+ <fileSet>
+ <directory>../../release-docs</directory>
+ <outputDirectory>qpid-${qpid.version}/docs</outputDirectory>
+ <includes>
+ <include>RELEASE_NOTES.txt</include>
+ </includes>
+ </fileSet>
+
+ <!-- Performance txt files-->
+ <fileSet>
+ <directory>..</directory>
+ <outputDirectory>qpid-${qpid.version}</outputDirectory>
+ <includes>
+ <include>*.txt</include>
+ </includes>
+ </fileSet>
+
+ <!-- Execution Scripts -->
+ <fileSet>
+ <directory>../bin</directory>
+ <outputDirectory>qpid-${qpid.version}/bin</outputDirectory>
+ <includes>
+ <include>*</include>
+ </includes>
+ <fileMode>777</fileMode>
+ </fileSet>
+
+ <!-- Provide Source in easy access location -->
+ <fileSet>
+ <directory>../src/main</directory>
+ <outputDirectory>qpid-${qpid.version}/src</outputDirectory>
+ <includes>
+ <include>**/*.java</include>
+ <include>**/*.log4j</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>../src/test</directory>
+ <outputDirectory>qpid-${qpid.version}/src</outputDirectory>
+ <includes>
+ <include>**/*.java</include>
+ </includes>
+ </fileSet>
+
+ <!-- Metadata Jar -->
+ <fileSet>
+ <directory>target</directory>
+ <outputDirectory>qpid-${qpid.version}/lib</outputDirectory>
+ <includes>
+ <include>qpid-performance.jar</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>qpid-${qpid.version}/lib</outputDirectory>
+ <unpack>false</unpack>
+ <excludes>
+ <exclude>org.apache.qpid:qpid-perftests-distribution</exclude>
+ </excludes>
+ </dependencySet>
+ </dependencySets>
+</assembly>
diff --git a/qpid/java/perftests/jar-with-dependencies.xml b/qpid/java/perftests/jar-with-dependencies.xml
new file mode 100644
index 0000000000..99bfac65bf
--- /dev/null
+++ b/qpid/java/perftests/jar-with-dependencies.xml
@@ -0,0 +1,29 @@
+<!-- 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/perftests/pom.xml b/qpid/java/perftests/pom.xml
index 3af906c4ac..d97a78ea09 100644
--- a/qpid/java/perftests/pom.xml
+++ b/qpid/java/perftests/pom.xml
@@ -35,21 +35,262 @@
<properties>
<topDirectoryLocation>..</topDirectoryLocation>
+ <log4j.perftests>perftests.log4j</log4j.perftests>
</properties>
<dependencies>
+
<dependency>
<groupId>org.apache.qpid</groupId>
<artifactId>qpid-client</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </dependency>
+
+ <!-- Test dependencies. -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>uk.co.thebadgerset</groupId>
+ <artifactId>junit-toolkit</artifactId>
+ </dependency>
+
</dependencies>
-<!-- <build>
+ <build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <!--<skip>true</skip>-->
+ </configuration>
+ </plugin>
+
+ <!-- The JUnit Toolkit maven2 plugin is in the process of being added to the maven repository. It will take a day or two from 16/1/2007.
+
+ Configures the toolkit test runner for performance testing. These can be run from within maven, or by using the generated
+ scripts.
+
+ To run from maven:
+
+ mvn uk.co.thebadgerset:junit-toolkit-maven-plugin:tktest
+
+ To run from the command line (after doing assembly:assembly goal):
+
+ java -cp target/test_jar-jar-with-dependencies.jar uk.co.thebadgerset.junit.extensions.TKTestRunner -s 1 -r 100000 -o target org.apache.qpid.requestreply.PingPongTestPerf
+
+ To generate the scripts do:
+
+ mvn uk.co.thebadgerset:junit-toolkit-maven-plugin:tkscriptgen
+
+ Then to run the scripts do (after doing assembly:assembly goal):
+
+ ./bin/script_name or ./bin/script_name.bat
+
+ These scripts can find everything in the 'all test dependencies' jar created by the assembly:assembly goal.
+ -->
+
+ <plugin>
+ <groupId>uk.co.thebadgerset</groupId>
+ <artifactId>junit-toolkit-maven-plugin</artifactId>
+ <version>0.3</version>
+
+ <configuration>
+ <scriptOutDirectory>target</scriptOutDirectory>
+ <testJar>${project.build.finalName}-all-test-deps.jar</testJar>
+
+ <systemproperties>
+ <property>
+ <name>log4j.configuration</name>
+ <value>${log4j.perftests}</value>
+ </property>
+ <property>
+ <name>amqj.logging.level</name>
+ <value>warn</value>
+ </property>
+ <property>
+ <name>badger.level</name>
+ <value>warn</value>
+ </property>
+ <property>
+ <name>amqj.test.logging.level</name>
+ <value>info</value>
+ </property>
+ </systemproperties>
+
+ <commands>
+ <!-- Run the ping pong test once. This is just to check toolkit test runner is working. Real tests follow. -->
+ <PingOnce>-n PingOnce -s [1] -r 1 -t testPingOk -o . org.apache.qpid.ping.PingTestPerf</PingOnce>
+
+ <!-- Tests the accuracy of the throttle implementation at different speeds. Throttle is used to restrict message rate in some tsts. -->
+ <ThrottleTest>-n ThrottleTest -r 5 -s [10,10000],samples=100,exp -t testThrottle -o . org.apache.qpid.ping.ThrottleTestPerf</ThrottleTest>
+
+ <!--
+ Skim Tests.
+ These are not part of the performance suite. They run quick tests to check that the different combinations of
+ options that the performance suite uses are going to work.
+ -->
+ <Skim-Tx>-n Skim-Tx -s [1000] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf transacted=true</Skim-Tx>
+ <Skim-Size>-n Skim-Size -s [1000] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf messageSize=51200</Skim-Size>
+ <Skim-Many>-n Skim-Many -s [1] -c [4] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf</Skim-Many>
+ <Skim-Queues>-n Skim-Queues -s [1000] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf destinationcount=10</Skim-Queues>
+ <Skim-Duration>-n Skim-Duration -s [1000] -d10S -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf</Skim-Duration>
+ <Skim-Rate>-n Skim-Rate -s [1000] -d10S -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf rate=100</Skim-Rate>
+
+ <!-- P2P Volume Tests. -->
+ <VT-Qpid-1>-n VT-Qpid-1 -s [15000000] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf pubsub=true BatchSize=10000 CommitBatchSize=20000 transacted=true</VT-Qpid-1>
+ <VT-Qpid-2>-n VT-Qpid-2 -s [15000000] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf pubsub=true BatchSize=10000</VT-Qpid-2>
+ <VT-Qpid-3>-n VT-Qpid-3 -s [1000000] -d 24H -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf pubsub=true CommitBatchSize=20000 rate=10000 transacted=true</VT-Qpid-3>
+ <VT-Qpid-4>-n VT-Qpid-4 -s [1000000] -d 24H -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf pubsub=true </VT-Qpid-4>
+
+ <!-- P2P Scalability Tests. -->
+ <PT-Qpid-1>-n PT-Qpid-1 -s [250000] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf pubsub=true CommitBatchSize=20000 transacted=true</PT-Qpid-1>
+ <PT-Qpid-2>-n PT-Qpid-2 -s [250000] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf pubsub=true </PT-Qpid-2>
+ <PT-Qpid-3>-n PT-Qpid-3 -s [250000] -c[10] -o .-t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf pubsub=true CommitBatchSize=20000 transacted=true destinationname=ping</PT-Qpid-3>
+ <PT-Qpid-4>-n PT-Qpid-4 -s [250000] -c[10] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf pubsub=true destinationname=ping</PT-Qpid-4>
+ <PT-Qpid-5>-n PT-Qpid-5 -s [250000] -c[10] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf pubsub=true transacted=true</PT-Qpid-5>
+ <PT-Qpid-6>-n PT-Qpid-6 -s [250000] -c[10] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf pubsub=true</PT-Qpid-6>
+ <PT-Qpid-7>-n PT-Qpid-7 -s [250000] -c[10] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf pubsub=true transacted=true destinationcount=10</PT-Qpid-7>
+ <PT-Qpid-8>-n PT-Qpid-8 -s [250000] -c[10] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf pubsub=true destinationcount=10</PT-Qpid-8>
+ <PT-Qpid-9>-n PT-Qpid-9 -s [250000] -c[100] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf pubsub=true transacted=true</PT-Qpid-9>
+ <PT-Qpid-10>-n PT-Qpid-10 -s [250000] -c[100] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf pubsub=true</PT-Qpid-10>
+ <PT-Qpid-11>-n PT-Qpid-11 -s [250000] -c[100] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf pubsub=true transacted=true destinationcount=10</PT-Qpid-11>
+ <PT-Qpid-12>-n PT-Qpid-12 -s [250000] -c[100] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf pubsub=true destinationcount=10</PT-Qpid-12>
+ <PT-Qpid-13>-n PT-Qpid-13 -s [250000] -c[1000] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf pubsub=true transacted=true</PT-Qpid-13>
+ <PT-Qpid-14>-n PT-Qpid-14 -s [250000] -c[1000] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf pubsub=true</PT-Qpid-14>
+
+ <!-- P2P Volume Tests. -->
+ <VQ-Qpid-1>-n VQ-Qpid-1 -s [900000] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf transacted=true</VQ-Qpid-1>
+ <VQ-Qpid-2>-n VQ-Qpid-2 -s [900000] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf</VQ-Qpid-2>
+ <VQ-Qpid-3>-n VQ-Qpid-3 -s [10000] -d 24H -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf rate=10000 transacted=true</VQ-Qpid-3>
+ <VQ-Qpid-4>-n VQ-Qpid-4 -s [10000] -d 24H -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf rate=10000</VQ-Qpid-4>
+
+ <!-- P2P Scalability Tests. -->
+ <PQ-Qpid-1>-n PQ-Qpid-1 -s [15000] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf transacted=true</PQ-Qpid-1>
+ <PQ-Qpid-2>-n PQ-Qpid-2 -s [15000] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf</PQ-Qpid-2>
+ <PQ-Qpid-3>-n PQ-Qpid-3 -s [15000] -c[10] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf transacted=true destinationname=ping</PQ-Qpid-3>
+ <PQ-Qpid-4>-n PQ-Qpid-4 -s [15000] -c[10] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf destinationname=ping</PQ-Qpid-4>
+ <PQ-Qpid-5>-n PQ-Qpid-5 -s [15000] -c[10] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf transacted=true</PQ-Qpid-5>
+ <PQ-Qpid-6>-n PQ-Qpid-6 -s [15000] -c[10] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf</PQ-Qpid-6>
+ <PQ-Qpid-7>-n PQ-Qpid-7 -s [15000] -c[10] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf transacted=true destinationcount=10</PQ-Qpid-7>
+ <PQ-Qpid-8>-n PQ-Qpid-8 -s [15000] -c[10] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf destinationcount=10</PQ-Qpid-8>
+ <PQ-Qpid-9>-n PQ-Qpid-9 -s [15000] -c[100] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf transacted=true</PQ-Qpid-9>
+ <PQ-Qpid-10>-n PQ-Qpid-10 -s [15000] -c[100] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf</PQ-Qpid-10>
+ <PQ-Qpid-11>-n PQ-Qpid-11 -s [15000] -c[100] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf transacted=true destinationcount=10</PQ-Qpid-11>
+ <PQ-Qpid-12>-n PQ-Qpid-12 -s [15000] -c[100] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf destinationcount=10</PQ-Qpid-12>
+ <PQ-Qpid-13>-n PQ-Qpid-13 -s [15000] -c[1000] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf transacted=true</PQ-Qpid-13>
+ <PQ-Qpid-14>-n PQ-Qpid-14 -s [15000] -c[1000] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf</PQ-Qpid-14>
+
+ <!-- Increasing Message Payload Tests. -->
+ <LT-Qpid-1-512b>-n LT-Qpid-1-512b -s [1000000] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf pubsub=true messageSize=512 transacted=true</LT-Qpid-1-512b>
+ <LT-Qpid-2-512b>-n LT-Qpid-2-512b -s [1000000] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf pubsub=true messageSize=512</LT-Qpid-2-512b>
+ <LT-Qpid-1-1K>-n LT-Qpid-1-1K -s [1000000] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf pubsub=true transacted=true</LT-Qpid-1-1K>
+ <LT-Qpid-2-1K>-n LT-Qpid-2-1K -s [1000000] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf pubsub=true</LT-Qpid-2-1K>
+ <LT-Qpid-1-5K>-n LT-Qpid-1-5K -s [1000000] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf pubsub=true messageSize=5120 transacted=true</LT-Qpid-1-5K>
+ <LT-Qpid-2-5K>-n LT-Qpid-2-5K -s [1000000] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf pubsub=true messageSize=5120</LT-Qpid-2-5K>
+ <LT-Qpid-1-10K>-n LT-Qpid-1-10K -s [1000000] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf pubsub=true messageSize=10240 transacted=true</LT-Qpid-1-10K>
+ <LT-Qpid-2-10K>-n LT-Qpid-2-10K -s [1000000] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf pubsub=true messageSize=10240</LT-Qpid-2-10K>
+ <LT-Qpid-1-50K>-n LT-Qpid-1-50K -s [1000000] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf pubsub=true messageSize=51200 transacted=true</LT-Qpid-1-50K>
+ <LT-Qpid-2-50K>-n LT-Qpid-2-50K -s [1000000] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf pubsub=true messageSize=51200</LT-Qpid-2-50K>
+ <LT-Qpid-1-1M>-n LT-Qpid-1-1M -s [1000000] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf pubsub=true messageSize=1048576 transacted=true</LT-Qpid-1-1M>
+ <LT-Qpid-2-1M>-n LT-Qpid-2-1M -s [1000000] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf pubsub=true messageSize=1048476</LT-Qpid-2-1M>
+
+
+ <LT-Qpid-3-512b>-n LT-Qpid-3-512b -s [900000] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf messageSize=512 transacted=true</LT-Qpid-3-512b>
+ <LT-Qpid-4-512b>-n LT-Qpid-4-512b -s [900000] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf messageSize=512</LT-Qpid-4-512b>
+ <LT-Qpid-3-1K>-n LT-Qpid-3-1K -s [900000] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf transacted=true</LT-Qpid-3-1K>
+ <LT-Qpid-4-1K>-n LT-Qpid-4-1K -s [900000] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf </LT-Qpid-4-1K>
+ <LT-Qpid-3-5K>-n LT-Qpid-3-5K -s [900000] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf messageSize=5120 transacted=true</LT-Qpid-3-5K>
+ <LT-Qpid-4-5K>-n LT-Qpid-4-5K -s [900000] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf messageSize=5120</LT-Qpid-4-5K>
+ <LT-Qpid-3-10K>-n LT-Qpid-3-10K -s [900000] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf messageSize=10240 transacted=true</LT-Qpid-3-10K>
+ <LT-Qpid-4-10K>-n LT-Qpid-4-10K -s [900000] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf messageSize=10240</LT-Qpid-4-10K>
+ <LT-Qpid-3-50K>-n LT-Qpid-3-50K -s [900000] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf messageSize=51200 transacted=true</LT-Qpid-3-50K>
+ <LT-Qpid-4-50K>-n LT-Qpid-4-50K -s [900000] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf messageSize=51200</LT-Qpid-4-50K>
+ <LT-Qpid-3-1M>-n LT-Qpid-3-1M -s [900000] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf messageSize=1048576 transacted=true</LT-Qpid-3-1M>
+ <LT-Qpid-4-1M>-n LT-Qpid-4-1M -s [900000] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf messageSize=1048576</LT-Qpid-4-1M>
+
+ <!-- Failover Tests. -->
+ <FT-Qpid-1>-n FT-Qpid-1 -s [250000] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf CommitBatchSize=125000 broker="tcp://localhost:5001;tcp://localhost:5002" transacted=true FailBeforeSend=true</FT-Qpid-1>
+ <FT-Qpid-2>-n FT-Qpid-2 -s [250000] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf CommitBatchSize=125000 broker="tcp://localhost:5001;tcp://localhost:5002" transacted=true FailAfterSend=true</FT-Qpid-2>
+ <FT-Qpid-3>-n FT-Qpid-3 -s [250000] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf CommitBatchSize=125000 broker="tcp://localhost:5001;tcp://localhost:5002" transacted=true FailAfterCommit=true</FT-Qpid-3>
+
+ <FT-Qpid-4>-n FT-Qpid-4 -s [250000] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf broker="tcp://localhost:5001;tcp://localhost:5002" transacted=false FailBeforeSend=true</FT-Qpid-4>
+ <FT-Qpid-5>-n FT-Qpid-5 -s [250000] -o . -t testAsyncPingOk org.apache.qpid.ping.PingAsyncTestPerf broker="tcp://localhost:5001;tcp://localhost:5002" transacted=false FailAfterSend=true</FT-Qpid-5>
+
+
+ </commands>
+ </configuration>
+
+ <executions>
+ <execution>
+ <phase>test</phase>
+ <!--<goals>
+ <goal>tktest</goal>
+ </goals>-->
+ </execution>
+ </executions>
+ </plugin>
+
+
+ <!-- Bundles all the dependencies, fully expanded into a single jar, required to run the tests.
+
+ Usefull when bundling system, integration or performance tests into a convenient
+ package to hand over to testers. To use it run:
+
+ java -cp target/your_app_name-all-test-deps.jar path.to.your.Class
+
+ or often:
+
+ java -cp target/your_app_name-all-test-deps.jar junit.framework.textui.TestRunner path.to.your.test.Class
+
+ or other JUnit test runner invocations.
+ -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.2-SNAPSHOT</version>
+ <configuration>
+ <descriptors>
+ <descriptor>jar-with-dependencies.xml</descriptor>
+ </descriptors>
+ <outputDirectory>target</outputDirectory>
+ <workDirectory>target/assembly/work</workDirectory>
+ </configuration>
+ </plugin>
+
</plugins>
- </build>-->
+
+ <resources>
+ <!-- Include source files in built jar -->
+ <resource>
+ <targetPath>src/</targetPath>
+ <filtering>false</filtering>
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**/*.java</include>
+ </includes>
+ </resource>
+ <!-- Include a log4j configuration in the jar at the root level (don't name this log4j.properties though as won't be able to override it). -->
+ <resource>
+ <targetPath>/</targetPath>
+ <filtering>false</filtering>
+ <directory>src/main/java</directory>
+ <includes>
+ <include>perftests.log4j</include>
+ </includes>
+ </resource>
+ </resources>
+ </build>
+
</project>
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
new file mode 100644
index 0000000000..c0f236b833
--- /dev/null
+++ b/qpid/java/perftests/src/main/java/org/apache/qpid/client/message/TestMessageFactory.java
@@ -0,0 +1,118 @@
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.qpid.client.message;
+
+import org.apache.mina.common.ByteBuffer;
+import org.apache.mina.common.SimpleByteBufferAllocator;
+
+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.Queue;
+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 JMSTextMessage newJMSTextMessage(int size, String encoding) throws JMSException
+ {
+ ByteBuffer byteBuffer = (new SimpleByteBufferAllocator()).allocate(size, true);
+ JMSTextMessage message = new JMSTextMessage(byteBuffer, encoding);
+ 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)
+ {
+ 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/ping/AbstractPingClient.java b/qpid/java/perftests/src/main/java/org/apache/qpid/ping/AbstractPingClient.java
new file mode 100644
index 0000000000..68dd98ff6b
--- /dev/null
+++ b/qpid/java/perftests/src/main/java/org/apache/qpid/ping/AbstractPingClient.java
@@ -0,0 +1,204 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.io.IOException;
+import java.text.SimpleDateFormat;
+
+import javax.jms.JMSException;
+
+import org.apache.log4j.Logger;
+
+import org.apache.qpid.client.AMQConnection;
+import org.apache.qpid.jms.Session;
+
+/**
+ * Provides common functionality that ping clients (the recipients of ping messages) can use. This base class keeps
+ * track of the connection used to send pings, provides a convenience method to commit a transaction only when a session
+ * to commit on is transactional, keeps track of whether the ping client is pinging to a queue or a topic, provides
+ * prompts to the console to terminate brokers before and after commits, in order to test failover functionality, and
+ * provides a convience formatter for outputing readable timestamps for pings.
+ *
+ * <p><table id="crc"><caption>CRC Card</caption>
+ * <tr><th> Responsibilities <th> Collaborations
+ * <tr><td> Commit the current transcation on a session.
+ * <tr><td> Generate failover promts.
+ * <tr><td> Keep track the connection.
+ * <tr><td> Keep track of p2p or topic ping type.
+ * </table>
+ *
+ * @todo This base class does not seem particularly usefull and all functionality is duplicated in {@link AbstractPingProducer}.
+ * Merge it into that class.
+ */
+public abstract class AbstractPingClient
+{
+ private static final Logger _logger = Logger.getLogger(TestPingClient.class);
+
+ /** A convenient formatter to use when time stamping output. */
+ protected static final SimpleDateFormat timestampFormatter = new SimpleDateFormat("hh:mm:ss:SS");
+
+ /** 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;
+
+ /**
+ * Convenience method to commit the transaction on the specified session. If the session to commit on is not
+ * a transactional session, 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.trace("Failing Before Commit");
+ doFailover();
+ }
+
+ session.commit();
+
+ if (_failAfterCommit)
+ {
+ _logger.trace("Failing After Commit");
+ doFailover();
+ }
+
+ _logger.trace("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.");
+
+ }
+
+ /**
+ * 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;
+ }
+}
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/ping/AbstractPingProducer.java b/qpid/java/perftests/src/main/java/org/apache/qpid/ping/AbstractPingProducer.java
new file mode 100644
index 0000000000..f9d1deecba
--- /dev/null
+++ b/qpid/java/perftests/src/main/java/org/apache/qpid/ping/AbstractPingProducer.java
@@ -0,0 +1,523 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.io.IOException;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import javax.jms.*;
+import javax.jms.Connection;
+import javax.jms.Message;
+
+import org.apache.log4j.Logger;
+
+import org.apache.qpid.client.AMQDestination;
+import org.apache.qpid.client.AMQNoConsumersException;
+import org.apache.qpid.client.AMQQueue;
+import org.apache.qpid.client.AMQTopic;
+import org.apache.qpid.client.message.TestMessageFactory;
+import org.apache.qpid.jms.Session;
+
+/**
+ * Provides common functionality that ping producers (the senders of ping messages) can use. This base class keeps
+ * track of the connection used to send pings; provides a convenience method to commit a transaction only when a session
+ * to commit on is transactional; keeps track of whether the ping client is pinging to a queue or a topic; provides
+ * prompts to the console to terminate brokers before and after commits, in order to test failover functionality;
+ * requires sub-classes to implement a ping loop, that this provides a run loop to repeatedly call; provides a
+ * default shutdown hook to cleanly terminate the run loop; keeps track of the destinations to send pings to;
+ * provides a convenience method to generate short pauses; and provides a convience formatter for outputing readable
+ * timestamps for pings.
+ *
+ * <p><table id="crc"><caption>CRC Card</caption>
+ * <tr><th> Responsibilities <th> Collaborations
+ * <tr><td> Commit the current transcation on a session.
+ * <tr><td> Generate failover promts.
+ * <tr><td> Keep track the connection.
+ * <tr><td> Keep track of p2p or topic ping type.
+ * <tr><td> Call ping loop to repeatedly send pings.
+ * <tr><td> Provide a shutdown hook.
+ * <tr><td> Generate short pauses.
+ * </table>
+ *
+ * @todo Destination count versus list of desintations is redundant. Use _destinions.size() to get the count and
+ * use a list of 1 destination when only 1 is needed. It is only important to distinguish when 1 destination
+ * is shared between multiple ping producers on the same JVM or if each ping producer has its own single
+ * destination.
+ *
+ * @todo Timestamp messages in nanos, not millis. Millis seems to have bad resolution, at least on windows.
+ */
+public abstract class AbstractPingProducer implements Runnable, ExceptionListener
+{
+ private static final Logger _logger = Logger.getLogger(AbstractPingProducer.class);
+
+ /** Flag used to indicate if this is a point to point or pub/sub ping client. */
+ private boolean _isPubSub = false;
+
+ /** A convenient formatter to use when time stamping output. */
+ protected static final DateFormat timestampFormatter = new SimpleDateFormat("hh:mm:ss:SS");
+
+ /**
+ * 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.
+ */
+ private static AtomicInteger _queueSequenceID = new AtomicInteger();
+
+ /** Used to tell the ping loop when to terminate, it only runs while this is true. */
+ protected boolean _publish = true;
+
+ /** Holds the connection to the broker. */
+ private Connection _connection;
+
+ /** Holds the producer session, needed to create ping messages. */
+ private Session _producerSession;
+
+ /** Holds the number of destinations that this ping producer will send pings to, defaulting to a single destination. */
+ protected int _destinationCount = 1;
+
+ /** Holds the set of destiniations that this ping producer pings. */
+ private List<Destination> _destinations = new ArrayList<Destination>();
+
+ /** Holds the message producer to send the pings through. */
+ protected org.apache.qpid.jms.MessageProducer _producer;
+
+ /** Flag used to indicate that the user should be prompted to terminate a broker, to test failover before a commit. */
+ protected boolean _failBeforeCommit = false;
+
+ /** Flag used to indicate that the user should be prompted to terminate a broker, to test failover after a commit. */
+ protected boolean _failAfterCommit = false;
+
+ /** Flag used to indicate that the user should be prompted to terminate a broker, to test failover before a send. */
+ protected boolean _failBeforeSend = false;
+
+ /** Flag used to indicate that the user should be prompted to terminate a broker, to test failover after a send. */
+ protected boolean _failAfterSend = false;
+
+ /** Flag used to indicate that failover prompting should only be done on the first commit, not on every commit. */
+ protected boolean _failOnce = true;
+
+ /** Holds the number of sends that should be performed in every transaction when using transactions. */
+ protected int _txBatchSize = 1;
+
+ /**
+ * 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 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)
+ { }
+ }
+ }
+
+ /**
+ * Implementations should provide this method to perform a single ping cycle (which may send many messages). The
+ * run loop will repeatedly call this method until the publish flag is set to false.
+ */
+ public abstract void pingLoop();
+
+ /**
+ * 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 JMSException All underlying JMSException are allowed to fall through.
+ */
+ public ObjectMessage getTestMessage(Destination replyQueue, int messageSize, boolean persistent) throws JMSException
+ {
+ ObjectMessage msg = TestMessageFactory.newObjectMessage(_producerSession, replyQueue, messageSize, persistent);
+ // Timestamp the message.
+ msg.setLongProperty("timestamp", System.currentTimeMillis());
+
+ return msg;
+ }
+
+ /**
+ * Stops the ping loop by clearing the publish flag. The current loop will complete before it notices that this
+ * flag has been cleared.
+ */
+ public void stop()
+ {
+ _publish = false;
+ }
+
+ /**
+ * 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)
+ {
+ _publish = false;
+ _logger.debug("There was a JMSException: " + e.getMessage(), e);
+ }
+
+ /**
+ * 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();
+ }
+ });
+ }
+
+ /**
+ * Gets the underlying connection that this ping client is running on.
+ *
+ * @return The underlying connection that this ping client is running on.
+ */
+ public Connection getConnection()
+ {
+ return _connection;
+ }
+
+ /**
+ * Sets the connection that this ping client is using.
+ *
+ * @param connection The ping connection.
+ */
+ public void setConnection(Connection connection)
+ {
+ this._connection = connection;
+ }
+
+ /**
+ * Gets the producer session that the ping client is using to send pings on.
+ *
+ * @return The producer session that the ping client is using to send pings on.
+ */
+ public Session getProducerSession()
+ {
+ return _producerSession;
+ }
+
+ /**
+ * Keeps track of the producer session that the ping client is using to send pings on.
+ *
+ * @param session The producer session that the ping client is using to send pings on.
+ */
+ public void setProducerSession(Session session)
+ {
+ this._producerSession = session;
+ }
+
+ /**
+ * Gets the number of destinations that this ping client is sending to.
+ *
+ * @return The number of destinations that this ping client is sending to.
+ */
+ public int getDestinationsCount()
+ {
+ return _destinationCount;
+ }
+
+ /**
+ * Sets the number of destination that this ping client should send to.
+ *
+ * @param count The number of destination that this ping client should send to.
+ *
+ * @deprectaed Use _destinations.size() instead.
+ */
+ public void setDestinationsCount(int count)
+ {
+ this._destinationCount = count;
+ }
+
+ /**
+ * Commits the transaction on the producer session.
+ *
+ * @throws JMSException All underlying JMSExceptions are allowed to fall through.
+ *
+ * @deprecated Use the commitTx(Session session) method instead, to explicitly specify which session is being
+ * committed. This makes it more obvious what is going on.
+ */
+ protected void commitTx() throws JMSException
+ {
+ commitTx(getProducerSession());
+ }
+
+ /**
+ * Creates the specified number of destinations to send pings to. Topics or Queues will be created depending on
+ * the value of the {@link #_isPubSub} flag.
+ *
+ * @param count The number of ping destinations to create.
+ */
+ protected void createDestinations(int count)
+ {
+ // Create the desired number of ping destinations.
+ for (int i = 0; i < count; i++)
+ {
+ AMQDestination destination = null;
+
+ // Check if this is a pub/sub pinger, in which case create topics.
+ if (isPubSub())
+ {
+ String name =
+ new String("AMQTopic_" + _queueSequenceID.incrementAndGet() + "_" + System.currentTimeMillis());
+ destination = new AMQTopic(name);
+ }
+ // Otherwise this is a p2p pinger, in which case create queues.
+ else
+ {
+ String name =
+ new String("AMQQueue_" + _queueSequenceID.incrementAndGet() + "_" + System.currentTimeMillis());
+ destination = new AMQQueue(name, name, false, false);
+ }
+
+ _destinations.add(destination);
+ }
+ }
+
+ /**
+ * Returns the destination from the destinations list with the given index.
+ *
+ * @param index The index of the destination to get.
+ *
+ * @return Destination with the given index.
+ */
+ protected Destination getDestination(int index)
+ {
+ return _destinations.get(index);
+ }
+
+ /**
+ * Convenience method to commit the transaction on the specified session. If the session to commit on is not
+ * a transactional session, 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.
+ *
+ * @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 void commitTx(Session session) throws JMSException
+ {
+ _logger.trace("Batch time reached");
+ if (_failAfterSend)
+ {
+ _logger.trace("Batch size reached");
+ if (_failOnce)
+ {
+ _failAfterSend = false;
+ }
+
+ _logger.trace("Failing After Send");
+ doFailover();
+ }
+
+ if (session.getTransacted())
+ {
+ try
+ {
+ if (_failBeforeCommit)
+ {
+ if (_failOnce)
+ {
+ _failBeforeCommit = false;
+ }
+
+ _logger.trace("Failing Before Commit");
+ doFailover();
+ }
+
+ session.commit();
+
+ if (_failAfterCommit)
+ {
+ if (_failOnce)
+ {
+ _failAfterCommit = false;
+ }
+
+ _logger.trace("Failing After Commit");
+ doFailover();
+ }
+
+ _logger.trace("Session Commited.");
+ }
+ catch (JMSException e)
+ {
+ _logger.trace("JMSException on commit:" + e.getMessage(), e);
+
+ // Warn that the bounce back client is not available.
+ if (e.getLinkedException() instanceof AMQNoConsumersException)
+ {
+ _logger.debug("No consumers on queue.");
+ }
+
+ try
+ {
+ session.rollback();
+ _logger.trace("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;
+ }
+ }
+ }
+ }
+
+ /**
+ * Sends the specified message to the default destination of the ping producer.
+ *
+ * @param message The message to send.
+ *
+ * @throws JMSException All underlying JMSExceptions are allowed to fall through.
+ */
+ protected void sendMessage(Message message) throws JMSException
+ {
+ sendMessage(null, message);
+ }
+
+ /**
+ * Sends the message to the specified destination. If the destination is null, it gets sent to the default destination
+ * of the ping producer. If an explicit destination is set, this overrides the default.
+ *
+ * @param destination The destination to send to.
+ * @param message The message to send.
+ *
+ * @throws JMSException All underlying JMSExceptions are allowed to fall through.
+ */
+ protected void sendMessage(Destination destination, Message message) throws JMSException
+ {
+ if (_failBeforeSend)
+ {
+ if (_failOnce)
+ {
+ _failBeforeSend = false;
+ }
+
+ _logger.trace("Failing Before Send");
+ doFailover();
+ }
+
+ if (destination == null)
+ {
+ _producer.send(message);
+ }
+ else
+ {
+ _producer.send(destination, message);
+ }
+ }
+
+ /**
+ * 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 then press return");
+ 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 then press return");
+ try
+ {
+ System.in.read();
+ }
+ catch (IOException e)
+ { }
+
+ System.out.println("Continuing.");
+ }
+}
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingClient.java b/qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingClient.java
new file mode 100644
index 0000000000..949ace20e1
--- /dev/null
+++ b/qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingClient.java
@@ -0,0 +1,192 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.net.InetAddress;
+
+import javax.jms.*;
+
+import org.apache.log4j.Logger;
+
+import org.apache.qpid.client.AMQConnection;
+import org.apache.qpid.client.AMQQueue;
+import org.apache.qpid.jms.Session;
+
+/**
+ * PingClient is a message listener that received time stamped ping messages. It can work out how long a ping took,
+ * provided that its clokc is synchronized to that of the ping producer, or by running it on the same machine (or jvm)
+ * as the ping producer.
+ * <p/>
+ * <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/>
+ * <p><table id="crc"><caption>CRC Card</caption>
+ * <tr><th> Responsibilities <th> Collaborations
+ * <tr><td> Provide command line invocation to start the ping consumer on a configurable broker url.
+ * </table>
+ *
+ * @todo Add a better command line interpreter to the main method. The command line is not very nice...
+ */
+class TestPingClient extends AbstractPingClient implements MessageListener
+{
+ private static final Logger _logger = Logger.getLogger(TestPingClient.class);
+
+ /**
+ * Used to indicate that the reply generator should log timing info to the console (logger info level).
+ */
+ private boolean _verbose = false;
+
+ /**
+ * The producer session.
+ */
+ private Session _consumerSession;
+
+ /**
+ * Creates a TestPingClient on the specified session.
+ *
+ * @param brokerDetails
+ * @param username
+ * @param password
+ * @param queueName
+ * @param virtualpath
+ * @param transacted
+ * @param selector
+ * @param verbose
+ * @param afterCommit
+ *@param beforeCommit @throws Exception All underlying exceptions allowed to fall through. This is only test code...
+ */
+ public TestPingClient(String brokerDetails, String username, String password, String queueName, String virtualpath,
+ boolean transacted, String selector, boolean verbose, boolean afterCommit, boolean beforeCommit) throws Exception
+ {
+ // Create a connection to the broker.
+ InetAddress address = InetAddress.getLocalHost();
+ String clientID = address.getHostName() + System.currentTimeMillis();
+
+ setConnection(new AMQConnection(brokerDetails, username, password, clientID, virtualpath));
+
+ // Create a transactional or non-transactional session depending on the command line parameter.
+ _consumerSession = (Session) getConnection().createSession(transacted, Session.AUTO_ACKNOWLEDGE);
+
+ // Connect a consumer to the ping queue and register this to be called back by it.
+ Queue q = new AMQQueue(queueName);
+ MessageConsumer consumer = _consumerSession.createConsumer(q, 1, false, false, selector);
+
+ consumer.setMessageListener(this);
+
+ // Hang on to the verbose flag setting.
+ _verbose = verbose;
+
+ // Set failover interrupts
+ _failAfterCommit = afterCommit;
+ _failBeforeCommit = beforeCommit;
+ }
+
+ /**
+ * Starts a stand alone ping-pong client running in verbose mode.
+ *
+ * @param args
+ */
+ public static void main(String[] args) throws Exception
+ {
+ _logger.info("Starting...");
+
+ // Display help on the command line.
+ if (args.length < 4)
+ {
+ System.out.println(
+ "Usage: brokerdetails username password virtual-path [queueName] [verbose] [transacted] [selector] [failover:<before|after>:commit]");
+ System.exit(1);
+ }
+
+ // Extract all command line parameters.
+ String brokerDetails = args[0];
+ String username = args[1];
+ String password = args[2];
+ String virtualpath = args[3];
+ String queueName = (args.length >= 5) ? args[4] : "ping";
+ boolean verbose = (args.length >= 6) ? Boolean.parseBoolean(args[5]) : true;
+ boolean transacted = (args.length >= 7) ? Boolean.parseBoolean(args[6]) : false;
+ String selector = (args.length == 8) ? args[7] : null;
+
+ boolean afterCommit = false;
+ boolean beforeCommit = false;
+
+ for (String arg : args)
+ {
+ if (arg.startsWith("failover:"))
+ {
+ //failover:<before|after>:<send:commit>
+ String[] parts = arg.split(":");
+ if (parts.length == 3)
+ {
+ if (parts[2].equals("commit"))
+ {
+ afterCommit = parts[1].equals("after");
+ beforeCommit = parts[1].equals("before");
+ }
+ }
+ else
+ {
+ System.out.println("Unrecognized failover request:" + arg);
+ }
+ }
+ }
+
+ // Create the test ping client and set it running.
+ TestPingClient pingClient =
+ new TestPingClient(brokerDetails, username, password, queueName, virtualpath, transacted, selector, verbose, afterCommit, beforeCommit);
+
+ pingClient.getConnection().start();
+
+ System.out.println("Waiting...");
+ }
+ /**
+ * 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.
+ *
+ * @param message The message that triggered this callback.
+ */
+ public void onMessage(javax.jms.Message message)
+ {
+ try
+ {
+ // 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;
+ System.out.println("Ping time: " + diff);
+ }
+ }
+
+ // Commit the transaction if running in transactional mode.
+ commitTx(_consumerSession);
+ }
+ catch (JMSException e)
+ {
+ _logger.error("There was a JMSException: " + e.getMessage(), e);
+ }
+ }
+}
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingItself.java b/qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingItself.java
new file mode 100644
index 0000000000..acb0135b86
--- /dev/null
+++ b/qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingItself.java
@@ -0,0 +1,223 @@
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.qpid.ping;
+
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.ObjectMessage;
+
+import org.apache.log4j.Logger;
+
+import org.apache.qpid.requestreply.PingPongProducer;
+import org.apache.qpid.topic.Config;
+
+/**
+ * This class is used to test sending and receiving messages to (pingQueue) and from a queue (replyQueue).
+ * The producer and consumer created by this test send and receive messages to and from the same Queue. ie.
+ * pingQueue and replyQueue are same.
+ * This class extends @see org.apache.qpid.requestreply.PingPongProducer which different ping and reply Queues
+ */
+public class TestPingItself extends PingPongProducer
+{
+ private static final Logger _logger = Logger.getLogger(TestPingItself.class);
+
+ /**
+ * If noOfDestinations is <= 1 : There will be one Queue and one consumer instance for the test
+ * If noOfDestinations is > 1 : This creats a client for tests with multiple queues. Creates as many consumer instances
+ * as there are queues, each listening to a Queue. A producer is created which picks up a queue from
+ * the list of queues to send message
+ *
+ * @param brokerDetails
+ * @param username
+ * @param password
+ * @param virtualpath
+ * @param queueName
+ * @param selector
+ * @param transacted
+ * @param persistent
+ * @param messageSize
+ * @param verbose
+ * @param afterCommit
+ * @param beforeCommit
+ * @param afterSend
+ * @param beforeSend
+ * @param failOnce
+ * @param batchSize
+ * @param noOfDestinations
+ * @throws Exception
+ */
+ public TestPingItself(String brokerDetails, String username, String password, String virtualpath, String queueName,
+ String selector, boolean transacted, boolean persistent, int messageSize, boolean verbose,
+ boolean afterCommit, boolean beforeCommit, boolean afterSend, boolean beforeSend, boolean failOnce,
+ int batchSize, int noOfDestinations, int rate, boolean pubsub) throws Exception
+ {
+ super(brokerDetails, username, password, virtualpath, queueName, selector, transacted, persistent,
+ messageSize, verbose, afterCommit, beforeCommit, afterSend, beforeSend, failOnce, batchSize,
+ noOfDestinations, rate, pubsub);
+
+ if (noOfDestinations > DEFAULT_DESTINATION_COUNT)
+ {
+ createDestinations(noOfDestinations);
+ _persistent = persistent;
+ _messageSize = messageSize;
+ _verbose = verbose;
+
+ createConsumers(selector);
+ createProducer();
+ }
+ }
+
+ /**
+ * Sets the replyQueue to be the same as ping queue.
+ */
+ @Override
+ public void createConsumer(String selector) throws JMSException
+ {
+ // Create a message consumer to get the replies with and register this to be called back by it.
+ setReplyDestination(getPingDestination());
+ MessageConsumer consumer =
+ getConsumerSession().createConsumer(getReplyDestination(), PREFETCH, false, EXCLUSIVE, selector);
+ consumer.setMessageListener(this);
+ }
+
+ /**
+ * Starts a ping-pong loop running from the command line.
+ *
+ * @param args The command line arguments as defined above.
+ */
+ public static void main(String[] args) throws Exception
+ {
+ // Extract the command line.
+ Config config = new Config();
+ config.setOptions(args);
+ if (args.length == 0)
+ {
+ _logger.info("Running test with default values...");
+ }
+
+ String brokerDetails = config.getHost() + ":" + config.getPort();
+ String virtualpath = "/test";
+ boolean verbose = true;
+ boolean transacted = config.isTransacted();
+ boolean persistent = config.usePersistentMessages();
+ int messageSize = (config.getPayload() != 0) ? config.getPayload() : DEFAULT_MESSAGE_SIZE;
+ int messageCount = config.getMessages();
+ int destCount = (config.getDestinationsCount() != 0) ? config.getDestinationsCount() : DEFAULT_DESTINATION_COUNT;
+ int batchSize = (config.getBatchSize() != 0) ? config.getBatchSize() : DEFAULT_BATCH_SIZE;
+ int rate = (config.getRate() != 0) ? config.getRate() : DEFAULT_RATE;
+ boolean pubsub = config.isPubSub();
+
+ String destName = config.getDestination();
+ if (destName == null)
+ {
+ destName = PING_DESTINATION_NAME;
+ }
+
+ boolean afterCommit = false;
+ boolean beforeCommit = false;
+ boolean afterSend = false;
+ boolean beforeSend = false;
+ boolean failOnce = false;
+
+ for (String arg : args)
+ {
+ if (arg.startsWith("failover:"))
+ {
+ //failover:<before|after>:<send:commit>
+ String[] parts = arg.split(":");
+ if (parts.length == 3)
+ {
+ if (parts[2].equals("commit"))
+ {
+ afterCommit = parts[1].equals("after");
+ beforeCommit = parts[1].equals("before");
+ }
+
+ if (parts[2].equals("send"))
+ {
+ afterSend = parts[1].equals("after");
+ beforeSend = parts[1].equals("before");
+ }
+
+ if (parts[1].equals("once"))
+ {
+ failOnce = true;
+ }
+
+ }
+ else
+ {
+ System.out.println("Unrecognized failover request:" + arg);
+ }
+ }
+ }
+
+ // Create a ping producer to handle the request/wait/reply cycle.
+ TestPingItself pingItself = new TestPingItself(brokerDetails, "guest", "guest", virtualpath, destName, null,
+ transacted, persistent, messageSize, verbose, afterCommit,
+ beforeCommit, afterSend, beforeSend, failOnce, batchSize,
+ destCount, rate, pubsub);
+
+ pingItself.getConnection().start();
+
+ // Create a shutdown hook to terminate the ping-pong producer.
+ Runtime.getRuntime().addShutdownHook(pingItself.getShutdownHook());
+
+ // Ensure that the ping pong producer is registered to listen for exceptions on the connection too.
+ pingItself.getConnection().setExceptionListener(pingItself);
+
+ if ((destCount > DEFAULT_DESTINATION_COUNT) || (messageCount > 0))
+ {
+ _logger.info("Destinations Count:" + destCount + ", Transacted:" + transacted + ", persistent:" +
+ persistent + ",Message Size:" + messageSize + " bytes, pubsub:" + pubsub);
+ pingItself.pingLoop();
+ }
+ else
+ {
+ _logger.info("Destination:" + destName + ", Transacted:" + transacted + ", persistent:" +
+ persistent + ",Message Size:" + messageSize + " bytes, pubsub:" + pubsub);
+ // set the message count to 0 to run this loop
+ // Run a few priming pings to remove warm up time from test results.
+ pingItself.prime(PRIMING_LOOPS);
+
+ _logger.info("Running the infinite loop and pinging the broker...");
+ // Create the ping loop thread and run it until it is terminated by the shutdown hook or exception.
+ Thread pingThread = new Thread(pingItself);
+ pingThread.run();
+ pingThread.join();
+ }
+
+ pingItself.getConnection().close();
+ }
+
+ private static void usage()
+ {
+ System.err.println("Usage: TestPingPublisher \n" + "-host : broker host" + "-port : broker port" +
+ "-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" +
+ "-payload : paylaod size. Default is 0\n" +
+ "-messages : no of messages to be sent (if 0, the ping loop will run indefinitely)\n" +
+ "-destinationscount : no of destinations for multi-destinations test\n" +
+ "-batchsize : batch size\n" +
+ "-rate : thruput rate\n");
+ System.exit(0);
+ }
+}
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingProducer.java b/qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingProducer.java
new file mode 100644
index 0000000000..d9e81d39de
--- /dev/null
+++ b/qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingProducer.java
@@ -0,0 +1,249 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.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.jms.MessageProducer;
+import org.apache.qpid.jms.Session;
+
+/**
+ * PingProducer is a client that sends timestamped pings to a queue. It is designed to be run from the command line
+ * as a stand alone test tool, but it may also be fairly easily instantiated by other code by supplying a session and
+ * configured message producer.
+ * <p/>
+ * <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 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 loop cleanly.
+ * <p/>
+ * <p/><table id="crc"><caption>CRC Card</caption>
+ * <tr><th> Responsibilities <th> Collaborations
+ * <tr><td> Provide a ping cycle.
+ * <tr><td> Provide command line invocation to loop the ping cycle on a configurable broker url.
+ * </table>
+ */
+class TestPingProducer extends AbstractPingProducer
+{
+ private static final Logger _logger = Logger.getLogger(TestPingProducer.class);
+
+ /**
+ * Used to set up a default message size.
+ */
+ private static final int DEFAULT_MESSAGE_SIZE = 0;
+
+ /**
+ * Used to define how long to wait between pings.
+ */
+ private static final long SLEEP_TIME = 250;
+
+ /**
+ * Holds the name of the queue to send pings on.
+ */
+ private static final String PING_QUEUE_NAME = "ping";
+
+ private static TestPingProducer _pingProducer;
+
+ /**
+ * Determines whether this producer sends persistent messages from the run method.
+ */
+ private boolean _persistent = false;
+
+ /**
+ * Holds the message size to send, from the run method.
+ */
+ private int _messageSize = DEFAULT_MESSAGE_SIZE;
+
+ /**
+ * Used to indicate that the ping loop should print out whenever it pings.
+ */
+ private boolean _verbose = false;
+
+ public TestPingProducer(String brokerDetails, String username, String password, String virtualpath, String queueName,
+ boolean transacted, boolean persistent, int messageSize, boolean verbose, boolean afterCommit,
+ boolean beforeCommit, boolean afterSend, boolean beforeSend, boolean failOnce, int batchSize)
+ throws Exception
+ {
+ // Create a connection to the broker.
+ InetAddress address = InetAddress.getLocalHost();
+ String clientID = address.getHostName() + System.currentTimeMillis();
+
+ setConnection(new AMQConnection(brokerDetails, username, password, clientID, virtualpath));
+
+ // Create a transactional or non-transactional session, based on the command line arguments.
+ setProducerSession((Session) getConnection().createSession(transacted, Session.AUTO_ACKNOWLEDGE));
+
+ // Create a queue to send the pings on.
+ Queue pingQueue = new AMQQueue(queueName);
+ _producer = (MessageProducer) getProducerSession().createProducer(pingQueue);
+
+ _persistent = persistent;
+ _messageSize = messageSize;
+
+ _verbose = verbose;
+
+ // Set failover interrupts
+ _failAfterCommit = afterCommit;
+ _failBeforeCommit = beforeCommit;
+ _failAfterSend = afterSend;
+ _failBeforeSend = beforeSend;
+ _txBatchSize = batchSize;
+ _failOnce = failOnce;
+ }
+
+ /**
+ * Starts a ping-pong loop running from the command line. The bounce back client {@link TestPingClient} also needs
+ * to be started to bounce the pings back again.
+ *
+ * @param args The command line arguments as defined above.
+ */
+ public static void main(String[] args) throws Exception
+ {
+ // Extract the command line.
+ if (args.length < 2)
+ {
+ System.err.println(
+ "Usage: TestPingPublisher <brokerDetails> <virtual path> "
+ + "[<verbose(true|false)> <transacted(true|false))> <persistent(true|false)> <message size in bytes> <batchsize>");
+ System.exit(0);
+ }
+
+ String brokerDetails = args[0];
+ String virtualpath = args[1];
+ boolean verbose = (args.length >= 3) ? Boolean.parseBoolean(args[2]) : true;
+ boolean transacted = (args.length >= 4) ? Boolean.parseBoolean(args[3]) : false;
+ boolean persistent = (args.length >= 5) ? Boolean.parseBoolean(args[4]) : false;
+ int messageSize = (args.length >= 6) ? Integer.parseInt(args[5]) : DEFAULT_MESSAGE_SIZE;
+ int batchSize = (args.length >= 7) ? Integer.parseInt(args[6]) : 1;
+
+ boolean afterCommit = false;
+ boolean beforeCommit = false;
+ boolean afterSend = false;
+ boolean beforeSend = false;
+ boolean failOnce = false;
+
+ for (String arg : args)
+ {
+ if (arg.startsWith("failover:"))
+ {
+ //failover:<before|after>:<send:commit>
+ String[] parts = arg.split(":");
+ if (parts.length == 3)
+ {
+ if (parts[2].equals("commit"))
+ {
+ afterCommit = parts[1].equals("after");
+ beforeCommit = parts[1].equals("before");
+ }
+
+ if (parts[2].equals("send"))
+ {
+ afterSend = parts[1].equals("after");
+ beforeSend = parts[1].equals("before");
+ }
+
+ if (parts[1].equals("once"))
+ {
+ failOnce = true;
+ }
+ }
+ else
+ {
+ System.out.println("Unrecognized failover request:" + arg);
+ }
+ }
+ }
+
+ // Create a ping producer to generate the pings.
+ _pingProducer = new TestPingProducer(brokerDetails, "guest", "guest", virtualpath, PING_QUEUE_NAME, transacted,
+ persistent, messageSize, verbose, afterCommit, beforeCommit, afterSend,
+ beforeSend, failOnce, batchSize);
+
+ // Start the connection running.
+ _pingProducer.getConnection().start();
+
+ // Create a shutdown hook to terminate the ping-pong producer.
+ Runtime.getRuntime().addShutdownHook(_pingProducer.getShutdownHook());
+
+ // Ensure the ping loop execption listener is registered on the connection to terminate it on error.
+ _pingProducer.getConnection().setExceptionListener(_pingProducer);
+
+ // Start the ping loop running until it is interrupted.
+ Thread pingThread = new Thread(_pingProducer);
+ pingThread.run();
+ pingThread.join();
+ }
+
+ /**
+ * Sends the specified ping message.
+ *
+ * @param message The message to send.
+ * @throws JMSException All underlying JMSExceptions are allowed to fall through.
+ */
+ public void ping(Message message) throws JMSException
+ {
+ sendMessage(message);
+
+ // Keep the messageId to correlate with the reply.
+ String messageId = message.getJMSMessageID();
+
+ // Commit the transaction if running in transactional mode. This must happen now, rather than at the end of
+ // this method, as the message will not be sent until the transaction is committed.
+ commitTx();
+ }
+
+ /**
+ * The ping loop implementation. This send out pings of the configured size, persistence and transactionality, and
+ * waits for short pauses in between each.
+ */
+ public void pingLoop()
+ {
+ try
+ {
+ // Generate a sample message and time stamp it.
+ ObjectMessage msg = getTestMessage(null, _messageSize, _persistent);
+ msg.setLongProperty("timestamp", System.currentTimeMillis());
+
+ // Send the message.
+ ping(msg);
+
+ if (_verbose)
+ {
+ System.out.println("Pinged at: " + timestampFormatter.format(new Date())); //" + " with id: " + msg.getJMSMessageID());
+ }
+ // Introduce a short pause if desired.
+ pause(SLEEP_TIME);
+ }
+ catch (JMSException e)
+ {
+ _publish = false;
+ _logger.error("There was a JMSException: " + e.getMessage(), e);
+ }
+ }
+}
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingPublisher.java b/qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingPublisher.java
new file mode 100644
index 0000000000..3b2dcc4d36
--- /dev/null
+++ b/qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingPublisher.java
@@ -0,0 +1,197 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.qpid.pingpong;
+
+import org.apache.log4j.Logger;
+import org.apache.qpid.client.AMQConnection;
+import org.apache.qpid.AMQException;
+import org.apache.qpid.url.URLSyntaxException;
+import org.apache.qpid.client.AMQTopic;
+import org.apache.qpid.client.BasicMessageProducer;
+import org.apache.qpid.client.message.TestMessageFactory;
+import org.apache.qpid.jms.MessageProducer;
+import org.apache.qpid.jms.Session;
+
+import javax.jms.*;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
+/**
+ * A client that behaves as follows:
+ * <ul><li>Connects to a queue, whose name is specified as a cmd-line argument</li>
+ * <li>Creates a temporary queue</li>
+ * <li>Creates messages containing a property that is the name of the temporary queue</li>
+ * <li>Fires off a message on the original queue and waits for a response on the temporary queue</li>
+ * </ul>
+ */
+public class TestPingPublisher implements ExceptionListener
+{
+ private static final Logger _log = Logger.getLogger(TestPingPublisher.class);
+
+ private AMQConnection _connection;
+
+ private boolean _publish;
+ private static int _messageSize = 0;
+ private long SLEEP_TIME = 0L;
+
+// private class CallbackHandler implements MessageListener
+// {
+//
+// private int _actualMessageCount;
+//
+//
+// public void onMessage(Message m)
+// {
+// if (_log.isDebugEnabled())
+// {
+// _log.debug("Message received: " + m);
+// }
+// _actualMessageCount++;
+// if (_actualMessageCount % 1000 == 0)
+// {
+// _log.info("Received message count: " + _actualMessageCount);
+// }
+// }
+// }
+
+ public TestPingPublisher(String brokerDetails, String clientID, String virtualpath) throws AMQException, URLSyntaxException
+ {
+ try
+ {
+ createConnection(brokerDetails, clientID, virtualpath);
+
+ Session session = (Session) _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ //AMQQueue destination = new AMQQueue("ping");
+ AMQTopic destination = new AMQTopic("ping");
+ MessageProducer producer = (MessageProducer) session.createProducer(destination);
+
+ _connection.setExceptionListener(this);
+
+ _connection.start();
+
+ int msgCount = 0;
+ while (_publish)
+ {
+/*
+ TextMessage msg = session.createTextMessage(
+ "Presented to in conjunction with Mahnah Mahnah and the Snowths: " + ++messageNumber);
+*/
+ ObjectMessage msg = null;
+ if (_messageSize != 0)
+ {
+ msg = TestMessageFactory.newObjectMessage(session, _messageSize);
+ }
+ else
+ {
+ msg = session.createObjectMessage();
+ }
+
+ Long time = System.nanoTime();
+ msg.setStringProperty("timestampString", Long.toString(time));
+ msg.setLongProperty("timestamp", time);
+
+ ((BasicMessageProducer) producer).send(msg, DeliveryMode.PERSISTENT, true);
+
+ _log.info("Message Sent:" + msgCount++);
+ _log.debug(msg);
+
+ if (msgCount == Integer.MAX_VALUE)
+ {
+ _publish = false;
+ }
+
+ if (SLEEP_TIME > 0)
+ {
+ try
+ {
+ Thread.sleep(SLEEP_TIME);
+ }
+ catch (InterruptedException ie)
+ {
+ //do nothing
+ }
+ }
+ }
+
+ }
+ catch (JMSException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ private void createConnection(String brokerDetails, String clientID, String virtualpath) throws AMQException, URLSyntaxException
+ {
+ _publish = true;
+ _connection = new AMQConnection(brokerDetails, "guest", "guest", clientID, virtualpath);
+ _log.info("Connected with URL:" + _connection.toURL());
+ }
+
+ /**
+ * @param args argument 1 if present specifies the name of the temporary queue to create. Leaving it blank
+ * means the server will allocate a name.
+ */
+ public static void main(String[] args)
+ {
+ if (args.length < 2)
+ {
+ System.err.println("Usage: TestPingPublisher <brokerDetails> <virtual path> [message size in bytes]");
+ System.exit(0);
+ }
+ try
+ {
+ InetAddress address = InetAddress.getLocalHost();
+ String clientID = address.getHostName() + System.currentTimeMillis();
+ if (args.length > 2 )
+ {
+ _messageSize = Integer.parseInt(args[2]);
+ }
+ new TestPingPublisher(args[0], clientID, args[1]);
+ }
+ catch (UnknownHostException e)
+ {
+ e.printStackTrace();
+ }
+ catch (AMQException e)
+ {
+ System.err.println("Error in client: " + e);
+ e.printStackTrace();
+ }
+ catch (URLSyntaxException e)
+ {
+ System.err.println("Error in connection arguments : " + e);
+ }
+
+ //System.exit(0);
+ }
+
+ /**
+ * @see javax.jms.ExceptionListener#onException(javax.jms.JMSException)
+ */
+ public void onException(JMSException e)
+ {
+ System.err.println(e.getMessage());
+
+ _publish = false;
+ e.printStackTrace(System.err);
+ }
+}
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingSubscriber.java b/qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingSubscriber.java
new file mode 100644
index 0000000000..b43319744a
--- /dev/null
+++ b/qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingSubscriber.java
@@ -0,0 +1,134 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.qpid.pingpong;
+
+import org.apache.log4j.Logger;
+import org.apache.log4j.Level;
+import org.apache.qpid.client.AMQConnection;
+import org.apache.qpid.client.AMQTopic;
+import org.apache.qpid.jms.Session;
+
+import javax.jms.MessageConsumer;
+import javax.jms.MessageListener;
+import javax.jms.Topic;
+import javax.jms.JMSException;
+import java.net.InetAddress;
+
+public class TestPingSubscriber
+{
+ private static final Logger _logger = Logger.getLogger(TestPingSubscriber.class);
+
+ private static class TestPingMessageListener implements MessageListener
+ {
+ public TestPingMessageListener()
+ {
+ }
+
+ long _lastTimestamp = 0L;
+ long _lastTimestampString = 0L;
+
+ public void onMessage(javax.jms.Message message)
+ {
+ Long time = System.nanoTime();
+
+ if (_logger.isInfoEnabled())
+ {
+ long timestampString = 0L;
+
+ try
+ {
+ long timestamp = message.getLongProperty("timestamp");
+ timestampString = Long.parseLong(message.getStringProperty("timestampString"));
+
+ if (timestampString != timestamp)
+ {
+ _logger.info("Timetamps differ!:\n" +
+ "timestamp:" + timestamp + "\n" +
+ "timestampString:" + timestampString);
+ }
+
+ }
+ catch (JMSException jmse)
+ {
+ _logger.error("JMSException caught:" + jmse.getMessage(), jmse);
+ }
+
+
+ long stringDiff = time - timestampString;
+
+ _logger.info("Ping: TS:" + stringDiff / 1000 + "us");
+
+ // _logger.info(_name + " got message '" + message + "\n");
+ }
+ }
+ }
+
+ public static void main(String[] args)
+ {
+ _logger.info("Starting...");
+
+ if (args.length < 4)
+ {
+ System.out.println("Usage: brokerdetails username password virtual-path [selector] ");
+ System.exit(1);
+ }
+ try
+ {
+ InetAddress address = InetAddress.getLocalHost();
+ AMQConnection con1 = new AMQConnection(args[0], args[1], args[2],
+ address.getHostName(), args[3]);
+
+ _logger.info("Connected with URL:" + con1.toURL());
+
+ final org.apache.qpid.jms.Session session1 = (org.apache.qpid.jms.Session)
+ con1.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+
+ String selector = null;
+
+ if (args.length == 5)
+ {
+ selector = args[4];
+ _logger.info("Message selector is <" + selector + ">...");
+ }
+ else
+ {
+ _logger.info("Not using message selector ");
+ }
+
+ Topic t = new AMQTopic("ping");
+
+ MessageConsumer consumer1 = session1.createConsumer(t,
+ 1, false, false, selector);
+
+ consumer1.setMessageListener(new TestPingMessageListener());
+ con1.start();
+ }
+ catch (Throwable t)
+ {
+ System.err.println("Fatal error: " + t);
+ t.printStackTrace();
+ }
+
+ System.out.println("Waiting...");
+ }
+}
+
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/ping/Throttle.java b/qpid/java/perftests/src/main/java/org/apache/qpid/ping/Throttle.java
new file mode 100644
index 0000000000..a33ba4557a
--- /dev/null
+++ b/qpid/java/perftests/src/main/java/org/apache/qpid/ping/Throttle.java
@@ -0,0 +1,67 @@
+package org.apache.qpid.ping;
+
+/**
+ * Throttle is a helper class used in situations where a controlled rate of processing is desired. It allows a certain
+ * number of operations-per-second to be defined and supplies a {@link #throttle} method that can only be called at
+ * most at that rate. The first call to the throttle method will return immediately, subsequent calls will introduce
+ * a short pause to fill out the remainder of the current cycle to attain the desired rate. If there is no remainder
+ * left then it will return immediately.
+ *
+ * <p><table id="crc"><caption>CRC Card</caption>
+ * <tr><th> Responsibilities <th> Collaborations
+ * </table>
+ *
+ * @author Rupert Smith
+ */
+public class Throttle
+{
+ /** Holds the length of the cycle in nano seconds. */
+ long cycleLengthNanos = 0L;
+
+ /** Records the nano time of the last call to the throttle method. */
+ long lastTimeNanos = 0L;
+
+ /**
+ * Sets up the desired rate of operation per second that the throttle method should restrict to.
+ *
+ * @param opsPerSecond The maximum number of calls per second that the throttle method will take.
+ */
+ public void setRate(int opsPerSecond)
+ {
+ // Calculate the length of a cycle.
+ cycleLengthNanos = 1000000000 / opsPerSecond;
+ }
+
+ /**
+ * Introduces a short pause to fill out any time left in the cycle since this method was last called, of length
+ * defined by a call to the {@link #setRate} method.
+ */
+ public void throttle()
+ {
+ // Record the time now.
+ long currentTimeNanos = System.nanoTime();
+
+ // Check if there is any time remaining in the current cycle and introduce a short wait to fill out the
+ // remainder of the cycle if needed.
+ long remainingTimeNanos = cycleLengthNanos - (currentTimeNanos - lastTimeNanos);
+
+ if (remainingTimeNanos > 0)
+ {
+ long milliWait = remainingTimeNanos / 1000000;
+ int nanoWait = (int) (remainingTimeNanos % 1000000);
+
+ try
+ {
+ Thread.currentThread().sleep(milliWait, nanoWait);
+ }
+ catch (InterruptedException e)
+ {
+ // Just ignore this?
+ }
+ }
+
+ // Keep the time of the last call to this method to calculate the next cycle.
+ //lastTimeNanos = currentTimeNanos;
+ lastTimeNanos = System.nanoTime();
+ }
+}
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
new file mode 100644
index 0000000000..0fde5c6c3c
--- /dev/null
+++ b/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongBouncer.java
@@ -0,0 +1,300 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.net.InetAddress;
+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.ping.AbstractPingClient;
+import org.apache.qpid.topic.Config;
+
+/**
+ * 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 extends AbstractPingClient 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;
+
+ /** 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 session. */
+ private Session _consumerSession;
+
+ /** The producer session. */
+ private Session _producerSession;
+
+ /**
+ * 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 session 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);
+ }
+
+ private void createConsumerDestination(String name)
+ {
+ if (isPubSub())
+ {
+ _consumerDestination = new AMQTopic(name);
+ }
+ else
+ {
+ _consumerDestination = new AMQQueue(name);
+ }
+ }
+
+ /**
+ * 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...");
+ }
+
+ /**
+ * 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);
+ }
+ }
+
+ 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");
+ }
+
+ /**
+ * 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
new file mode 100644
index 0000000000..fb0ae19767
--- /dev/null
+++ b/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java
@@ -0,0 +1,806 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.net.InetAddress;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicLong;
+
+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.MessageProducer;
+import org.apache.qpid.jms.Session;
+import org.apache.qpid.ping.AbstractPingProducer;
+import org.apache.qpid.ping.Throttle;
+import org.apache.qpid.topic.Config;
+
+/**
+ * PingPongProducer is a client that sends pings to a queue and waits for pongs to be bounced back by a bounce back
+ * client (see {@link PingPongBouncer} for the bounce back client). It is designed to be run from the command line
+ * as a stand alone test tool, but it may also be fairly easily instantiated by other code by supplying a session,
+ * message producer and message consumer to run the ping-pong cycle on.
+ * <p/>
+ * <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
+ * id in the ping to be bounced back in the correlation id. If a new temporary queue per ping were used, then
+ * this correlation would not need to be done.
+ * <p/>
+ * <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/>
+ * <p/><table id="crc"><caption>CRC Card</caption>
+ * <tr><th> Responsibilities <th> Collaborations
+ * <tr><td> Provide a ping and wait for response cycle.
+ * <tr><td> Provide command line invocation to loop the ping cycle on a configurable broker url.
+ * </table>
+ *
+ * @todo Make temp queue per ping a command line option.
+ * @todo Make the queue name a command line option.
+ */
+public class PingPongProducer extends AbstractPingProducer implements Runnable, MessageListener, ExceptionListener
+{
+ private static final Logger _logger = Logger.getLogger(PingPongProducer.class);
+
+ /**
+ * Used to set up a default message size.
+ */
+ protected static final int DEFAULT_MESSAGE_SIZE = 0;
+
+ /**
+ * This is set and used when the test is for multiple-destinations
+ */
+ protected static final int DEFAULT_DESTINATION_COUNT = 0;
+
+ protected static final int DEFAULT_RATE = 0;
+
+ /**
+ * Used to define how long to wait between pings.
+ */
+ protected static final long SLEEP_TIME = 250;
+
+ /**
+ * Used to define how long to wait before assuming that a ping has timed out.
+ */
+ protected static final long TIMEOUT = 9000;
+
+ /**
+ * Holds the name of the destination to send pings on.
+ */
+ protected static final String PING_DESTINATION_NAME = "ping";
+
+ /**
+ * The batch size.
+ */
+ protected static final int DEFAULT_BATCH_SIZE = 100;
+
+ protected static final int PREFETCH = 100;
+ protected static final boolean NO_LOCAL = true;
+ protected static final boolean EXCLUSIVE = false;
+
+ /**
+ * The number of priming loops to run.
+ */
+ protected static final int PRIMING_LOOPS = 3;
+
+ /**
+ * A source for providing sequential unique correlation ids.
+ */
+ private static AtomicLong idGenerator = new AtomicLong(0L);
+
+ /**
+ * Holds a map from message ids to latches on which threads wait for replies.
+ */
+ private static Map<String, CountDownLatch> trafficLights = new HashMap<String, CountDownLatch>();
+
+ /**
+ * Destination where the responses messages will arrive
+ */
+ private Destination _replyDestination;
+
+ /**
+ * Destination where the producer will be sending message to
+ */
+ private Destination _pingDestination;
+
+ /**
+ * Determines whether this producer sends persistent messages from the run method.
+ */
+ protected boolean _persistent;
+
+ /**
+ * Holds the message size to send, from the run method.
+ */
+ protected int _messageSize;
+
+ /**
+ * Used to indicate that the ping loop should print out whenever it pings.
+ */
+ protected boolean _verbose = false;
+
+ protected Session _consumerSession;
+
+ /**
+ * Used to restrict the sending rate to a specified limit.
+ */
+ private Throttle rateLimiter = null;
+
+ /**
+ * The throttler can only reliably restrict to a few hundred cycles per second, so a throttling batch size is used
+ * to group sends together into batches large enough that the throttler runs slower than that.
+ */
+ int _throttleBatchSize;
+
+ private MessageListener _messageListener = null;
+
+ private PingPongProducer(String brokerDetails, String username, String password, String virtualpath, boolean transacted,
+ boolean persistent, int messageSize, boolean verbose, boolean afterCommit, boolean beforeCommit,
+ boolean afterSend, boolean beforeSend, boolean failOnce, int batchSize, int rate)
+ throws Exception
+ {
+ // Create a connection to the broker.
+ InetAddress address = InetAddress.getLocalHost();
+ String clientID = address.getHostName() + System.currentTimeMillis();
+
+ setConnection(new AMQConnection(brokerDetails, username, password, clientID, virtualpath));
+
+ // Create transactional or non-transactional sessions, based on the command line arguments.
+ setProducerSession((Session) getConnection().createSession(transacted, Session.AUTO_ACKNOWLEDGE));
+ _consumerSession = (Session) getConnection().createSession(transacted, Session.AUTO_ACKNOWLEDGE);
+
+ _persistent = persistent;
+ _messageSize = messageSize;
+ _verbose = verbose;
+
+ // Set failover interrupts
+ _failAfterCommit = afterCommit;
+ _failBeforeCommit = beforeCommit;
+ _failAfterSend = afterSend;
+ _failBeforeSend = beforeSend;
+ _failOnce = failOnce;
+ _txBatchSize = batchSize;
+
+ // Calculate a throttling batch size and rate such that the throttle runs slower than 100 cycles per second
+ // and batched sends within each cycle multiply up to give the desired rate.
+ //
+ // total rate = throttle rate * batch size.
+ // 1 < throttle rate < 100
+ // 1 < total rate < 20000
+ if (rate > DEFAULT_RATE)
+ {
+ // 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 back into the range 1 to 100.
+ int x = (int) (Math.log10(rate) / 2);
+ _throttleBatchSize = (int) Math.pow(100, x);
+ int throttleRate = rate / _throttleBatchSize;
+
+ _logger.debug("rate = " + rate);
+ _logger.debug("x = " + x);
+ _logger.debug("_throttleBatchSize = " + _throttleBatchSize);
+ _logger.debug("throttleRate = " + throttleRate);
+
+ rateLimiter = new Throttle();
+ rateLimiter.setRate(throttleRate);
+ }
+ }
+
+ /**
+ * Creates a ping pong producer with the specified connection details and type.
+ *
+ * @param brokerDetails
+ * @param username
+ * @param password
+ * @param virtualpath
+ * @param transacted
+ * @throws Exception All allowed to fall through. This is only test code...
+ */
+ public PingPongProducer(String brokerDetails, String username, String password, String virtualpath,
+ String destinationName, String selector, boolean transacted, boolean persistent,
+ int messageSize, boolean verbose, boolean afterCommit, boolean beforeCommit,
+ boolean afterSend, boolean beforeSend, boolean failOnce, int batchSize,
+ int noOfDestinations, int rate, boolean pubsub) throws Exception
+ {
+ this(brokerDetails, username, password, virtualpath, transacted, persistent, messageSize, verbose, afterCommit,
+ beforeCommit, afterSend, beforeSend, failOnce, batchSize, rate);
+
+ _destinationCount = noOfDestinations;
+ setPubSub(pubsub);
+
+ if (noOfDestinations == DEFAULT_DESTINATION_COUNT)
+ {
+ if (destinationName != null)
+ {
+ createPingDestination(destinationName);
+ // Create producer and the consumer
+ createProducer();
+ createConsumer(selector);
+ }
+ else
+ {
+ _logger.error("Destination is not specified");
+ throw new IllegalArgumentException("Destination is not specified");
+ }
+ }
+ }
+
+ private void createPingDestination(String name)
+ {
+ if (isPubSub())
+ {
+ _pingDestination = new AMQTopic(name);
+ }
+ else
+ {
+ _pingDestination = new AMQQueue(name);
+ }
+ }
+
+ /**
+ * Creates the producer to send the pings on. If the tests are with nultiple-destinations, then producer
+ * is created with null destination, so that any destination can be specified while sending
+ *
+ * @throws JMSException
+ */
+ public void createProducer() throws JMSException
+ {
+ if (getDestinationsCount() > DEFAULT_DESTINATION_COUNT)
+ {
+ // create producer with initial destination as null for test with multiple-destinations
+ // In this case, a different destination will be used while sending the message
+ _producer = (MessageProducer) getProducerSession().createProducer(null);
+ }
+ else
+ {
+ // Create a producer with known destination to send the pings on.
+ _producer = (MessageProducer) getProducerSession().createProducer(_pingDestination);
+
+ }
+
+ _producer.setDisableMessageTimestamp(true);
+ _producer.setDeliveryMode(_persistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT);
+ }
+
+ /**
+ * Creates the temporary destination to listen to the responses
+ *
+ * @param selector
+ * @throws JMSException
+ */
+ public void createConsumer(String selector) throws JMSException
+ {
+ // Create a temporary destination to get the pongs on.
+ if (isPubSub())
+ {
+ _replyDestination = _consumerSession.createTemporaryTopic();
+ }
+ else
+ {
+ _replyDestination = _consumerSession.createTemporaryQueue();
+ }
+
+ // Create a message consumer to get the replies with and register this to be called back by it.
+ MessageConsumer consumer = _consumerSession.createConsumer(_replyDestination, PREFETCH, NO_LOCAL, EXCLUSIVE, selector);
+ consumer.setMessageListener(this);
+ }
+
+ /**
+ * Creates consumer instances for each destination. This is used when test is being done with multiple destinations.
+ *
+ * @param selector
+ * @throws JMSException
+ */
+ public void createConsumers(String selector) throws JMSException
+ {
+ for (int i = 0; i < getDestinationsCount(); i++)
+ {
+ MessageConsumer consumer =
+ getConsumerSession().createConsumer(getDestination(i), PREFETCH, false, EXCLUSIVE, selector);
+ consumer.setMessageListener(this);
+ }
+ }
+
+
+ public Session getConsumerSession()
+ {
+ return _consumerSession;
+ }
+
+ public Destination getPingDestination()
+ {
+ return _pingDestination;
+ }
+
+ protected void setPingDestination(Destination destination)
+ {
+ _pingDestination = destination;
+ }
+
+ /**
+ * Starts a ping-pong loop running from the command line. The bounce back client {@link org.apache.qpid.requestreply.PingPongBouncer} also needs
+ * to be started to bounce the pings back again.
+ * <p/>
+ * <p/>The command line takes from 2 to 4 arguments:
+ * <p/><table>
+ * <tr><td>brokerDetails <td> The broker connection string.
+ * <tr><td>virtualPath <td> The virtual path.
+ * <tr><td>transacted <td> A boolean flag, telling this client whether or not to use transactions.
+ * <tr><td>size <td> The size of ping messages to use, in bytes.
+ * </table>
+ *
+ * @param args The command line arguments as defined above.
+ */
+ public static void main(String[] args) throws Exception
+ {
+ // Extract the command line.
+ Config config = new Config();
+ config.setOptions(args);
+ if (args.length == 0)
+ {
+ _logger.info("Running test with default values...");
+ //usage();
+ //System.exit(0);
+ }
+
+ String brokerDetails = config.getHost() + ":" + config.getPort();
+ String virtualpath = "/test";
+ String selector = config.getSelector();
+ boolean verbose = true;
+ boolean transacted = config.isTransacted();
+ boolean persistent = config.usePersistentMessages();
+ int messageSize = (config.getPayload() != 0) ? config.getPayload() : DEFAULT_MESSAGE_SIZE;
+ //int messageCount = config.getMessages();
+ int destCount = (config.getDestinationsCount() != 0) ? config.getDestinationsCount() : DEFAULT_DESTINATION_COUNT;
+ int batchSize = (config.getBatchSize() != 0) ? config.getBatchSize() : DEFAULT_BATCH_SIZE;
+ int rate = (config.getRate() != 0) ? config.getRate() : DEFAULT_RATE;
+ boolean pubsub = config.isPubSub();
+
+ String destName = config.getDestination();
+ if (destName == null)
+ {
+ destName = PING_DESTINATION_NAME;
+ }
+
+ boolean afterCommit = false;
+ boolean beforeCommit = false;
+ boolean afterSend = false;
+ boolean beforeSend = false;
+ boolean failOnce = false;
+
+ for (String arg : args)
+ {
+ if (arg.startsWith("failover:"))
+ {
+ //failover:<before|after>:<send:commit> | failover:once
+ String[] parts = arg.split(":");
+ if (parts.length == 3)
+ {
+ if (parts[2].equals("commit"))
+ {
+ afterCommit = parts[1].equals("after");
+ beforeCommit = parts[1].equals("before");
+ }
+
+ if (parts[2].equals("send"))
+ {
+ afterSend = parts[1].equals("after");
+ beforeSend = parts[1].equals("before");
+ }
+
+ if (parts[1].equals("once"))
+ {
+ failOnce = true;
+ }
+ }
+ else
+ {
+ System.out.println("Unrecognized failover request:" + arg);
+ }
+ }
+ }
+
+ // Create a ping producer to handle the request/wait/reply cycle.
+ PingPongProducer pingProducer = new PingPongProducer(brokerDetails, "guest", "guest", virtualpath,
+ destName, selector, transacted, persistent, messageSize, verbose,
+ afterCommit, beforeCommit, afterSend, beforeSend, failOnce, batchSize,
+ destCount, rate, pubsub);
+
+ pingProducer.getConnection().start();
+
+ // Run a few priming pings to remove warm up time from test results.
+ //pingProducer.prime(PRIMING_LOOPS);
+ // 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);
+
+ // 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();
+ }
+
+ private static void usage()
+ {
+ System.err.println("Usage: TestPingPublisher \n" + "-host : broker host" + "-port : broker port" +
+ "-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" +
+ "-payload : paylaod size. Default is 0\n" +
+ //"-messages : no of messages to be sent (if 0, the ping loop will run indefinitely)\n" +
+ "-destinationscount : no of destinations for multi-destinations test\n" +
+ "-batchsize : batch size\n" +
+ "-rate : thruput rate\n");
+ }
+
+ /**
+ * Primes the test loop by sending a few messages, then introduces a short wait. This allows the bounce back client
+ * on the other end a chance to configure its reply producer on the reply to destination. It is also worth calling
+ * this a few times, in order to prime the JVMs JIT compilation.
+ *
+ * @param x The number of priming loops to run.
+ * @throws JMSException All underlying exceptions are allowed to fall through.
+ */
+ public void prime(int x) throws JMSException
+ {
+ for (int i = 0; i < x; i++)
+ {
+ // Create and send a small message.
+ Message first = getTestMessage(_replyDestination, 0, false);
+ sendMessage(first);
+
+ commitTx();
+
+ try
+ {
+ Thread.sleep(100);
+ }
+ catch (InterruptedException ignore)
+ {
+
+ }
+ }
+
+
+ }
+
+ /**
+ * 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.
+ */
+ public void onMessage(Message message)
+ {
+
+ try
+ {
+
+ // Store the reply, if it has a correlation id that is expected.
+ String correlationID = message.getJMSCorrelationID();
+
+ if (_verbose)
+ {
+ _logger.info(timestampFormatter.format(new Date()) + ": Got reply with correlation id, " + correlationID);
+ //_logger.debug("Received from : " + message.getJMSDestination());
+ }
+
+ // Turn the traffic light to green.
+ CountDownLatch trafficLight = trafficLights.get(correlationID);
+
+ if (trafficLight != null)
+ {
+ if (_messageListener != null)
+ {
+ synchronized (trafficLight)
+ {
+ _messageListener.onMessage(message);
+ trafficLight.countDown();
+ }
+ }
+ else
+ {
+ trafficLight.countDown();
+ }
+
+ _logger.trace("Reply was expected, decrementing the latch for the id.");
+
+ long remainingCount = trafficLight.getCount();
+
+ if ((remainingCount % _txBatchSize) == 0)
+ {
+ commitTx(getConsumerSession());
+ }
+
+ }
+ else
+ {
+ _logger.trace("There was no thread waiting for reply: " + correlationID);
+ }
+
+ if (_verbose)
+ {
+ Long timestamp = message.getLongProperty("timestamp");
+
+ if (timestamp != null)
+ {
+ long diff = System.currentTimeMillis() - timestamp;
+ _logger.trace("Time for round trip: " + diff);
+ }
+ }
+ }
+ catch (JMSException e)
+ {
+ _logger.warn("There was a JMSException: " + e.getMessage(), e);
+ }
+ }
+
+ /**
+ * 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.
+ *
+ * @param message The message to send.
+ * @param numPings The number of ping messages to send.
+ * @param timeout The timeout in milliseconds.
+ * @return The number of replies received. This may be less than the number sent if the timeout terminated the
+ * wait for all prematurely.
+ * @throws JMSException All underlying JMSExceptions are allowed to fall through.
+ */
+ public int pingAndWaitForReply(Message message, int numPings, long timeout) throws JMSException, InterruptedException
+ {
+ String messageCorrelationId = null;
+
+ try
+ {
+ // Put a unique correlation id on the message before sending it.
+ messageCorrelationId = Long.toString(getNewID());
+
+ pingNoWaitForReply(message, numPings, messageCorrelationId);
+
+ CountDownLatch trafficLight = trafficLights.get(messageCorrelationId);
+ // Block the current thread until a reply to the message is received, or it times out.
+ trafficLight.await(timeout, TimeUnit.MILLISECONDS);
+
+ // Work out how many replies were receieved.
+ int numReplies = numPings - (int) trafficLight.getCount();
+
+ if ((numReplies < numPings) && _verbose)
+ {
+ _logger.info("Timed out (" + timeout + " ms) before all replies received on id, " + messageCorrelationId);
+ }
+ else if (_verbose)
+ {
+ _logger.info("Got all replies on id, " + messageCorrelationId);
+ }
+
+ commitTx(getConsumerSession());
+
+ return numReplies;
+ }
+ finally
+ {
+ removeLock(messageCorrelationId);
+ }
+ }
+
+ public long getNewID()
+ {
+ return idGenerator.incrementAndGet();
+ }
+
+ public CountDownLatch removeLock(String correlationID)
+ {
+ return trafficLights.remove(correlationID);
+ }
+
+
+ /*
+ * Sends the specified ping message but does not wait for a correlating reply.
+ *
+ * @param message The message to send.
+ * @param numPings The number of pings to send.
+ * @return The reply, or null if no reply arrives before the timeout.
+ * @throws JMSException All underlying JMSExceptions are allowed to fall through.
+ */
+ public void pingNoWaitForReply(Message message, int numPings, String messageCorrelationId) throws JMSException, InterruptedException
+ {
+ // Create a count down latch to count the number of replies with. This is created before the message is sent
+ // so that the message is not received before the count down is created.
+ CountDownLatch trafficLight = new CountDownLatch(numPings);
+ trafficLights.put(messageCorrelationId, trafficLight);
+
+ message.setJMSCorrelationID(messageCorrelationId);
+
+ // Set up a committed flag to detect uncommitted message 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++)
+ {
+ // Reset the committed flag to indicate that there are uncommitted message.
+ committed = false;
+
+ // Re-timestamp the message.
+ message.setLongProperty("timestamp", System.currentTimeMillis());
+
+ // Check if the test is with multiple-destinations, in which case round robin the destinations
+ // as the messages are sent.
+ if (getDestinationsCount() > DEFAULT_DESTINATION_COUNT)
+ {
+ sendMessage(getDestination(i % getDestinationsCount()), message);
+ }
+ else
+ {
+ sendMessage(message);
+ }
+
+ // Apply message rate throttling if a rate limit has been set up and the throttling batch limit has been
+ // reached. See the comment on the throttle batch size for information about the use of batches here.
+ if ((rateLimiter != null) && ((i % _throttleBatchSize) == 0))
+ {
+ rateLimiter.throttle();
+ }
+
+ // Call commit every time the commit batch size is reached.
+ if ((i % _txBatchSize) == 0)
+ {
+ commitTx();
+ committed = true;
+ }
+ }
+
+ // Call commit if the send loop finished before reaching a batch size boundary so there may still be uncommitted messages.
+ if (!committed)
+ {
+ commitTx();
+ }
+
+ // Spew out per message timings only in verbose mode.
+ if (_verbose)
+ {
+ _logger.info(timestampFormatter.format(new Date()) + ": Pinged at with correlation id, " + messageCorrelationId);
+ }
+
+ }
+
+ /**
+ * The ping loop implementation. This send out pings of the configured size, persistence and transactionality, and
+ * waits for replies and inserts short pauses in between each.
+ */
+ public void pingLoop()
+ {
+ try
+ {
+ // Generate a sample message and time stamp it.
+ ObjectMessage msg = getTestMessage(_replyDestination, _messageSize, _persistent);
+ msg.setLongProperty("timestamp", System.currentTimeMillis());
+
+ // Send the message and wait for a reply.
+ pingAndWaitForReply(msg, DEFAULT_BATCH_SIZE, TIMEOUT);
+
+ // Introduce a short pause if desired.
+ pause(SLEEP_TIME);
+ }
+ catch (JMSException e)
+ {
+ _publish = false;
+ _logger.debug("There was a JMSException: " + e.getMessage(), e);
+ }
+ catch (InterruptedException e)
+ {
+ _publish = false;
+ _logger.debug("There was an interruption: " + e.getMessage(), e);
+ }
+ }
+
+ public Destination getReplyDestination()
+ {
+ return _replyDestination;
+ }
+
+ protected void setReplyDestination(Destination destination)
+ {
+ _replyDestination = destination;
+ }
+
+ public void setMessageListener(MessageListener messageListener)
+ {
+ _messageListener = messageListener;
+ }
+
+ public CountDownLatch getEndLock(String correlationID)
+ {
+ return trafficLights.get(correlationID);
+ }
+
+ /*
+ * When the test is being performed with multiple queues, then this method will be used, which has a loop to
+ * pick up the next queue from the queues list and sends message to it.
+ *
+ * @param message
+ * @param numPings
+ * @throws JMSException
+ */
+ /*private void pingMultipleQueues(Message message, int numPings) throws JMSException
+ {
+ int queueIndex = 0;
+ for (int i = 0; i < numPings; i++)
+ {
+ // Re-timestamp the message.
+ message.setLongProperty("timestamp", System.currentTimeMillis());
+
+ sendMessage(getDestination(queueIndex++), message);
+
+ // reset the counter to get the first queue
+ if (queueIndex == (getDestinationsCount() - 1))
+ {
+ queueIndex = 0;
+ }
+ }
+ }*/
+
+ /**
+ * 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; //Allow failover
+ }
+
+ public boolean preResubscribe()
+ {
+ return true; // Allow resubscription
+ }
+
+ public void failoverComplete()
+ {
+ _logger.info("App got failover complete callback.");
+ }
+ }
+}
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/ServiceProvidingClient.java b/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/ServiceProvidingClient.java
index ddee643a76..bab732e2a6 100644
--- a/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/ServiceProvidingClient.java
+++ b/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/ServiceProvidingClient.java
@@ -7,9 +7,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -21,11 +21,11 @@
package org.apache.qpid.requestreply;
import org.apache.log4j.Logger;
+import org.apache.qpid.AMQException;
import org.apache.qpid.client.AMQConnection;
import org.apache.qpid.client.AMQQueue;
-import org.apache.qpid.jms.Session;
import org.apache.qpid.jms.ConnectionListener;
-import org.apache.qpid.AMQException;
+import org.apache.qpid.jms.Session;
import org.apache.qpid.url.URLSyntaxException;
import javax.jms.*;
@@ -42,12 +42,22 @@ public class ServiceProvidingClient
private AMQConnection _connection;
+ private Session _session;
+ private Session _producerSession;
+
+ private boolean _isTransactional;
+
public ServiceProvidingClient(String brokerDetails, String username, String password,
- String clientName, String virtualPath, String serviceName)
+ String clientName, String virtualPath, String serviceName,
+ final int deliveryMode, boolean transactedMode, String selector)
throws AMQException, JMSException, URLSyntaxException
{
- _connection = new AMQConnection(brokerDetails, username, password,
- clientName, virtualPath);
+ _isTransactional = transactedMode;
+
+ _logger.info("Delivery Mode: " + (deliveryMode == DeliveryMode.NON_PERSISTENT ? "Non Persistent" : "Persistent")
+ + "\t isTransactional: " + _isTransactional);
+
+ _connection = new AMQConnection(brokerDetails, username, password, clientName, virtualPath);
_connection.setConnectionListener(new ConnectionListener()
{
@@ -74,14 +84,15 @@ public class ServiceProvidingClient
_logger.info("App got failover complete callback");
}
});
- final Session session = (Session) _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ _session = (Session) _connection.createSession(_isTransactional, Session.AUTO_ACKNOWLEDGE);
+ _producerSession = (Session) _connection.createSession(_isTransactional, Session.AUTO_ACKNOWLEDGE);
_logger.info("Service (queue) name is '" + serviceName + "'...");
AMQQueue destination = new AMQQueue(serviceName);
- MessageConsumer consumer = session.createConsumer(destination,
- 100, true, false, null);
+ MessageConsumer consumer = _session.createConsumer(destination,
+ 100, true, false, selector);
consumer.setMessageListener(new MessageListener()
{
@@ -90,9 +101,7 @@ public class ServiceProvidingClient
public void onMessage(Message message)
{
//_logger.info("Got message '" + message + "'");
-
TextMessage tm = (TextMessage) message;
-
try
{
Destination responseDest = tm.getJMSReplyTo();
@@ -107,9 +116,9 @@ public class ServiceProvidingClient
_responseDest = responseDest;
_logger.info("About to create a producer");
- _destinationProducer = session.createProducer(responseDest);
+ _destinationProducer = _producerSession.createProducer(responseDest);
_destinationProducer.setDisableMessageTimestamp(true);
- _destinationProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
+ _destinationProducer.setDeliveryMode(deliveryMode);
_logger.info("After create a producer");
}
}
@@ -127,14 +136,25 @@ public class ServiceProvidingClient
try
{
String payload = "This is a response: sing together: 'Mahnah mahnah...'" + tm.getText();
- TextMessage msg = session.createTextMessage(payload);
+ TextMessage msg = _producerSession.createTextMessage(payload);
if (tm.propertyExists("timeSent"))
{
_logger.info("timeSent property set on message");
- _logger.info("timeSent value is: " + tm.getLongProperty("timeSent"));
- msg.setStringProperty("timeSent", tm.getStringProperty("timeSent"));
+ long timesent = tm.getLongProperty("timeSent");
+ _logger.info("timeSent value is: " + timesent);
+ msg.setLongProperty("timeSent", timesent);
}
+
_destinationProducer.send(msg);
+
+ if (_isTransactional)
+ {
+ _producerSession.commit();
+ }
+ if (_isTransactional)
+ {
+ _session.commit();
+ }
if (_messageCount % 1000 == 0)
{
_logger.info("Sent response to '" + _responseDest + "'");
@@ -160,7 +180,7 @@ public class ServiceProvidingClient
if (args.length < 5)
{
- System.out.println("Usage: brokerDetails username password virtual-path serviceQueue [selector]");
+ System.out.println("Usage: serviceProvidingClient <brokerDetails> <username> <password> <virtual-path> <serviceQueue> [<P[ersistent]|N[onPersistent]> <T[ransacted]|N[onTransacted]>] [selector]");
System.exit(1);
}
String clientId = null;
@@ -174,10 +194,28 @@ public class ServiceProvidingClient
_logger.error("Error: " + e, e);
}
+ int deliveryMode = DeliveryMode.NON_PERSISTENT;
+ boolean transactedMode = false;
+
+ if (args.length > 7)
+ {
+ deliveryMode = args[args.length - 2].toUpperCase().charAt(0) == 'P' ? DeliveryMode.PERSISTENT
+ : DeliveryMode.NON_PERSISTENT;
+
+ transactedMode = args[args.length - 1].toUpperCase().charAt(0) == 'T' ? true : false;
+ }
+
+ String selector = null;
+ if ((args.length == 8) || (args.length == 7))
+ {
+ selector = args[args.length - 1];
+ }
+
try
{
ServiceProvidingClient client = new ServiceProvidingClient(args[0], args[1], args[2],
- clientId, args[3], args[4]);
+ clientId, args[3], args[4],
+ deliveryMode, transactedMode, selector);
client.run();
}
catch (JMSException e)
@@ -192,10 +230,6 @@ public class ServiceProvidingClient
{
_logger.error("Error: " + e, e);
}
-
-
-
}
-
}
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/ServiceRequestingClient.java b/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/ServiceRequestingClient.java
index b52d06558a..57512929c1 100644
--- a/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/ServiceRequestingClient.java
+++ b/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/ServiceRequestingClient.java
@@ -7,9 +7,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -22,13 +22,15 @@ package org.apache.qpid.requestreply;
import org.apache.log4j.Logger;
import org.apache.qpid.AMQException;
-import org.apache.qpid.url.URLSyntaxException;
import org.apache.qpid.client.AMQConnection;
-import org.apache.qpid.client.AMQQueue;
import org.apache.qpid.client.AMQDestination;
+import org.apache.qpid.client.AMQQueue;
+import org.apache.qpid.client.message.TestMessageFactory;
+import org.apache.qpid.client.message.JMSTextMessage;
import org.apache.qpid.jms.MessageConsumer;
import org.apache.qpid.jms.MessageProducer;
import org.apache.qpid.jms.Session;
+import org.apache.qpid.url.URLSyntaxException;
import javax.jms.*;
import java.net.InetAddress;
@@ -38,26 +40,33 @@ import java.net.UnknownHostException;
* A client that behaves as follows:
* <ul><li>Connects to a queue, whose name is specified as a cmd-line argument</li>
* <li>Creates a temporary queue</li>
- * <li>Creates messages containing a property that is the name of the temporary queue</li>
- * <li>Fires off a message on the original queue and waits for a response on the temporary queue</li>
+ * <li>Creates messages containing a property(reply-to) that is the name of the temporary queue</li>
+ * <li>Fires off a message on the original queue and registers the callbackHandler to listen to the response on the temporary queue</li>
+ * <li>Start the loop to send all messages</li>
+ * <li>CallbackHandler keeps listening to the responses and exits if all the messages have been received back or
+ * if the waiting time for next message is elapsed</li>
* </ul>
- *
*/
public class ServiceRequestingClient implements ExceptionListener
{
private static final Logger _log = Logger.getLogger(ServiceRequestingClient.class);
- private static final String MESSAGE_DATA_BYTES = "jfd ghljgl hjvhlj cvhvjf ldhfsj lhfdsjf hldsjfk hdslkfj hsdflk ";
+ private long _messageIdentifier = 0;
+
+ // time for which callbackHandler should wait for a message before exiting. Default time= 60 secs
+ private static long _callbackHandlerWaitingTime = 60000;
private String MESSAGE_DATA;
private AMQConnection _connection;
private Session _session;
+ private Session _producerSession;
private long _averageLatency;
private int _messageCount;
+ private boolean _isTransactional;
private volatile boolean _completed;
@@ -67,40 +76,25 @@ public class ServiceRequestingClient implements ExceptionListener
private Object _waiter;
- private static String createMessagePayload(int size)
- {
- _log.info("Message size set to " + size + " bytes");
- 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();
- }
-
private class CallbackHandler implements MessageListener
{
- private int _expectedMessageCount;
-
private int _actualMessageCount;
private long _startTime;
+ // The time when the last message was received by the callbackHandler
+ private long _messageReceivedTime = 0;
+ private Object _timerCallbackHandler = new Object();
- public CallbackHandler(int expectedMessageCount, long startTime)
+ public CallbackHandler(long startTime)
{
- _expectedMessageCount = expectedMessageCount;
_startTime = startTime;
+ // Start the timer thread, which will keep checking if test should exit because the waiting time has elapsed
+ (new Thread(new TimerThread())).start();
}
public void onMessage(Message m)
{
+ _messageReceivedTime = System.currentTimeMillis();
if (_log.isDebugEnabled())
{
_log.debug("Message received: " + m);
@@ -110,20 +104,23 @@ public class ServiceRequestingClient implements ExceptionListener
m.getPropertyNames();
if (m.propertyExists("timeSent"))
{
- long timeSent = Long.parseLong(m.getStringProperty("timeSent"));
- long now = System.currentTimeMillis();
+ long timeSent = m.getLongProperty("timeSent");
if (_averageLatency == 0)
{
- _averageLatency = now - timeSent;
+ _averageLatency = _messageReceivedTime - timeSent;
_log.info("Latency " + _averageLatency);
}
else
{
- _log.info("Individual latency: " + (now - timeSent));
- _averageLatency = (_averageLatency + (now - timeSent)) / 2;
+ _log.info("Individual latency: " + (_messageReceivedTime - timeSent));
+ _averageLatency = (_averageLatency + (_messageReceivedTime - timeSent)) / 2;
_log.info("Average latency now: " + _averageLatency);
}
}
+ if(_isTransactional)
+ {
+ _session.commit();
+ }
}
catch (JMSException e)
{
@@ -135,26 +132,114 @@ public class ServiceRequestingClient implements ExceptionListener
_log.info("Received message count: " + _actualMessageCount);
}
- if (_actualMessageCount == _expectedMessageCount)
+ checkForMessageID(m);
+
+ if (_actualMessageCount == _messageCount)
{
- _completed = true;
- notifyWaiter();
- long timeTaken = System.currentTimeMillis() - _startTime;
- _log.info("Total time taken to receive " + _expectedMessageCount + " messages was " +
- timeTaken + "ms, equivalent to " +
- (_expectedMessageCount / (timeTaken / 1000.0)) + " messages per second");
-
- try
+ finishTesting(_actualMessageCount);
+ }
+ }
+
+ /**
+ * sets completed flag to true, closes the callbackHandler connection and notifies the waiter thread,
+ * so that the callbackHandler can finish listening for messages. This causes the test to finish.
+ * @param receivedMessageCount
+ */
+ private void finishTesting(int receivedMessageCount)
+ {
+ _completed = true;
+ notifyWaiter();
+ notifyTimerThread();
+
+ long timeTaken = System.currentTimeMillis() - _startTime;
+ _log.info("***** Result *****");
+ _log.info("Total messages received = " + receivedMessageCount);
+ _log.info("Total time taken to receive " + receivedMessageCount + " messages was " +
+ timeTaken + "ms, equivalent to " +
+ (receivedMessageCount / (timeTaken / 1000.0)) + " messages per second");
+
+ try
+ {
+ _connection.close();
+ _log.info("Connection closed");
+ }
+ catch (JMSException e)
+ {
+ _log.error("Error closing connection");
+ }
+ }
+
+ private void notifyTimerThread()
+ {
+ if (_timerCallbackHandler != null)
+ {
+ synchronized (_timerCallbackHandler)
{
- _connection.close();
- _log.info("Connection closed");
+ _timerCallbackHandler.notify();
}
- catch (JMSException e)
+ }
+ }
+
+ /**
+ * Thread class implementing the timer for callbackHandler. The thread will exit the test if the waiting time
+ * has elapsed before next message is received.
+ */
+ private class TimerThread implements Runnable
+ {
+ public void run()
+ {
+ do
{
- _log.error("Error closing connection");
+ try
+ {
+ synchronized(_timerCallbackHandler)
+ {
+ _timerCallbackHandler.wait(_callbackHandlerWaitingTime);
+ }
+ }
+ catch (InterruptedException ignore)
+ {
+
+ }
+
+ // exit if callbackHandler has received all messages
+ if (_completed)
+ {
+ return;
+ }
}
+ while ((System.currentTimeMillis() - _messageReceivedTime) < _callbackHandlerWaitingTime);
+
+ // waiting time has elapsed, so exit the test
+ _log.info("");
+ _log.info("Exited after waiting for " + _callbackHandlerWaitingTime/1000 + " secs");
+ finishTesting(_actualMessageCount);
}
}
+ } // end of CallbackHandler class
+
+ /**
+ * Checks if the received AMQ Message ID(delivery tag) is in sequence, by comparing it with the AMQ MessageID
+ * of previous message.
+ * @param receivedMsg
+ */
+ private void checkForMessageID(Message receivedMsg)
+ {
+ try
+ {
+ JMSTextMessage msg = (JMSTextMessage)receivedMsg;
+ if (! (msg.getDeliveryTag() == _messageIdentifier + 1))
+ {
+ _log.info("Out of sequence message received. Previous AMQ MessageID= " + _messageIdentifier +
+ ", Received AMQ messageID= " + receivedMsg.getJMSMessageID());
+ }
+ _messageIdentifier = msg.getDeliveryTag();
+ }
+ catch (Exception ex)
+ {
+ _log.error("Error in checking messageID ", ex);
+ }
+
}
private void notifyWaiter()
@@ -167,25 +252,31 @@ public class ServiceRequestingClient implements ExceptionListener
}
}
}
+
public ServiceRequestingClient(String brokerHosts, String clientID, String username, String password,
String vpath, String commandQueueName,
+ int deliveryMode, boolean transactedMode,
final int messageCount, final int messageDataLength) throws AMQException, URLSyntaxException
{
+ _isTransactional = transactedMode;
+
+ _log.info("Delivery Mode: " + (deliveryMode == DeliveryMode.NON_PERSISTENT ? "Non Persistent" : "Persistent"));
+ _log.info("isTransactional: " + _isTransactional);
+
_messageCount = messageCount;
- MESSAGE_DATA = createMessagePayload(messageDataLength);
+ MESSAGE_DATA = TestMessageFactory.createMessagePayload(messageDataLength);
try
{
createConnection(brokerHosts, clientID, username, password, vpath);
- _session = (Session) _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
+ _session = (Session) _connection.createSession(_isTransactional, Session.AUTO_ACKNOWLEDGE);
+ _producerSession = (Session) _connection.createSession(_isTransactional, Session.AUTO_ACKNOWLEDGE);
_connection.setExceptionListener(this);
-
AMQQueue destination = new AMQQueue(commandQueueName);
- _producer = (MessageProducer) _session.createProducer(destination);
+ _producer = (MessageProducer) _producerSession.createProducer(destination);
_producer.setDisableMessageTimestamp(true);
- _producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
+ _producer.setDeliveryMode(deliveryMode);
_tempDestination = new AMQQueue("TempResponse" +
Long.toString(System.currentTimeMillis()), true);
@@ -195,7 +286,11 @@ public class ServiceRequestingClient implements ExceptionListener
//Send first message, then wait a bit to allow the provider to get initialised
TextMessage first = _session.createTextMessage(MESSAGE_DATA);
first.setJMSReplyTo(_tempDestination);
- _producer.send(first);
+ _producer.send(first);
+ if (_isTransactional)
+ {
+ _producerSession.commit();
+ }
try
{
Thread.sleep(1000);
@@ -207,7 +302,7 @@ public class ServiceRequestingClient implements ExceptionListener
//now start the clock and the test...
final long startTime = System.currentTimeMillis();
- messageConsumer.setMessageListener(new CallbackHandler(messageCount, startTime));
+ messageConsumer.setMessageListener(new CallbackHandler(startTime));
}
catch (JMSException e)
{
@@ -217,6 +312,7 @@ public class ServiceRequestingClient implements ExceptionListener
/**
* Run the test and notify an object upon receipt of all responses.
+ *
* @param waiter the object that will be notified
* @throws JMSException
*/
@@ -226,14 +322,19 @@ public class ServiceRequestingClient implements ExceptionListener
_connection.start();
for (int i = 1; i < _messageCount; i++)
{
- TextMessage msg = _session.createTextMessage(MESSAGE_DATA + i);
+ TextMessage msg = _producerSession.createTextMessage(MESSAGE_DATA + i);
msg.setJMSReplyTo(_tempDestination);
if (i % 1000 == 0)
{
long timeNow = System.currentTimeMillis();
- msg.setStringProperty("timeSent", String.valueOf(timeNow));
+ msg.setLongProperty("timeSent", timeNow);
}
- _producer.send(msg);
+ _producer.send(msg);
+ if (_isTransactional)
+ {
+ _producerSession.commit();
+ }
+
}
_log.info("Finished sending " + _messageCount + " messages");
}
@@ -246,8 +347,7 @@ public class ServiceRequestingClient implements ExceptionListener
private void createConnection(String brokerHosts, String clientID, String username, String password,
String vpath) throws AMQException, URLSyntaxException
{
- _connection = new AMQConnection(brokerHosts, username, password,
- clientID, vpath);
+ _connection = new AMQConnection(brokerHosts, username, password, clientID, vpath);
}
/**
@@ -256,22 +356,48 @@ public class ServiceRequestingClient implements ExceptionListener
*/
public static void main(String[] args)
{
- if (args.length < 6)
+ if ((args.length < 6) || (args.length == 8))
{
- System.err.println(
- "Usage: ServiceRequestingClient <brokerDetails - semicolon separated host:port list> <username> <password> <vpath> <command queue name> <number of messages> <message size>");
+ System.err.println("Usage: ServiceRequestingClient <brokerDetails> <username> <password> <vpath> " +
+ "<command queue name> <number of messages> [<message size>] " +
+ "[<P[ersistent]|N[onPersistent] (Default N)> <T[ransacted]|N[onTransacted] (Default N)>] " +
+ "[<waiting time for response in sec (default 60 sec)>]");
+ System.exit(1);
}
try
{
- int messageDataLength = args.length > 6 ? Integer.parseInt(args[6]) : 4096;
+ int messageSize = 4096;
+ boolean transactedMode = false;
+ int deliveryMode = DeliveryMode.NON_PERSISTENT;
+
+ if (args.length > 6)
+ {
+ messageSize = Integer.parseInt(args[6]);
+ }
+ if (args.length > 7)
+ {
+ deliveryMode = args[7].toUpperCase().charAt(0) == 'P' ? DeliveryMode.PERSISTENT
+ : DeliveryMode.NON_PERSISTENT;
+
+ transactedMode = args[8].toUpperCase().charAt(0) == 'T' ? true : false;
+ }
+
+ if (args.length > 9)
+ {
+ _callbackHandlerWaitingTime = Long.parseLong(args[9]) * 1000;
+ }
+
+ _log.info("Each message size = " + messageSize + " bytes");
InetAddress address = InetAddress.getLocalHost();
String clientID = address.getHostName() + System.currentTimeMillis();
ServiceRequestingClient client = new ServiceRequestingClient(args[0], clientID, args[1], args[2], args[3],
- args[4], Integer.parseInt(args[5]),
- messageDataLength);
+ args[4], deliveryMode, transactedMode, Integer.parseInt(args[5]),
+ messageSize);
Object waiter = new Object();
client.run(waiter);
+
+ // Start a thread to
synchronized (waiter)
{
while (!client.isCompleted())
@@ -279,7 +405,6 @@ public class ServiceRequestingClient implements ExceptionListener
waiter.wait();
}
}
-
}
catch (UnknownHostException e)
{
@@ -292,7 +417,7 @@ public class ServiceRequestingClient implements ExceptionListener
}
}
- /**
+ /**
* @see javax.jms.ExceptionListener#onException(javax.jms.JMSException)
*/
public void onException(JMSException e)
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
index bb740f9094..60aa9f3930 100644
--- 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
@@ -22,14 +22,12 @@ package org.apache.qpid.topic;
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
+public class Config extends AbstractConfig implements ConnectorConfig
{
private String host = "localhost";
@@ -45,23 +43,30 @@ class Config extends AbstractConfig implements ConnectorConfig
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;
public Config()
{
}
- int getAckMode()
+ public int getAckMode()
{
return ackMode;
}
- void setPayload(int payload)
+ public void setPayload(int payload)
{
this.payload = payload;
}
- int getPayload()
+ public int getPayload()
{
return payload;
}
@@ -81,11 +86,26 @@ class Config extends AbstractConfig implements ConnectorConfig
this.messages = messages;
}
- int getMessages()
+ 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;
@@ -141,21 +161,41 @@ class Config extends AbstractConfig implements ConnectorConfig
this.delay = delay;
}
- String getClientId()
+ public String getClientId()
{
return clientId;
}
- String getSubscriptionId()
+ public String getSubscriptionId()
{
return subscriptionId;
}
- boolean usePersistentMessages()
+ 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))
@@ -217,6 +257,34 @@ class Config extends AbstractConfig implements ConnectorConfig
{
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
{
System.out.println("Ignoring unrecognised option: " + key);
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
index d788029ee9..c3b19b558a 100644
--- 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
@@ -51,7 +51,7 @@ public class Publisher implements MessageListener
_factory.createControlConsumer().setMessageListener(this);
_connection.start();
- if(warmup > 0)
+ if (warmup > 0)
{
System.out.println("Runing warmup (" + warmup + " msgs)");
long time = batch(warmup, consumerCount);
@@ -59,11 +59,14 @@ public class Publisher implements MessageListener
}
long[] times = new long[batches];
- for(int i = 0; i < batches; i++)
+ for (int i = 0; i < batches; i++)
{
- if(i > 0) Thread.sleep(delay*1000);
+ 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.");
+ System.out.println("Batch " + (i + 1) + " of " + batches + " completed in " + times[i] + " ms.");
}
long min = min(times);
@@ -131,7 +134,7 @@ public class Publisher implements MessageListener
static long min(long[] times)
{
long min = times.length > 0 ? times[0] : 0;
- for(int i = 0; i < times.length; i++)
+ for (int i = 0; i < times.length; i++)
{
min = Math.min(min, times[i]);
}
@@ -141,7 +144,7 @@ public class Publisher implements MessageListener
static long max(long[] times)
{
long max = times.length > 0 ? times[0] : 0;
- for(int i = 0; i < times.length; i++)
+ for (int i = 0; i < times.length; i++)
{
max = Math.max(max, times[i]);
}
@@ -151,14 +154,22 @@ public class Publisher implements MessageListener
static long avg(long[] times, long min, long max)
{
long sum = 0;
- for(int i = 0; i < times.length; i++)
+ for (int i = 0; i < times.length; i++)
{
sum += times[i];
}
- sum -= min;
- sum -= max;
- return (sum / (times.length - 2));
+ 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
diff --git a/qpid/java/perftests/src/main/java/perftests.log4j b/qpid/java/perftests/src/main/java/perftests.log4j
new file mode 100644
index 0000000000..a6e1bd5452
--- /dev/null
+++ b/qpid/java/perftests/src/main/java/perftests.log4j
@@ -0,0 +1,45 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT 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.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.topic=${amqj.test.logging.level}
+
+
+log4j.logger.uk.co.thebadgerset.junit.extensions=info, console
+log4j.additivity.uk.co.thebadgerset.junit.extensions=false
+log4j.logger.uk.co.thebadgerset.junit.extensions=info
+
+log4j.appender.console=org.apache.log4j.ConsoleAppender
+log4j.appender.console.Threshold=all
+log4j.appender.console.layout=org.apache.log4j.PatternLayout
+
+#log4j.appender.console.layout.ConversionPattern=%t %d %p [%c{4}] %m%n
+log4j.appender.console.layout.ConversionPattern=%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/src/test/java/org/apache/qpid/ping/PingAsyncTestPerf.java b/qpid/java/perftests/src/test/java/org/apache/qpid/ping/PingAsyncTestPerf.java
new file mode 100644
index 0000000000..a5647babff
--- /dev/null
+++ b/qpid/java/perftests/src/test/java/org/apache/qpid/ping/PingAsyncTestPerf.java
@@ -0,0 +1,310 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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 uk.co.thebadgerset.junit.extensions.TimingControllerAware;
+//import uk.co.thebadgerset.junit.extensions.TimingController;
+
+import javax.jms.MessageListener;
+import javax.jms.ObjectMessage;
+import javax.jms.JMSException;
+import javax.jms.Message;
+
+import junit.framework.Assert;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.log4j.Logger;
+
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.CountDownLatch;
+
+
+public class PingAsyncTestPerf extends PingTestPerf //implements TimingControllerAware
+{
+// private static Logger _logger = Logger.getLogger(PingAsyncTestPerf.class);
+
+// private TimingController _timingController;
+
+// private AsyncMessageListener _listener;
+
+ public PingAsyncTestPerf(String name)
+ {
+ super(name);
+ }
+
+// /**
+// * Compile all the tests into a test suite.
+// */
+// 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;
+// }
+//
+// protected void setUp() throws Exception
+// {
+// // Create the test setups on a per thread basis, only if they have not already been created.
+//
+// if (threadSetup.get() == null)
+// {
+// PerThreadSetup perThreadSetup = new PerThreadSetup();
+//
+// // Extract the test set up paramaeters.
+// String brokerDetails = testParameters.getProperty(BROKER_PROPNAME);
+// String username = "guest";
+// String password = "guest";
+// String virtualpath = testParameters.getProperty(VIRTUAL_PATH_PROPNAME);
+// int destinationscount = Integer.parseInt(testParameters.getProperty(PING_DESTINATION_COUNT_PROPNAME));
+// String destinationname = testParameters.getProperty(PING_DESTINATION_NAME_PROPNAME);
+// boolean persistent = Boolean.parseBoolean(testParameters.getProperty(PERSISTENT_MODE_PROPNAME));
+// boolean transacted = Boolean.parseBoolean(testParameters.getProperty(TRANSACTED_PROPNAME));
+// String selector = null;
+// boolean verbose = Boolean.parseBoolean(testParameters.getProperty(VERBOSE_OUTPUT_PROPNAME));
+// int messageSize = Integer.parseInt(testParameters.getProperty(MESSAGE_SIZE_PROPNAME));
+// int rate = Integer.parseInt(testParameters.getProperty(RATE_PROPNAME));
+// boolean pubsub = Boolean.parseBoolean(testParameters.getProperty(IS_PUBSUB_PROPNAME));
+//
+//
+// boolean afterCommit = Boolean.parseBoolean(testParameters.getProperty(FAIL_AFTER_COMMIT));
+// boolean beforeCommit = Boolean.parseBoolean(testParameters.getProperty(FAIL_BEFORE_COMMIT));
+// boolean afterSend = Boolean.parseBoolean(testParameters.getProperty(FAIL_AFTER_SEND));
+// boolean beforeSend = Boolean.parseBoolean(testParameters.getProperty(FAIL_BEFORE_SEND));
+// boolean failOnce = Boolean.parseBoolean(testParameters.getProperty(FAIL_ONCE));
+//
+// int batchSize = Integer.parseInt(testParameters.getProperty(BATCH_SIZE));
+// int commitbatchSize = Integer.parseInt(testParameters.getProperty(COMMIT_BATCH_SIZE));
+//
+// // 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 Queue and listen the reply back from same Queue
+// perThreadSetup._pingItselfClient = new TestPingItself(brokerDetails, username, password, virtualpath,
+// destinationname, selector, transacted, persistent,
+// messageSize, verbose,
+// afterCommit, beforeCommit, afterSend, beforeSend, failOnce,
+// commitbatchSize, destinationscount, rate, pubsub);
+// }
+//
+// // Attach the per-thread set to the thread.
+// threadSetup.set(perThreadSetup);
+//
+// _listener = new AsyncMessageListener(batchSize);
+//
+// perThreadSetup._pingItselfClient.setMessageListener(_listener);
+// // Start the client connection
+// perThreadSetup._pingItselfClient.getConnection().start();
+//
+// }
+// }
+//
+//
+// public void testAsyncPingOk(int numPings)
+// {
+// _timingController = this.getTimingController();
+//
+// _listener.setTotalMessages(numPings);
+//
+// PerThreadSetup perThreadSetup = threadSetup.get();
+// if (numPings == 0)
+// {
+// _logger.error("Number of pings requested was zero.");
+// fail("Number of pings requested was zero.");
+// }
+//
+// // Generate a sample message. This message is already time stamped and has its reply-to destination set.
+// ObjectMessage msg = null;
+//
+// try
+// {
+// msg = perThreadSetup._pingItselfClient.getTestMessage(null,
+// Integer.parseInt(testParameters.getProperty(
+// MESSAGE_SIZE_PROPNAME)),
+// Boolean.parseBoolean(testParameters.getProperty(
+// PERSISTENT_MODE_PROPNAME)));
+// }
+// catch (JMSException e)
+// {
+//
+// }
+//
+// // start the test
+// long timeout = Long.parseLong(testParameters.getProperty(TIMEOUT_PROPNAME));
+//
+// String correlationID = Long.toString(perThreadSetup._pingItselfClient.getNewID());
+//
+// try
+// {
+// _logger.debug("Sending messages");
+//
+// perThreadSetup._pingItselfClient.pingNoWaitForReply(msg, numPings, correlationID);
+//
+// _logger.debug("All sent");
+// }
+// catch (JMSException e)
+// {
+// e.printStackTrace();
+// Assert.fail("JMS Exception Received" + e);
+// }
+// catch (InterruptedException e)
+// {
+// e.printStackTrace();
+// }
+//
+// try
+// {
+// _logger.debug("Awating test finish");
+//
+// perThreadSetup._pingItselfClient.getEndLock(correlationID).await(timeout, TimeUnit.MILLISECONDS);
+//
+// if (perThreadSetup._pingItselfClient.getEndLock(correlationID).getCount() != 0)
+// {
+// _logger.error("Timeout occured");
+// }
+// //Allow the time out to exit the loop.
+// }
+// catch (InterruptedException e)
+// {
+// //ignore
+// _logger.error("Awaiting test end was interrupted.");
+//
+// }
+//
+// // Fail the test if the timeout was exceeded.
+// int numReplies = numPings - (int) perThreadSetup._pingItselfClient.removeLock(correlationID).getCount();
+//
+// _logger.info("Test Finished");
+//
+// if (numReplies != numPings)
+// {
+// try
+// {
+// perThreadSetup._pingItselfClient.commitTx(perThreadSetup._pingItselfClient.getConsumerSession());
+// }
+// catch (JMSException e)
+// {
+// _logger.error("Error commiting received messages", e);
+// }
+// try
+// {
+// if (_timingController != null)
+// {
+// _logger.trace("Logging missing message count");
+// _timingController.completeTest(false, numPings - numReplies);
+// }
+// }
+// catch (InterruptedException e)
+// {
+// //ignore
+// }
+// Assert.fail("The ping timed out after " + timeout + " ms. Messages Sent = " + numPings + ", MessagesReceived = " + numReplies);
+// }
+// }
+//
+// public void setTimingController(TimingController timingController)
+// {
+// _timingController = timingController;
+// }
+//
+// public TimingController getTimingController()
+// {
+// return _timingController;
+// }
+//
+//
+// private class AsyncMessageListener implements MessageListener
+// {
+// private volatile int _totalMessages;
+// private int _batchSize;
+// PerThreadSetup _perThreadSetup;
+//
+// public AsyncMessageListener(int batchSize)
+// {
+// this(batchSize, -1);
+// }
+//
+// public AsyncMessageListener(int batchSize, int totalMessages)
+// {
+// _batchSize = batchSize;
+// _totalMessages = totalMessages;
+// _perThreadSetup = threadSetup.get();
+// }
+//
+// public void setTotalMessages(int newTotal)
+// {
+// _totalMessages = newTotal;
+// }
+//
+// public void onMessage(Message message)
+// {
+// try
+// {
+// _logger.trace("Message Received");
+//
+// CountDownLatch count = _perThreadSetup._pingItselfClient.getEndLock(message.getJMSCorrelationID());
+//
+// int messagesLeft = (int) count.getCount() - 1;// minus one as we haven't yet counted the current message
+//
+// if ((messagesLeft % _batchSize) == 0)
+// {
+// doDone(_batchSize);
+// }
+// else if (messagesLeft == 0)
+// {
+// doDone(_totalMessages % _batchSize);
+// }
+//
+//
+// }
+// catch (JMSException e)
+// {
+// _logger.warn("There was a JMSException", e);
+// }
+//
+// }
+//
+// private void doDone(int messageCount)
+// {
+// _logger.trace("Messages received:" + messageCount);
+// _logger.trace("Total Messages :" + _totalMessages);
+//
+// try
+// {
+// if (_timingController != null)
+// {
+// _timingController.completeTest(true, messageCount);
+// }
+// }
+// catch (InterruptedException e)
+// {
+// //ignore
+// }
+// }
+//
+// }
+
+}
diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/ping/PingTestPerf.java b/qpid/java/perftests/src/test/java/org/apache/qpid/ping/PingTestPerf.java
new file mode 100644
index 0000000000..774c6f94b8
--- /dev/null
+++ b/qpid/java/perftests/src/test/java/org/apache/qpid/ping/PingTestPerf.java
@@ -0,0 +1,314 @@
+package org.apache.qpid.ping;
+
+import java.util.Properties;
+
+import javax.jms.*;
+
+import junit.framework.Assert;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.log4j.Logger;
+
+import uk.co.thebadgerset.junit.extensions.AsymptoticTestCase;
+
+/**
+ * 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/>
+ * <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/>
+ * <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/>
+ * <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/>
+ * <p/>Configurable test properties: message size, transacted or not, persistent or not. Broker connection details.
+ * <p/>
+ * <p><table id="crc"><caption>CRC Card</caption>
+ * <tr><th> Responsibilities <th> Collaborations
+ * </table>
+ *
+ * @author Rupert Smith
+ */
+public class PingTestPerf extends AsymptoticTestCase //implements TimingControllerAware
+{
+ private static Logger _logger = Logger.getLogger(PingTestPerf.class);
+
+ /**
+ * Holds the name of the property to get the test message size from.
+ */
+ protected static final String MESSAGE_SIZE_PROPNAME = "messagesize";
+
+ /**
+ * Holds the name of the property to get the ping queue name from.
+ */
+ protected static final String PING_DESTINATION_NAME_PROPNAME = "destinationname";
+
+ /**
+ * holds the queue count, if the test is being performed with multiple queues
+ */
+ protected static final String PING_DESTINATION_COUNT_PROPNAME = "destinationscount";
+
+ /**
+ * Holds the name of the property to get the test delivery mode from.
+ */
+ protected static final String PERSISTENT_MODE_PROPNAME = "persistent";
+
+ /**
+ * Holds the name of the property to get the test transactional mode from.
+ */
+ protected static final String TRANSACTED_PROPNAME = "transacted";
+
+ /**
+ * Holds the name of the property to get the test broker url from.
+ */
+ protected static final String BROKER_PROPNAME = "broker";
+
+ /**
+ * Holds the name of the property to get the test broker virtual path.
+ */
+ protected static final String VIRTUAL_PATH_PROPNAME = "virtualPath";
+
+ /**
+ * Holds the name of the property to get the waiting timeout for response messages.
+ */
+ protected static final String TIMEOUT_PROPNAME = "timeout";
+
+ /** Holds the name of the property to get the message rate from. */
+ protected static final String RATE_PROPNAME = "rate";
+
+ protected static final String VERBOSE_OUTPUT_PROPNAME = "verbose";
+
+ /** Holds the true or false depending on wether it is P2P test or PubSub */
+ protected static final String IS_PUBSUB_PROPNAME = "pubsub";
+ /**
+ * Holds the size of message body to attach to the ping messages.
+ */
+ protected static final int MESSAGE_SIZE_DEFAULT = 1024;
+
+ protected static final int BATCH_SIZE_DEFAULT = 1000;
+
+ protected static final int COMMIT_BATCH_SIZE_DEFAULT = BATCH_SIZE_DEFAULT;
+
+ /**
+ * Holds the name of the queue to which pings are sent.
+ */
+ private static final String PING_DESTINATION_NAME_DEFAULT = "ping";
+
+ /**
+ * Holds the message delivery mode to use for the test.
+ */
+ protected static final boolean PERSISTENT_MODE_DEFAULT = false;
+
+ /**
+ * Holds the transactional mode to use for the test.
+ */
+ protected static final boolean TRANSACTED_DEFAULT = false;
+
+ /**
+ * Holds the default broker url for the test.
+ */
+ protected static final String BROKER_DEFAULT = "tcp://localhost:5672";
+
+ /**
+ * Holds the default virtual path for the test.
+ */
+ protected static final String VIRTUAL_PATH_DEFAULT = "/test";
+
+ /**
+ * Sets a default ping timeout.
+ */
+ protected static final long TIMEOUT_DEFAULT = 3000;
+
+ /** Holds the default rate. A value of zero means infinity, only values of 1 or greater are meaningfull. */
+ private static final int RATE_DEFAULT = 0;
+
+ protected static final String FAIL_AFTER_COMMIT = "FailAfterCommit";
+ protected static final String FAIL_BEFORE_COMMIT = "FailBeforeCommit";
+ protected static final String FAIL_AFTER_SEND = "FailAfterSend";
+ protected static final String FAIL_BEFORE_SEND = "FailBeforeSend";
+ protected static final String COMMIT_BATCH_SIZE = "CommitBatchSize";
+ protected static final String BATCH_SIZE = "BatchSize";
+ protected static final String FAIL_ONCE = "FailOnce";
+
+ /**
+ * Thread local to hold the per-thread test setup fields.
+ */
+ ThreadLocal<PerThreadSetup> threadSetup = new ThreadLocal<PerThreadSetup>();
+
+ Object _lock = new Object();
+
+ // 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.
+ protected Properties testParameters = System.getProperties();
+ //private Properties testParameters = new ContextualProperties(System.getProperties());
+
+ public PingTestPerf(String name)
+ {
+ super(name);
+ // Sets up the test parameters with defaults.
+
+ setSystemPropertyIfNull(FAIL_AFTER_COMMIT, "false");
+ setSystemPropertyIfNull(FAIL_BEFORE_COMMIT, "false");
+ setSystemPropertyIfNull(FAIL_AFTER_SEND, "false");
+ setSystemPropertyIfNull(FAIL_BEFORE_SEND, "false");
+ setSystemPropertyIfNull(FAIL_ONCE, "true");
+
+ setSystemPropertyIfNull(BATCH_SIZE, Integer.toString(BATCH_SIZE_DEFAULT));
+ setSystemPropertyIfNull(COMMIT_BATCH_SIZE, Integer.toString(COMMIT_BATCH_SIZE_DEFAULT));
+ setSystemPropertyIfNull(MESSAGE_SIZE_PROPNAME, Integer.toString(MESSAGE_SIZE_DEFAULT));
+ setSystemPropertyIfNull(PING_DESTINATION_NAME_PROPNAME, PING_DESTINATION_NAME_DEFAULT);
+ setSystemPropertyIfNull(PERSISTENT_MODE_PROPNAME, Boolean.toString(PERSISTENT_MODE_DEFAULT));
+ setSystemPropertyIfNull(TRANSACTED_PROPNAME, Boolean.toString(TRANSACTED_DEFAULT));
+ setSystemPropertyIfNull(BROKER_PROPNAME, BROKER_DEFAULT);
+ setSystemPropertyIfNull(VIRTUAL_PATH_PROPNAME, VIRTUAL_PATH_DEFAULT);
+ setSystemPropertyIfNull(TIMEOUT_PROPNAME, Long.toString(TIMEOUT_DEFAULT));
+ setSystemPropertyIfNull(PING_DESTINATION_COUNT_PROPNAME, Integer.toString(0));
+ setSystemPropertyIfNull(VERBOSE_OUTPUT_PROPNAME, Boolean.toString(false));
+ setSystemPropertyIfNull(RATE_PROPNAME, Integer.toString(RATE_DEFAULT));
+ setSystemPropertyIfNull(IS_PUBSUB_PROPNAME, Boolean.toString(false));
+ }
+
+ /**
+ * Compile all the tests into a test suite.
+ */
+ 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;
+ //return new junit.framework.TestSuite(PingTestPerf.class);
+ }
+
+ protected static void setSystemPropertyIfNull(String propName, String propValue)
+ {
+ if (System.getProperty(propName) == null)
+ {
+ System.setProperty(propName, propValue);
+ }
+ }
+
+ public void testPing(int jim) throws Exception
+ {
+ testPingOk(1);
+ }
+
+ public void testPingOk(int numPings) throws Exception
+ {
+ // Get the per thread test setup to run the test through.
+ PerThreadSetup perThreadSetup = threadSetup.get();
+ if (numPings == 0)
+ {
+ _logger.error("Number of pings requested was zero.");
+ }
+
+ // Generate a sample message. This message is already time stamped and has its reply-to destination set.
+ ObjectMessage msg =
+ perThreadSetup._pingItselfClient.getTestMessage(null,
+ Integer.parseInt(testParameters.getProperty(
+ MESSAGE_SIZE_PROPNAME)),
+ Boolean.parseBoolean(testParameters.getProperty(
+ PERSISTENT_MODE_PROPNAME)));
+
+ // start the test
+ long timeout = Long.parseLong(testParameters.getProperty(TIMEOUT_PROPNAME));
+ int numReplies = perThreadSetup._pingItselfClient.pingAndWaitForReply(msg, numPings, timeout);
+
+ // Fail the test if the timeout was exceeded.
+ if (numReplies != numPings)
+ {
+ Assert.fail("The ping timed out after " + timeout + " ms. Messages Sent = " + numPings + ", MessagesReceived = "
+ + numReplies);
+ }
+ }
+
+
+ protected void setUp() throws Exception
+ {
+ // Log4j will propagate the test name as a thread local in all log output.
+ // Carefull when using this, it can cause memory leaks when not cleaned up properly.
+ //NDC.push(getName());
+
+ // Create the test setups on a per thread basis, only if they have not already been created.
+
+ if (threadSetup.get() == null)
+ {
+ PerThreadSetup perThreadSetup = new PerThreadSetup();
+
+ // Extract the test set up paramaeters.
+ String brokerDetails = testParameters.getProperty(BROKER_PROPNAME);
+ String username = "guest";
+ String password = "guest";
+ String virtualpath = testParameters.getProperty(VIRTUAL_PATH_PROPNAME);
+ int destinationscount = Integer.parseInt(testParameters.getProperty(PING_DESTINATION_COUNT_PROPNAME));
+ String destinationname = testParameters.getProperty(PING_DESTINATION_NAME_PROPNAME);
+ boolean persistent = Boolean.parseBoolean(testParameters.getProperty(PERSISTENT_MODE_PROPNAME));
+ boolean transacted = Boolean.parseBoolean(testParameters.getProperty(TRANSACTED_PROPNAME));
+ String selector = null;
+ boolean verbose = Boolean.parseBoolean(testParameters.getProperty(VERBOSE_OUTPUT_PROPNAME));
+ int messageSize = Integer.parseInt(testParameters.getProperty(MESSAGE_SIZE_PROPNAME));
+ int rate = Integer.parseInt(testParameters.getProperty(RATE_PROPNAME));
+ boolean pubsub = Boolean.parseBoolean(testParameters.getProperty(IS_PUBSUB_PROPNAME));
+
+ boolean afterCommit = Boolean.parseBoolean(testParameters.getProperty(FAIL_AFTER_COMMIT));
+ boolean beforeCommit = Boolean.parseBoolean(testParameters.getProperty(FAIL_BEFORE_COMMIT));
+ boolean afterSend = Boolean.parseBoolean(testParameters.getProperty(FAIL_AFTER_SEND));
+ boolean beforeSend = Boolean.parseBoolean(testParameters.getProperty(FAIL_BEFORE_SEND));
+ boolean failOnce = Boolean.parseBoolean(testParameters.getProperty(FAIL_ONCE));
+
+ int batchSize = Integer.parseInt(testParameters.getProperty(BATCH_SIZE));
+
+ // This is synchronized because there is a race condition, which causes one connection to sleep if
+ // all threads try to create connection concurrently
+ synchronized (_lock)
+ {
+ // Establish a client to ping a Destination and listen the reply back from same Destination
+ perThreadSetup._pingItselfClient = new TestPingItself(brokerDetails, username, password, virtualpath,
+ destinationname, selector, transacted, persistent,
+ messageSize, verbose, afterCommit, beforeCommit,
+ afterSend, beforeSend, failOnce, batchSize, destinationscount,
+ rate, pubsub);
+ }
+ // Start the client connection
+ perThreadSetup._pingItselfClient.getConnection().start();
+
+ // Attach the per-thread set to the thread.
+ threadSetup.set(perThreadSetup);
+ }
+ }
+
+ protected void tearDown() throws Exception
+ {
+ try
+ {
+ /*
+ if ((_pingItselfClient != null) && (_pingItselfClient.getConnection() != null))
+ {
+ _pingItselfClient.getConnection().close();
+ }
+ */
+ }
+ finally
+ {
+ //NDC.pop();
+ }
+ }
+
+ protected static class PerThreadSetup
+ {
+ /**
+ * Holds the test ping client.
+ */
+ protected TestPingItself _pingItselfClient;
+ }
+}
diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/ping/ThrottleTestPerf.java b/qpid/java/perftests/src/test/java/org/apache/qpid/ping/ThrottleTestPerf.java
new file mode 100644
index 0000000000..7183d4746a
--- /dev/null
+++ b/qpid/java/perftests/src/test/java/org/apache/qpid/ping/ThrottleTestPerf.java
@@ -0,0 +1,63 @@
+package org.apache.qpid.ping;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import uk.co.thebadgerset.junit.extensions.AsymptoticTestCase;
+
+/**
+ * Tests the {@link Throttle} implementation. Test timings can be taken using this test class to confirm that the
+ * throttle works as it should, and what the maximum rate is that it works reliably.
+ *
+ * <p><table id="crc"><caption>CRC Card</caption>
+ * <tr><th> Responsibilities <th> Collaborations
+ * <tr><td> Enable test timings to be taken to confirm that the throttle works at the correct rate.
+ * </table>
+ *
+ * @author Rupert Smith
+ */
+public class ThrottleTestPerf extends AsymptoticTestCase
+{
+ ThreadLocal<Throttle> threadSetup = new ThreadLocal<Throttle>();
+
+ public ThrottleTestPerf(String name)
+ {
+ super(name);
+ }
+
+ /**
+ * 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 ThrottleTestPerf("testThrottle"));
+
+ return suite;
+ }
+
+ public void testThrottle(int opsPerSecond)
+ {
+ Throttle throttle = threadSetup.get();
+
+ // Setting this on every test call won't cause any harm, convenient to use the size parameter for this.
+ throttle.setRate(opsPerSecond);
+
+ // Run the test at the throttled rate, do this for the num of opsPerSecond, then every test should take 1 second.
+ for (int i = 0; i < opsPerSecond; i++)
+ {
+ throttle.throttle();
+ }
+ }
+
+ protected void setUp()
+ {
+ if (threadSetup.get() == null)
+ {
+ threadSetup.set(new Throttle());
+ }
+ }
+}
diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/requestreply/PingPongTestPerf.java b/qpid/java/perftests/src/test/java/org/apache/qpid/requestreply/PingPongTestPerf.java
new file mode 100644
index 0000000000..62af73e53d
--- /dev/null
+++ b/qpid/java/perftests/src/test/java/org/apache/qpid/requestreply/PingPongTestPerf.java
@@ -0,0 +1,296 @@
+package org.apache.qpid.requestreply;
+
+import java.util.Properties;
+
+import javax.jms.*;
+
+import junit.framework.Assert;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.log4j.Logger;
+
+import uk.co.thebadgerset.junit.extensions.AsymptoticTestCase;
+
+/**
+ * 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/>
+ * <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 TKTestRunner} or {@link PPTestRunner} for more information on how
+ * to do this.
+ * <p/>
+ * <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/>
+ * <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/>
+ * <p/>Configurable test properties: message size, transacted or not, persistent or not. Broker connection details.
+ * <p/>
+ * <p><table id="crc"><caption>CRC Card</caption>
+ * <tr><th> Responsibilities <th> Collaborations
+ * </table>
+ *
+ * @author Rupert Smith
+ */
+public class PingPongTestPerf extends AsymptoticTestCase //implements TimingControllerAware
+{
+ private static Logger _logger = Logger.getLogger(PingPongTestPerf.class);
+
+ /**
+ * Holds the name of the property to get the test message size from.
+ */
+ private static final String MESSAGE_SIZE_PROPNAME = "messagesize";
+
+ /**
+ * Holds the name of the property to get the ping queue name from.
+ */
+ private static final String PING_QUEUE_NAME_PROPNAME = "destinationname";
+
+ /**
+ * Holds the name of the property to get the test delivery mode from.
+ */
+ private static final String PERSISTENT_MODE_PROPNAME = "persistent";
+
+ /**
+ * Holds the name of the property to get the test transactional mode from.
+ */
+ private static final String TRANSACTED_PROPNAME = "transacted";
+
+ /**
+ * Holds the name of the property to get the test broker url from.
+ */
+ private static final String BROKER_PROPNAME = "broker";
+
+ /**
+ * Holds the name of the property to get the test broker virtual path.
+ */
+ private static final String VIRTUAL_PATH_PROPNAME = "virtualPath";
+
+ /**
+ * Holds the size of message body to attach to the ping messages.
+ */
+ private static final int MESSAGE_SIZE_DEFAULT = 0;
+
+ private static final int BATCH_SIZE_DEFAULT = 2;
+
+ /**
+ * Holds the name of the queue to which pings are sent.
+ */
+ private static final String PING_QUEUE_NAME_DEFAULT = "ping";
+
+ /**
+ * Holds the message delivery mode to use for the test.
+ */
+ private static final boolean PERSISTENT_MODE_DEFAULT = false;
+
+ /**
+ * Holds the transactional mode to use for the test.
+ */
+ private static final boolean TRANSACTED_DEFAULT = false;
+
+ /**
+ * Holds the default broker url for the test.
+ */
+ private static final String BROKER_DEFAULT = "tcp://localhost:5672";
+
+ /**
+ * Holds the default virtual path for the test.
+ */
+ private static final String VIRTUAL_PATH_DEFAULT = "/test";
+
+ /**
+ * Sets a default ping timeout.
+ */
+ private static final long TIMEOUT = 15000;
+
+ /** Holds the name of the property to get the message rate from. */
+ private static final String RATE_PROPNAME = "rate";
+
+ private static final String VERBOSE_OUTPUT_PROPNAME = "verbose";
+
+ /** Holds the true or false depending on wether it is P2P test or PubSub */
+ private static final String IS_PUBSUB_PROPNAME = "pubsub";
+
+ /** Holds the default rate. A value of zero means infinity, only values of 1 or greater are meaningfull. */
+ private static final int RATE_DEFAULT = 0;
+
+ private static final String FAIL_AFTER_COMMIT = "FailAfterCommit";
+ private static final String FAIL_BEFORE_COMMIT = "FailBeforeCommit";
+ private static final String FAIL_AFTER_SEND = "FailAfterSend";
+ private static final String FAIL_BEFORE_SEND = "FailBeforeSend";
+ private static final String BATCH_SIZE = "BatchSize";
+ private static final String FAIL_ONCE = "FailOnce";
+
+ /**
+ * Thread local to hold the per-thread test setup fields.
+ */
+ ThreadLocal<PerThreadSetup> threadSetup = new ThreadLocal<PerThreadSetup>();
+ Object _lock = new Object();
+
+ // 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 Properties testParameters = new ContextualProperties(System.getProperties());
+
+ public PingPongTestPerf(String name)
+ {
+ super(name);
+
+ // Sets up the test parameters with defaults.
+ setSystemPropertyIfNull(BATCH_SIZE, Integer.toString(BATCH_SIZE_DEFAULT));
+ setSystemPropertyIfNull(MESSAGE_SIZE_PROPNAME, Integer.toString(MESSAGE_SIZE_DEFAULT));
+ setSystemPropertyIfNull(PING_QUEUE_NAME_PROPNAME, PING_QUEUE_NAME_DEFAULT);
+ setSystemPropertyIfNull(PERSISTENT_MODE_PROPNAME, Boolean.toString(PERSISTENT_MODE_DEFAULT));
+ setSystemPropertyIfNull(TRANSACTED_PROPNAME, Boolean.toString(TRANSACTED_DEFAULT));
+ setSystemPropertyIfNull(BROKER_PROPNAME, BROKER_DEFAULT);
+ setSystemPropertyIfNull(VIRTUAL_PATH_PROPNAME, VIRTUAL_PATH_DEFAULT);
+ setSystemPropertyIfNull(VERBOSE_OUTPUT_PROPNAME, Boolean.toString(false));
+ setSystemPropertyIfNull(RATE_PROPNAME, Integer.toString(RATE_DEFAULT));
+ setSystemPropertyIfNull(IS_PUBSUB_PROPNAME, Boolean.toString(false));
+ }
+
+ /**
+ * 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.
+ ObjectMessage msg =
+ perThreadSetup._testPingProducer.getTestMessage(perThreadSetup._testPingProducer.getReplyDestination(),
+ Integer.parseInt(testParameters.getProperty(
+ MESSAGE_SIZE_PROPNAME)),
+ Boolean.parseBoolean(testParameters.getProperty(
+ PERSISTENT_MODE_PROPNAME)));
+
+ // Use the test timing controller to reset the test timer now and obtain the current time.
+ // This can be used to remove the message creation time from the test.
+ //TestTimingController timingUtils = getTimingController();
+ //long startTime = timingUtils.restart();
+
+ // Send the message and wait for a reply.
+ int numReplies = perThreadSetup._testPingProducer.pingAndWaitForReply(msg, numPings, TIMEOUT);
+
+ // Fail the test if the timeout was exceeded.
+ if (numReplies != numPings)
+ {
+ Assert.fail("The ping timed out, got " + numReplies + " out of " + numPings);
+ }
+ }
+
+ protected void setUp() throws Exception
+ {
+ // Log4j will propagate the test name as a thread local in all log output.
+ // Carefull when using this, it can cause memory leaks when not cleaned up properly.
+ //NDC.push(getName());
+
+ // Create the test setups on a per thread basis, only if they have not already been created.
+ if (threadSetup.get() == null)
+ {
+ PerThreadSetup perThreadSetup = new PerThreadSetup();
+
+ // Extract the test set up paramaeters.
+ String brokerDetails = testParameters.getProperty(BROKER_PROPNAME);
+ String username = "guest";
+ String password = "guest";
+ String virtualpath = testParameters.getProperty(VIRTUAL_PATH_PROPNAME);
+ String queueName = testParameters.getProperty(PING_QUEUE_NAME_PROPNAME);
+ boolean persistent = Boolean.parseBoolean(testParameters.getProperty(PERSISTENT_MODE_PROPNAME));
+ boolean transacted = Boolean.parseBoolean(testParameters.getProperty(TRANSACTED_PROPNAME));
+ String selector = null;
+ boolean verbose = Boolean.parseBoolean(testParameters.getProperty(VERBOSE_OUTPUT_PROPNAME));
+ int messageSize = Integer.parseInt(testParameters.getProperty(MESSAGE_SIZE_PROPNAME));
+ int rate = Integer.parseInt(testParameters.getProperty(RATE_PROPNAME));
+ boolean pubsub = Boolean.parseBoolean(testParameters.getProperty(IS_PUBSUB_PROPNAME));
+
+ boolean afterCommit = Boolean.parseBoolean(testParameters.getProperty(FAIL_AFTER_COMMIT));
+ boolean beforeCommit = Boolean.parseBoolean(testParameters.getProperty(FAIL_BEFORE_COMMIT));
+ boolean afterSend = Boolean.parseBoolean(testParameters.getProperty(FAIL_AFTER_SEND));
+ boolean beforeSend = Boolean.parseBoolean(testParameters.getProperty(FAIL_BEFORE_SEND));
+ int batchSize = Integer.parseInt(testParameters.getProperty(BATCH_SIZE));
+ Boolean failOnce = Boolean.parseBoolean(testParameters.getProperty(FAIL_ONCE));
+
+ synchronized(_lock)
+ {
+ // Establish a bounce back client on the ping queue to bounce back the pings.
+ perThreadSetup._testPingBouncer = new PingPongBouncer(brokerDetails, username, password, virtualpath,
+ queueName, 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 with.
+
+ perThreadSetup._testPingProducer = new PingPongProducer(brokerDetails, username, password, virtualpath,
+ queueName, selector, transacted, persistent, messageSize,
+ verbose, afterCommit, beforeCommit, afterSend,
+ beforeSend, failOnce, batchSize, 0, rate, pubsub);
+ perThreadSetup._testPingProducer.getConnection().start();
+ }
+
+ // Attach the per-thread set to the thread.
+ threadSetup.set(perThreadSetup);
+ }
+ }
+
+ protected void tearDown() throws Exception
+ {
+ try
+ {
+ /**if ((_testPingBouncer != null) && (_testPingBouncer.getConnection() != null))
+ {
+ _testPingBouncer.getConnection().close();
+ }
+
+ if ((_testPingProducer != null) && (_testPingProducer.getConnection() != null))
+ {
+ _testPingProducer.getConnection().close();
+ }*/
+ }
+ finally
+ {
+ //NDC.pop();
+ }
+ }
+
+ private 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/pom.xml b/qpid/java/pom.xml
index 0f1f016a54..e1d9805bbb 100644
--- a/qpid/java/pom.xml
+++ b/qpid/java/pom.xml
@@ -46,6 +46,14 @@
<name>Apache SNAPSHOT Repository</name>
<url>scp://people.apache.org/www/people.apache.org/repo/m2-snapshot-repository</url>
</snapshotRepository>
+
+ <!-- Qpid has a Wiki site, maven generated site not used. This is just so that it can be created locally for viewing the reports. -->
+ <site>
+ <id>Qpid_Site</id>
+ <name>Qpid Site</name>
+ <url>file:/temp</url>
+ </site>
+
</distributionManagement>
<inceptionYear>2006</inceptionYear>
@@ -65,6 +73,7 @@
<archive>http://mail-archives.apache.org/mod_mbox/incubator-qpid-commits</archive>
</mailingList>
</mailingLists>
+
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
@@ -72,23 +81,33 @@
<distribution>repo</distribution>
</license>
</licenses>
+
<organization>
<name>Apache Software Foundation</name>
<url>http://www.apache.org/</url>
</organization>
+
<properties>
<topDirectoryLocation>.</topDirectoryLocation>
- <surefire.fork.mode>once</surefire.fork.mode>
+ <surefire.fork.mode>never</surefire.fork.mode>
<surefire.format>brief</surefire.format>
<surefire.usefile>false</surefire.usefile>
<compile.forked>false</compile.forked>
<java.source.version>1.5</java.source.version>
<compile.flags>-Xlint:fallthrough,finally</compile.flags>
+ <!--
+ This should always point to a default minimal log4j configuration that all developers are happy with as a useable default. To use your own
+ log4j preferences set up an alternative in your settings.xml and avoid corrupting the default with private preferences.
+ -->
+ <!--<log4j.configuration>file:/${topDirectoryLocation}/etc/log4j.xml</log4j.configuration>-->
+ <amqj.logging.level>warn</amqj.logging.level> <!-- This is referenced in the default log4j.xml -->
+
<!--Versions for various plugins and features -->
<antrun.version>1.2-SNAPSHOT</antrun.version>
- <assembly.version>2.1</assembly.version>
+ <!--<assembly.version>2.2-SNAPSHOT</assembly.version>-->
+ <assembly.version>2.1</assembly.version>
<cobertura.version>2.0</cobertura.version>
<compiler.version>2.0.1</compiler.version>
<dependency.plugin.version>1.0</dependency.plugin.version>
@@ -103,8 +122,6 @@
<surefire-report.version>2.1-SNAPSHOT</surefire-report.version>
<surefire.version>2.2</surefire.version>
- <amqj.logging.level>warn</amqj.logging.level>
-
<eclipse.workspace.dir>${basedir}/${topDirectoryLocation}/../workspace</eclipse.workspace.dir>
<clover.license.pathname>/set/clover/license/path/here</clover.license.pathname>
</properties>
@@ -115,6 +132,7 @@
<module>client</module>
<module>cluster</module>
<module>systests</module>
+ <module>perftests</module>
<module>management/eclipse-plugin</module>
</modules>
@@ -124,6 +142,7 @@
<directory>src/main/java</directory>
<excludes>
<exclude>**/*.java</exclude>
+ <exclude>**/log4j.properties</exclude>
</excludes>
</resource>
<resource>
@@ -146,6 +165,7 @@
</includes>
</resource>
</resources>
+
<testResources>
<testResource>
<directory>src/test/java</directory>
@@ -181,7 +201,6 @@
<artifactId>ant-nodeps</artifactId>
<version>1.6.5</version>
</dependency>
-
</dependencies>
<executions>
@@ -194,13 +213,13 @@
time, during the 'package' phase to capture the version of any resources added to jar files.
This svnversion command is always run in the top directory to accurately reflect the svnversion range accross all modules
at the time of the build.
- The properties are placed into a file 'qpidversion.properties' in the target/classes directory of any child module that runs
- this plugin.
+ The properties are placed into a file 'qpidversion.properties' in the target/classes directory of any child module
+ that runs this plugin.
The 'qpidversion.properties' file is loaded by the org.apache.qpid.common.QpidProperties class.
Be carefull of the possibility that the 'common' module may run this antrun plugin and recieve its own set of
- qpidversion.properties and then the client or broker being built against an older version of the common library ending up with
- the wrong version information. This is unlikely to happen because the client or broker should pick up its own properties
- from the classpath first. If this happens it will be obvious because the productName property will be
+ qpidversion.properties and then the client or broker being built against an older version of the common library ending
+ up with the wrong version information. This is unlikely to happen because the client or broker should pick up its own
+ properties from the classpath first. If this happens it will be obvious because the productName property will be
'Qpid Common Utilities'. If this is a problem then push this ant task down into the client and broker poms and remove it
from here.
-->
@@ -230,16 +249,19 @@
</execution>
</executions>
</plugin>
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>${jar.version}</version>
</plugin>
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>${resources.version}</version>
</plugin>
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
@@ -250,6 +272,7 @@
<fork>${compile.forked}</fork>
</configuration>
</plugin>
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
@@ -265,17 +288,23 @@
<argLine>-ea</argLine>
<systemproperties>
<property>
- <name>amqj.logging.level</name>
+ <name>amqj.logging.level</name>
<value>${amqj.logging.level}</value>
+ <!--
+ <name>log4j.configuration</name>
+ <value>${log4j.configuration}</value>
+ -->
</property>
</systemproperties>
</configuration>
</plugin>
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>${site.version}</version>
</plugin>
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
@@ -290,14 +319,16 @@
</projectnatures>
</configuration>
</plugin>
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-idea-plugin</artifactId>
<configuration>
- <downloadSources>true</downloadSources>
+ <!--downloadSources>true</downloadSources-->
<downloadJavadocs>true</downloadJavadocs>
</configuration>
</plugin>
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clover-plugin</artifactId>
@@ -316,9 +347,20 @@
</execution>
</executions>
</plugin>
+
+ <!-- The JUnit Toolkit maven2 plugin is in the process of being added to the maven repository. It will take a day or two from 16/1/2007.
+ <plugin>
+ <groupId>uk.co.thebadgerset</groupId>
+ <artifactId>junit-toolkit-maven-plugin</artifactId>
+ <version>0.3</version>
+ </plugin>
+ -->
+
</plugins>
</pluginManagement>
+
<defaultGoal>install</defaultGoal>
+
</build>
<dependencyManagement>
@@ -347,13 +389,6 @@
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.1</version>
- <exclusions>
- <!-- this seems to have a junit compile dependency -->
- <exclusion>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
@@ -405,18 +440,30 @@
<artifactId>backport-util-concurrent</artifactId>
<version>2.2</version>
</dependency>
+
+ <!-- Test Dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
+
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymockclassextension</artifactId>
<version>2.2</version>
<scope>test</scope>
</dependency>
+
+ <dependency>
+ <groupId>uk.co.thebadgerset</groupId>
+ <artifactId>junit-toolkit</artifactId>
+ <version>0.3</version>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- Qpid Version Dependencies -->
<dependency>
<groupId>org.apache.qpid</groupId>
<artifactId>qpid-common</artifactId>
@@ -434,6 +481,16 @@
</dependency>
<dependency>
<groupId>org.apache.qpid</groupId>
+ <artifactId>qpid-perftests</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.qpid</groupId>
+ <artifactId>qpid-systests</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.qpid</groupId>
<artifactId>qpid-mgmt-core</artifactId>
<version>${project.version}</version>
</dependency>
diff --git a/qpid/java/systests/distribution/pom.xml b/qpid/java/systests/distribution/pom.xml
new file mode 100644
index 0000000000..bff1e0d9e5
--- /dev/null
+++ b/qpid/java/systests/distribution/pom.xml
@@ -0,0 +1,111 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT 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 xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.qpid</groupId>
+ <artifactId>qpid-systests-distribution</artifactId>
+ <packaging>jar</packaging>
+ <version>1.0-incubating-M2-SNAPSHOT</version>
+ <name>Qpid System Tests Distribution</name>
+ <url>http://cwiki.apache.org/confluence/display/qpid</url>
+
+ <parent>
+ <groupId>org.apache.qpid</groupId>
+ <artifactId>qpid</artifactId>
+ <version>1.0-incubating-M2-SNAPSHOT</version>
+ </parent>
+
+ <properties>
+ <topDirectoryLocation>..</topDirectoryLocation>
+ <java.source.version>1.5</java.source.version>
+ <qpid.version>${pom.version}</qpid.version>
+ <qpid.targetDir>${project.build.directory}</qpid.targetDir>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.qpid</groupId>
+ <artifactId>qpid-systests</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>${java.source.version}</source>
+ <target>${java.source.version}</target>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>${assembly.version}</version>
+ <configuration>
+ <finalName>qpid-${pom.version}</finalName>
+ <outputDirectory>${qpid.targetDir}</outputDirectory>
+ <tarLongFileMode>gnu</tarLongFileMode>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <finalName>qpid-systests</finalName>
+ <archive>
+ <manifest>
+ <addClasspath>true</addClasspath>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </pluginManagement>
+
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>distribution-package</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/assembly/systests.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+
+ </build>
+
+</project>
diff --git a/qpid/java/systests/distribution/src/main/assembly/systests.xml b/qpid/java/systests/distribution/src/main/assembly/systests.xml
new file mode 100644
index 0000000000..2d6a6d8572
--- /dev/null
+++ b/qpid/java/systests/distribution/src/main/assembly/systests.xml
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<assembly>
+ <id>system-test-java</id>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <formats>
+ <format>tar.gz</format>
+ <format>zip</format>
+ </formats>
+
+<fileSets>
+ <!-- Apache Licensing Details-->
+ <fileSet>
+ <directory>../../resources</directory>
+ <outputDirectory>qpid-${qpid.version}</outputDirectory>
+ <includes>
+ <include>DISCLAIMER</include>
+ <include>LICENSE.txt</include>
+ <include>NOTICE.txt</include>
+ <include>README.txt</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>..</directory>
+ <outputDirectory>qpid-${qpid.version}</outputDirectory>
+ <includes>
+ <include>*.txt</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>../../release-docs</directory>
+ <outputDirectory>qpid-${qpid.version}/docs</outputDirectory>
+ <includes>
+ <include>RELEASE_NOTES.txt</include>
+ </includes>
+ </fileSet>
+
+ <!-- Scripts to run the system tests-->
+ <fileSet>
+ <directory>../bin</directory>
+ <outputDirectory>qpid-${qpid.version}/bin</outputDirectory>
+ <includes>
+ <include>*</include>
+ </includes>
+ </fileSet>
+
+ <!-- Include source files in easy access form -->
+ <fileSet>
+ <directory>../src/main</directory>
+ <outputDirectory>qpid-${qpid.version}/src</outputDirectory>
+ <includes>
+ <include>**/*.java</include>
+ <include>**/*.log4j</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>target</directory>
+ <outputDirectory>qpid-${qpid.version}/lib</outputDirectory>
+ <includes>
+ <include>qpid-systests.jar</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>qpid-${qpid.version}/lib</outputDirectory>
+ <unpack>false</unpack>
+ <excludes>
+ <exclude>org.apache.qpid:qpid-systests-distribution</exclude>
+ </excludes>
+ </dependencySet>
+ </dependencySets>
+</assembly>
diff --git a/qpid/java/systests/pom.xml b/qpid/java/systests/pom.xml
index c73e5f2c44..614166754c 100644
--- a/qpid/java/systests/pom.xml
+++ b/qpid/java/systests/pom.xml
@@ -39,23 +39,20 @@
<dependencies>
<dependency>
<groupId>org.apache.qpid</groupId>
- <artifactId>qpid-common</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.qpid</groupId>
<artifactId>qpid-client</artifactId>
+ <type>jar</type>
</dependency>
+
<dependency>
<groupId>org.apache.qpid</groupId>
<artifactId>qpid-broker</artifactId>
+ <type>jar</type>
</dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- </dependency>
+
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
+ <scope>compile</scope>
</dependency>
</dependencies>
@@ -65,26 +62,30 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <systemProperties>
- <property>
- <name>amqj.noAutoCreateVMBroker</name>
- <value>true</value>
- </property>
- <property>
- <name>amqj.logging.level</name>
- <value>${amqj.logging.level}</value>
- </property>
- <property>
- <name>log4j.debug</name>
- <value>true</value>
- </property>
- <property>
- <name>log4j.configuration</name>
- <value>file:///${basedir}/src/test/java/log4j.properties</value>
- </property>
- </systemProperties>
+ <skip>true</skip>
</configuration>
</plugin>
+
</plugins>
+
+ <!-- Include source files in built jar -->
+ <resources>
+ <resource>
+ <targetPath>src/</targetPath>
+ <filtering>false</filtering>
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**/*.java</include>
+ </includes>
+ </resource>
+ <resource>
+ <targetPath>src/</targetPath>
+ <filtering>false</filtering>
+ <directory>src/main/java</directory>
+ <includes>
+ <include>systests.log4j</include>
+ </includes>
+ </resource>
+ </resources>
</build>
</project>