activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r416542 [1/2] - in /incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src: main/java/org/apache/activemq/maven/ main/java/org/apache/activemq/tool/ main/java/org/apache/activemq/tool/properties/ main/java/org/apache/activemq/tool/...
Date Fri, 23 Jun 2006 01:53:50 GMT
Author: aco
Date: Thu Jun 22 18:53:48 2006
New Revision: 416542

URL: http://svn.apache.org/viewvc?rev=416542&view=rev
Log:
- Redesigned the perf plugin
- Added the cpu sampler for linux using vmstat (no summary as of the moment).

Added:
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/AbstractJmsClient.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/AbstractJmsClientSystem.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/AbstractJmsMeasurableClient.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/properties/
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/properties/AbstractObjectProperties.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/properties/JmsClientProperties.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/properties/JmsClientSystemProperties.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/properties/JmsConsumerProperties.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/properties/JmsConsumerSystemProperties.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/properties/JmsFactoryProperties.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/properties/JmsProducerProperties.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/properties/JmsProducerSystemProperties.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/properties/ReflectionConfigurable.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/properties/ReflectionUtil.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/reports/plugins/
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/reports/plugins/CpuReportPlugin.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/reports/plugins/ReportPlugin.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/reports/plugins/ThroughputReportPlugin.java
Removed:
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsClientSupport.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsClientSystemSupport.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsFactorySupport.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsPerformanceSupport.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/PerfEventAdapter.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/PerfEventListener.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/PerfMeasurable.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/PerfMeasurementTool.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/ReflectionUtil.java
Modified:
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/maven/ConsumerMojo.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/maven/ProducerMojo.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/maven/ServerMojo.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsConsumerClient.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsConsumerSystem.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsProducerClient.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsProducerSystem.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/reports/AbstractPerfReportWriter.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/reports/PerformanceReportWriter.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/reports/VerbosePerfReportWriter.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/reports/XmlFilePerfReportWriter.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/spi/ClassLoaderSPIConnectionFactory.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/test/java/org/apache/activemq/tool/ReflectionUtilTest.java

Modified: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/maven/ConsumerMojo.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/maven/ConsumerMojo.java?rev=416542&r1=416541&r2=416542&view=diff
==============================================================================
--- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/maven/ConsumerMojo.java (original)
+++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/maven/ConsumerMojo.java Thu Jun 22 18:53:48 2006
@@ -1,13 +1,12 @@
-package org.apache.activemq.maven;
-
-/*
- * Copyright 2001-2005 The Apache Software Foundation.
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
  *
  * Licensed 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
+ * 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,
@@ -15,13 +14,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+package org.apache.activemq.maven;
 
 import org.apache.activemq.tool.JmsConsumerSystem;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 
-import javax.jms.JMSException;
-
+import java.util.Properties;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Set;
+import java.util.HashSet;
 
 /**
  * Goal which touches a timestamp file.
@@ -29,211 +33,40 @@
  * @goal consumer
  * @phase process-sources
  */
