Author: ritchiem
Date: Wed Jan 10 07:47:18 2007
New Revision: 494861

URL: http://svn.apache.org/viewvc?view=rev&rev=494861
Log:
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.

Added:
    incubator/qpid/trunk/qpid/java/perftests/bin/testPingClient.sh   (with 
props)
    incubator/qpid/trunk/qpid/java/perftests/bin/testPingProducer.sh   (with 
props)
    incubator/qpid/trunk/qpid/java/perftests/bin/testPingPublisher.sh   (with 
props)
    incubator/qpid/trunk/qpid/java/perftests/bin/testPingSubscriber.sh   (with 
props)
    
incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/pingpong/
    
incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/pingpong/TestPingClient.java
      - copied, changed from r494425, 
incubator/qpid/trunk/qpid/java/client/src/old_test/java/org/apache/qpid/ping/TestPingClient.java
    
incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/pingpong/TestPingProducer.java
      - copied, changed from r494425, 
incubator/qpid/trunk/qpid/java/client/src/old_test/java/org/apache/qpid/ping/TestPingProducer.java
    
incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/pingpong/TestPingPublisher.java
      - copied, changed from r494425, 
incubator/qpid/trunk/qpid/java/client/src/old_test/java/org/apache/qpid/ping/TestPingPublisher.java
    
incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/pingpong/TestPingSubscriber.java
      - copied, changed from r494425, 
incubator/qpid/trunk/qpid/java/client/src/old_test/java/org/apache/qpid/ping/TestPingSubscriber.java
    incubator/qpid/trunk/qpid/java/perftests/src/main/java/perftests.log4j
Modified:
    incubator/qpid/trunk/qpid/java/distribution/pom.xml
    incubator/qpid/trunk/qpid/java/distribution/src/main/assembly/bin.xml
    incubator/qpid/trunk/qpid/java/perftests/   (props changed)
    incubator/qpid/trunk/qpid/java/perftests/bin/serviceProvidingClient.sh
    incubator/qpid/trunk/qpid/java/perftests/bin/serviceRequestingClient.sh
    incubator/qpid/trunk/qpid/java/perftests/bin/setupclasspath.sh
    incubator/qpid/trunk/qpid/java/perftests/pom.xml
    
incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/ServiceRequestingClient.java
    incubator/qpid/trunk/qpid/java/pom.xml

Modified: incubator/qpid/trunk/qpid/java/distribution/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/distribution/pom.xml?view=diff&rev=494861&r1=494860&r2=494861
==============================================================================
--- incubator/qpid/trunk/qpid/java/distribution/pom.xml (original)
+++ incubator/qpid/trunk/qpid/java/distribution/pom.xml Wed Jan 10 07:47:18 2007
@@ -62,6 +62,11 @@
             <version>${pom.version}</version>
         </dependency>
         <dependency>
+            <groupId>${pom.groupId}</groupId>
+            <artifactId>qpid-perftests</artifactId>
+            <version>${pom.version}</version>
+        </dependency>
+        <dependency>
             <groupId>${pom.groupId}.management</groupId>
             <artifactId>org.apache.qpid.management.ui</artifactId>
             <version>${pom.version}</version>

Modified: incubator/qpid/trunk/qpid/java/distribution/src/main/assembly/bin.xml
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/distribution/src/main/assembly/bin.xml?view=diff&rev=494861&r1=494860&r2=494861
==============================================================================
--- incubator/qpid/trunk/qpid/java/distribution/src/main/assembly/bin.xml 
(original)
+++ incubator/qpid/trunk/qpid/java/distribution/src/main/assembly/bin.xml Wed 
Jan 10 07:47:18 2007
@@ -66,6 +66,14 @@
           <include>qpid-incubating.jar</include>
       </includes>
     </fileSet>
+       <fileSet>
+      <directory>../perftests/bin</directory>
+      <outputDirectory>qpid-${qpid.version}/bin/perftests</outputDirectory>
+      <includes>
+          <include>*</include>
+      </includes>
+    </fileSet>
+       
   </fileSets>
   <files>
     <!-- due to a bug in the assembly plugin (MASSEMBLY-153) you have

Propchange: incubator/qpid/trunk/qpid/java/perftests/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Jan 10 07:47:18 2007
@@ -0,0 +1 @@
+target

