Author: [email protected]
Date: Tue Mar 29 12:16:16 2011
New Revision: 912

Log:
[AMDATU-332] Added -clean option

Modified:
   
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/main/Main.java
   
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/runtest/AmdatuLauncher.java
   
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/runtest/ApplicationContext.java

Modified: 
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/main/Main.java
==============================================================================
--- 
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/main/Main.java
  (original)
+++ 
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/main/Main.java
  Tue Mar 29 12:16:16 2011
@@ -44,6 +44,7 @@
     public static String RUNTEST_ARG = "-runtest";
     public static String NOEXAMPLES_ARG = "-noexamples";
     public static String VERIFY_ARG = "-verify";
+    public static String CLEAN_ARG = "-clean";
     public static String AMDATU_X_ARG = "-amdatuVersionX";
     public static String AMDATU_Y_ARG = "-amdatuVersionY";
     public static String JMETERPLANSDIR_ARG = "-jmeterplansdir";
@@ -53,6 +54,7 @@
     public static String OMIT_ARG = "-omit";
     public static String PORT_ARG = "-port";
     public static String SAMPLESIZE_ARG = "-m";
+    
 
     // Wordy arguments
     private final static List<String> BOOLEAN_ARGS = new ArrayList<String>();
@@ -62,6 +64,7 @@
         BOOLEAN_ARGS.add(RUNTEST_ARG);
         BOOLEAN_ARGS.add(NOEXAMPLES_ARG);
         BOOLEAN_ARGS.add(VERIFY_ARG);
+        BOOLEAN_ARGS.add(CLEAN_ARG);
     }
 
     // File arguments
@@ -248,7 +251,13 @@
             for (String version : versions) {
                 try {
                     context.setCurrentContext(version);
-                    launcher.start();
+                    try {
+                        launcher.start();
+                    } catch (IllegalStateException e) {
+                        // Retry once
+                        launcher.kill();
+                        launcher.start();
+                    }
                     jmeter.run();
                 } finally {
                     launcher.stop();

Modified: 
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/runtest/AmdatuLauncher.java
==============================================================================
--- 
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/runtest/AmdatuLauncher.java
     (original)
+++ 
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/runtest/AmdatuLauncher.java
     Tue Mar 29 12:16:16 2011
@@ -113,6 +113,11 @@
 
             m_amdatuProcess.waitFor();
         }
+        
+        if (m_context.clean) {
+            // Clean up work directory after shutdown
+            FileUtils.deleteDirectory(new File(m_tmpDir, "work"));
+        }
 
         System.out.println("Amdatu shutdown completed");
     }
@@ -166,7 +171,7 @@
                 if (checkURL(url) == responseCode) {
                     return true;
                 }
-                Thread.sleep(1000);
+                Thread.sleep(2000);
             }
             catch (InterruptedException ie) {}
             catch (IOException e) {}

Modified: 
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/runtest/ApplicationContext.java
==============================================================================
--- 
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/runtest/ApplicationContext.java
 (original)
+++ 
trunk/etc/performancetest/src/main/java/org/amdatu/test/performance/runtest/ApplicationContext.java
 Tue Mar 29 12:16:16 2011
@@ -25,6 +25,7 @@
     public String jmeterPlanDir; // directory to read JMeter plans from
     public String resultsDir; // directory to write results to
     public boolean noExamples; // Indication of examples should be removed 
prior to running the tests
+    public boolean clean = false; // Indicates if the Amdatu work directory 
must be deleted prior to running each test
     public int omit; // Amount of initial results to omit
     public File rootTmpDir; // Root temporary directory
     public int testLoops;
@@ -54,6 +55,9 @@
         if (arguments.containsKey(Main.SAMPLESIZE_ARG)) {
             sampleSize = 
Integer.parseInt(arguments.get(Main.SAMPLESIZE_ARG).toString());
         }
+        if (arguments.containsKey(Main.CLEAN_ARG)) {
+            clean = true;
+        }
     }
     
     public void setContext(TestContext x, TestContext y) {
_______________________________________________
Amdatu-commits mailing list
[email protected]
http://lists.amdatu.org/mailman/listinfo/amdatu-commits

Reply via email to