-public class ConsumerMojo
-        extends AbstractMojo {
+public class ConsumerMojo extends AbstractMojo {
 
-    /**
-     * @parameter expression="${sampler.duration}" default-value="60000"
-     * @required
-     */
-    private String duration;
-
-    /**
-     * @parameter expression="${sampler.interval}" default-value="1000"
-     * @required
-     */
-    private String interval;
-
-    /**
-     * @parameter expression="${sampler.rampUpTime}" default-value="10000"
-     * @required
-     */
-    private String rampUpTime;
-
-    /**
-     * @parameter expression="${sampler.rampDownTime}" default-value="10000"
-     * @required
-     */
-    private String rampDownTime;
-
-    /**
-     * @parameter expression="${consumer.spiClass}" default-value="org.apache.activemq.tool.spi.ActiveMQPojoSPI"
-     * @required
-     */
-    private String spiClass;
-
-    /**
-     * @parameter expression="${consumer.sessTransacted}" default-value="false"
-     * @required
-     */
-    private String sessTransacted;
-
-    /**
-     * @parameter expression="${consumer.sessAckMode}" default-value="autoAck"
-     * @required
-     */
-    private String sessAckMode;
-
-    /**
-     * @parameter expression="${consumer.destName}" default-value="topic://TEST.PERFORMANCE.FOO.BAR"
-     * @required
-     */
-    private String destName;
-
-    /**
-     * @parameter expression="${consumer.destCount}" default-value="1"
-     * @required
-     */
-    private String destCount;
-
-    /**
-     * @parameter expression="${consumer.destComposite}" default-value="false"
-     * @required
-     */
-    private String destComposite;
-
-    /**
-     * @parameter expression="${consumer.durable}" default-value="false"
-     * @required
-     */
-    private String durable;
-
-    /**
-     * @parameter expression="${consumer.asyncRecv}" default-value="true"
-     * @required
-     */
-    private String asyncRecv;
-
-    /**
-     * @parameter expression="${consumer.recvCount}" default-value="1000000"
-     * @required
-     */
-    private String recvCount;
-
-    /*
-     * @parameter expression="${consumer.recvDuration}" default-value="60000"
-     * @required
-
-    private String recvDuration;
-    */
-
-    /**
-     * @parameter expression="${consumer.recvType}" default-value="time"
-     * @required
-     */
-    private String recvType;
-
-    /**
-     * @parameter expression="${factory.brokerUrl}" default-value="tcp://localhost:61616"
-     * @required
-     */
-    private String brokerUrl;
-
-    /**
-     * @parameter expression="${factory.optimAck}" default-value="true"
-     * @required
-     */
-    private String optimAck;
-
-    /**
-     * @parameter expression="${factory.optimDispatch}" default-value="true"
-     * @required
-     */
-    private String optimDispatch;
-
-    /**
-     * @parameter expression="${factory.prefetchQueue}" default-value="5000"
-     * @required
-     */
-    private String prefetchQueue;
-
-    /**
-     * @parameter expression="${factory.prefetchTopic}" default-value="5000"
-     * @required
-     */
-    private String prefetchTopic;
-
-    /**
-     * @parameter expression="${factory.useRetroactive}" default-value="false"
-     * @required
-     */
-    private String useRetroactive;
-
-    /**
-     * @parameter expression="${sysTest.numClients}" default-value="1"
-     * @required
-     */
-    private String numClients;
-
-    /**
-     * @parameter expression="${sysTest.totalDests}" default-value="1"
-     * @required
-     */
-    private String totalDests;
-
-    /**
-     * @parameter expression="${sysTest.destDistro}" default-value="all"
-     * @required
-     */
-    private String destDistro;
-
-    /**
-     * @parameter expression="${sysTest.reportDirectory}" default-value="${project.build.directory}/test-perf"
-     * @required
-     */
-    private String reportDirectory;
-
-    /**
-     * @parameter expression="${sysTest.reportType}" default-value="xml"
-     * @required
-     */
-    private String reportType;
-
-    public void execute()
-            throws MojoExecutionException {
-
-        try {
-            JmsConsumerSystem.main(createArgument());
-        } catch (JMSException e) {
-            throw new MojoExecutionException(e.getMessage());
-        }
+    private String[] validPrefix = {
+        "sysTest.",
+        "factory.",
+        "consumer.",
+        "tpSampler.",
+        "cpuSampler."
+    };
 
+    public void execute() throws MojoExecutionException {
+        JmsConsumerSystem.main(createArgument());
     }
 
-    public String[] createArgument() {
-        String[] options = {
-            "sampler.duration=" + duration, 
-            "sampler.interval=" + interval,    
-            "sampler.rampUpTime=" + rampUpTime,   
-            "sampler.rampDownTime=" + rampDownTime, 
-    
-            "consumer.spiClass=" + spiClass,
-            "consumer.sessTransacted=" + sessTransacted,
-            "consumer.sessAckMode=" + sessAckMode,
-            "consumer.destName=" + destName,
-            "consumer.destCount=" + destCount,
-            "consumer.destComposite=" + destComposite,
-    
-            "consumer.durable=" + durable,
-            "consumer.asyncRecv=" + asyncRecv,
-            "consumer.recvCount=" + recvCount,   
-            "consumer.recvDuration=" + duration, 
-            "consumer.recvType=" + recvType,
-    
-            "factory.brokerUrl=" + brokerUrl,
-            "factory.optimAck=" + optimAck,
-            "factory.optimDispatch=" + optimDispatch,
-            "factory.prefetchQueue=" + prefetchQueue,
-            "factory.prefetchTopic=" + prefetchTopic,
-            "factory.useRetroactive=" + useRetroactive,
-    
-            "sysTest.numClients=" + numClients,
-            "sysTest.totalDests=" + totalDests,
-            "sysTest.destDistro=" + destDistro,
-            "sysTest.reportDirectory=" + reportDirectory,
-            "sysTest.reportType=" + reportType
-        };
+    protected String[] createArgument() {
+        List args = new ArrayList();
+        Properties sysProps = System.getProperties();
+        Set keys = new HashSet(sysProps.keySet());
+
+        for (Iterator i=keys.iterator(); i.hasNext();) {
+            String key = (String)i.next();
+            if (isRecognizedProperty(key)) {
+                args.add(key + "=" + sysProps.remove(key));
+            }
+        }
+        return (String[])args.toArray(new String[0]);
+    }
 
-        return options;
+    protected boolean isRecognizedProperty(String key) {
+        for (int j=0; j<validPrefix.length; j++) {
+            if (key.startsWith(validPrefix[j])) {
+                return true;
+            }
+        }
+        return false;
     }
 }

Modified: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/maven/ProducerMojo.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/maven/ProducerMojo.java?rev=416542&r1=416541&r2=416542&view=diff
==============================================================================
--- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/maven/ProducerMojo.java (original)
+++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/maven/ProducerMojo.java Thu Jun 22 18:53:48 2006
@@ -1,17 +1,12 @@
-package org.apache.activemq.maven;
-
-import org.apache.activemq.tool.JmsProducerSystem;
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-
-/*
- * Copyright 2001-2005 The Apache Software Foundation.
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
  *
  * Licensed 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
+ * 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,
@@ -19,7 +14,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+package org.apache.activemq.maven;
 
+import org.apache.activemq.tool.JmsProducerSystem;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Properties;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.HashSet;
 
 /**
  * Goal which touches a timestamp file.
@@ -27,180 +33,40 @@
  * @goal producer
  * @phase process
  */
-public class ProducerMojo
-        extends AbstractMojo {
+public class ProducerMojo extends AbstractMojo {
 
-    /**
-     * @parameter expression="${sampler.duration}" default-value="60000"
-     * @required
-     */
-    private String duration;
-
-    /**
-     * @parameter expression="${sampler.interval}" default-value="1000"
-     * @required
-     */
-    private String interval;
-
-    /**
-     * @parameter expression="${sampler.rampUpTime}" default-value="10000"
-     * @required
-     */
-    private String rampUpTime;
-
-    /**
-     * @parameter expression="${sampler.rampDownTime}" default-value="10000"
-     * @required
-     */
-    private String rampDownTime;
-
-    /**
-     * @parameter expression="${producer.spiClass}" default-value="org.apache.activemq.tool.spi.ActiveMQPojoSPI"
-     * @required
-     */
-    private String spiClass;
-
-    /**
-     * @parameter expression="${producer.sessTransacted}" default-value="false"
-     * @required
-     */
-    private String sessTransacted;
-
-    /**
-     * @parameter expression="${producer.sessAckMode}" default-value="autoAck"
-     * @required
-     */
-    private String sessAckMode;
-
-    /**
-     * @parameter expression="${producer.destName}" default-value="topic://TEST.PERFORMANCE.FOO.BAR"
-     * @required
-     */
-    private String destName;
-
-    /**
-     * @parameter expression="${producer.destCount}" default-value="1"
-     * @required
-     */
-    private String destCount;
-
-    /**
-     * @parameter expression="${producer.destComposite}" default-value="false"
-     * @required
-     */
-    private String destComposite;
-
-    /**
-     * @parameter expression="${producer.deliveryMode}" default-value="nonpersistent"
-     * @required
-     */
-    private String deliveryMode;
-
-    /**
-     * @parameter expression="${producer.messageSize}" default-value="1024"
-     * @required
-     */
-    private String messageSize;
-
-    /**
-     * @parameter expression="${producer.sendCount}" default-value="1000000"
-     * @required
-     */
-    private String sendCount;
-
-    /*
-     * @parameter expression="${producer.sendDuration}" default-value="60000"
-     * @required
-
-    private String sendDuration;
-    */
-
-    /**
-     * @parameter expression="${producer.sendType}" default-value="time"
-     * @required
-     */
-    private String sendType;
-
-    /**
-     * @parameter expression="${factory.brokerUrl}" default-value="tcp://localhost:61616"
-     * @required
-     */
-    private String brokerUrl;
-
-    /**
-     * @parameter expression="${factory.asyncSend}" default-value="true"
-     * @required
-     */
-    private String asyncSend;
-
-    /**
-     * @parameter expression="${sysTest.numClients}" default-value="1"
-     * @required
-     */
-    private String numClients;
-
-    /**
-     * @parameter expression="${sysTest.totalDests}" default-value="1"
-     * @required
-     */
-    private String totalDests;
-
-    /**
-     * @parameter expression="${sysTest.destDistro}" default-value="all"
-     * @required
-     */
-    private String destDistro;
-
-    /**
-     * @parameter expression="${sysTest.reportDirectory}" default-value="${project.build.directory}/test-perf"
-     * @required
-     */
-    private String reportDirectory;
-
-    /**
-     * @parameter expression="${sysTest.reportType}" default-value="xml"
-     * @required
-     */
-    private String reportType;
-
-
-    public void execute()
-            throws MojoExecutionException {
+    private String[] validPrefix = {
+        "sysTest.",
+        "factory.",
+        "producer.",
+        "tpSampler.",
+        "cpuSampler."
+    };
 
+    public void execute() throws MojoExecutionException {
         JmsProducerSystem.main(createArgument());
     }
 
-    public String[] createArgument() {
-
-        String[] options = {
-            "sampler.duration=" + duration,   
-            "sampler.interval=" + interval,     
-            "sampler.rampUpTime=" + rampUpTime,   
-            "sampler.rampDownTime=" + rampDownTime, 
-    
-            "producer.spiClass=" + spiClass,
-            "producer.sessTransacted=" + sessTransacted,
-            "producer.sessAckMode=" + sessAckMode,
-            "producer.destName=" + destName,
-            "producer.destCount=" + destCount,
-            "producer.destComposite=" + destComposite,
-
-            "producer.deliveryMode="+deliveryMode,
-            "producer.messageSize="+messageSize,
-            "producer.sendCount="+sendCount,    
-            "producer.sendDuration="+duration, 
-            "producer.sendType="+sendType,
-    
-            "factory.brokerUrl="+brokerUrl,
-            "factory.asyncSend="+asyncSend,
-    
-            "sysTest.numClients=" + numClients,
-            "sysTest.totalDests=" + totalDests,
-            "sysTest.destDistro=" + destDistro,
-            "sysTest.reportDirectory=" + reportDirectory,
-            "sysTest.reportType=" + reportType
-        };
+    protected String[] createArgument() {
+        List args = new ArrayList();
+        Properties sysProps = System.getProperties();
+        Set keys = new HashSet(sysProps.keySet());
+
+        for (Iterator i=keys.iterator(); i.hasNext();) {
+            String key = (String)i.next();
+            if (isRecognizedProperty(key)) {
+                args.add(key + "=" + sysProps.remove(key));
+            }
+        }
+        return (String[])args.toArray(new String[0]);
+    }
 
-        return options;
+    protected boolean isRecognizedProperty(String key) {
+        for (int j=0; j<validPrefix.length; j++) {
+            if (key.startsWith(validPrefix[j])) {
+                return true;
+            }
+        }
+        return false;
     }
 }

Modified: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/maven/ServerMojo.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/maven/ServerMojo.java?rev=416542&r1=416541&r2=416542&view=diff
==============================================================================
--- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/maven/ServerMojo.java (original)
+++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/maven/ServerMojo.java Thu Jun 22 18:53:48 2006
@@ -1,13 +1,12 @@
-package org.apache.activemq.maven;
-
-/*
- * Copyright 2001-2005 The Apache Software Foundation.
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
  *
  * Licensed 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
+ * 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,
@@ -15,6 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+package org.apache.activemq.maven;
 
 import org.apache.activemq.console.Main;
 import org.apache.maven.plugin.AbstractMojo;
@@ -33,8 +33,7 @@
  * @goal broker
  * @phase process-sources
  */
-public class ServerMojo
-        extends AbstractMojo {
+public class ServerMojo extends AbstractMojo {
     /**
      * Location of the output directory. Defaults to target.
      *
@@ -82,7 +81,6 @@
         if (!out.exists()) {
             out.mkdirs();
         }
-
 
         String[] args = new String[2];
         if (url != null) {

Added: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/AbstractJmsClient.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/AbstractJmsClient.java?rev=416542&view=auto
==============================================================================
--- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/AbstractJmsClient.java (added)
+++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/AbstractJmsClient.java Thu Jun 22 18:53:48 2006
@@ -0,0 +1,150 @@
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * Licensed 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.
+ */
+package org.apache.activemq.tool;
+
+import org.apache.activemq.tool.properties.JmsClientProperties;
+
+import javax.jms.ConnectionFactory;
+import javax.jms.Connection;
+import javax.jms.Session;
+import javax.jms.JMSException;
+import javax.jms.Destination;
+
+public abstract class AbstractJmsClient {
+    protected ConnectionFactory factory;
+    protected Connection jmsConnection;
+    protected Session jmsSession;
+
+    protected int destCount = 1, destIndex = 0;
+    protected String clientName = "";
+
+    public AbstractJmsClient(ConnectionFactory factory) {
+        this.factory = factory;
+    }
+
+    abstract public JmsClientProperties getClient();
+    abstract public void setClient(JmsClientProperties client);
+
+    public ConnectionFactory getFactory() {
+        return factory;
+    }
+
+    public void setFactory(ConnectionFactory factory) {
+        this.factory = factory;
+    }
+
+    public int getDestCount() {
+        return destCount;
+    }
+
+    public void setDestCount(int destCount) {
+        this.destCount = destCount;
+    }
+
+    public int getDestIndex() {
+        return destIndex;
+    }
+
+    public void setDestIndex(int destIndex) {
+        this.destIndex = destIndex;
+    }
+
+    public String getClientName() {
+        return clientName;
+    }
+
+    public void setClientName(String clientName) {
+        this.clientName = clientName;
+    }
+
+    public Connection getConnection() throws JMSException {
+        if (jmsConnection == null) {
+            jmsConnection = factory.createConnection();
+        }
+        return jmsConnection;
+    }
+
+    public Session getSession() throws JMSException {
+        if (jmsSession == null) {
+            int ackMode;
+            if (getClient().getSessAckMode().equalsIgnoreCase(JmsClientProperties.SESSION_AUTO_ACKNOWLEDGE)) {
+                ackMode = Session.AUTO_ACKNOWLEDGE;
+            } else if (getClient().getSessAckMode().equalsIgnoreCase(JmsClientProperties.SESSION_CLIENT_ACKNOWLEDGE)) {
+                ackMode = Session.CLIENT_ACKNOWLEDGE;
+            } else if (getClient().getSessAckMode().equalsIgnoreCase(JmsClientProperties.SESSION_DUPS_OK_ACKNOWLEDGE)) {
+                ackMode = Session.DUPS_OK_ACKNOWLEDGE;
+            } else if (getClient().getSessAckMode().equalsIgnoreCase(JmsClientProperties.SESSION_TRANSACTED)) {
+                ackMode = Session.SESSION_TRANSACTED;
+            } else {
+                ackMode = Session.AUTO_ACKNOWLEDGE;
+            }
+            jmsSession = getConnection().createSession(getClient().isSessTransacted(), ackMode);
+        }
+        return jmsSession;
+    }
+
+    public Destination[] createDestination(int destIndex, int destCount) throws JMSException {
+
+        if (getClient().isDestComposite()) {
+            return new Destination[] {createCompositeDestination(getClient().getDestName(), destIndex, destCount)};
+        } else {
+            Destination[] dest = new Destination[destCount];
+            for (int i=0; i<destCount; i++) {
+                dest[i] = createDestination(getClient().getDestName() + "." + (destIndex + i));
+            }
+
+            return dest;
+        }
+    }
+
+    public Destination createCompositeDestination(int destIndex, int destCount) throws JMSException {
+        return createCompositeDestination(getClient().getDestName(), destIndex, destCount);
+    }
+
+    protected Destination createCompositeDestination(String name, int destIndex, int destCount) throws JMSException {
+        String compDestName;
+        String simpleName;
+
+        if (name.startsWith("queue://")) {
+            simpleName = name.substring("queue://".length());
+        } else if (name.startsWith("topic://")) {
+            simpleName = name.substring("topic://".length());
+        } else {
+            simpleName = name;
+        }
+
+        int i;
+        compDestName = name + "." + destIndex + ","; // First destination
+        for (i=1; i<destCount-1; i++) {
+            compDestName += (simpleName + "." + (destIndex + i) +",");
+        }
+        compDestName += (simpleName + "." + (destIndex + i)); // Last destination (minus the comma)
+
+        return createDestination(compDestName);
+    }
+
+    protected Destination createDestination(String name) throws JMSException {
+        if (name.startsWith("queue://")) {
+            return getSession().createQueue(name.substring("queue://".length()));
+        } else if (name.startsWith("topic://")) {
+            return getSession().createTopic(name.substring("topic://".length()));
+        } else {
+            return getSession().createTopic(name);
+        }
+    }
+
+}

Added: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/AbstractJmsClientSystem.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/AbstractJmsClientSystem.java?rev=416542&view=auto
==============================================================================
--- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/AbstractJmsClientSystem.java (added)
+++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/AbstractJmsClientSystem.java Thu Jun 22 18:53:48 2006
@@ -0,0 +1,210 @@
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * Licensed 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.
+ */
+package org.apache.activemq.tool;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.activemq.tool.sampler.ThroughputSamplerTask;
+import org.apache.activemq.tool.sampler.CpuSamplerTask;
+import org.apache.activemq.tool.reports.PerformanceReportWriter;
+import org.apache.activemq.tool.reports.XmlFilePerfReportWriter;
+import org.apache.activemq.tool.reports.VerbosePerfReportWriter;
+import org.apache.activemq.tool.properties.JmsClientSystemProperties;
+import org.apache.activemq.tool.properties.AbstractObjectProperties;
+import org.apache.activemq.tool.properties.JmsFactoryProperties;
+import org.apache.activemq.tool.properties.ReflectionUtil;
+import org.apache.activemq.tool.properties.JmsClientProperties;
+import org.apache.activemq.tool.spi.SPIConnectionFactory;
+
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import java.util.Properties;
+import java.io.IOException;
+
+public abstract class AbstractJmsClientSystem extends AbstractObjectProperties {
+    private static final Log log = LogFactory.getLog(AbstractJmsClientSystem.class);
+
+    private int clientDestIndex, clientDestCount;
+
+    protected ThreadGroup clientThreadGroup;
+    protected ConnectionFactory jmsConnFactory;
+
+    // Properties
+    protected JmsFactoryProperties factory  = new JmsFactoryProperties();
+    protected ThroughputSamplerTask tpSampler = new ThroughputSamplerTask();
+    protected CpuSamplerTask cpuSampler = new CpuSamplerTask();
+
+    public void runSystemTest() throws JMSException {
+        // Create connection factory
+        jmsConnFactory = loadJmsFactory(getSysTest().getSpiClass(), factory.getFactorySettings());
+
+        // Create performance sampler
+        PerformanceReportWriter writer = createPerfWriter();
+        tpSampler.setPerfReportWriter(writer);
+        cpuSampler.setPerfReportWriter(writer);
+
+        writer.openReportWriter();
+        writer.writeProperties("jvmSettings", System.getProperties());
+        writer.writeProperties("testSystemSettings", ReflectionUtil.retrieveObjectProperties(getSysTest()));
+        writer.writeProperties("jmsFactorySettings", ReflectionUtil.retrieveObjectProperties(jmsConnFactory));
+        writer.writeProperties("jmsClientSettings", ReflectionUtil.retrieveObjectProperties(getJmsClientProperties()));
+        writer.writeProperties("tpSamplerSettings", ReflectionUtil.retrieveObjectProperties(tpSampler));
+        writer.writeProperties("cpuSamplerSettings", ReflectionUtil.retrieveObjectProperties(cpuSampler));
+
+        clientThreadGroup = new ThreadGroup(getSysTest().getClientPrefix() + " Thread Group");
+        for (int i=0; i<getSysTest().getNumClients(); i++) {
+            distributeDestinations(getSysTest().getDestDistro(), i, getSysTest().getNumClients(), getSysTest().getTotalDests());
+
+            final String clientName = getSysTest().getClientPrefix() + i;
+            final int clientDestIndex = this.clientDestIndex;
+            final int clientDestCount = this.clientDestCount;
+            Thread t = new Thread(clientThreadGroup, new Runnable() {
+                public void run() {
+                    runJmsClient(clientName, clientDestIndex, clientDestCount);
+                }
+            });
+            t.setName(getSysTest().getClientPrefix() + i + " Thread");
+            t.start();
+        }
+
+        // Run samplers
+        if (getSysTest().getSamplers().indexOf(JmsClientSystemProperties.SAMPLER_TP) > -1) {
+            tpSampler.startSampler();
+        }
+
+        if (getSysTest().getSamplers().indexOf(JmsClientSystemProperties.SAMPLER_CPU) > -1) {
+            try {
+                cpuSampler.createPlugin();
+                cpuSampler.startSampler();
+            } catch (IOException e) {
+                log.warn("Unable to start CPU sampler plugin. Reason: " + e.getMessage());
+            }
+        }
+
+        tpSampler.waitUntilDone();
+        cpuSampler.waitUntilDone();
+
+        writer.closeReportWriter();
+    }
+
+    public ThroughputSamplerTask getTpSampler() {
+        return tpSampler;
+    }
+
+    public void setTpSampler(ThroughputSamplerTask tpSampler) {
+        this.tpSampler = tpSampler;
+    }
+
+    public CpuSamplerTask getCpuSampler() {
+        return cpuSampler;
+    }
+
+    public void setCpuSampler(CpuSamplerTask cpuSampler) {
+        this.cpuSampler = cpuSampler;
+    }
+
+    public JmsFactoryProperties getFactory() {
+        return factory;
+    }
+
+    public void setFactory(JmsFactoryProperties factory) {
+        this.factory = factory;
+    }
+
+    public abstract JmsClientSystemProperties getSysTest();
+    public abstract void setSysTest(JmsClientSystemProperties sysTestProps);
+    public abstract JmsClientProperties getJmsClientProperties();
+
+    protected PerformanceReportWriter createPerfWriter() {
+        if (getSysTest().getReportType().equalsIgnoreCase(JmsClientSystemProperties.REPORT_XML_FILE)) {
+            String reportName;
+
+            if ((reportName = getSysTest().getReportName()) == null) {
+                reportName = getSysTest().getClientPrefix() + "_" +
+                             "numClients" + getSysTest().getNumClients() + "_" +
+                             "numDests" + getSysTest().getTotalDests() + "_" +
+                             getSysTest().getDestDistro();
+            }
+            return new XmlFilePerfReportWriter(getSysTest().getReportDir(), reportName);
+        } else if (getSysTest().getReportType().equalsIgnoreCase(JmsClientSystemProperties.REPORT_VERBOSE)) {
+            return new VerbosePerfReportWriter();
+        } else {
+            // Use verbose if unknown report type
+            return new VerbosePerfReportWriter();
+        }
+    }
+
+    protected void distributeDestinations(String distroType, int clientIndex, int numClients, int numDests) {
+        if (distroType.equalsIgnoreCase(JmsClientSystemProperties.DEST_DISTRO_ALL)) {
+            clientDestCount = numDests;
+            clientDestIndex = 0;
+        } else if (distroType.equalsIgnoreCase(JmsClientSystemProperties.DEST_DISTRO_EQUAL)) {
+            int destPerClient = (numDests / numClients);
+            // There are equal or more destinations per client
+            if (destPerClient > 0) {
+                clientDestCount = destPerClient;
+                clientDestIndex = destPerClient * clientIndex;
+            // If there are more clients than destinations, share destinations per client
+            } else {
+                clientDestCount = 1; // At most one destination per client
+                clientDestIndex = clientIndex % numDests;
+            }
+        } else if (distroType.equalsIgnoreCase(JmsClientSystemProperties.DEST_DISTRO_DIVIDE)) {
+            int destPerClient = (numDests / numClients);
+            // There are equal or more destinations per client
+            if (destPerClient > 0) {
+                int remain = numDests % numClients;
+                int nextIndex;
+                if (clientIndex < remain) {
+                    destPerClient++;
+                    nextIndex = clientIndex * destPerClient;
+                } else {
+                    nextIndex = (clientIndex * destPerClient) + remain;
+                }
+
+                clientDestCount = destPerClient;
+                clientDestIndex = nextIndex;
+
+            // If there are more clients than destinations, share destinations per client
+            } else {
+                clientDestCount = 1; // At most one destination per client
+                clientDestIndex = clientIndex % numDests;
+            }
+
+        // Send to all for unknown behavior
+        } else {
+            log.warn("Unknown destination distribution type: " + distroType);
+            clientDestCount = numDests;
+            clientDestIndex = 0;
+        }
+    }
+
+    protected ConnectionFactory loadJmsFactory(String spiClass, Properties factorySettings) throws JMSException {
+        try {
+            Class spi = Class.forName(spiClass);
+            SPIConnectionFactory spiFactory = (SPIConnectionFactory)spi.newInstance();
+            ConnectionFactory jmsFactory = spiFactory.createConnectionFactory(factorySettings);
+            log.info("Created: " + jmsFactory.getClass().getName() + " using SPIConnectionFactory: " + spiFactory.getClass().getName());
+            return jmsFactory;
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new JMSException(e.getMessage());
+        }
+    }
+
+    protected abstract void runJmsClient(String clientName, int clientDestIndex, int clientDestCount);
+}

Added: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/AbstractJmsMeasurableClient.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/AbstractJmsMeasurableClient.java?rev=416542&view=auto
==============================================================================
--- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/AbstractJmsMeasurableClient.java (added)
+++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/AbstractJmsMeasurableClient.java Thu Jun 22 18:53:48 2006
@@ -0,0 +1,51 @@
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * Licensed 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.
+ */
+package org.apache.activemq.tool;
+
+import org.apache.activemq.tool.sampler.MeasurableClient;
+
+import javax.jms.ConnectionFactory;
+
+import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicLong;
+
+public abstract class AbstractJmsMeasurableClient extends AbstractJmsClient implements MeasurableClient {
+    protected AtomicLong throughput = new AtomicLong(0);
+
+    public AbstractJmsMeasurableClient( ConnectionFactory factory) {
+        super( factory);
+    }
+
+    public void reset() {
+        setThroughput(0);
+    }
+
+    public long getThroughput() {
+        return throughput.get();
+    }
+
+    public void setThroughput(long val) {
+        throughput.set(val);
+    }
+
+    public void incThroughput() {
+        throughput.incrementAndGet();
+    }
+
+    public void incThroughput(long val) {
+        throughput.addAndGet(val);
+    }
+}

Modified: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsConsumerClient.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsConsumerClient.java?rev=416542&r1=416541&r2=416542&view=diff
==============================================================================
--- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsConsumerClient.java (original)
+++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsConsumerClient.java Thu Jun 22 18:53:48 2006
@@ -14,176 +14,195 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.activemq.tool;
 
-import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger;
-import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.commons.logging.Log;
+import org.apache.activemq.tool.properties.JmsConsumerProperties;
+import org.apache.activemq.tool.properties.JmsClientProperties;
 
-import java.util.Properties;
-
+import javax.jms.MessageConsumer;
+import javax.jms.JMSException;
+import javax.jms.ConnectionFactory;
 import javax.jms.Connection;
 import javax.jms.Destination;
-import javax.jms.JMSException;
 import javax.jms.Message;
-import javax.jms.MessageConsumer;
 import javax.jms.MessageListener;
 import javax.jms.Topic;
 
-public class JmsConsumerClient extends JmsPerformanceSupport {
-    private static final Log log = LogFactory.getLog(JmsConsumerClient.class);
+import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger;
 
-    private static final String PREFIX_CONFIG_CONSUMER = "consumer.";
-    public static final String TIME_BASED_RECEIVING = "time";
-    public static final String COUNT_BASED_RECEIVING = "count";
+public class JmsConsumerClient extends AbstractJmsMeasurableClient {
+    private static final Log log = LogFactory.getLog(JmsConsumerClient.class);
 
-    protected Properties jmsConsumerSettings = new Properties();
     protected MessageConsumer jmsConsumer;
+    protected JmsConsumerProperties client;
 
-    protected boolean durable = false;
-    protected boolean asyncRecv = true;
+    public JmsConsumerClient(ConnectionFactory factory) {
+        this(new JmsConsumerProperties(), factory);
+    }
 
-    protected long recvCount = 1000000;       // Receive a million messages by default
-    protected long recvDuration = 5 * 60 * 1000; // Receive for 5 mins by default
-    protected String recvType = TIME_BASED_RECEIVING;
+    public JmsConsumerClient(JmsConsumerProperties clientProps, ConnectionFactory factory) {
+        super(factory);
+        client = clientProps;
+    }
 
     public void receiveMessages() throws JMSException {
-        if (listener != null) {
-            listener.onConfigEnd(this);
-        }
-        if (isAsyncRecv()) {
-            receiveAsyncMessages();
+        if (client.isAsyncRecv()) {
+            if (client.getRecvType().equalsIgnoreCase(JmsConsumerProperties.TIME_BASED_RECEIVING)) {
+                receiveAsyncTimeBasedMessages(client.getRecvDuration());
+            } else {
+                receiveAsyncCountBasedMessages(client.getRecvCount());
+            }
         } else {
-            receiveSyncMessages();
+            if (client.getRecvType().equalsIgnoreCase(JmsConsumerProperties.TIME_BASED_RECEIVING)) {
+                receiveSyncTimeBasedMessages(client.getRecvDuration());
+            } else {
+                receiveSyncCountBasedMessages(client.getRecvCount());
+            }
         }
     }
 
-    public void receiveSyncMessages() throws JMSException {
+    public void receiveMessages(int destCount) throws JMSException {
+        this.destCount = destCount;
+        receiveMessages();
+    }
+
+    public void receiveMessages(int destIndex, int destCount) throws JMSException {
+        this.destIndex = destIndex;
+        receiveMessages(destCount);
+    }
+
+    public void receiveSyncTimeBasedMessages(long duration) throws JMSException {
         if (getJmsConsumer() == null) {
             createJmsConsumer();
         }
 
         try {
             getConnection().start();
-            if (listener != null) {
-                listener.onConsumeStart(this);
-            }
-            if (getRecvType().equalsIgnoreCase(TIME_BASED_RECEIVING)) {
-                long endTime = System.currentTimeMillis() + getRecvDuration();
-                while (System.currentTimeMillis() < endTime) {
-                    getJmsConsumer().receive();
-                    incThroughput();
-                }
-            } else {
-                int count = 0;
-                while (count < getRecvCount()) {
-                    getJmsConsumer().receive();
-                    incThroughput();
-                    count++;
-                }
+
+            log.info("Starting to synchronously receive messages for " + duration + " ms...");
+            long endTime = System.currentTimeMillis() + duration;
+            while (System.currentTimeMillis() < endTime) {
+                getJmsConsumer().receive();
+                incThroughput();
             }
         } finally {
-            if (listener != null) {
-                listener.onConsumeEnd(this);
+            getConnection().close();
+        }
+    }
+
+    public void receiveSyncCountBasedMessages(long count) throws JMSException {
+        if (getJmsConsumer() == null) {
+            createJmsConsumer();
+        }
+
+        try {
+            getConnection().start();
+            log.info("Starting to synchronously receive " + count + " messages...");
+
+            int recvCount = 0;
+            while (recvCount < count) {
+                getJmsConsumer().receive();
+                incThroughput();
+                recvCount++;
             }
+        } finally {
             getConnection().close();
         }
     }
 
-    public void receiveAsyncMessages() throws JMSException {
+    public void receiveAsyncTimeBasedMessages(long duration) throws JMSException {
         if (getJmsConsumer() == null) {
             createJmsConsumer();
         }
 
-        if (getRecvType().equalsIgnoreCase(TIME_BASED_RECEIVING)) {
-            getJmsConsumer().setMessageListener(new MessageListener() {
-                public void onMessage(Message msg) {
-                    incThroughput();
-                }
-            });
+        getJmsConsumer().setMessageListener(new MessageListener() {
+            public void onMessage(Message msg) {
+                incThroughput();
+            }
+        });
 
+        try {
+            getConnection().start();
+            log.info("Starting to asynchronously receive messages for " + duration + " ms...");
             try {
-                getConnection().start();
-                if (listener != null) {
-                    listener.onConsumeStart(this);
-                }
-                try {
-                    Thread.sleep(getRecvDuration());
-                } catch (InterruptedException e) {
-                    throw new JMSException("JMS consumer thread sleep has been interrupted. Message: " + e.getMessage());
-                }
-            } finally {
-                if (listener != null) {
-                    listener.onConsumeEnd(this);
-                }
-                getConnection().close();
+                Thread.sleep(duration);
+            } catch (InterruptedException e) {
+                throw new JMSException("JMS consumer thread sleep has been interrupted. Message: " + e.getMessage());
             }
-        } else {
-            final AtomicInteger count = new AtomicInteger(0);
-            getJmsConsumer().setMessageListener(new MessageListener() {
-                public void onMessage(Message msg) {
-                    incThroughput();
-                    count.incrementAndGet();
-                    count.notify();
-                }
-            });
+        } finally {
+            getConnection().close();
+        }
+    }
 
+    public void receiveAsyncCountBasedMessages(long count) throws JMSException {
+        if (getJmsConsumer() == null) {
+            createJmsConsumer();
+        }
+
+        final AtomicInteger recvCount = new AtomicInteger(0);
+        getJmsConsumer().setMessageListener(new MessageListener() {
+            public void onMessage(Message msg) {
+                incThroughput();
+                recvCount.incrementAndGet();
+                recvCount.notify();
+            }
+        });
+
+        try {
+            getConnection().start();
+            log.info("Starting to asynchronously receive " + client.getRecvCount() + " messages...");
             try {
-                getConnection().start();
-                if (listener != null) {
-                    listener.onConsumeStart(this);
+                while (recvCount.get() < count) {
+                    recvCount.wait();
                 }
-                try {
-                    while (count.get() < getRecvCount()) {
-                        count.wait();
-                    }
-                } catch (InterruptedException e) {
-                    throw new JMSException("JMS consumer thread wait has been interrupted. Message: " + e.getMessage());
-                }
-            } finally {
-                if (listener != null) {
-                    listener.onConsumeEnd(this);
-                }
-                getConnection().close();
+            } catch (InterruptedException e) {
+                throw new JMSException("JMS consumer thread wait has been interrupted. Message: " + e.getMessage());
             }
+        } finally {
+            getConnection().close();
         }
     }
-    
+
     public Connection getConnection() throws JMSException {
-    	Connection c = super.getConnection();
-    	if (c.getClientID() == null && isDurable()) {
-    		c.setClientID(getClientName());
-    	}
-    	return c;
+        Connection c = super.getConnection();
+        if (c.getClientID() == null && client.isDurable()) {
+            c.setClientID(getClientName());
+        }
+        return c;
     }
-    
+
     public MessageConsumer createJmsConsumer() throws JMSException {
-        Destination[] dest = createDestination();
+        Destination[] dest = createDestination(destIndex, destCount);
         return createJmsConsumer(dest[0]);
     }
 
     public MessageConsumer createJmsConsumer(Destination dest) throws JMSException {
-        if (isDurable()) {
+        if (client.isDurable()) {
             String clientName = getClientName();
             if (clientName == null) {
                 clientName = "JmsConsumer";
             }
+            log.info("Creating durable subscriber to: " + dest.toString());
             jmsConsumer = getSession().createDurableSubscriber((Topic) dest, clientName);
         } else {
+            log.info("Creating non-durable consumer to: " + dest.toString());
             jmsConsumer = getSession().createConsumer(dest);
         }
         return jmsConsumer;
     }
 
     public MessageConsumer createJmsConsumer(Destination dest, String selector, boolean noLocal) throws JMSException {
-        if (isDurable()) {
+        if (client.isDurable()) {
             String clientName = getClientName();
             if (clientName == null) {
                 clientName = "JmsConsumer";
             }
+            log.info("Creating durable subscriber to: " + dest.toString());
             jmsConsumer = getSession().createDurableSubscriber((Topic) dest, clientName, selector, noLocal);
         } else {
+            log.info("Creating non-durable consumer to: " + dest.toString());
             jmsConsumer = getSession().createConsumer(dest, selector, noLocal);
         }
         return jmsConsumer;
@@ -193,101 +212,11 @@
         return jmsConsumer;
     }
 
-    public Properties getJmsConsumerSettings() {
-        return jmsConsumerSettings;
+    public JmsClientProperties getClient() {
+        return client;
     }
 
-    public void setJmsConsumerSettings(Properties jmsConsumerSettings) {
-        this.jmsConsumerSettings = jmsConsumerSettings;
-        ReflectionUtil.configureClass(this, jmsConsumerSettings);
-    }
-
-    public boolean isDurable() {
-        return durable;
-    }
-
-    public void setDurable(boolean durable) {
-        this.durable = durable;
-    }
-
-    public boolean isAsyncRecv() {
-        return asyncRecv;
-    }
-
-    public void setAsyncRecv(boolean asyncRecv) {
-        this.asyncRecv = asyncRecv;
-    }
-
-    public long getRecvCount() {
-        return recvCount;
-    }
-
-    public void setRecvCount(long recvCount) {
-        this.recvCount = recvCount;
-    }
-
-    public long getRecvDuration() {
-        return recvDuration;
-    }
-
-    public void setRecvDuration(long recvDuration) {
-        this.recvDuration = recvDuration;
-    }
-
-    public String getRecvType() {
-        return recvType;
-    }
-
-    public void setRecvType(String recvType) {
-        this.recvType = recvType;
-    }
-
-    public Properties getSettings() {
-        Properties allSettings = new Properties(jmsConsumerSettings);
-        allSettings.putAll(super.getSettings());
-        return allSettings;
-    }
-
-    public void setSettings(Properties settings) {
-        super.setSettings(settings);
-        ReflectionUtil.configureClass(this, jmsConsumerSettings);
-    }
-
-    public void setProperty(String key, String value) {
-        if (key.startsWith(PREFIX_CONFIG_CONSUMER)) {
-            jmsConsumerSettings.setProperty(key, value);
-        } else {
-            super.setProperty(key, value);
-        }
-    }
-
-    public static void main(String[] args) throws JMSException {
-
-        Properties samplerSettings = new Properties();
-        Properties consumerSettings = new Properties();
-
-        for (int i = 0; i < args.length; i++) {
-            // Get property define options only
-            int index = args[i].indexOf("=");
-            String key = args[i].substring(0, index);
-            String val = args[i].substring(index + 1);
-            if (key.startsWith("sampler.")) {
-                samplerSettings.setProperty(key, val);
-            } else {
-                consumerSettings.setProperty(key, val);
-            }
-
-        }
-
-        JmsConsumerClient client = new JmsConsumerClient();
-        client.setSettings(consumerSettings);
-
-        PerfMeasurementTool sampler = new PerfMeasurementTool();
-        sampler.setSamplerSettings(samplerSettings);
-        sampler.registerClient(client);
-        sampler.startSampler();
-
-        client.setPerfEventListener(sampler);
-        client.receiveMessages();
+    public void setClient(JmsClientProperties clientProps) {
+        client = (JmsConsumerProperties)clientProps;
     }
 }

Modified: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsConsumerSystem.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsConsumerSystem.java?rev=416542&r1=416541&r2=416542&view=diff
==============================================================================
--- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsConsumerSystem.java (original)
+++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsConsumerSystem.java Thu Jun 22 18:53:48 2006
@@ -16,74 +16,72 @@
  */
 package org.apache.activemq.tool;
 
+import org.apache.activemq.tool.properties.JmsClientSystemProperties;
+import org.apache.activemq.tool.properties.JmsConsumerSystemProperties;
+import org.apache.activemq.tool.properties.JmsConsumerProperties;
+import org.apache.activemq.tool.properties.JmsClientProperties;
+import org.apache.activemq.tool.sampler.ThroughputSamplerTask;
+
 import javax.jms.JMSException;
 import java.util.Properties;
 
-public class JmsConsumerSystem extends JmsClientSystemSupport {
+public class JmsConsumerSystem extends AbstractJmsClientSystem {
+    protected JmsConsumerSystemProperties sysTest = new JmsConsumerSystemProperties();
+    protected JmsConsumerProperties consumer = new JmsConsumerProperties();
 
-    public String getReportName() {
-        if (reportName == null) {
-            return "JmsConsumer_Client" + getNumClients() + "_Dest" + getTotalDests() + "_" + getDestDistro() + ".xml";
-        } else {
-            return reportName;
-        }
+    public JmsClientSystemProperties getSysTest() {
+        return sysTest;
     }
 
-    public String getClientName() {
-        if (clientName == null) {
-            return "JmsConsumer";
-        } else {
-            return clientName;
-        }
+    public void setSysTest(JmsClientSystemProperties sysTestProps) {
+        sysTest = (JmsConsumerSystemProperties)sysTestProps;
     }
 
-    protected void runJmsClient(String clientName, Properties clientSettings) {
-        PerfMeasurementTool sampler = getPerformanceSampler();
+    public JmsClientProperties getJmsClientProperties() {
+        return getConsumer();
+    }
 
-        JmsConsumerClient consumer = new JmsConsumerClient();
-        consumer.setSettings(clientSettings);
-        consumer.setClientName(clientName);
+    public JmsConsumerProperties getConsumer() {
+        return consumer;
+    }
+
+    public void setConsumer(JmsConsumerProperties consumer) {
+        this.consumer = consumer;
+    }
+
+    protected void runJmsClient(String clientName, int clientDestIndex, int clientDestCount) {
+        ThroughputSamplerTask sampler = getTpSampler();
+
+        JmsConsumerClient consumerClient = new JmsConsumerClient(consumer, jmsConnFactory);
+        consumerClient.setClientName(clientName);
 
         if (sampler != null) {
-            sampler.registerClient(consumer);
-            consumer.setPerfEventListener(sampler);
+            sampler.registerClient(consumerClient);
         }
 
         try {
-            consumer.receiveMessages();
+            consumerClient.receiveMessages(clientDestIndex, clientDestCount);
         } catch (JMSException e) {
             e.printStackTrace();
         }
     }
 
-    protected String getThreadName() {
-        return "JMS Consumer Thread: ";
-    }
-
-    protected String getThreadGroupName() {
-        return "JMS Consumer Thread Group";
-    }
-
-    protected String getDestCountKey() {
-        return "consumer.destCount";
-    }
-
-    protected String getDestIndexKey() {
-        return "consumer.destIndex";
-    }
-
-    public static void main(String[] args) throws JMSException {
-        Properties sysSettings = new Properties();
-        for (int i = 0; i < args.length; i++) {
-            // Get property define options only
+    public static void main(String[] args) {
+        Properties props = new Properties();
+        for (int i=0; i<args.length; i++) {
             int index = args[i].indexOf("=");
             String key = args[i].substring(0, index);
             String val = args[i].substring(index + 1);
-            sysSettings.setProperty(key, val);
+            props.setProperty(key, val);
         }
 
-        JmsConsumerSystem sysTest = new JmsConsumerSystem();
-        sysTest.setSettings(sysSettings);
-        sysTest.runSystemTest();
+        JmsConsumerSystem sys = new JmsConsumerSystem();
+        sys.configureProperties(props);
+
+        try {
+            sys.runSystemTest();
+        } catch (JMSException e) {
+            e.printStackTrace();
+        }
     }
 }

Modified: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsProducerClient.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsProducerClient.java?rev=416542&r1=416541&r2=416542&view=diff
==============================================================================
--- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsProducerClient.java (original)
+++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsProducerClient.java Thu Jun 22 18:53:48 2006
@@ -16,51 +16,60 @@
  */
 package org.apache.activemq.tool;
 
+import org.apache.activemq.tool.properties.JmsProducerProperties;
+import org.apache.activemq.tool.properties.JmsClientProperties;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import javax.jms.*;
-
+import javax.jms.ConnectionFactory;
+import javax.jms.MessageProducer;
+import javax.jms.TextMessage;
+import javax.jms.JMSException;
+import javax.jms.Destination;
+import javax.jms.DeliveryMode;
 import java.util.Arrays;
-import java.util.Properties;
 
-public class JmsProducerClient extends JmsPerformanceSupport {
+public class JmsProducerClient extends AbstractJmsMeasurableClient {
     private static final Log log = LogFactory.getLog(JmsProducerClient.class);
 
-    private static final String PREFIX_CONFIG_PRODUCER = "producer.";
-    public static final String TIME_BASED_SENDING = "time";
-    public static final String COUNT_BASED_SENDING = "count";
-    public static final String DELIVERY_MODE_PERSISTENT = "persistent";
-    public static final String DELIVERY_MODE_NON_PERSISTENT = "nonpersistent";
-
-    protected Properties jmsProducerSettings = new Properties();
+    protected JmsProducerProperties client;
     protected MessageProducer jmsProducer;
     protected TextMessage jmsTextMessage;
 
-    protected String deliveryMode = DELIVERY_MODE_NON_PERSISTENT;
-    protected int messageSize = 1024;          // Send 1kb messages by default
-    protected long sendCount = 1000000;       // Send a million messages by default
-    protected long sendDuration = 5 * 60 * 1000; // Send for 5 mins by default
-    protected String sendType = TIME_BASED_SENDING;
+    public JmsProducerClient(ConnectionFactory factory) {
+        this(new JmsProducerProperties(), factory);
+    }
+
+    public JmsProducerClient(JmsProducerProperties clientProps, ConnectionFactory factory) {
+        super(factory);
+        this.client = clientProps;
+    }
 
     public void sendMessages() throws JMSException {
-        if (listener != null) {
-            listener.onConfigEnd(this);
-        }
         // Send a specific number of messages
-        if (sendType.equalsIgnoreCase(COUNT_BASED_SENDING)) {
-            sendCountBasedMessages(getSendCount());
+        if (client.getSendType().equalsIgnoreCase(JmsProducerProperties.COUNT_BASED_SENDING)) {
+            sendCountBasedMessages(client.getSendCount());
 
-            // Send messages for a specific duration
+        // Send messages for a specific duration
         } else {
-            sendTimeBasedMessages(getSendDuration());
+            sendTimeBasedMessages(client.getSendDuration());
         }
     }
 
+    public void sendMessages(int destCount) throws JMSException {
+        this.destCount = destCount;
+        sendMessages();
+    }
+
+    public void sendMessages(int destIndex, int destCount) throws JMSException {
+        this.destIndex = destIndex;
+        sendMessages(destCount);
+    }
+
     public void sendCountBasedMessages(long messageCount) throws JMSException {
         // Parse through different ways to send messages
         // Avoided putting the condition inside the loop to prevent effect on performance
-        Destination[] dest = createDestination();
+        Destination[] dest = createDestination(destIndex, destCount);
 
         // Create a producer, if none is created.
         if (getJmsProducer() == null) {
@@ -72,11 +81,13 @@
         }
         try {
             getConnection().start();
-            if (listener != null) {
-                listener.onPublishStart(this);
-            }
+            log.info("Starting to publish " + client.getMessageSize() + " byte(s) of " + messageCount + " messages...");
+
             // Send one type of message only, avoiding the creation of different messages on sending
-            if (getJmsTextMessage() != null) {
+            if (!client.isCreateNewMsg()) {
+                // Create only a single message
+                createJmsTextMessage();
+
                 // Send to more than one actual destination
                 if (dest.length > 1) {
                     for (int i = 0; i < messageCount; i++) {
@@ -115,9 +126,6 @@
                 }
             }
         } finally {
-            if (listener != null) {
-                listener.onPublishEnd(this);
-            }
             getConnection().close();
         }
     }
@@ -127,7 +135,7 @@
         // Parse through different ways to send messages
         // Avoided putting the condition inside the loop to prevent effect on performance
 
-        Destination[] dest = createDestination();
+        Destination[] dest = createDestination(destIndex, destCount);
 
         // Create a producer, if none is created.
         if (getJmsProducer() == null) {
@@ -140,12 +148,13 @@
 
         try {
             getConnection().start();
-            if (listener != null) {
-                listener.onPublishStart(this);
-            }
+            log.info("Starting to publish " + client.getMessageSize() + " byte(s) messages for " + duration + " ms");
 
             // Send one type of message only, avoiding the creation of different messages on sending
-            if (getJmsTextMessage() != null) {
+            if (!client.isCreateNewMsg()) {
+                // Create only a single message
+                createJmsTextMessage();
+
                 // Send to more than one actual destination
                 if (dest.length > 1) {
                     while (System.currentTimeMillis() < endTime) {
@@ -186,27 +195,17 @@
                 }
             }
         } finally {
-            if (listener != null) {
-                listener.onPublishEnd(this);
-            }
             getConnection().close();
         }
     }
 
-    public Properties getJmsProducerSettings() {
-        return jmsProducerSettings;
-    }
-
-    public void setJmsProducerSettings(Properties jmsProducerSettings) {
-        this.jmsProducerSettings = jmsProducerSettings;
-        ReflectionUtil.configureClass(this, jmsProducerSettings);
-    }
-
     public MessageProducer createJmsProducer() throws JMSException {
         jmsProducer = getSession().createProducer(null);
-        if (getDeliveryMode().equalsIgnoreCase(DELIVERY_MODE_PERSISTENT)) {
+        if (client.getDeliveryMode().equalsIgnoreCase(JmsProducerProperties.DELIVERY_MODE_PERSISTENT)) {
+            log.info("Creating producer to possible multiple destinations with persistent delivery.");
             jmsProducer.setDeliveryMode(DeliveryMode.PERSISTENT);
-        } else if (getDeliveryMode().equalsIgnoreCase(DELIVERY_MODE_NON_PERSISTENT)) {
+        } else if (client.getDeliveryMode().equalsIgnoreCase(JmsProducerProperties.DELIVERY_MODE_NON_PERSISTENT)) {
+            log.info("Creating producer to possible multiple destinations with non-persistent delivery.");
             jmsProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
         } else {
             log.warn("Unknown deliveryMode value. Defaulting to non-persistent.");
@@ -217,9 +216,11 @@
 
     public MessageProducer createJmsProducer(Destination dest) throws JMSException {
         jmsProducer = getSession().createProducer(dest);
-        if (getDeliveryMode().equalsIgnoreCase(DELIVERY_MODE_PERSISTENT)) {
+        if (client.getDeliveryMode().equalsIgnoreCase(JmsProducerProperties.DELIVERY_MODE_PERSISTENT)) {
+            log.info("Creating producer to: " + dest.toString() + " with persistent delivery.");
             jmsProducer.setDeliveryMode(DeliveryMode.PERSISTENT);
-        } else if (getDeliveryMode().equalsIgnoreCase(DELIVERY_MODE_NON_PERSISTENT)) {
+        } else if (client.getDeliveryMode().equalsIgnoreCase(JmsProducerProperties.DELIVERY_MODE_NON_PERSISTENT)) {
+            log.info("Creating  producer to: " + dest.toString() + " with non-persistent delivery.");
             jmsProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
         } else {
             log.warn("Unknown deliveryMode value. Defaulting to non-persistent.");
@@ -233,7 +234,7 @@
     }
 
     public TextMessage createJmsTextMessage() throws JMSException {
-        return createJmsTextMessage(getMessageSize());
+        return createJmsTextMessage(client.getMessageSize());
     }
 
     public TextMessage createJmsTextMessage(int size) throws JMSException {
@@ -242,7 +243,7 @@
     }
 
     public TextMessage createJmsTextMessage(String text) throws JMSException {
-        jmsTextMessage = getSession().createTextMessage(buildText(text, getMessageSize()));
+        jmsTextMessage = getSession().createTextMessage(buildText(text, client.getMessageSize()));
         return jmsTextMessage;
     }
 
@@ -250,100 +251,17 @@
         return jmsTextMessage;
     }
 
-    protected String buildText(String text, int size) {
-        byte[] data = new byte[size - text.length()];
-        Arrays.fill(data, (byte) 0);
-        return text + new String(data);
-    }
-
-    public String getDeliveryMode() {
-        return deliveryMode;
-    }
-
-    public void setDeliveryMode(String deliveryMode) {
-        this.deliveryMode = deliveryMode;
-    }
-
-    public int getMessageSize() {
-        return messageSize;
+    public JmsClientProperties getClient() {
+        return client;
     }
 
-    public void setMessageSize(int messageSize) {
-        this.messageSize = messageSize;
+    public void setClient(JmsClientProperties clientProps) {
+        client = (JmsProducerProperties)clientProps;
     }
 
-    public long getSendCount() {
-        return sendCount;
-    }
-
-    public void setSendCount(long sendCount) {
-        this.sendCount = sendCount;
-    }
-
-    public long getSendDuration() {
-        return sendDuration;
-    }
-
-    public void setSendDuration(long sendDuration) {
-        this.sendDuration = sendDuration;
-    }
-
-    public String getSendType() {
-        return sendType;
-    }
-
-    public void setSendType(String sendType) {
-        this.sendType = sendType;
-    }
-
-    public Properties getSettings() {
-        Properties allSettings = new Properties(jmsProducerSettings);
-        allSettings.putAll(super.getSettings());
-        return allSettings;
-    }
-
-    public void setSettings(Properties settings) {
-        super.setSettings(settings);
-        ReflectionUtil.configureClass(this, jmsProducerSettings);
-    }
-
-    public void setProperty(String key, String value) {
-        if (key.startsWith(PREFIX_CONFIG_PRODUCER)) {
-            jmsProducerSettings.setProperty(key, value);
-        } else {
-            super.setProperty(key, value);
-        }
-    }
-
-    public static void main(String[] args) throws JMSException {
-        Properties samplerSettings = new Properties();
-        Properties producerSettings = new Properties();
-
-        for (int i = 0; i < args.length; i++) {
-            // Get property define options only
-            int index = args[i].indexOf("=");
-            String key = args[i].substring(0, index);
-            String val = args[i].substring(index + 1);
-            if (key.startsWith("sampler.")) {
-                samplerSettings.setProperty(key, val);
-            } else {
-                producerSettings.setProperty(key, val);
-            }
-
-        }
-
-        JmsProducerClient client = new JmsProducerClient();
-        client.setSettings(producerSettings);
-
-        PerfMeasurementTool sampler = new PerfMeasurementTool();
-        sampler.setSamplerSettings(samplerSettings);
-        sampler.registerClient(client);
-        sampler.startSampler();
-
-        client.setPerfEventListener(sampler);
-
-        // This will reuse only a single message every send, which will improve performance
-        client.createJmsTextMessage();
-        client.sendMessages();
+    protected String buildText(String text, int size) {
+        byte[] data = new byte[size - text.length()];
+        Arrays.fill(data, (byte) 0);
+        return text + new String(data);
     }
 }

Modified: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsProducerSystem.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsProducerSystem.java?rev=416542&r1=416541&r2=416542&view=diff
==============================================================================
--- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsProducerSystem.java (original)
+++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsProducerSystem.java Thu Jun 22 18:53:48 2006
@@ -16,76 +16,72 @@
  */
 package org.apache.activemq.tool;
 
+import org.apache.activemq.tool.properties.JmsClientSystemProperties;
+import org.apache.activemq.tool.properties.JmsProducerSystemProperties;
+import org.apache.activemq.tool.properties.JmsProducerProperties;
+import org.apache.activemq.tool.properties.JmsClientProperties;
+import org.apache.activemq.tool.sampler.ThroughputSamplerTask;
+
 import javax.jms.JMSException;
 import java.util.Properties;
 
-public class JmsProducerSystem extends JmsClientSystemSupport {
+public class JmsProducerSystem extends AbstractJmsClientSystem {
+    protected JmsProducerSystemProperties sysTest = new JmsProducerSystemProperties();
+    protected JmsProducerProperties producer = new JmsProducerProperties();
 
-    public String getReportName() {
-        if (reportName == null) {
-            return "JmsProducer_Client" + getNumClients() + "_Dest" + getTotalDests() + "_" + getDestDistro() + ".xml";
-        } else {
-            return reportName;
-        }
+    public JmsClientSystemProperties getSysTest() {
+        return sysTest;
     }
 
-    public String getClientName() {
-        if (clientName == null) {
-            return "JmsProducer";
-        } else {
-            return clientName;
-        }
+    public void setSysTest(JmsClientSystemProperties sysTestProps) {
+        sysTest = (JmsProducerSystemProperties)sysTestProps;
+    }
+
+    public JmsClientProperties getJmsClientProperties() {
+        return getProducer();
+    }
+
+    public JmsProducerProperties getProducer() {
+        return producer;
+    }
+
+    public void setProducer(JmsProducerProperties producer) {
+        this.producer = producer;
     }
 
-    protected void runJmsClient(String clientName, Properties clientSettings) {
-        PerfMeasurementTool sampler = getPerformanceSampler();
+    protected void runJmsClient(String clientName, int clientDestIndex, int clientDestCount) {
+        ThroughputSamplerTask sampler = getTpSampler();
 
-        JmsProducerClient producer = new JmsProducerClient();
-        producer.setSettings(clientSettings);
-        producer.setClientName(clientName);
+        JmsProducerClient producerClient = new JmsProducerClient(producer, jmsConnFactory);
+        producerClient.setClientName(clientName);
 
         if (sampler != null) {
-            sampler.registerClient(producer);
-            producer.setPerfEventListener(sampler);
+            sampler.registerClient(producerClient);
         }
 
         try {
-            producer.createJmsTextMessage();
-            producer.sendMessages();
+            producerClient.sendMessages(clientDestIndex, clientDestCount);
         } catch (JMSException e) {
             e.printStackTrace();
         }
     }
 
-    protected String getThreadName() {
-        return "JMS Producer Thread: ";
-    }
-
-    protected String getThreadGroupName() {
-        return "JMS Producer Thread Group";
-    }
-
-    protected String getDestCountKey() {
-        return "producer.destCount";
-    }
-
-    protected String getDestIndexKey() {
-        return "producer.destIndex";
-    }
-
     public static void main(String[] args) {
-        Properties sysSettings = new Properties();
-
-        for (int i = 0; i < args.length; i++) {
-            // Get property define options only
+        Properties props = new Properties();
+        for (int i=0; i<args.length; i++) {
             int index = args[i].indexOf("=");
             String key = args[i].substring(0, index);
             String val = args[i].substring(index + 1);
-            sysSettings.setProperty(key, val);
+            props.setProperty(key, val);
         }
 
-        JmsProducerSystem sysTest = new JmsProducerSystem();
-        sysTest.setSettings(sysSettings);
-        sysTest.runSystemTest();
+        JmsProducerSystem sys = new JmsProducerSystem();
+        sys.configureProperties(props);
+
+        try {
+            sys.runSystemTest();
+        } catch (JMSException e) {
+            e.printStackTrace();
+        }
     }
 }

Added: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/properties/AbstractObjectProperties.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/properties/AbstractObjectProperties.java?rev=416542&view=auto
==============================================================================
--- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/properties/AbstractObjectProperties.java (added)
+++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/properties/AbstractObjectProperties.java Thu Jun 22 18:53:48 2006
@@ -0,0 +1,34 @@
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * Licensed 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.
+ */
+package org.apache.activemq.tool.properties;
+
+import java.util.Properties;
+
+public abstract class AbstractObjectProperties implements ReflectionConfigurable {
+
+    public void configureProperties(Properties props) {
+        ReflectionUtil.configureClass(this, props);
+    }
+
+    public Properties retrieveProperties(Properties props) {
+        return null;
+    }
+
+    public boolean acceptConfig(String key, String val) {
+        return true; // accept by default
+    }
+}

Added: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/properties/JmsClientProperties.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/properties/JmsClientProperties.java?rev=416542&view=auto
==============================================================================
--- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/properties/JmsClientProperties.java (added)
+++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/properties/JmsClientProperties.java Thu Jun 22 18:53:48 2006
@@ -0,0 +1,61 @@
+/**
+ * Copyright 2005-2006 The Apache Software Foundation
+ * <p/>
+ * Licensed 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.
+ */
+package org.apache.activemq.tool.properties;
+
+public class JmsClientProperties extends AbstractObjectProperties {
+    public static final String SESSION_AUTO_ACKNOWLEDGE    = "autoAck";
+    public static final String SESSION_CLIENT_ACKNOWLEDGE  = "clientAck";
+    public static final String SESSION_DUPS_OK_ACKNOWLEDGE = "dupsAck";
+    public static final String SESSION_TRANSACTED          = "transacted";
+
+    protected String  destName       = "TEST.FOO";
+    protected boolean destComposite  = false;
+
+    protected String  sessAckMode    = SESSION_AUTO_ACKNOWLEDGE;
+    protected boolean sessTransacted = false;
+
+    public String getDestName() {
+        return destName;
+    }
+
+    public void setDestName(String destName) {
+        this.destName = destName;
+    }
+
+    public boolean isDestComposite() {
+        return destComposite;
+    }
+
+    public void setDestComposite(boolean destComposite) {
+        this.destComposite = destComposite;
+    }
+
+    public String getSessAckMode() {
+        return sessAckMode;
+    }
+
+    public void setSessAckMode(String sessAckMode) {
+        this.sessAckMode = sessAckMode;
+    }
+
+    public boolean isSessTransacted() {
+        return sessTransacted;
+    }
+
+    public void setSessTransacted(boolean sessTransacted) {
+        this.sessTransacted = sessTransacted;
+    }
+}



Mime
View raw message