Author: bhupendrab
Date: Wed Jan 24 07:02:07 2007
New Revision: 499426

URL: http://svn.apache.org/viewvc?view=rev&rev=499426
Log: (empty)

Modified:
    
incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingItself.java
    
incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongBouncer.java
    
incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/topic/Config.java

Modified: 
incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingItself.java
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingItself.java?view=diff&rev=499426&r1=499425&r2=499426
==============================================================================
--- 
incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingItself.java
 (original)
+++ 
incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/ping/TestPingItself.java
 Wed Jan 24 07:02:07 2007
@@ -75,7 +75,6 @@
         if (noOfDestinations > 0)
         {
             createDestinations(noOfDestinations);
-
             _persistent = persistent;
             _messageSize = messageSize;
             _verbose = verbose;
@@ -108,22 +107,38 @@
         // 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 @@
         }
 
         // 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 @@
         // 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 @@
 
     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);
     }
 }

Modified: 
incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongBouncer.java
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongBouncer.java?view=diff&rev=499426&r1=499425&r2=499426
==============================================================================
--- 
incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongBouncer.java
 (original)
+++ 
incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongBouncer.java
 Wed Jan 24 07:02:07 2007
@@ -33,6 +33,7 @@
 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 @@
     /** 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 @@
         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...");

@@ -250,6 +258,16 @@
         {

             _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");

     }

 

     /**


Modified: 
incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/topic/Config.java
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/topic/Config.java?view=diff&rev=499426&r1=499425&r2=499426
==============================================================================
--- 
incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/topic/Config.java
 (original)
+++ 
incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/topic/Config.java
 Wed Jan 24 07:02:07 2007
@@ -43,9 +43,11 @@
     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 @@
         return rate;
     }
 
-    public int getQueueCount()
+    public int getDestinationsCount()
     {
-        return noOfQueues;
+        return destinationsCount;
     }
 
     public String getHost()
@@ -169,6 +171,16 @@
         return subscriptionId;
     }
 
+    public String getSelector()
+    {
+        return selector;
+    }
+
+    public String getDestination()
+    {
+        return destinationName;
+    }
+
     public boolean usePersistentMessages()
     {
         return persistent;
@@ -249,9 +261,9 @@
         {
             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))
         {
@@ -264,6 +276,14 @@
         else if("-pubsub".equalsIgnoreCase(key))
         {
             ispubsub = "true".equalsIgnoreCase(value);
+        }
+        else if("-selector".equalsIgnoreCase(key))
+        {
+            selector = value;
+        }
+        else if("-destinationname".equalsIgnoreCase(key))
+        {
+            destinationName = value;
         }
         else
         {


Reply via email to