Author: [email protected]
Date: Tue Apr 17 15:01:23 2012
New Revision: 2266

Log:
[AMDATUAUTH-147]Removed analysis code from launcher artifact

Added:
   
trunk/amdatu-auth/test-performance/test-execution/src/main/resources/shell/launcher.properties
Modified:
   
trunk/amdatu-auth/test-performance/test-execution/src/main/resources/shell/run.bat
   
trunk/amdatu-auth/test-performance/test-execution/src/main/resources/shell/run.sh
   
trunk/amdatu-auth/test-performance/test-launcher/src/main/java/org/amdatu/auth/test/performance/launcher/Utils.java
   
trunk/amdatu-auth/test-performance/test-launcher/src/main/java/org/amdatu/auth/test/performance/launcher/analysis/JMeterPlanReport.java
   
trunk/amdatu-auth/test-performance/test-launcher/src/main/java/org/amdatu/auth/test/performance/launcher/analysis/JMeterResultsParser.java
   
trunk/amdatu-auth/test-performance/test-launcher/src/main/java/org/amdatu/auth/test/performance/launcher/analysis/ReportSummary.java
   
trunk/amdatu-auth/test-performance/test-launcher/src/main/java/org/amdatu/auth/test/performance/launcher/analysis/Statistics.java
   
trunk/amdatu-auth/test-performance/test-launcher/src/main/java/org/amdatu/auth/test/performance/launcher/analysis/XYSample.java
   
trunk/amdatu-auth/test-performance/test-launcher/src/main/java/org/amdatu/auth/test/performance/launcher/analysis/ZSamples.java
   
trunk/amdatu-auth/test-performance/test-launcher/src/main/java/org/amdatu/auth/test/performance/launcher/main/Main.java
   
trunk/amdatu-auth/test-performance/test-launcher/src/main/java/org/amdatu/auth/test/performance/launcher/runtest/ApplicationContext.java
   
trunk/amdatu-auth/test-performance/test-launcher/src/main/java/org/amdatu/auth/test/performance/launcher/runtest/JMeterRunner.java
   
trunk/amdatu-auth/test-performance/test-launcher/src/main/java/org/amdatu/auth/test/performance/launcher/runtest/Logger.java

Added: 
trunk/amdatu-auth/test-performance/test-execution/src/main/resources/shell/launcher.properties
==============================================================================
--- (empty file)
+++ 
trunk/amdatu-auth/test-performance/test-execution/src/main/resources/shell/launcher.properties
      Tue Apr 17 15:01:23 2012
@@ -0,0 +1,52 @@
+# Copyright (c) 2010, 2011 The Amdatu 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.verning permissions and limitations
+# under the License.
+
+# Java properties file for performance test execution.
+
+# Verbose will print all input arguments to the command line
+verbose=false
+
+# 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
+
+# Executes the test for all Amdatu versions available in this directory
+# NB: Copy the versions to this directory before running this test
+versiondir=amdatu-versions
+
+# The temporary directoy in which all test execution takes place
+tmpdir=tmp
+
+# Removes the work directory just before starting Amdatu. Can be:
+# 0 - Do not remove work directory
+# 1 - Remove work directory, except for the bundle cache
+# 2 - Remove work directory completely
+clean=1
+
+# Execute the JMeter plans from the directory:
+jmeterplansdir=jmeter-plans
+
+# Write the analyze results to the directory:
+resultsdir=results
+
+# The amount of test loops to execute
+testloops=50
+
+# Omit the first [amount] results of each test run, with the purpose of 
reducing correlation between the results
+omit=50
+
+# Run the HTTP service on port 2204
+port=2204

Modified: 
trunk/amdatu-auth/test-performance/test-execution/src/main/resources/shell/run.bat
==============================================================================
--- 
trunk/amdatu-auth/test-performance/test-execution/src/main/resources/shell/run.bat
  (original)
+++ 
trunk/amdatu-auth/test-performance/test-execution/src/main/resources/shell/run.bat
  Tue Apr 17 15:01:23 2012
@@ -13,4 +13,4 @@
 @REM limitations under the License.verning permissions and limitations
 @REM under the License.
 
-java -Xmx1024m -jar 
org.amdatu.auth.test.performance.launcher-${project.version}.jar -config 
configuration.properties
\ No newline at end of file
+java -Xmx1024m -jar 
org.amdatu.auth.test.performance.launcher-${project.version}.jar -config 
launcher.properties
\ No newline at end of file

