Author: [email protected]
Date: Thu Apr 28 14:13:50 2011
New Revision: 1056

Log:
[AMDATUOPENSOCIAL-40] Finished performance test framework setup

Added:
   
trunk/amdatu-opensocial/test-performance/src/main/resources/shell/configuration.properties
   trunk/amdatu-opensocial/test-performance/src/main/resources/shell/run.sh
Modified:
   trunk/amdatu-opensocial/test-performance/src/main/resources/shell/run.bat
   
trunk/test-performance/src/main/java/org/amdatu/test/performance/main/Main.java

Added: 
trunk/amdatu-opensocial/test-performance/src/main/resources/shell/configuration.properties
==============================================================================
--- (empty file)
+++ 
trunk/amdatu-opensocial/test-performance/src/main/resources/shell/configuration.properties
  Thu Apr 28 14:13:50 2011
@@ -0,0 +1,40 @@
+# Java properties file for performance test execution.
+
+# Run a performance test
+runtest=true
+
+# ... on all Amdatu versions available in directory:
+# NB: Copy the versions to this directory before running this test
+versiondir=amdatu-versions
+
+# ... , execute the JMeter plans from the directory:
+jmeterplansdir=jmeter-plans
+
+# ... , write the result to the directory:
+resultsdir=results
+
+# ... and use this as temporary directoy:
+tmpdir=tmp
+
+# Before execution of the test, remove the example bundles from the release
+noexamples=true
+
+# Run the HTTP service on port 2204
+port=2204
+
+# Run a verification, meaning that also a performance test is excuted of
+# version X against version X. This should obviously result in an outcome
+# stating that there is no significant difference in performance
+verify=true
+
+# Run 1 testloop
+testloops=50
+
+# Perform a statistics analysis after running the test
+analyze=true
+
+# ... but omit the first 50 results of each test run
+omit=50
+
+# ... and use new samples Z where each sample Z is mean of m samples X-Y
+m=250
\ No newline at end of file

Modified: 
trunk/amdatu-opensocial/test-performance/src/main/resources/shell/run.bat
==============================================================================
--- trunk/amdatu-opensocial/test-performance/src/main/resources/shell/run.bat   
(original)
+++ trunk/amdatu-opensocial/test-performance/src/main/resources/shell/run.bat   
Thu Apr 28 14:13:50 2011
@@ -1 +1 @@
-java -Xmx1024m -jar org.amdatu.test.performance-${test.performance.version}.jar
\ No newline at end of file
+java -Xmx1024m -jar 
org.amdatu.test.performance-${test.performance.version}.jar -config 
configuration.properties
\ No newline at end of file

Added: trunk/amdatu-opensocial/test-performance/src/main/resources/shell/run.sh
==============================================================================
--- (empty file)
+++ trunk/amdatu-opensocial/test-performance/src/main/resources/shell/run.sh    
Thu Apr 28 14:13:50 2011
@@ -0,0 +1 @@
+java -Xmx1024m -jar 
org.amdatu.test.performance-${test.performance.version}.jar -config 
configuration.properties
\ No newline at end of file

Modified: 
trunk/test-performance/src/main/java/org/amdatu/test/performance/main/Main.java
==============================================================================
--- 
trunk/test-performance/src/main/java/org/amdatu/test/performance/main/Main.java 
    (original)
+++ 
trunk/test-performance/src/main/java/org/amdatu/test/performance/main/Main.java 
    Thu Apr 28 14:13:50 2011
@@ -17,11 +17,13 @@
 package org.amdatu.test.performance.main;
 
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Properties;
 
 import javax.xml.parsers.ParserConfigurationException;
 
@@ -40,6 +42,7 @@
  * @author ivol
  */
 public class Main {
+    public static String CONFIGFILE_ARG = "-config";
     public static String VERBOSE_ARG = "-verbose";
     public static String ANALYZE_ARG = "-analyze";
     public static String RUNTEST_ARG = "-runtest";
@@ -74,6 +77,7 @@
     static {
         FILE_ARGS.add(AMDATU_X_ARG);
         FILE_ARGS.add(AMDATU_Y_ARG);
+        FILE_ARGS.add(CONFIGFILE_ARG);
     }
 
     // Directory arguments
@@ -144,6 +148,11 @@
                 }
             }
 
+            if (arguments.containsKey(CONFIGFILE_ARG)) {
+                String configFile = arguments.get(CONFIGFILE_ARG).toString();
+                parseConfigurationFile(configFile, arguments);
+            }
+
             if (Boolean.TRUE.equals(arguments.get(VERBOSE_ARG))) {
                 for (String key : arguments.keySet()) {
                     System.err.println(key + "=" + arguments.get(key)) ;
@@ -336,4 +345,66 @@
         }
         return tests;
     }
+
+    // Read configuration from the properties file instead
+    private static void parseConfigurationFile(String configFile, Map<String, 
Object> arguments) throws IOException {
+        Properties properties = new Properties();
+        FileInputStream is = null;
+        try {
+            is = new FileInputStream(configFile);
+            properties.load(is);
+        } finally {
+            if (is != null) {
+                is.close();
+            }
+        }
+
+        // Read boolean properties
+        for (String property : BOOLEAN_ARGS) {
+            property = property.substring(1);
+            if (properties.containsKey(property)) {
+                boolean value = 
properties.getProperty(property).equalsIgnoreCase("true");
+                arguments.put("-" + property, value);
+            } else {
+                arguments.put("-" + property, false);
+            }
+        }
+
+        // Read file properties
+        for (String property : FILE_ARGS) {
+            property = property.substring(1);
+            if (properties.containsKey(property)) {
+                String value = properties.getProperty(property).toString();
+                if (!new File(value).exists() || !new File(value).isFile()) {
+                    System.err.println("File " + value + " does not exist or 
is not a file");
+                } 
+                arguments.put("-" + property, value);
+            }
+        }
+
+        // Read directory properties
+        for (String property : DIR_ARGS) {
+            property = property.substring(1);
+            if (properties.containsKey(property)) {
+                String value = properties.getProperty(property).toString();
+                if (!new File(value).exists() || !new 
File(value).isDirectory()) {
+                    if (value.equals(TMPDIR_ARG) || 
value.equals(RESULTSDIR_ARG)) {
+                        new File(value).mkdirs();
+                    } else {
+                        System.err.println("Directory " + value + " does not 
exist or is not a directory");
+                    }
+                }
+                arguments.put("-" + property, value);
+            }
+        }
+
+        // Read other properties
+        for (String property : OTHER_ARGS) {
+            property = property.substring(1);
+            if (properties.containsKey(property)) {
+                String value = properties.getProperty(property).toString();
+                arguments.put("-" + property, value);
+            }
+        }      
+    }
 }
\ No newline at end of file
_______________________________________________
Amdatu-commits mailing list
[email protected]
http://lists.amdatu.org/mailman/listinfo/amdatu-commits

Reply via email to