summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBhupendra Bhusman Bhardwaj <bhupendrab@apache.org>2007-01-24 15:02:07 +0000
committerBhupendra Bhusman Bhardwaj <bhupendrab@apache.org>2007-01-24 15:02:07 +0000
commitf7a8494385741b9ac33d5fef670fbaabb4a7bf9c (patch)
tree927a0dc896c536e6dd5369ec3d449cf9f4d6b81d
parent7ff5bd78e9efef4ab7ad1f78c6e89f82752b1453 (diff)
downloadqpid-python-f7a8494385741b9ac33d5fef670fbaabb4a7bf9c.tar.gz
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@499426 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--java/perftests/src/main/java/org/apache/qpid/ping/TestPingItself.java48
-rw-r--r--java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongBouncer.java52
-rw-r--r--java/perftests/src/main/java/org/apache/qpid/topic/Config.java30
3 files changed, 95 insertions, 35 deletions
diff --git a/java/perftests/src/main/java/org/apache/qpid/ping/TestPingItself.java b/java/perftests/src/main/java/org/apache/qpid/ping/TestPingItself.java
index 72d8010fe3..e7515b0f78 100644
--- a/java/perftests/src/main/java/org/apache/qpid/ping/TestPingItself.java
+++ b/java/perftests/src/main/java/org/apache/qpid/ping/TestPingItself.java
@@ -75,7 +75,6 @@ public class TestPingItself extends PingPongProducer
if (noOfDestinations > 0)
{
createDestinations(noOfDestinations);
-
_persistent = persistent;
_messageSize = messageSize;
_verbose = verbose;
@@ -108,22 +107,38 @@ public class TestPingItself extends PingPongProducer
// 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 = false;
+ 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 queueCount = (config.getQueueCount() != 0) ? config.getQueueCount() : 1;
+ int destCount = (config.getDestinationsCount() != 0) ? config.getDestinationsCount() : 1;
int batchSize = (config.getBatchSize() != 0) ? config.getBatchSize() : BATCH_SIZE;
int rate = (config.getRate() != 0) ? config.getRate() : 0;
boolean pubsub = config.isPubSub();
- String queue = "ping_" + System.currentTimeMillis();
- _logger.info("Queue:" + queue + ", Transacted:" + transacted + ", persistent:" + persistent + ",MessageSize:"
- + messageSize + " bytes");
+ String destName = config.getDestination();
+ if (destName == null)
+ {
+ destName = PING_DESTINATION_NAME;
+ }
+ if (destCount > 1)
+ {
+ _logger.info("Destination Count:" + destCount + ", Transacted:" + transacted + ", persistent:" +
+ persistent + ",Message Size:" + messageSize + " bytes, pubsub:" + pubsub);
+ }
+ else
+ {
+ _logger.info("Destination:" + destName + ", Transacted:" + transacted + ", persistent:" +
+ persistent + ",Message Size:" + messageSize + " bytes, pubsub:" + pubsub);
+ }
boolean afterCommit = false;
boolean beforeCommit = false;
@@ -165,10 +180,10 @@ public class TestPingItself extends PingPongProducer
}
// Create a ping producer to handle the request/wait/reply cycle.
- TestPingItself pingItself = new TestPingItself(brokerDetails, "guest", "guest", virtualpath, queue, null,
+ TestPingItself pingItself = new TestPingItself(brokerDetails, "guest", "guest", virtualpath, destName, null,
transacted, persistent, messageSize, verbose, afterCommit,
beforeCommit, afterSend, beforeSend, failOnce, batchSize,
- queueCount, rate, pubsub);
+ destCount, rate, pubsub);
pingItself.getConnection().start();
@@ -178,7 +193,7 @@ public class TestPingItself extends PingPongProducer
// Ensure that the ping pong producer is registered to listen for exceptions on the connection too.
pingItself.getConnection().setExceptionListener(pingItself);
- if ((queueCount > 1) || (messageCount > 0))
+ if ((destCount > 1) || (messageCount > 0))
{
ObjectMessage msg = pingItself.getTestMessage(null, messageSize, persistent);
@@ -205,10 +220,17 @@ public class TestPingItself extends PingPongProducer
private static void usage()
{
- System.err.println("Usage: TestPingPublisher \n" + "-host : broker host" + "-port : broker port"
- + "-transacted : (true/false). Default is false" + "-persistent : (true/false). Default is false"
- + "-payload : paylaod size. Default is 0" + "-queues : no of queues"
- + "-messages : no of messages to be sent (if 0, the ping loop will run indefinitely)");
+ 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/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongBouncer.java b/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongBouncer.java
index 8a1583c609..bae6aa0dc2 100644
--- a/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongBouncer.java
+++ b/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongBouncer.java
@@ -33,6 +33,7 @@ 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
@@ -67,6 +68,8 @@ public class PingPongBouncer extends AbstractPingClient implements MessageListen
/** 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;
@@ -163,29 +166,34 @@ public class PingPongBouncer extends AbstractPingClient implements MessageListen
System.out.println("Starting...");
// Display help on the command line.
- if (args.length < 5)
+ if (args.length == 0)
{
- System.err.println("Usage: <brokerdetails> <username> <password> <virtual-path> <serviceQueue> " +
- "[<P[ersistent]|N[onPersistent]> <T[ransacted]|N<onTransacted]>] " +
- "[selector] [pubsub(true/false)]");
- System.exit(1);
+ _logger.info("Running test with default values...");
+ //usage();
+ //System.exit(0);
}
// Extract all command line parameters.
- String brokerDetails = args[0];
- String username = args[1];
- String password = args[2];
- String virtualpath = args[3];
- String queueName = args[4];
- boolean persistent = ((args.length > 5) && (args[5].toUpperCase().charAt(0) == 'P'));
- boolean transacted = ((args.length > 6) && (args[6].toUpperCase().charAt(0) == 'T'));
- String selector = (args.length > 7) ? args[7] : null;
- boolean pubsub = (args.length > 8) ? Boolean.parseBoolean(args[8]) : false;
+ 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, username, password, virtualpath, queueName, persistent, transacted,
- selector, true, pubsub);
+ PingPongBouncer pingBouncer = new PingPongBouncer(brokerDetails, "guest", "guest", virtualpath,
+ destinationName, persistent, transacted, selector, verbose, pubsub);
pingBouncer.getConnection().start();
System.out.println("Waiting...");
@@ -252,6 +260,16 @@ public class PingPongBouncer extends AbstractPingClient implements MessageListen
}
}
+ 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...
diff --git a/java/perftests/src/main/java/org/apache/qpid/topic/Config.java b/java/perftests/src/main/java/org/apache/qpid/topic/Config.java
index 6ecb15155c..60aa9f3930 100644
--- a/java/perftests/src/main/java/org/apache/qpid/topic/Config.java
+++ b/java/perftests/src/main/java/org/apache/qpid/topic/Config.java
@@ -43,9 +43,11 @@ public 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 noOfQueues;
+ private int destinationsCount;
private int batchSize;
private int rate;
private boolean ispubsub;
@@ -99,9 +101,9 @@ public class Config extends AbstractConfig implements ConnectorConfig
return rate;
}
- public int getQueueCount()
+ public int getDestinationsCount()
{
- return noOfQueues;
+ return destinationsCount;
}
public String getHost()
@@ -169,6 +171,16 @@ public class Config extends AbstractConfig implements ConnectorConfig
return subscriptionId;
}
+ public String getSelector()
+ {
+ return selector;
+ }
+
+ public String getDestination()
+ {
+ return destinationName;
+ }
+
public boolean usePersistentMessages()
{
return persistent;
@@ -249,9 +261,9 @@ public class Config extends AbstractConfig implements ConnectorConfig
{
transacted = "true".equalsIgnoreCase(value);
}
- else if ("-queues".equalsIgnoreCase(key))
+ else if ("-destinationscount".equalsIgnoreCase(key))
{
- noOfQueues = parseInt("Bad queues count", value);
+ destinationsCount = parseInt("Bad destinations count", value);
}
else if ("-batchsize".equalsIgnoreCase(key))
{
@@ -265,6 +277,14 @@ public class Config extends AbstractConfig implements ConnectorConfig
{
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);