activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r418007 - in /incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool: AbstractJmsClientSystem.java JmsConsumerSystem.java JmsProducerSystem.java properties/JmsClientSystemProperties.java
Date Thu, 29 Jun 2006 11:13:21 GMT
Author: aco
Date: Thu Jun 29 04:13:21 2006
New Revision: 418007

URL: http://svn.apache.org/viewvc?rev=418007&view=rev
Log:
Added option to specify a properties file to configure the system

Modified:
    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/JmsConsumerSystem.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/properties/JmsClientSystemProperties.java

Modified: 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=418007&r1=418006&r2=418007&view=diff
==============================================================================
--- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/AbstractJmsClientSystem.java
(original)
+++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/AbstractJmsClientSystem.java
Thu Jun 29 04:13:21 2006
@@ -36,6 +36,8 @@
 import java.util.Properties;
 import java.util.Enumeration;
 import java.io.IOException;
+import java.io.File;
+import java.io.FileInputStream;
 
 public abstract class AbstractJmsClientSystem extends AbstractObjectProperties {
     private static final Log log = LogFactory.getLog(AbstractJmsClientSystem.class);
@@ -227,4 +229,36 @@
     }
 
     protected abstract void runJmsClient(String clientName, int clientDestIndex, int clientDestCount);
+
+    protected static Properties parseStringArgs(String[] args) {
+        File configFile = null;
+        Properties props = new Properties();
+        for (int i=0; i<args.length; i++) {
+            String arg = args[i];
+            if (arg.startsWith("-D") || arg.startsWith("-d")) {
+                arg = arg.substring(2);
+            }
+            int index  = arg.indexOf("=");
+            String key = arg.substring(0, index);
+            String val = arg.substring(index + 1);
+
+            if (key.equalsIgnoreCase("sysTest.propsConfigFile")) {
+                if (!val.endsWith(".properties")) {
+                    val += ".properties";
+                }
+                configFile = new File(val);
+            }
+            props.setProperty(key, val);
+        }
+
+        Properties fileProps = new Properties();
+        try {
+            fileProps.load(new FileInputStream(configFile));
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        // Overwrite file settings with command line settings
+        fileProps.putAll(props);
+        return fileProps;
+    }
 }

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=418007&r1=418006&r2=418007&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 29 04:13:21 2006
@@ -67,20 +67,8 @@
     }
 
     public static void main(String[] args) {
-        Properties props = new Properties();
-        for (int i=0; i<args.length; i++) {
-            String arg = args[i];
-            if (arg.startsWith("-D") || arg.startsWith("-d")) {
-                arg = arg.substring(2);
-            }
-            int index  = arg.indexOf("=");
-            String key = arg.substring(0, index);
-            String val = arg.substring(index + 1);
-            props.setProperty(key, val);
-        }
-
         JmsConsumerSystem sys = new JmsConsumerSystem();
-        sys.configureProperties(props);
+        sys.configureProperties(AbstractJmsClientSystem.parseStringArgs(args));
 
         try {
             sys.runSystemTest();

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=418007&r1=418006&r2=418007&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 29 04:13:21 2006
@@ -67,20 +67,8 @@
     }
 
     public static void main(String[] args) {
-        Properties props = new Properties();
-        for (int i=0; i<args.length; i++) {
-            String arg = args[i];
-            if (arg.startsWith("-D") || arg.startsWith("-d")) {
-                arg = arg.substring(2);
-            }
-            int index  = arg.indexOf("=");
-            String key = arg.substring(0, index);
-            String val = arg.substring(index + 1);
-            props.setProperty(key, val);
-        }
-
         JmsProducerSystem sys = new JmsProducerSystem();
-        sys.configureProperties(props);
+        sys.configureProperties(AbstractJmsClientSystem.parseStringArgs(args));
 
         try {
             sys.runSystemTest();

Modified: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/properties/JmsClientSystemProperties.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/properties/JmsClientSystemProperties.java?rev=418007&r1=418006&r2=418007&view=diff
==============================================================================
--- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/properties/JmsClientSystemProperties.java
(original)
+++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/properties/JmsClientSystemProperties.java
Thu Jun 29 04:13:21 2006
@@ -16,6 +16,8 @@
  */
 package org.apache.activemq.tool.properties;
 
+import java.io.File;
+
 public class JmsClientSystemProperties extends AbstractObjectProperties {
     public static final String DEST_DISTRO_ALL    = "all";    // Each client will send/receive
to all destination;
     public static final String DEST_DISTRO_EQUAL  = "equal";  // Equally divide the number
of destinations to the number of clients
@@ -27,6 +29,8 @@
     public static final String SAMPLER_TP  = "tp";
     public static final String SAMPLER_CPU = "cpu";
 
+    protected File propsConfigFile = null;
+
     protected String reportType = REPORT_XML_FILE;
     protected String reportDir  = "./";
     protected String reportName = null;
@@ -109,5 +113,13 @@
 
     public void setDestDistro(String destDistro) {
         this.destDistro = destDistro;
+    }
+
+    public String getPropsConfigFile() {
+        return this.propsConfigFile + "";
+    }
+
+    public void setPropsConfigFile(String propsConfigFile) {
+        this.propsConfigFile = new File(propsConfigFile);
     }
 }



Mime
View raw message