Modified: 
trunk/amdatu-auth/test-performance/test-execution/src/main/resources/shell/run.sh
==============================================================================
--- 
trunk/amdatu-auth/test-performance/test-execution/src/main/resources/shell/run.sh
   (original)
+++ 
trunk/amdatu-auth/test-performance/test-execution/src/main/resources/shell/run.sh
   Tue Apr 17 15:01:23 2012
@@ -13,4 +13,4 @@
 # limitations under the License.verning permissions and limitations
 # under the License.
 
-java -Xmx1024m -jar 
org.amdatu.auth.test.performance.launcher-${project.version}.jar -config 
configuration.properties
\ No newline at end of file
+java -Xmx1024m -jar 
org.amdatu.auth.test.performance.launcher-${project.version}.jar -config 
launcher.properties
\ No newline at end of file

Modified: 
trunk/amdatu-auth/test-performance/test-launcher/src/main/java/org/amdatu/auth/test/performance/launcher/Utils.java
==============================================================================
--- 
trunk/amdatu-auth/test-performance/test-launcher/src/main/java/org/amdatu/auth/test/performance/launcher/Utils.java
 (original)
+++ 
trunk/amdatu-auth/test-performance/test-launcher/src/main/java/org/amdatu/auth/test/performance/launcher/Utils.java
 Tue Apr 17 15:01:23 2012
@@ -13,9 +13,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.amdatu.auth.test.performance.launcher;
-
-import org.amdatu.auth.test.performance.launcher.runtest.JMeterRunner;
+package org.amdatu.auth.test.performance.launcher;
+
 import org.amdatu.auth.test.performance.launcher.runtest.Logger;
 
 import java.io.BufferedInputStream;
@@ -26,152 +25,172 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.Calendar;
+import java.util.zip.CRC32;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipInputStream;
+import java.util.zip.ZipOutputStream;
 
