diff options
author | Bhupendra Bhusman Bhardwaj <bhupendrab@apache.org> | 2007-04-25 14:46:03 +0000 |
---|---|---|
committer | Bhupendra Bhusman Bhardwaj <bhupendrab@apache.org> | 2007-04-25 14:46:03 +0000 |
commit | 385cc184361c6d58d56fb696e4eeb0f6ad511fa0 (patch) | |
tree | 1f6204b12dc0dfee95bfe2844b4e3a2878a39c4d | |
parent | 67e83d69417b33226cf647f4d83bbd6a4bc86ce5 (diff) | |
download | qpid-python-385cc184361c6d58d56fb696e4eeb0f6ad511fa0.tar.gz |
Made the return type of getTestMessage() to a generic type for subclass to override.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/M2@532372 13f79535-47bb-0310-9956-ffa450edef68
6 files changed, 44 insertions, 6 deletions
diff --git a/java/perftests/etc/scripts/sendAndWaitClient.sh b/java/perftests/etc/scripts/sendAndWaitClient.sh new file mode 100755 index 0000000000..af4b788658 --- /dev/null +++ b/java/perftests/etc/scripts/sendAndWaitClient.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# + +$JAVA_HOME/bin/java -Dlog4j.configuration=backup-log4j.xml -cp qpid-perftests-1.0-incubating-M2-SNAPSHOT-all-test-deps.jar org.apache.qpid.ping.PingSendOnlyClient messageSize=512 diff --git a/java/perftests/src/main/java/org/apache/qpid/ping/PingSendOnlyClient.java b/java/perftests/src/main/java/org/apache/qpid/ping/PingSendOnlyClient.java index 7cf5e4516f..29757a20ba 100644 --- a/java/perftests/src/main/java/org/apache/qpid/ping/PingSendOnlyClient.java +++ b/java/perftests/src/main/java/org/apache/qpid/ping/PingSendOnlyClient.java @@ -6,6 +6,12 @@ import java.util.Properties; import org.apache.log4j.Logger;
import org.apache.qpid.util.CommandLineParser;
+import org.apache.qpid.client.message.TestMessageFactory;
+
+import javax.jms.ObjectMessage;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
/**
* <p><table id="crc"><caption>CRC Card</caption>
@@ -32,7 +38,7 @@ public class PingSendOnlyClient extends PingDurableClient {
// Create a ping producer overriding its defaults with all options passed on the command line.
Properties options = CommandLineParser.processCommandLine(args, new CommandLineParser(new String[][] {}));
- PingDurableClient pingProducer = new PingSendOnlyClient(options);
+ PingSendOnlyClient pingProducer = new PingSendOnlyClient(options);
// Create a shutdown hook to terminate the ping-pong producer.
Runtime.getRuntime().addShutdownHook(pingProducer.getShutdownHook());
@@ -54,4 +60,14 @@ public class PingSendOnlyClient extends PingDurableClient System.exit(1);
}
}
+
+ public Message getTestMessage(Destination replyQueue, int messageSize, boolean persistent) throws JMSException
+ {
+ Message msg = TestMessageFactory.newTextMessage(_producerSession, messageSize);
+
+ // Timestamp the message in nanoseconds.
+ msg.setLongProperty(MESSAGE_TIMESTAMP_PROPNAME, System.nanoTime());
+
+ return msg;
+ }
}
diff --git a/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java b/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java index ecaf27167f..5dec2125ee 100644 --- a/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java +++ b/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java @@ -1049,7 +1049,7 @@ public class PingPongProducer implements Runnable, MessageListener, ExceptionLis try
{
// Generate a sample message and time stamp it.
- ObjectMessage msg = getTestMessage(_replyDestination, _messageSize, _persistent);
+ Message msg = getTestMessage(_replyDestination, _messageSize, _persistent);
msg.setLongProperty(MESSAGE_TIMESTAMP_PROPNAME, System.nanoTime());
// Send the message and wait for a reply.
@@ -1096,7 +1096,7 @@ public class PingPongProducer implements Runnable, MessageListener, ExceptionLis *
* @throws javax.jms.JMSException All underlying JMSException are allowed to fall through.
*/
- public ObjectMessage getTestMessage(Destination replyQueue, int messageSize, boolean persistent) throws JMSException
+ public Message getTestMessage(Destination replyQueue, int messageSize, boolean persistent) throws JMSException
{
ObjectMessage msg = TestMessageFactory.newObjectMessage(_producerSession, replyQueue, messageSize, persistent);
diff --git a/java/perftests/src/test/java/org/apache/qpid/ping/PingLatencyTestPerf.java b/java/perftests/src/test/java/org/apache/qpid/ping/PingLatencyTestPerf.java index b303e16d2c..c822964152 100644 --- a/java/perftests/src/test/java/org/apache/qpid/ping/PingLatencyTestPerf.java +++ b/java/perftests/src/test/java/org/apache/qpid/ping/PingLatencyTestPerf.java @@ -168,7 +168,7 @@ public class PingLatencyTestPerf extends PingTestPerf implements TimingControlle pingClient.setChainedMessageListener(batchedResultsListener);
// Generate a sample message of the specified size.
- ObjectMessage msg =
+ Message msg =
pingClient.getTestMessage(perThreadSetup._pingClient.getReplyDestinations().get(0),
testParameters.getPropertyAsInteger(PingPongProducer.MESSAGE_SIZE_PROPNAME),
testParameters.getPropertyAsBoolean(PingPongProducer.PERSISTENT_MODE_PROPNAME));
diff --git a/java/perftests/src/test/java/org/apache/qpid/ping/PingTestPerf.java b/java/perftests/src/test/java/org/apache/qpid/ping/PingTestPerf.java index fd3bc3ff23..6e8bf65198 100644 --- a/java/perftests/src/test/java/org/apache/qpid/ping/PingTestPerf.java +++ b/java/perftests/src/test/java/org/apache/qpid/ping/PingTestPerf.java @@ -140,7 +140,7 @@ public class PingTestPerf extends AsymptoticTestCase implements TestThreadAware }
// Generate a sample message. This message is already time stamped and has its reply-to destination set.
- ObjectMessage msg =
+ Message msg =
perThreadSetup._pingClient.getTestMessage(perThreadSetup._pingClient.getReplyDestinations().get(0),
testParameters.getPropertyAsInteger(PingPongProducer.MESSAGE_SIZE_PROPNAME),
testParameters.getPropertyAsBoolean(PingPongProducer.PERSISTENT_MODE_PROPNAME));
diff --git a/java/perftests/src/test/java/org/apache/qpid/requestreply/PingPongTestPerf.java b/java/perftests/src/test/java/org/apache/qpid/requestreply/PingPongTestPerf.java index a09324b568..9a9f9ba6b5 100644 --- a/java/perftests/src/test/java/org/apache/qpid/requestreply/PingPongTestPerf.java +++ b/java/perftests/src/test/java/org/apache/qpid/requestreply/PingPongTestPerf.java @@ -148,7 +148,7 @@ public class PingPongTestPerf extends AsymptoticTestCase PerThreadSetup perThreadSetup = threadSetup.get();
// Generate a sample message. This message is already time stamped and has its reply-to destination set.
- ObjectMessage msg =
+ Message msg =
perThreadSetup._testPingProducer.getTestMessage(perThreadSetup._testPingProducer.getReplyDestinations().get(0),
testParameters.getPropertyAsInteger(PingPongProducer.MESSAGE_SIZE_PROPNAME),
testParameters.getPropertyAsBoolean(PingPongProducer.PERSISTENT_MODE_PROPNAME));
|