summaryrefslogtreecommitdiff
path: root/java/perftests/src
diff options
context:
space:
mode:
authorRupert Smith <rupertlssmith@apache.org>2007-08-16 10:16:48 +0000
committerRupert Smith <rupertlssmith@apache.org>2007-08-16 10:16:48 +0000
commit21ec90fa6f5d192df0e2753de0bace17bef5e7d2 (patch)
tree5cced6ffe20480949177c95ced0265dbd22da8e8 /java/perftests/src
parentabc5e0fb1ca84adf1b06c4cd4fb45e55faa55f76 (diff)
downloadqpid-python-21ec90fa6f5d192df0e2753de0bace17bef5e7d2.tar.gz
Fixed multiplcation for expected message count on shared destinations p2p.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/M2@566643 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/perftests/src')
-rw-r--r--java/perftests/src/main/java/org/apache/qpid/ping/PingClient.java21
-rw-r--r--java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java23
2 files changed, 32 insertions, 12 deletions
diff --git a/java/perftests/src/main/java/org/apache/qpid/ping/PingClient.java b/java/perftests/src/main/java/org/apache/qpid/ping/PingClient.java
index e3b0249ed3..984b994c05 100644
--- a/java/perftests/src/main/java/org/apache/qpid/ping/PingClient.java
+++ b/java/perftests/src/main/java/org/apache/qpid/ping/PingClient.java
@@ -20,12 +20,14 @@
*/
package org.apache.qpid.ping;
-import java.util.List;
-import java.util.Properties;
+import org.apache.log4j.Logger;
+
+import org.apache.qpid.requestreply.PingPongProducer;
import javax.jms.Destination;
-import org.apache.qpid.requestreply.PingPongProducer;
+import java.util.List;
+import java.util.Properties;
/**
* PingClient is a {@link PingPongProducer} that does not need a {@link org.apache.qpid.requestreply.PingPongBouncer}
@@ -36,7 +38,7 @@ import org.apache.qpid.requestreply.PingPongProducer;
* are created they will all be run in parallel and be active in sending and consuming pings at the same time.
* If the unique destinations flag is not set and a pub/sub ping cycle is being run, this means that they will all hear
* pings sent by each other. The expected number of pings received will therefore be multiplied up by the number of
- * active ping clients. The {@link #getConsumersPerTopic()} method is used to supply this multiplier under these
+ * active ping clients. The {@link #getConsumersPerDestination()} method is used to supply this multiplier under these
* conditions.
*
* <p/><table id="crc"><caption>CRC Card</caption>
@@ -47,6 +49,9 @@ import org.apache.qpid.requestreply.PingPongProducer;
*/
public class PingClient extends PingPongProducer
{
+ /** Used for debugging. */
+ private final Logger log = Logger.getLogger(PingClient.class);
+
/** Used to count the number of ping clients created. */
private static int _pingClientCount;
@@ -82,14 +87,20 @@ public class PingClient extends PingPongProducer
*
* @return The scaling up of the number of expected pub/sub pings.
*/
- public int getConsumersPerTopic()
+ public int getConsumersPerDestination()
{
+ log.debug("public int getConsumersPerDestination(): called");
+
if (_isUnique)
{
+ log.debug("1 consumer per destination.");
+
return 1;
}
else
{
+ log.debug(_pingClientCount + " consumers per destination.");
+
return _pingClientCount;
}
}
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 140e3bad1c..1a731b2b7e 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
@@ -435,10 +435,10 @@ public class PingPongProducer implements Runnable, MessageListener, ExceptionLis
protected MessageConsumer _consumer;
/**
- * Holds the number of consumers that will be attached to each topic. Each pings will result in a reply from each of the
- * attached clients
+ * Holds the number of consumers that will be attached to each destination in the test. Each pings will result in
+ * a message being received by each of these clients in a pub/sub tests, and by only one at a time in a p2p test.
*/
- static int _consumersPerTopic = 1;
+ static int _consumersPerDestination = 1;
/** The prompt to display when asking the user to kill the broker for failover testing. */
private static final String KILL_BROKER_PROMPT = "Kill broker now, then press Return.";
@@ -1427,18 +1427,27 @@ public class PingPongProducer implements Runnable, MessageListener, ExceptionLis
}
/**
- * This value will be changed by PingClient to represent the number of clients connected to each topic.
+ * Gets the number of consumers that are listening to each destination in the test.
*
* @return int The number of consumers subscribing to each topic.
*/
- public int getConsumersPerTopic()
+ public int getConsumersPerDestination()
{
- return _consumersPerTopic;
+ return _consumersPerDestination;
}
+ /**
+ * Calculates how many pings are expected to be received for the given number sent.
+ *
+ * @param numpings The number of pings that will be sent.
+ *
+ * @return The number that should be received, for the test to pass.
+ */
public int getExpectedNumPings(int numpings)
{
- return numpings * getConsumersPerTopic();
+ log.debug("Each ping will be received by " + (_isPubSub ? getConsumersPerDestination() : 1) + " consumers.");
+
+ return numpings * (_isPubSub ? getConsumersPerDestination() : 1);
}
/**