-import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.IOUtils;
-
-public class Utils {
-    // Private constant for buffer size.
-    private static final int BUFFER_SIZE = 40 * 1024; // Blocks of 40 Kb each
-
-    /**
-     * Unzips the file to the specified target directory.
-     * @param zipFile The zipfile to unzip
-     * @param targetDir The directory in which the resulting files should be 
Stored
-     * @exception IOException If not all files could be saved
-     */
-    public static void unzip(File zipFile, File targetDir) throws IOException {
-        // Create the buffer for streaming the contents
-
-        // Create the zip input stream
-        ZipInputStream zip = null;
-        try {
-            zip = new ZipInputStream(new BufferedInputStream(new 
FileInputStream(zipFile), BUFFER_SIZE));
-            // Process each entry
-            ZipEntry entry;
-            while ((entry = zip.getNextEntry()) != null) {
-                // Get and normalize the path
-                String path = entry.getName();
-                path = path.replace('/', File.separatorChar);
-                path = path.replace('\\', File.separatorChar);
-                File target = new File(targetDir, path);
-                // Check whether the target is a file or directory
-                if (entry.isDirectory()) {
-                    target.mkdirs();
-                } else {
-                    writeZipEntryToFile(zip, target);
-                }
-
-                // Set the last modified to the date specified in the zip
-                long time = entry.getTime();
-                if (time != -1) {
-                    target.setLastModified(time);
-                }
-            }
-        } finally {
-            if (zip != null) {
-                zip.close();
-            }
-        }
-    }
-
-    /**
-     * Writes the content of the zip entry to the specified file.
-     * @param zip The zip entry to write
-     * @param target The file to write to
-     * @throws IOException In case a IO exception occurs
-     */
-    public static void writeZipEntryToFile(ZipInputStream zip, File target) 
throws IOException {
-        // Create the parent directory
-        File parent = target.getParentFile();
-        if (!parent.exists()) {
-            parent.mkdirs();
-        }
-        // Stream the contents to the target file
-        int bytes;
-        byte[] buffer = new byte[BUFFER_SIZE];
-        OutputStream out = null;
-        try {
-            out = new BufferedOutputStream(new FileOutputStream(target), 
BUFFER_SIZE);
-            while ((bytes = zip.read(buffer, 0, buffer.length)) != -1) {
-                out.write(buffer, 0, bytes);
-            }
-        } catch (IOException ex) {
-            throw ex;
-        } finally {
-            if (out != null) {
-                out.close();
-            }
-        }
-    }
-
-    public static void mergeSampleFiles(String resultsDir) throws IOException {
-        File resultDir = new File(resultsDir);
-        for (File file : resultDir.listFiles()) {
-            if (file.getName().contains(JMeterRunner.SAMPLES_X + ".")) {
-                String path = file.getParent();
-                String fileName = file.getName().substring(0, 
file.getName().indexOf(JMeterRunner.SAMPLES_X));
-                String report = path + File.separator + fileName + 
JMeterRunner.SAMPLES;
-                merge(report + "X");
-                merge(report + "Y");
-            }
-        }
-    }
-
-    private static void merge(String bigFileName) throws IOException {
-        File bigFile = new File(bigFileName);
-        List<File> deleteFiles = new ArrayList<File>();
-        if (!bigFile.exists()) {
-            bigFile.createNewFile();
-
-            StringBuffer content = new StringBuffer();
-            boolean notFound = false;
-            int index = 1;
-            while (!notFound) {
-                File sourceFile = new File(bigFileName + "." + index);
-                if (sourceFile.exists()) {
-                    String part = FileUtils.readFileToString(sourceFile);
-                    int from = part.indexOf("<httpSample ");
-                    int to = part.indexOf("</testResults>");
-                    if (content.length() == 0) {
-                        content.append(part.substring(0, to));
-                    }
-                    else {
-                        content.append(part.substring(from, to));
-                    }
-                    deleteFiles.add(sourceFile);
+
+public class Utils {
+    // Private constant for buffer size.
+    private static final int BUFFER_SIZE = 40 * 1024; // Blocks of 40 Kb each
+
+    /**
+     * Unzips the file to the specified target directory.
+     * 
+     * @param zipFile The zipfile to unzip
+     * @param targetDir The directory in which the resulting files should be 
Stored
+     * @exception IOException If not all files could be saved
+     */
+    public static void unzip(File zipFile, File targetDir) throws IOException {
+        // Create the buffer for streaming the contents
+
+        // Create the zip input stream
+        ZipInputStream zip = null;
+        try {
+            zip = new ZipInputStream(new BufferedInputStream(new 
FileInputStream(zipFile), BUFFER_SIZE));
+            // Process each entry
+            ZipEntry entry;
+            while ((entry = zip.getNextEntry()) != null) {
+                // Get and normalize the path
+                String path = entry.getName();
+                path = path.replace('/', File.separatorChar);
+                path = path.replace('\\', File.separatorChar);
+                File target = new File(targetDir, path);
+                // Check whether the target is a file or directory
+                if (entry.isDirectory()) {
+                    target.mkdirs();
                 }
                 else {
-                    notFound = true;
+                    writeZipEntryToFile(zip, target);
+                }
+
+                // Set the last modified to the date specified in the zip
+                long time = entry.getTime();
+                if (time != -1) {
+                    target.setLastModified(time);
+                }
+            }
+        }
+        finally {
+            if (zip != null) {
+                zip.close();
+            }
+        }
+    }
+
+    public static void zipDirectory(File sourceDir, String targetFileName) 
throws IOException {
+        ZipOutputStream zos = null;
+        try {
+            File[] files = sourceDir.listFiles();
+            zos = new ZipOutputStream((OutputStream) new FileOutputStream(new 
File(sourceDir, targetFileName)));
+            zos.setLevel(6);
+            for (File file : files) {
+                addZipEntry(file, zos);
+            }
+        }
+        finally {
+            if (zos != null) {
+                try {
+                    zos.finish();
+                }
+                finally {
+                    zos.close();
                 }
-                index++;
             }
-            content.append("</testResults>");
-            FileUtils.writeStringToFile(bigFile, content.toString(), false);
         }
+    }
 
-        for (File file : deleteFiles) {
-            file.delete();
+    private static void addZipEntry(File sourceFile, ZipOutputStream zos) 
throws IOException {
+        FileInputStream fis = null;
+        try {
+            byte[] buf = new byte[1024];
+            fis = new FileInputStream(sourceFile);
+            fis.read(buf, 0, buf.length);
+            CRC32 crc = new CRC32();
+            ZipEntry entry = new ZipEntry(sourceFile.getName());
+            entry.setSize((long) buf.length);
+            crc.reset();
+            crc.update(buf);
+            entry.setCrc(crc.getValue());
+            zos.putNextEntry(entry);
+            zos.write(buf, 0, buf.length);
+        }
+        finally {
+            if (fis != null) {
+                fis.close();
+            }
         }
     }
 
-
-
-    public static void dispatchOutput(final Process process) {
-        new Thread(new Runnable() {
+    /**
+     * Writes the content of the zip entry to the specified file.
+     * 
+     * @param zip The zip entry to write
+     * @param target The file to write to
+     * @throws IOException In case a IO exception occurs
+     */
+    public static void writeZipEntryToFile(ZipInputStream zip, File target) 
throws IOException {
+        // Create the parent directory
+        File parent = target.getParentFile();
+        if (!parent.exists()) {
+            parent.mkdirs();
+        }
+        // Stream the contents to the target file
+        int bytes;
+        byte[] buffer = new byte[BUFFER_SIZE];
+        OutputStream out = null;
+        try {
+            out = new BufferedOutputStream(new FileOutputStream(target), 
BUFFER_SIZE);
+            while ((bytes = zip.read(buffer, 0, buffer.length)) != -1) {
+                out.write(buffer, 0, bytes);
+            }
+        }
+        catch (IOException ex) {
+            throw ex;
+        }
+        finally {
+            if (out != null) {
+                out.close();
+            }
+        }
+    }
+
+    public static String getTimestamp() {
+        Calendar cal = Calendar.getInstance();
+        String timestamp = new Integer(cal.get(Calendar.YEAR)).toString(); // 
year
+        timestamp += "-" + toTwoDigits(cal.get(Calendar.MONTH) + 1); // month
+        timestamp += "-" + toTwoDigits(cal.get(Calendar.DAY_OF_MONTH)); // day
+        timestamp += "_" + toTwoDigits(cal.get(Calendar.HOUR_OF_DAY)); // hour
+        timestamp += "-" + toTwoDigits(cal.get(Calendar.MINUTE)); // minutes
+        timestamp += "-" + toTwoDigits(cal.get(Calendar.SECOND)); // seconds
+        return timestamp;
+    }
+
+    private static String toTwoDigits(int dt) {
+        if (dt < 10) {
+            return "0" + new Integer(dt).toString();
+        }
+        else {
+            return new Integer(dt).toString();
+        }
+    }
+
+    public static void dispatchOutput(final Process process) {
+        new Thread(new Runnable() {
             public void run() {
-                InputStream is = null;
+                InputStream is = null;
                 try {
-                    is = process.getErrorStream();
-                    IOUtils.copy(is, Logger.logFile);
-                } catch (IOException e) {
-                    System.err.println(e.toString());
-                    e.printStackTrace();
-                }  finally {
+                    is = process.getErrorStream();
+                    IOUtils.copy(is, Logger.logFile);
+                }
+                catch (IOException e) {
+                    System.err.println(e.toString());
+                    e.printStackTrace();
+                }
+                finally {
                     if (is != null) {
                         try {
                             is.close();
@@ -181,19 +200,21 @@
                             e.printStackTrace();
                         }
                     }
-                }
-            }
-        }).start();
-        new Thread(new Runnable() {
+                }
+            }
+        }).start();
+        new Thread(new Runnable() {
             public void run() {
-                InputStream is = null;
+                InputStream is = null;
                 try {
-                    is = process.getInputStream();
-                    IOUtils.copy(is, Logger.logFile);
-                } catch (IOException e) {
-                    System.err.println(e.toString());
-                    e.printStackTrace();
-                } if (is != null) {
+                    is = process.getInputStream();
+                    IOUtils.copy(is, Logger.logFile);
+                }
+                catch (IOException e) {
+                    System.err.println(e.toString());
+                    e.printStackTrace();
+                }
+                if (is != null) {
                     try {
                         is.close();
                     }
@@ -201,8 +222,8 @@
                         System.err.println(e.toString());
                         e.printStackTrace();
                     }
-                }
-            }
-        }).start();
-    }
-}
+                }
+            }
+        }).start();
+    }
+}