Modified: incubator/qpid/trunk/qpid/java/perftests/bin/serviceProvidingClient.sh
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/perftests/bin/serviceProvidingClient.sh?view=diff&rev=494861&r1=494860&r2=494861
==============================================================================
--- incubator/qpid/trunk/qpid/java/perftests/bin/serviceProvidingClient.sh 
(original)
+++ incubator/qpid/trunk/qpid/java/perftests/bin/serviceProvidingClient.sh Wed 
Jan 10 07:47:18 2007
@@ -19,7 +19,13 @@
 #
 
 # XXX -Xms1024m -XX:NewSize=300m
+
+if [[ $# != 1 ]] ; then
+ echo "usage: ./serviceProvidingClient.sh <brokerdetails>"
+ exit 1
+fi
+
 . ./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=perftests.log4j 
org.apache.qpid.requestreply.ServiceProvidingClient $1 guest guest /test 
serviceQ

Modified: 
incubator/qpid/trunk/qpid/java/perftests/bin/serviceRequestingClient.sh
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/perftests/bin/serviceRequestingClient.sh?view=diff&rev=494861&r1=494860&r2=494861
==============================================================================
--- incubator/qpid/trunk/qpid/java/perftests/bin/serviceRequestingClient.sh 
(original)
+++ incubator/qpid/trunk/qpid/java/perftests/bin/serviceRequestingClient.sh Wed 
Jan 10 07:47:18 2007
@@ -18,10 +18,16 @@
 # under the License.
 #
 # args supplied: <host:port> <num messages>
+#
+if [[ $# < 2 ]] ; then
+ echo "usage: ./serviceRequestingClient.sh <brokerdetails> <number of 
messages> [<message size 4096b default>]"
+ 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 -Damqj.logging.level="warn" 
-Damqj.test.logging.level="info" -Dlog4j.configuration=perftests.log4j 
org.apache.qpid.requestreply.ServiceRequestingClient $thehosts guest guest 
/test serviceQ "$@"

Modified: incubator/qpid/trunk/qpid/java/perftests/bin/setupclasspath.sh
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/perftests/bin/setupclasspath.sh?view=diff&rev=494861&r1=494860&r2=494861
==============================================================================
--- incubator/qpid/trunk/qpid/java/perftests/bin/setupclasspath.sh (original)
+++ incubator/qpid/trunk/qpid/java/perftests/bin/setupclasspath.sh Wed Jan 10 
07:47:18 2007
@@ -7,3 +7,4 @@
 if [ `uname -o` == "Cygwin" ] ; then
      CP=`cygpath --path --windows $CP`
 fi
+

Added: incubator/qpid/trunk/qpid/java/perftests/bin/testPingClient.sh
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/perftests/bin/testPingClient.sh?view=auto&rev=494861
==============================================================================
--- incubator/qpid/trunk/qpid/java/perftests/bin/testPingClient.sh (added)
+++ incubator/qpid/trunk/qpid/java/perftests/bin/testPingClient.sh Wed Jan 10 
07:47:18 2007
@@ -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=perftests.log4j 
org.apache.qpid.pingpong.TestPingClient $thehosts guest guest /test "$@"

Propchange: incubator/qpid/trunk/qpid/java/perftests/bin/testPingClient.sh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/qpid/trunk/qpid/java/perftests/bin/testPingClient.sh
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/qpid/trunk/qpid/java/perftests/bin/testPingProducer.sh
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/perftests/bin/testPingProducer.sh?view=auto&rev=494861
==============================================================================
--- incubator/qpid/trunk/qpid/java/perftests/bin/testPingProducer.sh (added)
+++ incubator/qpid/trunk/qpid/java/perftests/bin/testPingProducer.sh Wed Jan 10 
07:47:18 2007
@@ -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=perftests.log4j 
org.apache.qpid.pingpong.TestPingProducer $thehosts /test

Propchange: incubator/qpid/trunk/qpid/java/perftests/bin/testPingProducer.sh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/qpid/trunk/qpid/java/perftests/bin/testPingProducer.sh
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/qpid/trunk/qpid/java/perftests/bin/testPingPublisher.sh
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/perftests/bin/testPingPublisher.sh?view=auto&rev=494861
==============================================================================
--- incubator/qpid/trunk/qpid/java/perftests/bin/testPingPublisher.sh (added)
+++ incubator/qpid/trunk/qpid/java/perftests/bin/testPingPublisher.sh Wed Jan 
10 07:47:18 2007
@@ -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=perftests.log4j 
org.apache.qpid.pingpong.TestPingPublisher $thehosts /test 

Propchange: incubator/qpid/trunk/qpid/java/perftests/bin/testPingPublisher.sh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/qpid/trunk/qpid/java/perftests/bin/testPingPublisher.sh
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/qpid/trunk/qpid/java/perftests/bin/testPingSubscriber.sh
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/perftests/bin/testPingSubscriber.sh?view=auto&rev=494861
==============================================================================
--- incubator/qpid/trunk/qpid/java/perftests/bin/testPingSubscriber.sh (added)
+++ incubator/qpid/trunk/qpid/java/perftests/bin/testPingSubscriber.sh Wed Jan 
10 07:47:18 2007
@@ -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=perftests.log4j 
org.apache.qpid.pingpong.TestPingSubscriber $thehosts guest guest /test "$@"

Propchange: incubator/qpid/trunk/qpid/java/perftests/bin/testPingSubscriber.sh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/qpid/trunk/qpid/java/perftests/bin/testPingSubscriber.sh
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/qpid/trunk/qpid/java/perftests/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/perftests/pom.xml?view=diff&rev=494861&r1=494860&r2=494861
==============================================================================
--- incubator/qpid/trunk/qpid/java/perftests/pom.xml (original)
+++ incubator/qpid/trunk/qpid/java/perftests/pom.xml Wed Jan 10 07:47:18 2007
@@ -44,12 +44,38 @@
         </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>
         </plugins>
-    </build>-->
+         <!-- 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></targetPath>
+               <filtering>false</filtering>
+               <directory>src/main/java</directory>
+               <includes>
+                       <include>perftests.log4j</include>
+               </includes>
+            </resource>
+        </resources>
+    </build>
 </project>

Copied: 
incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/pingpong/TestPingClient.java
 (from r494425, 
incubator/qpid/trunk/qpid/java/client/src/old_test/java/org/apache/qpid/ping/TestPingClient.java)
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/pingpong/TestPingClient.java?view=diff&rev=494861&p1=incubator/qpid/trunk/qpid/java/client/src/old_test/java/org/apache/qpid/ping/TestPingClient.java&r1=494425&p2=incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/pingpong/TestPingClient.java&r2=494861
==============================================================================
--- 
incubator/qpid/trunk/qpid/java/client/src/old_test/java/org/apache/qpid/ping/TestPingClient.java
 (original)
+++ 
incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/pingpong/TestPingClient.java
 Wed Jan 10 07:47:18 2007
@@ -18,12 +18,11 @@
  * under the License.
  *
  */
-package org.apache.qpid.ping;
+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.client.AMQQueue;
 import org.apache.qpid.jms.Session;
 
@@ -58,13 +57,14 @@
                     if (timestampString != timestamp)
                     {
                         _logger.info("Timetamps differ!:\n" +
-                                "timestamp:" + timestamp + "\n" +
-                                "timestampString:" + timestampString);
+                                     "timestamp:" + timestamp + "\n" +
+                                     "timestampString:" + timestampString);
                     }
 
                 }
                 catch (JMSException jmse)
                 {
+                    //ignore
                 }
 
                 long diff = timestamp - _lastTimestamp;
@@ -96,8 +96,11 @@
         {
             InetAddress address = InetAddress.getLocalHost();
             AMQConnection con1 = new AMQConnection(args[0], args[1], args[2],
-                    address.getHostName(), args[3]);
+                                                   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);
 
@@ -107,14 +110,18 @@
             if (args.length == 5)
             {
                 selector = args[4];
+                _logger.info("Message selector is <" + selector + ">...");
+            }
+            else
+            {
+                _logger.info("Not using message selector");
             }
 
-            _logger.info("Message selector is <" + selector + ">...");
 
             Queue q = new AMQQueue("ping");
 
             MessageConsumer consumer1 = session1.createConsumer(q,
-                    1, false, false, selector);
+                                                                1, false, 
false, selector);
 
             consumer1.setMessageListener(new TestPingMessageListener());
             con1.start();

Copied: 
incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/pingpong/TestPingProducer.java
 (from r494425, 
incubator/qpid/trunk/qpid/java/client/src/old_test/java/org/apache/qpid/ping/TestPingProducer.java)
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/pingpong/TestPingProducer.java?view=diff&rev=494861&p1=incubator/qpid/trunk/qpid/java/client/src/old_test/java/org/apache/qpid/ping/TestPingProducer.java&r1=494425&p2=incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/pingpong/TestPingProducer.java&r2=494861
==============================================================================
--- 
incubator/qpid/trunk/qpid/java/client/src/old_test/java/org/apache/qpid/ping/TestPingProducer.java
 (original)
+++ 
incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/pingpong/TestPingProducer.java
 Wed Jan 10 07:47:18 2007
@@ -18,7 +18,7 @@
  * under the License.
  *
  */
-package org.apache.qpid.ping;
+package org.apache.qpid.pingpong;
 
 import org.apache.log4j.Logger;
 import org.apache.qpid.client.AMQConnection;
@@ -48,31 +48,30 @@
 
     private AMQConnection _connection;
 
-    private Session _session;
 
     private boolean _publish;
 
     private long SLEEP_TIME = 250L;
 
-    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);
-            }
-        }
-    }
+//    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 TestPingProducer(boolean TRANSACTED, String brokerDetails, String 
clientID,
                             String virtualpath) throws AMQException, 