Modified: 
trunk/amdatu-auth/test-performance/test-launcher/src/main/java/org/amdatu/auth/test/performance/launcher/main/Main.java
==============================================================================
--- 
trunk/amdatu-auth/test-performance/test-launcher/src/main/java/org/amdatu/auth/test/performance/launcher/main/Main.java
     (original)
+++ 
trunk/amdatu-auth/test-performance/test-launcher/src/main/java/org/amdatu/auth/test/performance/launcher/main/Main.java
     Tue Apr 17 15:01:23 2012
@@ -15,7 +15,7 @@
  */
 package org.amdatu.auth.test.performance.launcher.main;
 
-import org.amdatu.auth.test.performance.launcher.analysis.Statistics;
+import org.amdatu.auth.test.performance.launcher.Utils;
 import org.amdatu.auth.test.performance.launcher.runtest.AmdatuLauncher;
 import org.amdatu.auth.test.performance.launcher.runtest.ApplicationContext;
 import org.amdatu.auth.test.performance.launcher.runtest.JMeterRunner;
@@ -45,8 +45,6 @@
     public static String CONFIGFILE_ARG = "-config";
     public static String VERBOSE_ARG = "-verbose";
 
-    public static String RUNTEST_ARG = "-runtest";
-    public static String ANALYZE_ARG = "-analyze";
     public static String VERIFY_ARG = "-verify";
 
     public static String VERSIONDIR_ARG = "-versiondir";
@@ -59,16 +57,13 @@
     public static String RESULTSDIR_ARG = "-resultsdir";
 
     public static String TESTLOOPS_ARG = "-testloops";
-    public static String OMIT_ARG = "-omit";
-    public static String SAMPLESIZE_ARG = "-m";
+    public static String OMIT_ARG = "-omit";
     public static String PORT_ARG = "-port";
 
     // Wordy arguments
     private final static List<String> BOOLEAN_ARGS = new ArrayList<String>();
     static {
         BOOLEAN_ARGS.add(VERBOSE_ARG);
-        BOOLEAN_ARGS.add(ANALYZE_ARG);
-        BOOLEAN_ARGS.add(RUNTEST_ARG);
         BOOLEAN_ARGS.add(VERIFY_ARG);
     }
 
@@ -94,8 +89,7 @@
     static {
         OTHER_ARGS.add(TESTLOOPS_ARG);
         OTHER_ARGS.add(OMIT_ARG);
-        OTHER_ARGS.add(PORT_ARG);
-        OTHER_ARGS.add(SAMPLESIZE_ARG);
+        OTHER_ARGS.add(PORT_ARG);
         OTHER_ARGS.add(CLEAN_ARG);
     }
     public static void main(String[] args) {
@@ -160,11 +154,6 @@
                 }
             }
 