URLSyntaxException
@@ -81,59 +80,65 @@
         {
             createConnection(brokerDetails, clientID, virtualpath);
 
+            Session session;
+
             if (TRANSACTED)
             {
-                _session = (Session) _connection.createSession(true, 
Session.SESSION_TRANSACTED);
+                session = (Session) _connection.createSession(true, 
Session.SESSION_TRANSACTED);
             }
             else
             {
-                _session = (Session) _connection.createSession(false, 
Session.AUTO_ACKNOWLEDGE);
+                session = (Session) _connection.createSession(false, 
Session.AUTO_ACKNOWLEDGE);
             }
 
-            AMQQueue destination = new AMQQueue("ping");
-            MessageProducer producer = (MessageProducer) 
_session.createProducer(destination);
+            String queue = "ping";
+            AMQQueue destination = new AMQQueue(queue);
+            MessageProducer producer = (MessageProducer) 
session.createProducer(destination);
 
             _connection.setExceptionListener(this);
 
             _connection.start();
 
-            int messageNumber = 0;
-
             while (_publish)
             {
 /*
-                TextMessage msg = _session.createTextMessage(
+                TextMessage msg = session.createTextMessage(
                         "Presented to in conjunction with Mahnah Mahnah and 
the Snowths: " + ++messageNumber);
 */
-                ObjectMessage msg = _session.createObjectMessage();
+                ObjectMessage msg = session.createObjectMessage();
 
                 msg.setStringProperty("timestampString", 
Long.toString(System.currentTimeMillis()));
                 msg.setLongProperty("timestamp", System.currentTimeMillis());
 
                 ((BasicMessageProducer) producer).send(msg, 
DeliveryMode.NON_PERSISTENT, true);
+                _log.info("Message Sent.");
+                _log.debug(msg);
 
 
                 if (TRANSACTED)
                 {
-                    try{
-                        _session.commit();
-                          _log.info("Message Sent.");// +"\n"+ msg);
-                    }catch (JMSException e)
+                    try
+                    {
+                        session.commit();
+                        _log.debug("Session Commited.");
+                    }
+                    catch (JMSException e)
                     {
+                        _log.trace("JMSException on commit:" + e);
                         try
                         {
-                            _session.rollback();
+                            session.rollback();
+                            _log.debug("Message rolled back.");
                         }
                         catch (JMSException jsme)
                         {
-                            _log.info(jsme);
+                            _log.trace("JMSE on rollback:" + jsme);
                         }
 
 
                         if (e.getLinkedException() instanceof 
AMQNoConsumersException)
                         {
-                            _log.info("No Consumers never mind.");
-
+                            _log.info("No Consumers on queue:'" + queue + "'");
                             continue;
                         }
                     }
@@ -167,16 +172,17 @@
     {
         _publish = true;
         _connection = new AMQConnection(brokerDetails, "guest", "guest",
-                clientID, virtualpath);
+                                        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) throws URLSyntaxException
+    public static void main(String[] args)
     {
-        if (args.length == 0)
+        if (args.length < 2)
         {
             System.err.println("Usage: TestPingPublisher <brokerDetails> 
<virtual path> [transacted]");
             System.exit(0);
@@ -189,12 +195,16 @@
         }
         catch (UnknownHostException e)
         {
-            e.printStackTrace();  //To change body of catch statement use File 
| Settings | File Templates.
+            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);

Copied: 
incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/pingpong/TestPingPublisher.java
 (from r494425, 
incubator/qpid/trunk/qpid/java/client/src/old_test/java/org/apache/qpid/ping/TestPingPublisher.java)
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/pingpong/TestPingPublisher.java?view=diff&rev=494861&p1=incubator/qpid/trunk/qpid/java/client/src/old_test/java/org/apache/qpid/ping/TestPingPublisher.java&r1=494425&p2=incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/pingpong/TestPingPublisher.java&r2=494861
==============================================================================
--- 
incubator/qpid/trunk/qpid/java/client/src/old_test/java/org/apache/qpid/ping/TestPingPublisher.java
 (original)
+++ 
incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/pingpong/TestPingPublisher.java
 Wed Jan 10 07:47:18 2007
@@ -18,7 +18,7 @@
  * under the License.
  *
  */
-package org.apache.qpid.ping;
+package org.apache.qpid.pingpong;
 
 import org.apache.log4j.Logger;
 import org.apache.qpid.client.AMQConnection;
@@ -47,31 +47,29 @@
 
     private AMQConnection _connection;
 
-    private Session _session;
-
     private boolean _publish;
 
     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);
-            }
-        }
-    }
+//    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
     {
@@ -79,25 +77,24 @@
         {
             createConnection(brokerDetails, clientID, virtualpath);
 
-            _session = (Session) _connection.createSession(false, 
Session.AUTO_ACKNOWLEDGE);
+            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);
+            MessageProducer producer = (MessageProducer) 
session.createProducer(destination);
 
             _connection.setExceptionListener(this);
 
             _connection.start();
 
-            int messageNumber = 0;
-
+            int msgCount = 0;
             while (_publish)
             {
 /*
-                TextMessage msg = _session.createTextMessage(
+                TextMessage msg = session.createTextMessage(
                         "Presented to in conjunction with Mahnah Mahnah and 
the Snowths: " + ++messageNumber);
 */
-                ObjectMessage msg = _session.createObjectMessage();
+                ObjectMessage msg = session.createObjectMessage();
 
                 Long time = System.nanoTime();
                 msg.setStringProperty("timestampString", Long.toString(time));
@@ -105,7 +102,13 @@
 
                 ((BasicMessageProducer) producer).send(msg, 
DeliveryMode.PERSISTENT, true);
 
-                _log.info("Message Sent:\n" + msg);
+                _log.info("Message Sent:" + msgCount++);
+                _log.debug(msg);
+
+                if (msgCount == Integer.MAX_VALUE)
+                {
+                    _publish = false;
+                }
 
                 if (SLEEP_TIME > 0)
                 {
@@ -133,17 +136,18 @@
     {
         _publish = true;
         _connection = new AMQConnection(brokerDetails, "guest", "guest",
-                clientID, virtualpath);
+                                        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) throws URLSyntaxException
+    public static void main(String[] args)
     {
-        if (args.length == 0)
+        if (args.length < 2)
         {
             System.err.println("Usage: TestPingPublisher <brokerDetails> 
<virtual path>");
             System.exit(0);
@@ -156,12 +160,16 @@
         }
         catch (UnknownHostException e)
         {
-            e.printStackTrace();  //To change body of catch statement use File 
| Settings | File Templates.
+            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);

Copied: 
incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/pingpong/TestPingSubscriber.java
 (from r494425, 
incubator/qpid/trunk/qpid/java/client/src/old_test/java/org/apache/qpid/ping/TestPingSubscriber.java)
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/pingpong/TestPingSubscriber.java?view=diff&rev=494861&p1=incubator/qpid/trunk/qpid/java/client/src/old_test/java/org/apache/qpid/ping/TestPingSubscriber.java&r1=494425&p2=incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/pingpong/TestPingSubscriber.java&r2=494861
==============================================================================
--- 
incubator/qpid/trunk/qpid/java/client/src/old_test/java/org/apache/qpid/ping/TestPingSubscriber.java
 (original)
+++ 
incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/pingpong/TestPingSubscriber.java
 Wed Jan 10 07:47:18 2007
@@ -18,7 +18,7 @@
  * under the License.
  *
  */
-package org.apache.qpid.ping;
+package org.apache.qpid.pingpong;
 
 import org.apache.log4j.Logger;
 import org.apache.log4j.Level;
@@ -34,7 +34,7 @@
 
 public class TestPingSubscriber
 {
-    private static final Logger _logger = 
Logger.getLogger(TestPingClient.class);
+    private static final Logger _logger = 
Logger.getLogger(TestPingSubscriber.class);
 
     private static class TestPingMessageListener implements MessageListener
     {
@@ -51,31 +51,30 @@
 
             if (_logger.isInfoEnabled())
             {
-                long timestamp = 0L;
                 long timestampString = 0L;
 
                 try
                 {
-                    timestamp = message.getLongProperty("timestamp");
+                    long timestamp = message.getLongProperty("timestamp");
                     timestampString = 
Long.parseLong(message.getStringProperty("timestampString"));
 
                     if (timestampString != timestamp)
                     {
                         _logger.info("Timetamps differ!:\n" +
-                                "timestamp:" + timestamp + "\n" +
-                                "timestampString:" + timestampString);
+                                     "timestamp:" + timestamp + "\n" +
+                                     "timestampString:" + timestampString);
                     }
 
                 }
                 catch (JMSException jmse)
                 {
+                    // ignore
                 }
 
-                long diff = time - timestamp;
 
                 long stringDiff = time - timestampString;
 
-                _logger.info("Ping: TS:" + stringDiff/1000+"us");
+                _logger.info("Ping: TS:" + stringDiff / 1000 + "us");
 
                 // _logger.info(_name + " got message '" + message + "\n");
             }
@@ -84,8 +83,6 @@
 
     public static void main(String[] args)
     {
-        _logger.setLevel(Level.INFO);
-
         _logger.info("Starting...");
 
         if (args.length < 4)
@@ -97,7 +94,9 @@
         {
             InetAddress address = InetAddress.getLocalHost();
             AMQConnection con1 = new AMQConnection(args[0], args[1], args[2],
-                    address.getHostName(), args[3]);
+                                                   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);
@@ -108,14 +107,17 @@
             if (args.length == 5)
             {
                 selector = args[4];
+                _logger.info("Message selector is <" + selector + ">...");
+            }
+            else
+            {
+                _logger.info("Not using message selector ");
             }
-
-            _logger.info("Message selector is <" + selector + ">...");
 
             Topic t = new AMQTopic("ping");
 
             MessageConsumer consumer1 = session1.createConsumer(t,
-                    1, false, false, selector);
+                                                                1, false, 
false, selector);
 
             consumer1.setMessageListener(new TestPingMessageListener());
             con1.start();

Modified: 
incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/ServiceRequestingClient.java
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/ServiceRequestingClient.java?view=diff&rev=494861&r1=494860&r2=494861
==============================================================================
--- 
incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/ServiceRequestingClient.java
 (original)
+++ 
incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/requestreply/ServiceRequestingClient.java
 Wed Jan 10 07:47:18 2007
@@ -41,7 +41,6 @@
  * <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 ServiceRequestingClient implements ExceptionListener
 {
@@ -167,6 +166,7 @@
             }
         }
     }
+
     public ServiceRequestingClient(String brokerHosts, String clientID, String 
username, String password,
                                    String vpath, String commandQueueName,
                                    final int messageCount, final int 
messageDataLength) throws AMQException, URLSyntaxException
@@ -217,6 +217,7 @@
 
     /**
      * Run the test and notify an object upon receipt of all responses.
+     *
      * @param waiter the object that will be notified
      * @throws JMSException
      */
@@ -260,6 +261,7 @@
         {
             System.err.println(
                     "Usage: ServiceRequestingClient <brokerDetails - semicolon 
separated host:port list> <username> <password> <vpath> <command queue name> 
<number of messages> <message size>");
+            System.exit(1);
         }
         try
         {
@@ -292,7 +294,7 @@
         }
     }
 
-     /**
+    /**
      * @see javax.jms.ExceptionListener#onException(javax.jms.JMSException)
      */
     public void onException(JMSException e)

Added: incubator/qpid/trunk/qpid/java/perftests/src/main/java/perftests.log4j
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/perftests/src/main/java/perftests.log4j?view=auto&rev=494861
==============================================================================
--- incubator/qpid/trunk/qpid/java/perftests/src/main/java/perftests.log4j 
(added)
+++ incubator/qpid/trunk/qpid/java/perftests/src/main/java/perftests.log4j Wed 
Jan 10 07:47:18 2007
@@ -0,0 +1,31 @@
+#
+# 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.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

Modified: incubator/qpid/trunk/qpid/java/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/pom.xml?view=diff&rev=494861&r1=494860&r2=494861
==============================================================================
--- incubator/qpid/trunk/qpid/java/pom.xml (original)
+++ incubator/qpid/trunk/qpid/java/pom.xml Wed Jan 10 07:47:18 2007
@@ -115,6 +115,7 @@
         <module>client</module>
         <module>cluster</module>
         <module>systests</module>
+        <module>perftests</module>
         <module>management/eclipse-plugin</module>
     </modules>
 


Reply via email to