-            if (!Boolean.TRUE.equals(arguments.get(RUNTEST_ARG)) && 
!Boolean.TRUE.equals(arguments.get(ANALYZE_ARG))) {
-                System.err.println("Invalid arguments provided");
-                printUsage();
-            }
-
             List<String[]> tests = new ArrayList<String[]>();
             if (arguments.containsKey(VERSIONDIR_ARG)) {
                 boolean verify = 
Boolean.TRUE.equals(arguments.get(VERIFY_ARG));
@@ -192,39 +181,32 @@
                     String amdatuX = test[0];
                     String amdatuY = test[1];
                     ApplicationContext context = new 
ApplicationContext(arguments);
-                    if (Boolean.TRUE.equals(arguments.get(RUNTEST_ARG))) {
-                        if (verifyRunTest(arguments)) {
-                            TestContext contextX = new TestContext(new 
File(amdatuX));
-                            TestContext contextY = new TestContext(new 
File(amdatuY));
-                            context.setContext(contextX, contextY);
-
+                   
+                    if (verifyRunTest(arguments)) {
+                        TestContext contextX = new TestContext(new 
File(amdatuX));
+                        TestContext contextY = new TestContext(new 
File(amdatuY));
+                        context.setContext(contextX, contextY);
+
+                        runTest(context);
+
+                        if (Boolean.TRUE.equals(arguments.get(VERIFY_ARG))) {
+                            // Run additional test runs to verify that the H0 
tests of X versus X and Y versus Y
+                            // are all accepted
+                            // Verify X
+                            context.setContext(contextX, contextX);
                             runTest(context);
 
-                            if 
(Boolean.TRUE.equals(arguments.get(VERIFY_ARG))) {
-                                // Run additional test runs to verify that the 
H0 tests of X versus X and Y versus Y
-                                // are all accepted
-                                // Verify X
-                                context.setContext(contextX, contextX);
-                                runTest(context);
-
-                                // Verify Y
-                                context.setContext(contextY, contextY);
-                                runTest(context);
-                            }
+                            // Verify Y
+                            context.setContext(contextY, contextY);
+                            runTest(context);
                         }
                     }
-                }
-                if (Boolean.TRUE.equals(arguments.get(ANALYZE_ARG))) {
-                    if (!arguments.containsKey(RESULTSDIR_ARG)) {
-                        printUsage();
-                    } else {
-                        ApplicationContext context = new 
ApplicationContext(arguments);
-                        Statistics stats = new Statistics(context);
-                        stats.analyze();
-                        stats.print();
-                        Logger.log("Amdatu performance test analysis 
completed.");
-                    }
-                }
+                }
+                
+                // Finally, zip all files in the result directory
+                File resultsDir = new  
File(arguments.get(RESULTSDIR_ARG).toString());
+                Utils.zipDirectory(resultsDir, "results_" + 
Utils.getTimestamp() + ".zip");
+                
             } finally {
                 Logger.closeLogFile();
             }
@@ -273,8 +255,6 @@
     private static void printUsage() {
         System.err.println("Usage: ");
         System.err.println("-verbose         Set verbose mode on");
-        System.err.println("-runtest         Runs a performance test");
-        System.err.println("-analyze         Run a performance test analysis");
         System.err.println("-verify          Run a verification test, 
executing a performance test of version X against version X. This should 
obviously result " +
                                             "in an outcome stating that there 
is no significant difference in performance");
         System.err.println("-versiondir      Executes the test for all Amdatu 
versions available in this directory. Should not be combines with 
-amdatuVersionX " +

Modified: 
trunk/amdatu-auth/test-performance/test-launcher/src/main/java/org/amdatu/auth/test/performance/launcher/runtest/ApplicationContext.java
==============================================================================
--- 
trunk/amdatu-auth/test-performance/test-launcher/src/main/java/org/amdatu/auth/test/performance/launcher/runtest/ApplicationContext.java
    (original)
+++ 
trunk/amdatu-auth/test-performance/test-launcher/src/main/java/org/amdatu/auth/test/performance/launcher/runtest/ApplicationContext.java
    Tue Apr 17 15:01:23 2012
@@ -29,7 +29,6 @@
     public File rootTmpDir; // Root temporary directory
     public int testLoops;
     public int port = 8080;
-    public int sampleSize = -1;
     public String versionDir = null;
 
     public final static String VERSION_X = "X";
@@ -50,9 +49,6 @@
         testLoops = arguments.containsKey(Main.TESTLOOPS_ARG) ? 
Integer.parseInt(arguments.get(Main.TESTLOOPS_ARG).toString()) : 1;
         if (arguments.containsKey(Main.PORT_ARG)) {
             port = Integer.parseInt(arguments.get(Main.PORT_ARG).toString());
-        }
-        if (arguments.containsKey(Main.SAMPLESIZE_ARG)) {
-            sampleSize = 
Integer.parseInt(arguments.get(Main.SAMPLESIZE_ARG).toString());
         }
         clean = arguments.containsKey(Main.CLEAN_ARG) ? 
Integer.parseInt(arguments.get(Main.CLEAN_ARG).toString()) : 0;
         if (arguments.containsKey(Main.VERSIONDIR_ARG)) {

Modified: 
trunk/amdatu-auth/test-performance/test-launcher/src/main/java/org/amdatu/auth/test/performance/launcher/runtest/JMeterRunner.java
==============================================================================
--- 
trunk/amdatu-auth/test-performance/test-launcher/src/main/java/org/amdatu/auth/test/performance/launcher/runtest/JMeterRunner.java
  (original)
+++ 
trunk/amdatu-auth/test-performance/test-launcher/src/main/java/org/amdatu/auth/test/performance/launcher/runtest/JMeterRunner.java
  Tue Apr 17 15:01:23 2012
@@ -27,9 +27,7 @@
 import java.io.RandomAccessFile;
 import java.net.URL;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.IOUtils;
@@ -49,7 +47,7 @@
     private Process m_jmeterProcess;
     private File m_sampleFile;
     private ApplicationContext m_context;
-    private Map<String, Integer> m_fileIndex = new HashMap<String, Integer>();
+    private List<File> m_sampleFiles = new ArrayList<File>();
 
     public JMeterRunner(ApplicationContext context) {
         m_context = context;
@@ -78,8 +76,9 @@
                     // slowing down JMeter
                     String sampleName =
                         jmeterPlan.getName().replace(".jmx", "") + 
m_context.getSamplesPostFix() + "."
-                            + m_context.currentContextName + "." + 
incFileIndex(jmeterPlan);
+                            + m_context.currentContextName;
                     m_sampleFile = new File(resultDir, sampleName);
+                    m_sampleFiles.add(m_sampleFile);
                 }
                 List<String> command = new ArrayList<String>();
                 String os = System.getProperty("os.name");
@@ -136,19 +135,11 @@
             }
         }
     }
-
-    private int incFileIndex(File jmeterPlan) {
-        int index = 1;
-        String key = jmeterPlan.getName() +  "." + 
m_context.currentContextName;
-        if (!m_fileIndex.containsKey(key)) {
-            m_fileIndex.put(key, 1);
-        } else {
-            index = m_fileIndex.get(key) + 1;
-            m_fileIndex.put(key, index);
-        }
-        return index;
+    
+    public List<File> getSampleFiles() {
+        return m_sampleFiles;
     }
-
+    
     private File installJMeter() throws FileNotFoundException, IOException {
         // Install only once
         File jmeter = new File(new File(m_context.rootTmpDir, "jmeter-2.4"), 
"jakarta-jmeter-2.4");

Modified: 
trunk/amdatu-auth/test-performance/test-launcher/src/main/java/org/amdatu/auth/test/performance/launcher/runtest/Logger.java
==============================================================================
--- 
trunk/amdatu-auth/test-performance/test-launcher/src/main/java/org/amdatu/auth/test/performance/launcher/runtest/Logger.java
        (original)
+++ 
trunk/amdatu-auth/test-performance/test-launcher/src/main/java/org/amdatu/auth/test/performance/launcher/runtest/Logger.java
        Tue Apr 17 15:01:23 2012
@@ -15,43 +15,25 @@
  */
 package org.amdatu.auth.test.performance.launcher.runtest;
 
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.Calendar;
+import org.amdatu.auth.test.performance.launcher.Utils;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
 
 public class Logger {
     public static FileWriter logFile;
 
     public static void setLogFile(String dir) throws IOException {
-        File f = new File(dir + File.separator + "perftest-" + getTimestamp() 
+ ".log");
+        File f = new File(dir + File.separator + "perftest-" + 
Utils.getTimestamp() + ".log");
         f.createNewFile();
-        logFile = new FileWriter(dir + File.separator + "perftest-" + 
getTimestamp() + ".log");
+        logFile = new FileWriter(dir + File.separator + "perftest-" + 
Utils.getTimestamp() + ".log");
     }
 
     public static void closeLogFile() throws IOException {
         logFile.close();
     }
 
-    private static String getTimestamp() {
-        Calendar cal = Calendar.getInstance();
-        String timestamp = new Integer(cal.get(Calendar.YEAR)).toString(); // 
year
-        timestamp += "-" + toTwoDigits(cal.get(Calendar.MONTH)+ 1); // month
-        timestamp += "-" + toTwoDigits(cal.get(Calendar.DAY_OF_MONTH)); //day
-        timestamp += "_" + toTwoDigits(cal.get(Calendar.HOUR_OF_DAY)); // hour
-        timestamp += "-" + toTwoDigits(cal.get(Calendar.MINUTE)); // minutes
-        timestamp += "-" + toTwoDigits(cal.get(Calendar.SECOND)); //seconds
-        return timestamp;
-    }
-
-    private static String toTwoDigits(int dt) {
-        if (dt < 10) {
-            return "0" + new Integer(dt).toString();
-        } else {
-             return new Integer(dt).toString();
-        }
-    }
-
     public static void log(String message) {
         System.out.println(message);
         try {
_______________________________________________
Amdatu-commits mailing list
[email protected]
http://lists.amdatu.org/mailman/listinfo/amdatu-commits

Reply via email to