You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by pm...@apache.org on 2017/12/07 21:31:05 UTC

svn commit: r1817424 [1/2] - in /jmeter/trunk: src/core/org/apache/jmeter/services/ src/jorphan/org/apache/jorphan/reflect/ test/src/org/apache/jmeter/assertions/ test/src/org/apache/jmeter/config/ test/src/org/apache/jmeter/functions/ test/src/org/apa...

Author: pmouawad
Date: Thu Dec  7 21:31:04 2017
New Revision: 1817424

URL: http://svn.apache.org/viewvc?rev=1817424&view=rev
Log:
Parallelised unit tests
Contributed by Graham Russell
This closes #350

Added:
    jmeter/trunk/test/src/org/apache/jmeter/services/FileServerSpec.groovy
    jmeter/trunk/test/src/org/apache/jorphan/test/JMeterSerialTest.java   (with props)
Removed:
    jmeter/trunk/test/src/org/apache/jmeter/services/TestFileServer.java
Modified:
    jmeter/trunk/src/core/org/apache/jmeter/services/FileServer.java
    jmeter/trunk/src/jorphan/org/apache/jorphan/reflect/ClassFinder.java
    jmeter/trunk/test/src/org/apache/jmeter/assertions/ResponseAssertionTest.java
    jmeter/trunk/test/src/org/apache/jmeter/assertions/SMIMEAssertionTest.java
    jmeter/trunk/test/src/org/apache/jmeter/config/TestCVSDataSet.java
    jmeter/trunk/test/src/org/apache/jmeter/functions/CSVReadFunctionTest.java
    jmeter/trunk/test/src/org/apache/jmeter/functions/PackageTest.java
    jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileRowColContainer.java
    jmeter/trunk/test/src/org/apache/jmeter/functions/TestGroovyFunction.java
    jmeter/trunk/test/src/org/apache/jmeter/functions/TestSetProperty.java
    jmeter/trunk/test/src/org/apache/jmeter/junit/spock/JMeterSpec.groovy
    jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCacheManagerHC4.java
    jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCacheManagerUrlConnection.java
    jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestHTTPMirrorThread.java
    jmeter/trunk/test/src/org/apache/jmeter/reporters/TestResultSaver.java
    jmeter/trunk/test/src/org/apache/jmeter/samplers/TestSampleResult.java
    jmeter/trunk/test/src/org/apache/jmeter/visualizers/backend/SamplerMetricFixedModeTest.java
    jmeter/trunk/test/src/org/apache/jmeter/visualizers/backend/SamplerMetricTimedModeTest.java
    jmeter/trunk/test/src/org/apache/jorphan/reflect/TestClassFinder.java
    jmeter/trunk/test/src/org/apache/jorphan/test/AllTests.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/core/org/apache/jmeter/services/FileServer.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/services/FileServer.java?rev=1817424&r1=1817423&r2=1817424&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/services/FileServer.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/services/FileServer.java Thu Dec  7 21:31:04 2017
@@ -16,9 +16,6 @@
  *
  */
 
-/*
- * Created on Oct 19, 2004
- */
 package org.apache.jmeter.services;
 
 import java.io.BufferedReader;
@@ -46,8 +43,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- *
- * The point of this class is to provide thread-safe access to files, and to
+ * This class provides thread-safe access to files, and to
  * provide some simplifying assumptions about where to find files and how to
  * name them. For instance, putting supporting files in the same directory as
  * the saved test plan file allows users to refer to the file with just it's
@@ -378,13 +374,13 @@ public class FileServer {
     }
 
     /**
-     * Return BufferedReader handling close if EOF reached and recycle is true 
+     * Return BufferedReader handling close if EOF reached and recycle is true
      * and ignoring first line if ignoreFirstLine is true
-     * @param alias String alias
-     * @param recycle Recycle at eof
+     *
+     * @param alias           String alias
+     * @param recycle         Recycle at eof
      * @param ignoreFirstLine Ignore first line
      * @return {@link BufferedReader}
-     * @throws IOException
      */
     private BufferedReader getReader(String alias, boolean recycle, boolean ignoreFirstLine) throws IOException {
         FileEntry fileEntry = files.get(alias);
@@ -396,7 +392,7 @@ public class FileServer {
                 if (ignoreFirstLine) {
                     // read first line and forget
                     reader.readLine(); //NOSONAR
-                }                
+                }
             } else if (!(fileEntry.inputOutputObject instanceof Reader)) {
                 throw new IOException("File " + alias + " already in use");
             } else {
@@ -411,7 +407,7 @@ public class FileServer {
                         if (ignoreFirstLine) {
                             // read first line and forget
                             reader.readLine(); //NOSONAR
-                        }                
+                        }
                     } else { // OK, we still have some data, restore it
                         reader.reset();
                     }
@@ -457,7 +453,7 @@ public class FileServer {
 
     private BufferedWriter createBufferedWriter(FileEntry fileEntry) throws IOException {
         FileOutputStream fos = new FileOutputStream(fileEntry.file);
-        OutputStreamWriter osw = null;
+        OutputStreamWriter osw;
         // If file encoding is specified, write using that encoding, otherwise use default platform encoding
         String charsetName = fileEntry.charSetEncoding;
         if(!JOrphanUtils.isBlank(charsetName)) {
@@ -493,28 +489,21 @@ public class FileServer {
     }
 
     boolean filesOpen() { // package access for test code only
-        for (FileEntry fileEntry : files.values()) {
-            if (fileEntry.inputOutputObject != null) {
-                return true;
-            }
-        }
-        return false;
+        return files.values().stream()
+                .anyMatch(fileEntry -> fileEntry.inputOutputObject != null);
     }
 
     /**
-     * Method will get a random file in a base directory 
+     * Method will get a random file in a base directory
      * <p>
-     * TODO hey, not sure this
-     * method belongs here. FileServer is for threadsafe File access relative to
-     * current test's base directory.
+     * TODO hey, not sure this method belongs here.
+     * FileServer is for thread safe File access relative to current test's base directory.
      *
-     * @param basedir
-     *            name of the directory in which the files can be found
-     * @param extensions
-     *            array of allowed extensions, if <code>null</code> is given,
-     *            any file be allowed
+     * @param basedir    name of the directory in which the files can be found
+     * @param extensions array of allowed extensions, if <code>null</code> is given,
+     *                   any file be allowed
      * @return a random File from the <code>basedir</code> that matches one of
-     *         the extensions
+     * the extensions
      */
     public File getRandomFile(String basedir, String[] extensions) {
         File input = null;
@@ -533,8 +522,9 @@ public class FileServer {
     /**
      * Get {@link File} instance for provided file path,
      * resolve file location relative to base dir or script dir when needed
+     *
      * @param path original path to file, maybe relative
-     * @return {@link File} instance 
+     * @return {@link File} instance
      */
     public File getResolvedFile(String path) {
         reserveFile(path);
@@ -547,10 +537,11 @@ public class FileServer {
         private final File file;
         private Closeable inputOutputObject; 
         private final String charSetEncoding;
-        FileEntry(File f, Closeable o, String e){
-            file=f;
-            inputOutputObject=o;
-            charSetEncoding=e;
+
+        FileEntry(File f, Closeable o, String e) {
+            file = f;
+            inputOutputObject = o;
+            charSetEncoding = e;
         }
     }
     

Modified: jmeter/trunk/src/jorphan/org/apache/jorphan/reflect/ClassFinder.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/jorphan/org/apache/jorphan/reflect/ClassFinder.java?rev=1817424&r1=1817423&r2=1817424&view=diff
==============================================================================
--- jmeter/trunk/src/jorphan/org/apache/jorphan/reflect/ClassFinder.java (original)
+++ jmeter/trunk/src/jorphan/org/apache/jorphan/reflect/ClassFinder.java Thu Dec  7 21:31:04 2017
@@ -21,7 +21,6 @@ package org.apache.jorphan.reflect;
 import java.io.File;
 import java.io.IOException;
 import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -43,7 +42,6 @@ import org.slf4j.LoggerFactory;
 
 /**
  * This class finds classes that extend one of a set of parent classes
- *
  */
 public final class ClassFinder {
     private static final Logger log = LoggerFactory.getLogger(ClassFinder.class);
@@ -73,7 +71,7 @@ public final class ClassFinder {
         private final ClassLoader contextClassLoader
             = Thread.currentThread().getContextClassLoader(); // Potentially expensive; do it once
 
-        ExtendsClassFilter(Class<?> []parents, boolean inner, String contains, String notContains){
+        ExtendsClassFilter(Class<?>[] parents, boolean inner, String contains, String notContains) {
             this.parents = parents;
             this.inner = inner;
             this.contains = contains;
@@ -93,58 +91,54 @@ public final class ClassFinder {
             }
             return false;
         }
-        
-       /**
-        *
-        * @param parentClasses list of classes to check for
-        * @param strClassName name of class to be checked
-        * @param contextClassLoader the classloader to use
-        * @return true if the class is a non-abstract, non-interface instance of at least one of the parent classes
-        */
-       private boolean isChildOf(Class<?> [] parentClasses, String strClassName,
-               ClassLoader contextClassLoader){
-               // might throw an exception, assume this is ignorable
-               try {
-                   Class<?> c = Class.forName(strClassName, false, contextClassLoader);
-
-                   if (!c.isInterface() && !Modifier.isAbstract(c.getModifiers())) {
-                       for (Class<?> parentClass : parentClasses) {
-                           if (parentClass.isAssignableFrom(c)) {
-                               return true;
-                           }
-                       }
-                   }
-               } catch (UnsupportedClassVersionError | ClassNotFoundException
-                       | NoClassDefFoundError | VerifyError e) {
-                   log.debug(e.getLocalizedMessage(), e);
-               }
-           return false;
-       }
+
+        /**
+         * @param parentClasses      list of classes to check for
+         * @param strClassName       name of class to be checked
+         * @param contextClassLoader the classloader to use
+         * @return true if the class is a non-abstract, non-interface instance of at least one of the parent classes
+         */
+        private boolean isChildOf(
+                Class<?>[] parentClasses, String strClassName, ClassLoader contextClassLoader) {
+            try {
+                Class<?> targetClass = Class.forName(strClassName, false, contextClassLoader);
+
+                if (!targetClass.isInterface()
+                        && !Modifier.isAbstract(targetClass.getModifiers())) {
+                    return Arrays.stream(parentClasses)
+                            .anyMatch(parent -> parent.isAssignableFrom(targetClass));
+                }
+            } catch (UnsupportedClassVersionError | ClassNotFoundException
+                    | NoClassDefFoundError | VerifyError e) {
+                log.debug(e.getLocalizedMessage(), e);
+            }
+            return false;
+        }
 
         /* (non-Javadoc)
          * @see java.lang.Object#toString()
          */
         @Override
         public String toString() {
-            return "ExtendsClassFilter [parents=" + 
+            return "ExtendsClassFilter [parents=" +
                     (parents != null ? Arrays.toString(parents) : "null") + ", inner=" + inner + ", contains="
                     + contains + ", notContains=" + notContains + "]";
         }
     }
-    
+
     private static class AnnoClassFilter implements ClassFilter {
-        
+
         private final boolean inner; // are inner classes OK?
 
         private final Class<? extends Annotation>[] annotations; // annotation classes to check
         private final ClassLoader contextClassLoader
             = Thread.currentThread().getContextClassLoader(); // Potentially expensive; do it once
-        
+
         AnnoClassFilter(Class<? extends Annotation> []annotations, boolean inner){
             this.annotations = annotations;
             this.inner = inner;
         }
-        
+
         @Override
         public boolean accept(String className) {
             if (!className.contains("$") || inner) { // $NON-NLS-1$
@@ -152,32 +146,29 @@ public final class ClassFinder {
             }
             return false;
         }
-        
-        private boolean hasAnnotationOnMethod(Class<? extends Annotation>[] annotations, String classInQuestion,
-                ClassLoader contextClassLoader ){
-                try{
-                    Class<?> c = Class.forName(classInQuestion, false, contextClassLoader);
-                    for(Method method : c.getMethods()) {
-                        for(Class<? extends Annotation> annotation : annotations) {
-                            if(method.isAnnotationPresent(annotation)) {
-                                return true;
-                            }
-                        }
-                    }
-                } catch (NoClassDefFoundError | ClassNotFoundException | UnsupportedClassVersionError | VerifyError ignored) {
-                    log.debug(ignored.getLocalizedMessage(), ignored);
-                }
-                return false;
+
+        private boolean hasAnnotationOnMethod(
+                Class<? extends Annotation>[] annotations,
+                String classInQuestion,
+                ClassLoader contextClassLoader) {
+            try {
+                Class<?> c = Class.forName(classInQuestion, false, contextClassLoader);
+                return Arrays.stream(c.getMethods())
+                        .anyMatch(method -> Arrays.stream(annotations).anyMatch(method::isAnnotationPresent));
+            } catch (NoClassDefFoundError | ClassNotFoundException | UnsupportedClassVersionError | VerifyError ignored) {
+                log.debug(ignored.getLocalizedMessage(), ignored);
             }
+            return false;
+        }
 
         /**
          * @see java.lang.Object#toString()
          */
         @Override
         public String toString() {
-            return "AnnoClassFilter [inner=" + inner + ", annotations=" + 
+            return "AnnoClassFilter [inner=" + inner + ", annotations=" +
                     (annotations != null ? Arrays.toString(annotations) : "null")+ "]";
-        }        
+        }
     }
 
     /**
@@ -185,16 +176,13 @@ public final class ClassFinder {
      * {@link #findClassesThatExtend(String[], Class[], boolean)} with the
      * option to include inner classes in the search set to false.
      *
-     * @param paths
-     *            pathnames or jarfiles to search for classes
-     * @param superClasses
-     *            required parent class(es)
+     * @param paths        pathnames or jarfiles to search for classes
+     * @param superClasses required parent class(es)
      * @return List of Strings containing discovered class names.
-     * @throws IOException
-     *             when scanning the classes fails
+     * @throws IOException when scanning the classes fails
      */
     public static List<String> findClassesThatExtend(String[] paths, Class<?>[] superClasses)
-        throws IOException {
+            throws IOException {
         return findClassesThatExtend(paths, superClasses, false);
     }
 
@@ -206,10 +194,10 @@ public final class ClassFinder {
             File dir = new File(path);
             if (dir.exists() && dir.isDirectory()) {
                 String[] jars = dir.list((f, name) -> {
-                    File fileInDirectory = new File(f, name); 
+                    File fileInDirectory = new File(f, name);
                     return fileInDirectory.isFile() && name.endsWith(DOT_JAR);
                 });
-                if(jars != null) {
+                if (jars != null) {
                     Collections.addAll(fullList, jars);
                 }
             }
@@ -219,10 +207,10 @@ public final class ClassFinder {
 
     /**
      * Find classes in the provided path(s)/jar(s) that extend the class(es).
-     * @param strPathsOrJars - pathnames or jarfiles to search for classes
-     * @param superClasses - required parent class(es)
-     * @param innerClasses - should we include inner classes?
      *
+     * @param strPathsOrJars pathnames or jarfiles to search for classes
+     * @param superClasses   required parent class(es)
+     * @param innerClasses   should we include inner classes?
      * @return List containing discovered classes
      * @throws IOException when scanning for classes fails
      */
@@ -234,12 +222,12 @@ public final class ClassFinder {
 
     /**
      * Find classes in the provided path(s)/jar(s) that extend the class(es).
-     * @param strPathsOrJars - pathnames or jarfiles to search for classes
-     * @param superClasses - required parent class(es)
-     * @param innerClasses - should we include inner classes?
-     * @param contains - classname should contain this string
-     * @param notContains - classname should not contain this string
      *
+     * @param strPathsOrJars pathnames or jarfiles to search for classes
+     * @param superClasses   required parent class(es)
+     * @param innerClasses   should we include inner classes?
+     * @param contains       classname should contain this string
+     * @param notContains    classname should not contain this string
      * @return List containing discovered classes
      * @throws IOException when scanning classes fails
      */
@@ -252,10 +240,10 @@ public final class ClassFinder {
 
     /**
      * Find classes in the provided path(s)/jar(s) that extend the class(es).
-     * @param strPathsOrJars - pathnames or jarfiles to search for classes
-     * @param annotations - required annotations
-     * @param innerClasses - should we include inner classes?
      *
+     * @param strPathsOrJars pathnames or jarfiles to search for classes
+     * @param annotations    required annotations
+     * @param innerClasses   should we include inner classes?
      * @return List containing discovered classes
      * @throws IOException when scanning classes fails
      */
@@ -269,9 +257,8 @@ public final class ClassFinder {
      * Find classes in the provided path(s)/jar(s) that extend the class(es).
      * Inner classes are not searched.
      *
-     * @param strPathsOrJars - pathnames or jarfiles to search for classes
-     * @param annotations - required annotations
-     *
+     * @param strPathsOrJars pathnames or jarfiles to search for classes
+     * @param annotations    required annotations
      * @return List containing discovered classes
      * @throws IOException when scanning classes fails
      */
@@ -283,13 +270,13 @@ public final class ClassFinder {
 
     /**
      * Find classes in the provided path(s)/jar(s) that extend the class(es).
-     * @param searchPathsOrJars - pathnames or jarfiles to search for classes
-     * @param classNames - required parent class(es) or annotations
-     * @param innerClasses - should we include inner classes?
-     * @param contains - classname should contain this string
-     * @param notContains - classname should not contain this string
-     * @param annotations - true if classnames are annotations
      *
+     * @param searchPathsOrJars pathnames or jarfiles to search for classes
+     * @param classNames        required parent class(es) or annotations
+     * @param innerClasses      should we include inner classes?
+     * @param contains          classname should contain this string
+     * @param notContains       classname should not contain this string
+     * @param annotations       true if classnames are annotations
      * @return List containing discovered classes
      * @throws IOException when scanning classes fails
      */
@@ -299,48 +286,45 @@ public final class ClassFinder {
                 throws IOException  {
         if (log.isDebugEnabled()) {
             log.debug("findClassesThatExtend with searchPathsOrJars : {}, superclass : {}"+
-                    " innerClasses : {} annotations: {} contains: {}, notContains: {}", 
+                    " innerClasses : {} annotations: {} contains: {}, notContains: {}",
                     Arrays.toString(searchPathsOrJars),
                     Arrays.toString(classNames),
                     innerClasses, annotations,
                     contains, notContains);
         }
 
-        
         ClassFilter filter;
-        if(annotations) {
-            @SuppressWarnings("unchecked") // Should only be called with classes that extend annotations
+        if (annotations) {
+            @SuppressWarnings("unchecked")
+            // Should only be called with classes that extend annotations
             final Class<? extends Annotation>[] annoclassNames = (Class<? extends Annotation>[]) classNames;
             filter = new AnnoClassFilter(annoclassNames, innerClasses);
-        }
-        else {
+        } else {
             filter = new ExtendsClassFilter(classNames, innerClasses, contains, notContains);
         }
-        
+
         return findClasses(searchPathsOrJars, filter);
     }
 
     /**
      * Find all classes in the given jars that passes the class filter.
-     * 
-     * @param searchPathsOrJars
-     *            list of strings representing the jar locations
-     * @param filter
-     *            {@link ClassFilter} that the classes in the jars should
-     *            conform to
+     *
+     * @param searchPathsOrJars list of strings representing the jar locations
+     * @param filter            {@link ClassFilter} that the classes in the jars should
+     *                          conform to
      * @return list of all classes in the jars, that conform to {@code filter}
-     * @throws IOException
-     *             when reading the jar files fails
+     * @throws IOException when reading the jar files fails
      */
-    public static List<String> findClasses(String[] searchPathsOrJars, ClassFilter filter) throws IOException  {
+    public static List<String> findClasses(String[] searchPathsOrJars, ClassFilter filter) throws IOException {
         if (log.isDebugEnabled()) {
-            log.debug("findClasses with searchPathsOrJars : {} and classFilter : {}", 
+            log.debug("findClasses with searchPathsOrJars : {} and classFilter : {}",
                     Arrays.toString(searchPathsOrJars), filter);
         }
-    
+
         // Find all jars in the search path
-        List<String> strPathsOrJars = Arrays.asList(addJarsInPath(searchPathsOrJars)).stream()
-                .map(ClassFinder::fixPathEntry).collect(Collectors.toList());
+        List<String> strPathsOrJars = Arrays.stream(addJarsInPath(searchPathsOrJars))
+                .map(ClassFinder::fixPathEntry)
+                .collect(Collectors.toList());
 
         // Now eliminate any classpath entries that do not "match" the search
         List<String> listPaths = getClasspathMatches(strPathsOrJars);
@@ -349,13 +333,13 @@ public final class ClassFinder {
                 log.debug("listPaths : {}", path);
             }
         }
-    
+
         Set<String> listClasses = new TreeSet<>();
         // first get all the classes
         for (String path : listPaths) {
             findClassesInOnePath(path, listClasses, filter);
         }
-        
+
         if (log.isDebugEnabled()) {
             log.debug("listClasses.size()={}", listClasses.size());
             for (String clazz : listClasses) {
@@ -368,6 +352,7 @@ public final class ClassFinder {
 
     /**
      * Returns the classpath entries that match the search list of jars and paths
+     *
      * @param strPathsOrJars can contain {@code null} element but must not be {@code null}
      * @return List of paths (jars or folders) that ends with one of the rows of strPathsOrJars
      */
@@ -382,13 +367,13 @@ public final class ClassFinder {
 
         // find all jar files or paths that end with strPathOrJar
         List<String> listPaths = new ArrayList<>();
-        String classpathElement = null;
+        String classpathElement;
         StringTokenizer classpathElements =
                 new StringTokenizer(javaClassPath, File.pathSeparator);
 
         while (classpathElements.hasMoreTokens()) {
             classpathElement = fixPathEntry(classpathElements.nextToken());
-            if(classpathElement == null) {
+            if (classpathElement == null) {
                 continue;
             }
             boolean found = false;
@@ -420,8 +405,8 @@ public final class ClassFinder {
      * <li>remove all trailing {@code /}</li>
      * </ul>
      */
-    private static String fixPathEntry(String path){
-        if (path == null ) {
+    private static String fixPathEntry(String path) {
+        if (path == null) {
             return null;
         }
         if (path.equals(".")) { // $NON-NLS-1$
@@ -444,8 +429,7 @@ public final class ClassFinder {
      * Converts a class file from the text stored in a Jar file to a version
      * that can be used in Class.forName().
      *
-     * @param strClassName
-     *            the class name from a Jar file
+     * @param strClassName the class name from a Jar file
      * @return String the Java-style dotted version of the name
      */
     private static String fixClassName(String strClassName) {
@@ -456,19 +440,19 @@ public final class ClassFinder {
         return fixedClassName;
     }
 
-    
+
     private static void findClassesInOnePath(String strPath, Set<String> listClasses, ClassFilter filter) throws IOException {
         File file = new File(strPath);
         if (file.isDirectory()) {
             findClassesInPathsDir(strPath, file, listClasses, filter);
         } else if (file.exists()) {
-            try (ZipFile zipFile = new ZipFile(file);){
+            try (ZipFile zipFile = new ZipFile(file)) {
                 Enumeration<? extends ZipEntry> entries = zipFile.entries();
                 while (entries.hasMoreElements()) {
                     String strEntry = entries.nextElement().toString();
                     if (strEntry.endsWith(DOT_CLASS)) {
                         String fixedClassName = fixClassName(strEntry);
-                        if(filter.accept(fixedClassName)) {
+                        if (filter.accept(fixedClassName)) {
                             listClasses.add(fixedClassName);
                         }
                     }
@@ -482,27 +466,26 @@ public final class ClassFinder {
 
     private static void findClassesInPathsDir(String strPathElement, File dir, Set<String> listClasses, ClassFilter filter) throws IOException {
         String[] list = dir.list();
-        if(list == null) {
+        if (list == null) {
             log.warn("{} is not a folder", dir.getAbsolutePath());
             return;
         }
-        
-        for (String aList : list) {
-            File file = new File(dir, aList);
+
+        for (String filePath : list) {
+            File file = new File(dir, filePath);
             if (file.isDirectory()) {
                 // Recursive call
                 findClassesInPathsDir(strPathElement, file, listClasses, filter);
-            }
-            else if (aList.endsWith(DOT_CLASS) && file.exists() && (file.length() != 0)) {
+            } else if (filePath.endsWith(DOT_CLASS) && file.exists() && (file.length() != 0)) {
                 final String path = file.getPath();
                 String className = path.substring(strPathElement.length() + 1,
                         path.lastIndexOf('.')) // $NON-NLS-1$
                         .replace(File.separator.charAt(0), '.');// $NON-NLS-1$
-                if(filter.accept(className)) {
+                if (filter.accept(className)) {
                     listClasses.add(className);
                 }
             }
         }
     }
-    
+
 }

Modified: jmeter/trunk/test/src/org/apache/jmeter/assertions/ResponseAssertionTest.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/assertions/ResponseAssertionTest.java?rev=1817424&r1=1817423&r2=1817424&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/assertions/ResponseAssertionTest.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/assertions/ResponseAssertionTest.java Thu Dec  7 21:31:04 2017
@@ -61,6 +61,17 @@ public class ResponseAssertionTest {
     }
 
     @Test
+    public void testResponseAssertionNoText() throws Exception{
+        assertion.clearTestStrings();
+        assertion.unsetNotType();
+        assertion.setToSubstringType();
+        assertion.setTestFieldResponseData();
+        //assertion.addTestString("response Data");
+        result = assertion.getResult(sample);
+        assertPassed();
+    }
+    
+    @Test
     public void testResponseAssertionEquals() throws Exception{
         assertion.unsetNotType();
         assertion.setToEqualsType();

Modified: jmeter/trunk/test/src/org/apache/jmeter/assertions/SMIMEAssertionTest.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/assertions/SMIMEAssertionTest.java?rev=1817424&r1=1817423&r2=1817424&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/assertions/SMIMEAssertionTest.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/assertions/SMIMEAssertionTest.java Thu Dec  7 21:31:04 2017
@@ -29,6 +29,7 @@ import javax.mail.MessagingException;
 import javax.mail.Session;
 import javax.mail.internet.MimeMessage;
 import org.apache.jmeter.samplers.SampleResult;
+import org.apache.jorphan.test.JMeterSerialTest;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -89,7 +90,7 @@ import org.junit.Test;
  * If a new signed email is generated, the signer key and certificate will
  * change, and thus the tests will have to be changed as well (serial number!).
  */
-public class SMIMEAssertionTest {
+public class SMIMEAssertionTest implements JMeterSerialTest {
 
     private MimeMessage msg;
     private SampleResult parent;

Modified: jmeter/trunk/test/src/org/apache/jmeter/config/TestCVSDataSet.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/config/TestCVSDataSet.java?rev=1817424&r1=1817423&r2=1817424&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/config/TestCVSDataSet.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/config/TestCVSDataSet.java Thu Dec  7 21:31:04 2017
@@ -13,13 +13,9 @@
  * 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 to test FileServer methods 
- */
-     
 package org.apache.jmeter.config;
 
 import static org.junit.Assert.assertEquals;
@@ -33,29 +29,33 @@ import org.apache.jmeter.services.FileSe
 import org.apache.jmeter.threads.JMeterContext;
 import org.apache.jmeter.threads.JMeterContextService;
 import org.apache.jmeter.threads.JMeterVariables;
+import org.apache.jorphan.test.JMeterSerialTest;
 import org.apache.jorphan.util.JMeterStopThreadException;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
-public class TestCVSDataSet extends JMeterTestCase {
+/**
+ * Package to test FileServer methods
+ */
+public class TestCVSDataSet extends JMeterTestCase implements JMeterSerialTest {
 
     private JMeterVariables threadVars;
-    
 
     @Before
     public void setUp(){
         JMeterContext jmcx = JMeterContextService.getContext();
         jmcx.setVariables(new JMeterVariables());
-        threadVars = jmcx.getVariables();        
+        threadVars = jmcx.getVariables();
         threadVars.put("b", "value");
     }
 
     @After
-    public void tearDown() throws IOException{
+    public void tearDown() throws IOException {
+        // Use of singleton requires this test run in serial
         FileServer.getFileServer().closeFiles();
     }
-    
+
     @Test
     public void testopen() throws Exception {
         CSVDataSet csv = new CSVDataSet();
@@ -76,7 +76,7 @@ public class TestCVSDataSet extends JMet
         csv.setFilename(findTestPath("testfiles/testempty.csv"));
         csv.setVariableNames("a,b,c");
         csv.setDelimiter(",");
-        
+
         csv.iterationStart(null);
         assertEquals("",threadVars.get("a"));
         assertEquals("b1",threadVars.get("b"));
@@ -97,13 +97,13 @@ public class TestCVSDataSet extends JMet
         assertEquals("a4",threadVars.get("a"));
         assertEquals("b4",threadVars.get("b"));
         assertEquals("c4",threadVars.get("c"));
-        
+
         csv.iterationStart(null); // Restart file
         assertEquals("",threadVars.get("a"));
         assertEquals("b1",threadVars.get("b"));
         assertEquals("c1",threadVars.get("c"));
     }
-    
+
     @Test
     public void testutf8() throws Exception {
 
@@ -113,7 +113,7 @@ public class TestCVSDataSet extends JMet
         csv.setDelimiter(",");
         csv.setQuotedData( true );
         csv.setFileEncoding( "UTF-8" );
-        
+
         csv.iterationStart(null);
         assertEquals("a1",threadVars.get("a"));
         assertEquals("b1",threadVars.get("b"));
@@ -159,7 +159,7 @@ public class TestCVSDataSet extends JMet
         assertEquals("c2",threadVars.get("C"));
         assertEquals("d2",threadVars.get("D|1"));
     }
-    
+
     // Test CSV file with a header line and recycle is true
     @Test
     public void testHeaderOpenAndRecycle(){
@@ -179,7 +179,7 @@ public class TestCVSDataSet extends JMet
         assertEquals("c1",threadVars.get("C"));
         assertEquals("d1",threadVars.get("D|1"));
     }
-    
+
     // Test CSV file with a header line
     @Test
     public void testHeaderQuotes(){
@@ -212,13 +212,13 @@ public class TestCVSDataSet extends JMet
             csv.iterationStart(null);
             fail("Expected JMeterStopThreadException");
         } catch (JMeterStopThreadException expected) {
-            
+
         }
     }
-    
+
     private CSVDataSet initCSV(){
         CSVDataSet csv = new CSVDataSet();
-        csv.setFilename(findTestPath("testfiles/test.csv"));
+        csv.setFilename(findTestPath("testfiles/unit/TestCVSDataSet.csv"));
         csv.setVariableNames("a,b,c");
         csv.setDelimiter(",");
         return csv;
@@ -226,7 +226,7 @@ public class TestCVSDataSet extends JMet
 
     @Test
     public void testShareMode(){
-        
+
         new CSVDataSetBeanInfo(); // needs to be initialised
         CSVDataSet csv0 = initCSV();
         CSVDataSet csv1 = initCSV();
@@ -241,9 +241,9 @@ public class TestCVSDataSet extends JMet
         csv2.setShareMode("abc");
         assertEquals("abc",csv2.getShareMode());
         csv2.iterationStart(null);
-        assertEquals("a3",threadVars.get("a"));        
+        assertEquals("a3",threadVars.get("a"));
         csv0.iterationStart(null);
-        assertEquals("a1",threadVars.get("a"));        
+        assertEquals("a1",threadVars.get("a"));
         csv1.iterationStart(null);
         assertEquals("a4",threadVars.get("a"));
     }

Modified: jmeter/trunk/test/src/org/apache/jmeter/functions/CSVReadFunctionTest.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/functions/CSVReadFunctionTest.java?rev=1817424&r1=1817423&r2=1817424&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/functions/CSVReadFunctionTest.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/functions/CSVReadFunctionTest.java Thu Dec  7 21:31:04 2017
@@ -26,11 +26,12 @@ import java.util.LinkedList;
 
 import org.apache.jmeter.engine.util.CompoundVariable;
 import org.apache.jmeter.junit.JMeterTestCase;
+import org.apache.jorphan.test.JMeterSerialTest;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class CSVReadFunctionTest extends JMeterTestCase {
+public class CSVReadFunctionTest extends JMeterTestCase implements JMeterSerialTest {
 
     private static final Logger log = LoggerFactory.getLogger(CSVReadFunctionTest.class);
     
@@ -69,64 +70,43 @@ public class CSVReadFunctionTest extends
     
     @Test
     public void testCSVNoFile() throws Exception {
-        String s;
 
-        CSVRead cr1 = setCSVReadParams("xtestfiles/test.csv", "1");
+        CSVRead cr1 = setCSVReadParams("does/not-exist.csv", "1");
         log.info("Expecting file not found");
-        s = cr1.execute(null, null);
-        assertEquals("", s);
+        assertEquals("", cr1.execute(null, null));
 
-        CSVRead cr2 = setCSVReadParams("xtestfiles/test.csv", "next");
+        CSVRead cr2 = setCSVReadParams("does/not-exist.csv", "next");
         log.info("Expecting no entry for file");
-        s = cr2.execute(null, null);
-        assertEquals("", s);
+        assertEquals("", cr2.execute(null, null));
 
-        CSVRead cr3 = setCSVReadParams("xtestfiles/test.csv", "*ABC");
+        CSVRead cr3 = setCSVReadParams("does/not-exist.csv", "*ABC");
         log.info("Expecting file not found");
-        s = cr3.execute(null, null);
-        assertEquals("", s);
+        assertEquals("", cr3.execute(null, null));
 
         CSVRead cr4 = setCSVReadParams("*ABC", "1");
         log.info("Expecting cannot open file");
-        s = cr4.execute(null, null);
-        assertEquals("", s);
+        assertEquals("", cr4.execute(null, null));
     }
     
     @Test
     public void testCSValias() throws Exception {
-        CSVRead cr1 = setCSVReadParams("testfiles/test.csv", "*A");
+        CSVRead cr1 = setCSVReadParams("testfiles/unit/CSVReadFunctionTest.csv", "*A");
         CSVRead cr2 = setCSVReadParams("*A", "1");
         CSVRead cr3 = setCSVReadParams("*A", "next");
 
-        CSVRead cr4 = setCSVReadParams("testfiles/test.csv", "*B");
+        CSVRead cr4 = setCSVReadParams("testfiles/unit/CSVReadFunctionTest.csv", "*B");
         CSVRead cr5 = setCSVReadParams("*B", "2");
         CSVRead cr6 = setCSVReadParams("*B", "next");
 
-        String s;
-
-        s = cr1.execute(null, null); // open as *A
-        assertEquals("", s);
-        s = cr2.execute(null, null); // col 1, line 1, *A
-        assertEquals("b1", s);
-
-        s = cr4.execute(null, null);// open as *B
-        assertEquals("", s);
-        s = cr5.execute(null, null);// col2 line 1
-        assertEquals("c1", s);
-
-        s = cr3.execute(null, null);// *A next
-        assertEquals("", s);
-        s = cr2.execute(null, null);// col 1, line 2, *A
-        assertEquals("b2", s);
-
-        s = cr5.execute(null, null);// col2, line 1, *B
-        assertEquals("c1", s);
-
-        s = cr6.execute(null, null);// *B next
-        assertEquals("", s);
-
-        s = cr5.execute(null, null);// col2, line 2, *B
-        assertEquals("c2", s);
+        assertEquals("", cr1.execute(null, null)); // open as *A
+        assertEquals("b1", cr2.execute(null, null)); // col 1, line 1, *A
+        assertEquals("", cr4.execute(null, null)); // open as *B
+        assertEquals("c1", cr5.execute(null, null)); // col2 line 1
+        assertEquals("", cr3.execute(null, null)); // *A next
+        assertEquals("b2", cr2.execute(null, null)); // col 1, line 2, *A
+        assertEquals("c1", cr5.execute(null, null)); // col2, line 1, *B
+        assertEquals("", cr6.execute(null, null)); // *B next
+        assertEquals("c2", cr5.execute(null, null)); // col2, line 2, *B
     }
     
     // Check blank lines are treated as EOF
@@ -135,29 +115,20 @@ public class CSVReadFunctionTest extends
         CSVRead csv1 = setCSVReadParams("testfiles/testblank.csv", "1");
         CSVRead csv2 = setCSVReadParams("testfiles/testblank.csv", "next");
 
-        String s;
-
         for (int i = 1; i <= 2; i++) {
-            s = csv1.execute(null, null);
-            assertEquals("b1", s);
-
-            s = csv2.execute(null, null);
-            assertEquals("", s);
-
-            s = csv1.execute(null, null);
-            assertEquals("b2", s);
-
-            s = csv2.execute(null, null);
-            assertEquals("", s);
+            assertEquals("b1", csv1.execute(null, null));
+            assertEquals("", csv2.execute(null, null));
+            assertEquals("b2", csv1.execute(null, null));
+            assertEquals("", csv2.execute(null, null));
         }
     }
     
     @Test
     public void CSVRun() throws Exception {
-        CSVRead cr1 = setCSVReadParams("testfiles/test.csv", "1");
-        CSVRead cr2 = setCSVReadParams("testfiles/test.csv", "2");
-        CSVRead cr3 = setCSVReadParams("testfiles/test.csv", "3");
-        CSVRead cr4 = setCSVReadParams("testfiles/test.csv", "next");
+        CSVRead cr1 = setCSVReadParams("testfiles/unit/CSVReadFunctionTest.csv", "1");
+        CSVRead cr2 = setCSVReadParams("testfiles/unit/CSVReadFunctionTest.csv", "2");
+        CSVRead cr3 = setCSVReadParams("testfiles/unit/CSVReadFunctionTest.csv", "3");
+        CSVRead cr4 = setCSVReadParams("testfiles/unit/CSVReadFunctionTest.csv", "next");
         CSVRead cr5 = setCSVReadParams("", "0");
         CSVRead cr6 = setCSVReadParams("", "next");
         
@@ -188,6 +159,5 @@ public class CSVReadFunctionTest extends
         assertEquals("a1", cr5.execute(null, null));
         assertEquals("", cr6.execute(null, null));
         assertEquals("a2", cr5.execute(null, null));
-
     }
 }

Modified: jmeter/trunk/test/src/org/apache/jmeter/functions/PackageTest.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/functions/PackageTest.java?rev=1817424&r1=1817423&r2=1817424&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/functions/PackageTest.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/functions/PackageTest.java Thu Dec  7 21:31:04 2017
@@ -281,8 +281,8 @@ public class PackageTest extends JMeterT
 
 
     public void CSVSetup() throws Exception {
-        cr1 = setCSVReadParams("testfiles/test.csv", "1");
-        cr4 = setCSVReadParams("testfiles/test.csv", "next");
+        cr1 = setCSVReadParams("testfiles/unit/FunctionsPackageTest.csv", "1");
+        cr4 = setCSVReadParams("testfiles/unit/FunctionsPackageTest.csv", "next");
     }
 
 

Modified: jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileRowColContainer.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileRowColContainer.java?rev=1817424&r1=1817423&r2=1817424&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileRowColContainer.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/functions/TestFileRowColContainer.java Thu Dec  7 21:31:04 2017
@@ -42,7 +42,7 @@ public class TestFileRowColContainer ext
 
     @Test
     public void testrowNum() throws Exception {
-        FileRowColContainer f = new FileRowColContainer(findTestPath("testfiles/test.csv"));
+        FileRowColContainer f = new FileRowColContainer(findTestPath("testfiles/unit/TestFileRowColContainer.csv"));
         assertNotNull(f);
         assertEquals("Expected 4 lines", 4, f.getSize());
 
@@ -56,7 +56,7 @@ public class TestFileRowColContainer ext
 
     @Test
     public void testColumns() throws Exception {
-        FileRowColContainer f = new FileRowColContainer(findTestPath("testfiles/test.csv"));
+        FileRowColContainer f = new FileRowColContainer(findTestPath("testfiles/unit/TestFileRowColContainer.csv"));
         assertNotNull(f);
         assertTrue("Not empty", f.getSize() > 0);
 
@@ -78,7 +78,7 @@ public class TestFileRowColContainer ext
 
     @Test
     public void testColumnsComma() throws Exception {
-        FileRowColContainer f = new FileRowColContainer(findTestPath("testfiles/test.csv"), ",");
+        FileRowColContainer f = new FileRowColContainer(findTestPath("testfiles/unit/TestFileRowColContainer.csv"), ",");
         assertNotNull(f);
         assertTrue("Not empty", f.getSize() > 0);
 

Modified: jmeter/trunk/test/src/org/apache/jmeter/functions/TestGroovyFunction.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/functions/TestGroovyFunction.java?rev=1817424&r1=1817423&r2=1817424&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/functions/TestGroovyFunction.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/functions/TestGroovyFunction.java Thu Dec  7 21:31:04 2017
@@ -30,11 +30,12 @@ import org.apache.jmeter.threads.JMeterC
 import org.apache.jmeter.threads.JMeterContextService;
 import org.apache.jmeter.threads.JMeterVariables;
 import org.apache.jmeter.util.JMeterUtils;
+import org.apache.jorphan.test.JMeterSerialTest;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
-public class TestGroovyFunction extends JMeterTestCase {
+public class TestGroovyFunction extends JMeterTestCase implements JMeterSerialTest {
     protected AbstractFunction function;
 
     private SampleResult result;

Modified: jmeter/trunk/test/src/org/apache/jmeter/functions/TestSetProperty.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/functions/TestSetProperty.java?rev=1817424&r1=1817423&r2=1817424&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/functions/TestSetProperty.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/functions/TestSetProperty.java Thu Dec  7 21:31:04 2017
@@ -19,6 +19,8 @@
 package org.apache.jmeter.functions;
 
 import static org.junit.Assert.assertEquals;
+
+import org.apache.jorphan.test.JMeterSerialTest;
 import org.junit.Assert;
 
 import java.util.Collection;
@@ -34,7 +36,7 @@ import org.apache.jmeter.util.JMeterUtil
 import org.junit.Before;
 import org.junit.Test;
 
-public class TestSetProperty extends JMeterTestCase {
+public class TestSetProperty extends JMeterTestCase implements JMeterSerialTest {
     protected AbstractFunction function;
 
     private SampleResult result;
@@ -72,7 +74,6 @@ public class TestSetProperty extends JMe
         assertEquals("value1", JMeterUtils.getProperty("prop1"));
         assertEquals("", returnValue);
     }
-    
 
     @Test
     public void testSetPropertyWithReturn() throws Exception {

Modified: jmeter/trunk/test/src/org/apache/jmeter/junit/spock/JMeterSpec.groovy
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/junit/spock/JMeterSpec.groovy?rev=1817424&r1=1817423&r2=1817424&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/junit/spock/JMeterSpec.groovy (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/junit/spock/JMeterSpec.groovy Thu Dec  7 21:31:04 2017
@@ -97,4 +97,13 @@ abstract class JMeterSpec extends Specif
         System.out.println(prop + "=" + System.getProperty(prop))
     }
 
+    // Helper method to find a test path
+    protected static String findTestPath(String file) {
+        File f = new File(file)
+        if (filePrefix.length() > 0 && !f.isAbsolute()) {
+            return filePrefix + file// Add the offset
+        }
+        return file
+    }
+
 }

Modified: jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCacheManagerHC4.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCacheManagerHC4.java?rev=1817424&r1=1817423&r2=1817424&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCacheManagerHC4.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCacheManagerHC4.java Thu Dec  7 21:31:04 2017
@@ -284,9 +284,6 @@ public class TestCacheManagerHC4 extends
         checkIfModifiedSinceHeader(httpMethod);
     }
 
-    /**
-     * 
-     */
     protected void checkIfModifiedSinceHeader(HttpRequestBase httpMethod) {
         SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US);
         try {

Modified: jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCacheManagerUrlConnection.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCacheManagerUrlConnection.java?rev=1817424&r1=1817423&r2=1817424&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCacheManagerUrlConnection.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCacheManagerUrlConnection.java Thu Dec  7 21:31:04 2017
@@ -22,7 +22,6 @@ import static org.junit.Assert.assertEqu
 import static org.junit.Assert.assertNotNull;
 
 import java.net.HttpURLConnection;
-import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
@@ -52,7 +51,7 @@ public class TestCacheManagerUrlConnecti
 
     @Override
     protected void checkRequestHeader(String requestHeader, String expectedValue) {
-        Map<String, List<String>> properties = ((HttpURLConnection)this.urlConnection).getRequestProperties();
+        Map<String, List<String>> properties = this.urlConnection.getRequestProperties();
         checkProperty(properties, requestHeader, expectedValue);
     }
 
@@ -62,15 +61,11 @@ public class TestCacheManagerUrlConnecti
     }
     
     private org.apache.jmeter.protocol.http.control.Header[] asHeaders(Map<String, List<String>> headers) {
-        List<org.apache.jmeter.protocol.http.control.Header> result = new ArrayList<>(headers.size());
-        for (Map.Entry<String, List<String>> header: headers.entrySet()) {
-            // Java Implementation returns a null header for URL
-            if(header.getKey() != null) {
-                result.add(new org.apache.jmeter.protocol.http.control.Header(
-                        header.getKey(), String.join(", ", header.getValue())));
-            }
-        }
-        return result.toArray(new org.apache.jmeter.protocol.http.control.Header[result.size()]);
+        // Java Implementation returns a null header for URL
+        return headers.entrySet().stream()
+                .filter(header -> header.getKey() != null)
+                .map(header -> new Header(header.getKey(), String.join(", ", header.getValue())))
+                .toArray(Header[]::new);
     }
 
     @Override

Modified: jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestHTTPMirrorThread.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestHTTPMirrorThread.java?rev=1817424&r1=1817423&r2=1817424&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestHTTPMirrorThread.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestHTTPMirrorThread.java Thu Dec  7 21:31:04 2017
@@ -53,7 +53,7 @@ public class TestHTTPMirrorThread extend
     // We need to use a suite in order to preserve the server across test cases
     // With JUnit4 we could use before/after class annotations
     public static Test suite(){
-        TestSetup setup = new TestSetup(new TestSuite(TestHTTPMirrorThread.class)){
+        return new TestSetup(new TestSuite(TestHTTPMirrorThread.class)){
             private HttpMirrorServer httpServer;
 
             @Override
@@ -68,7 +68,6 @@ public class TestHTTPMirrorThread extend
                 httpServer = null;
             }
         };
-        return setup;
     }
 
     /**
@@ -82,10 +81,10 @@ public class TestHTTPMirrorThread extend
      *             if something fails
      */
     public static HttpMirrorServer startHttpMirror(int port) throws Exception {
-        HttpMirrorServer server = null;
+        HttpMirrorServer server;
         server = new HttpMirrorServer(port);
         server.start();
-        Exception e = null;
+        Exception e;
         for (int i=0; i < 10; i++) {// Wait up to 1 second
             try {
                 Thread.sleep(100);
@@ -126,7 +125,7 @@ public class TestHTTPMirrorThread extend
         // Read the response
         ByteArrayOutputStream response = new ByteArrayOutputStream();
         byte[] buffer = new byte[1024];
-        int length = 0;
+        int length;
         while(( length = inputStream.read(buffer)) != -1) {
             response.write(buffer, 0, length);
         }
@@ -155,7 +154,7 @@ public class TestHTTPMirrorThread extend
         bos.close();
         byte[] firstChunk = bos.toByteArray();
         outputStream.write(firstChunk);
-        Thread.sleep(300);
+        Thread.sleep(200);
         // Write the rest of the headers
         bos = new ByteArrayOutputStream();
         bos.write("Host: localhost".getBytes(ISO_8859_1));
@@ -167,7 +166,6 @@ public class TestHTTPMirrorThread extend
         // Read the response
         response = new ByteArrayOutputStream();
         buffer = new byte[1024];
-        length = 0;
         while((length = inputStream.read(buffer)) != -1) {
             response.write(buffer, 0, length);
         }
@@ -217,7 +215,7 @@ public class TestHTTPMirrorThread extend
         // Read the response
         ByteArrayOutputStream response = new ByteArrayOutputStream();
         byte[] buffer = new byte[1024];
-        int length = 0;
+        int length;
         while((length = inputStream.read(buffer)) != -1) {
             response.write(buffer, 0, length);
         }
@@ -253,7 +251,7 @@ public class TestHTTPMirrorThread extend
         bos.close();
         byte[] firstChunk = bos.toByteArray();
         outputStream.write(firstChunk);
-        Thread.sleep(300);
+        Thread.sleep(200);
 
         // Write the body
         byte[] secondChunk = postBody;
@@ -261,7 +259,6 @@ public class TestHTTPMirrorThread extend
         // Read the response
         response = new ByteArrayOutputStream();
         buffer = new byte[1024];
-        length = 0;
         while((length = inputStream.read(buffer)) != -1) {
             response.write(buffer, 0, length);
         }
@@ -309,7 +306,7 @@ public class TestHTTPMirrorThread extend
         bos.close();
         firstChunk = bos.toByteArray();
         outputStream.write(firstChunk);
-        Thread.sleep(300);
+        Thread.sleep(200);
 
         // Write the body
         secondChunk = postBody;
@@ -317,7 +314,6 @@ public class TestHTTPMirrorThread extend
         // Read the response
         response = new ByteArrayOutputStream();
         buffer = new byte[1024];
-        length = 0;
         while((length = inputStream.read(buffer)) != -1) {
             response.write(buffer, 0, length);
         }
@@ -401,7 +397,7 @@ public class TestHTTPMirrorThread extend
     public void testSleep() throws Exception {
         URL url = new URL("http", "localhost", HTTP_SERVER_PORT, "/");
         HttpURLConnection conn = (HttpURLConnection) url.openConnection();
-        conn.addRequestProperty("X-Sleep", "1000");
+        conn.addRequestProperty("X-Sleep", "200");
         // use nanoTime to do timing measurement or calculation
         // See https://blogs.oracle.com/dholmes/entry/inside_the_hotspot_vm_clocks
         long now = System.nanoTime();
@@ -409,16 +405,12 @@ public class TestHTTPMirrorThread extend
         final InputStream inputStream = conn.getInputStream();
         while(inputStream.read() != -1) {} // CHECKSTYLE IGNORE EmptyBlock
         inputStream.close();
-        final long elapsed = (System.nanoTime() - now)/1000000L;
-        assertTrue("Expected > 990 " + elapsed, elapsed >= 990);
+        final long elapsed = (System.nanoTime() - now)/200000L;
+        assertTrue("Expected > 180 " + elapsed, elapsed >= 180);
     }
 
     /**
      * Check that the two byte arrays have identical content
-     *
-     * @param expected
-     * @param actual
-     * @throws UnsupportedEncodingException
      */
     private void checkArraysHaveSameContent(byte[] expected, byte[] actual) throws UnsupportedEncodingException {
         if(expected != null && actual != null) {

Modified: jmeter/trunk/test/src/org/apache/jmeter/reporters/TestResultSaver.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/reporters/TestResultSaver.java?rev=1817424&r1=1817423&r2=1817424&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/reporters/TestResultSaver.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/reporters/TestResultSaver.java Thu Dec  7 21:31:04 2017
@@ -27,15 +27,15 @@ import org.apache.jmeter.services.FileSe
 import org.apache.jmeter.threads.JMeterContext;
 import org.apache.jmeter.threads.JMeterContextService;
 import org.apache.jmeter.threads.JMeterVariables;
+import org.apache.jorphan.test.JMeterSerialTest;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 
-
 /**
  * Test for {@link ResultSaver}
  */
-public class TestResultSaver extends JMeterTestCase {
+public class TestResultSaver extends JMeterTestCase implements JMeterSerialTest {
     private ResultSaver resultSaver;
     private SampleResult sampleResult;
     private final String data = "response Data";

Modified: jmeter/trunk/test/src/org/apache/jmeter/samplers/TestSampleResult.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/samplers/TestSampleResult.java?rev=1817424&r1=1817423&r2=1817424&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/samplers/TestSampleResult.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/samplers/TestSampleResult.java Thu Dec  7 21:31:04 2017
@@ -28,11 +28,12 @@ import static org.junit.Assert.fail;
 import org.apache.jmeter.junit.JMeterTestCase;
 import org.apache.jmeter.util.Calculator;
 import org.apache.jmeter.util.LogRecordingDelegatingLogger;
+import org.apache.jorphan.test.JMeterSerialTest;
 import org.junit.Test;
 
 // TODO need more tests - particularly for the new functions
 
-public class TestSampleResult {
+public class TestSampleResult implements JMeterSerialTest {
 
         @Test
         public void testElapsedTrue() throws Exception {
@@ -70,7 +71,7 @@ public class TestSampleResult {
             long totalSampleTime = sleep(100); // accumulate the time spent 'sampling'
             res.samplePause();
 
-            Thread.sleep(200); // This should be ignored 
+            Thread.sleep(200); // This should be ignored
 
             // Re-increment
             res.sampleResume();
@@ -131,11 +132,11 @@ public class TestSampleResult {
             res.samplePause();
             assertNotEquals(0, recordLogger.getLogRecordCount());
         }
-        
+
         @Test
         public void testByteCount() throws Exception {
             SampleResult res = new SampleResult();
-            
+
             res.sampleStart();
             res.setBytes(100L);
             res.setSampleLabel("sample of size 100 bytes");
@@ -201,8 +202,8 @@ public class TestSampleResult {
             // subsamples, representing images that are downloaded for the
             // page representing the first sample.
 
-            // Sample that will get two sub results, simulates a web page load 
-            SampleResult parent = new SampleResult(nanoTime, nanoThreadSleep);            
+            // Sample that will get two sub results, simulates a web page load
+            SampleResult parent = new SampleResult(nanoTime, nanoThreadSleep);
 
             JMeterTestCase.assertPrimitiveEquals(nanoTime, parent.useNanoTime);
             assertEquals(nanoThreadSleep, parent.nanoThreadSleep);
@@ -218,7 +219,7 @@ public class TestSampleResult {
             long parentElapsed = parent.getTime();
 
             // Sample with no sub results, simulates an image download
-            SampleResult child1 = new SampleResult(nanoTime);            
+            SampleResult child1 = new SampleResult(nanoTime);
             child1.sampleStart();
             Thread.sleep(100);
             child1.setBytes(100L);
@@ -240,8 +241,8 @@ public class TestSampleResult {
                 actualPause = parent.currentTimeInMillis() - t1;
             }
 
-            // Sample with no sub results, simulates an image download 
-            SampleResult child2 = new SampleResult(nanoTime);            
+            // Sample with no sub results, simulates an image download
+            SampleResult child2 = new SampleResult(nanoTime);
             child2.sampleStart();
             Thread.sleep(100);
             child2.setBytes(200L);
@@ -255,7 +256,7 @@ public class TestSampleResult {
             assertEquals("Child2 Sample", child2.getSampleLabel());
             assertEquals(1, child2.getSampleCount());
             assertEquals(0, child2.getSubResults().length);
-            
+
             // Now add the subsamples to the sample
             parent.addSubResult(child1);
             parent.addSubResult(child2);
@@ -265,7 +266,7 @@ public class TestSampleResult {
             assertEquals(1, parent.getSampleCount());
             assertEquals(2, parent.getSubResults().length);
             long parentElapsedTotal = parent.getTime();
-            
+
             long overallTime = parent.currentTimeInMillis() - beginTest;
 
             long sumSamplesTimes = parentElapsed + child1Elapsed + actualPause + child2Elapsed;
@@ -274,7 +275,7 @@ public class TestSampleResult {
              * Parent elapsed total should be no smaller than the sum of the individual samples.
              * It may be greater by the timer granularity.
              */
-            
+
             long diff = parentElapsedTotal - sumSamplesTimes;
             long maxDiff = nanoTime ? 3 : 16; // TimeMillis has granularity of 10-20
             if (diff < 0 || diff > maxDiff) {
@@ -282,17 +283,15 @@ public class TestSampleResult {
                         + " = " + diff + " not in [0," + maxDiff + "]; nanotime=" + nanoTime);
             }
 
-            /**
-             * The overall time to run the test must be no less than, 
-             * and may be greater (but not much greater) than the parent elapsed time
-             */
-            
+             // The overall time to run the test must be no less than,
+             // and may be greater (but not much greater) than the parent elapsed time
+
             diff = overallTime - parentElapsedTotal;
             if (diff < 0 || diff > maxDiff) {
                 fail("TestElapsed: " + overallTime + " - " + " ParentElapsed: " + parentElapsedTotal
                         + " = " + diff + " not in [0," + maxDiff + "]; nanotime="+nanoTime);
             }
-            
+
             // Check that calculator gets the correct statistics from the sample
             Calculator calculator = new Calculator();
             calculator.addSample(parent);
@@ -304,7 +303,7 @@ public class TestSampleResult {
         }
 
         // TODO some more invalid sequence tests needed
-        
+
         @Test
         public void testEncodingAndType() throws Exception {
             // check default
@@ -312,7 +311,7 @@ public class TestSampleResult {
             assertEquals(SampleResult.DEFAULT_ENCODING,res.getDataEncodingWithDefault());
             assertEquals("DataType should be blank","",res.getDataType());
             assertNull(res.getDataEncodingNoDefault());
-            
+
             // check null changes nothing
             res.setEncodingAndType(null);
             assertEquals(SampleResult.DEFAULT_ENCODING,res.getDataEncodingWithDefault());
@@ -335,7 +334,7 @@ public class TestSampleResult {
             res.setEncodingAndType("text/html; charset=\"aBCd\"");
             assertEquals("aBCd",res.getDataEncodingWithDefault());
             assertEquals("aBCd",res.getDataEncodingNoDefault());
-            assertEquals("text",res.getDataType());         
+            assertEquals("text",res.getDataType());
         }
 
         // sleep and return how long we actually slept

Added: jmeter/trunk/test/src/org/apache/jmeter/services/FileServerSpec.groovy
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/services/FileServerSpec.groovy?rev=1817424&view=auto
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/services/FileServerSpec.groovy (added)
+++ jmeter/trunk/test/src/org/apache/jmeter/services/FileServerSpec.groovy Thu Dec  7 21:31:04 2017
@@ -0,0 +1,218 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jmeter.services
+
+import org.apache.jmeter.junit.spock.JMeterSpec
+import spock.lang.Unroll
+
+@Unroll
+class FileServerSpec extends JMeterSpec {
+
+    def sut = new FileServer()
+
+    def testFile = findTestPath("testfiles/unit/FileServerSpec.csv")
+    def emptyFile = findTestPath("testfiles/empty.csv")
+
+
+    def setup() {
+        sut.resetBase()
+    }
+
+    def tearDown() {
+        sut.closeFiles()
+    }
+
+    def "reading a non-existent file throws an exception"() {
+        when:
+            sut.readLine("test")
+        then:
+            thrown(IOException)
+    }
+
+    def "writing to a non-exisent file throws an exception"() {
+        when:
+            sut.write("test", "")
+        then:
+            thrown(IOException)
+    }
+
+    def "no files should be open following resetBase"() {
+        expect:
+            !sut.filesOpen()
+    }
+
+    def "closing unrecognised files are ignored"() {
+        when:
+            sut.closeFile("xxx")
+        then:
+            !sut.filesOpen()
+            noExceptionThrown()
+    }
+
+    def "file is not opened until read from"() {
+        when:
+            sut.reserveFile(testFile) // Does not open file
+        then:
+            !sut.filesOpen()
+        when:
+            def line = sut.readLine(testFile)
+        then:
+            line == "a1,b1,c1,d1"
+            sut.filesOpen()
+    }
+
+    def "reading lines loops to start once last line is read"() {
+        given:
+            sut.reserveFile(testFile)
+        when:
+            def firstPass = [sut.readLine(testFile), sut.readLine(testFile), sut.readLine(testFile), sut.readLine(testFile)]
+            def secondPass = [sut.readLine(testFile), sut.readLine(testFile), sut.readLine(testFile), sut.readLine(testFile)]
+        then:
+            firstPass == secondPass
+    }
+
+    def "cannot write to reserved file after reading"() {
+        given:
+            sut.reserveFile(testFile)
+            sut.readLine(testFile)
+        when:
+            sut.write(testFile, "")
+        then:
+            thrown(IOException)
+    }
+
+    def "closing reserved file after reading resets"() {
+        given:
+            sut.reserveFile(testFile)
+            sut.readLine(testFile)
+        when:
+            sut.closeFile(testFile) // does not remove the entry
+        then:
+            !sut.filesOpen()
+            sut.readLine(testFile) == "a1,b1,c1,d1" // Re-read first line
+            sut.filesOpen()
+    }
+
+    def "closeFiles() prevents reading of reserved file"() {
+        given:
+            sut.reserveFile(testFile)
+            sut.readLine(testFile)
+        when:
+            sut.closeFiles() // removes all entries
+            sut.readLine(testFile)
+        then:
+            !sut.filesOpen()
+            thrown(IOException)
+    }
+
+    def "baseDir is the defaultBasedir"() {
+        expect:
+            sut.getBaseDir() == FileServer.getDefaultBase()
+    }
+
+    def "setBaseDir doesn't error when no files are open"() {
+        when:
+            sut.setBasedir("testfiles/unit/FileServerSpec.csv")
+        then:
+            sut.getBaseDir().endsWith("testfiles/unit")
+    }
+
+    // TODO: what about throwing an exception in setBaseDir?
+    def "setBaseDir doesn't set base when passed a directory"() {
+        def dir = "does-not-exist"
+        given:
+            sut.setBasedir(dir)
+        when:
+            sut.getBaseDir().endsWith(dir)
+        then:
+            thrown(NullPointerException)
+    }
+
+    def "cannot set baseDir when files are open"() {
+        given:
+            sut.reserveFile(testFile)
+            sut.readLine(testFile) == "a1,b1,c1,d1"
+        when:
+            sut.setBasedir("testfiles")
+        then:
+            thrown(IllegalStateException)
+    }
+
+    static def baseFile = new File(FileServer.getDefaultBase())
+
+    def "setting base to #file gives getBaseDirRelative == #expectedBaseDirRelative"() {
+        when:
+            sut.setBaseForScript(file)
+        then:
+            sut.getBaseDirRelative().toString() == expectedBaseDirRelative
+        where:
+            file                                                | expectedBaseDirRelative
+            baseFile                                            | "."
+            baseFile.getParentFile()                            | "."
+            new File(baseFile.getParentFile(), "abcd/defg.jmx") | "."
+            new File(baseFile, "abcd/defg.jmx")                 | "abcd"
+    }
+
+    def "non-existent filename to reserveFile will throw exception"() {
+        given:
+            def missing = "no-such-file"
+            def alias = "missing"
+            def charsetName = "UTF-8"
+            def hasHeader = true
+        when:
+            sut.reserveFile(missing, charsetName, alias, hasHeader)
+        then:
+            def ex = thrown(IllegalArgumentException)
+            ex.getMessage() == "Could not read file header line for file $missing"
+            ex.getCause().getMessage() == "File $missing must exist and be readable"
+    }
+
+    def "reserving a file with no header will throw an exception if the header is expected"() {
+        given:
+            def alias = "empty"
+            def charsetName = "UTF-8"
+        when:
+            sut.reserveFile(emptyFile, charsetName, alias, true)
+        then:
+            def e = thrown(IllegalArgumentException)
+            e.getCause() instanceof EOFException
+    }
+
+    def "resolvedFile returns absolute and relative files"() {
+        given:
+            def testFile = new File(emptyFile)
+        expect:
+            // absolute
+            sut.getResolvedFile(testFile.getAbsolutePath())
+                    .getCanonicalFile() == testFile.getCanonicalFile()
+            // relative
+            sut.getResolvedFile(testFile.getParentFile().getPath() + "/../testfiles/empty.csv")
+                    .getCanonicalFile() == testFile.getCanonicalFile()
+    }
+
+    def "resolvedFile returns relative files with BaseForScript set"() {
+        given:
+            def testFile = new File(emptyFile)
+        when:
+            sut.setBaseForScript(testFile)
+        then:
+            sut.getResolvedFile(testFile.getName())
+                    .getCanonicalFile() == testFile.getCanonicalFile()
+    }
+
+}

Modified: jmeter/trunk/test/src/org/apache/jmeter/visualizers/backend/SamplerMetricFixedModeTest.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/visualizers/backend/SamplerMetricFixedModeTest.java?rev=1817424&r1=1817423&r2=1817424&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/visualizers/backend/SamplerMetricFixedModeTest.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/visualizers/backend/SamplerMetricFixedModeTest.java Thu Dec  7 21:31:04 2017
@@ -33,10 +33,6 @@ public class SamplerMetricFixedModeTest
 
     /**
      * Method to change a static final field
-     * 
-     * @param field
-     * @param newValue
-     * @throws Exception
      */
     static void setFinalStatic(Field field, Object newValue) throws Exception {
         field.setAccessible(true);
@@ -47,12 +43,12 @@ public class SamplerMetricFixedModeTest
     }
 
     @Before
-    public void initMode() throws NoSuchFieldException, SecurityException, Exception {
+    public void initMode() throws Exception {
         setFinalStatic(SamplerMetric.class.getDeclaredField("WINDOW_MODE"), WindowMode.FIXED);
     }
 
     @Test
-    public void checkResetOkAndAllStats() throws NoSuchFieldException, SecurityException, Exception {
+    public void checkResetOkAndAllStats() throws Exception {
 
         SamplerMetric metric = new SamplerMetric();
         metric.add(createSampleResult(true));
@@ -67,11 +63,10 @@ public class SamplerMetricFixedModeTest
         assertEquals("After reset in FIXED mode ok.max", DEFAULT_ELAPSED_TIME, metric.getOkMaxTime(), 0.001);
         assertEquals("After reset in FIXED mode all.max", DEFAULT_ELAPSED_TIME, metric.getAllMaxTime(), 0.0);
         assertEquals("After reset failure", 0, metric.getHits(), 0.0);
-        metric = null;
     }
 
     @Test
-    public void checkResetKoAndAllStats() throws NoSuchFieldException, SecurityException, Exception {
+    public void checkResetKoAndAllStats() throws Exception {
 
         SamplerMetric metric = new SamplerMetric();
         metric.add(createSampleResult(false));
@@ -86,7 +81,6 @@ public class SamplerMetricFixedModeTest
         assertEquals("After reset in FIXED mode  ko.max", DEFAULT_ELAPSED_TIME, metric.getKoMaxTime(), 0.0);
         assertEquals("After reset in FIXED mode all.max", DEFAULT_ELAPSED_TIME, metric.getAllMaxTime(), 0.0);
         assertEquals("After reset failure", 0, metric.getFailures(), 0.001);
-        metric = null;
     }
 
     @Test
@@ -100,7 +94,6 @@ public class SamplerMetricFixedModeTest
         assertEquals("Count for '400 - bad request' error ", 2, metric.getErrors().get(error), 0.0);
         error = new ErrorMetric(createSampleResult("500", "Internal Server Error"));
         assertEquals("Count for '500 - Internal Server Error' error ", 1, metric.getErrors().get(error), 0.0);
-        metric = null;
     }
 
     private SampleResult createSampleResult(boolean success) {

Modified: jmeter/trunk/test/src/org/apache/jmeter/visualizers/backend/SamplerMetricTimedModeTest.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/visualizers/backend/SamplerMetricTimedModeTest.java?rev=1817424&r1=1817423&r2=1817424&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/visualizers/backend/SamplerMetricTimedModeTest.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/visualizers/backend/SamplerMetricTimedModeTest.java Thu Dec  7 21:31:04 2017
@@ -40,13 +40,12 @@ public class SamplerMetricTimedModeTest
     }
 
     @Before
-    public void initMode() throws NoSuchFieldException, SecurityException, Exception {
+    public void initMode() throws Exception {
         setFinalStatic(SamplerMetric.class.getDeclaredField("WINDOW_MODE"), WindowMode.TIMED);
     }
 
-
     @Test
-    public void checkResetOkAndAllStats() throws NoSuchFieldException, SecurityException, Exception {
+    public void checkResetOkAndAllStats() throws Exception {
 
         SamplerMetric metric = new SamplerMetric();
 
@@ -60,11 +59,10 @@ public class SamplerMetricTimedModeTest
         assertEquals("After reset in TIMED mode ok.max", Double.NaN, metric.getOkMaxTime(), 0.0);
         assertEquals("After reset in TIMED mode all.max", Double.NaN, metric.getAllMaxTime(), 0.0);
         assertEquals("After reset failure", 0, metric.getHits(), 0.0);
-        metric = null;
     }
 
     @Test
-    public void checkResetKoAndAllStats() throws NoSuchFieldException, SecurityException, Exception {
+    public void checkResetKoAndAllStats() throws Exception {
 
         SamplerMetric metric = new SamplerMetric();
         metric.add(createSampleResult(false));
@@ -77,7 +75,6 @@ public class SamplerMetricTimedModeTest
         assertEquals("After reset in TIMED mode  ko.max", Double.NaN, metric.getKoMaxTime(), 0.0);
         assertEquals("After reset in TIMED mode all.max", Double.NaN, metric.getAllMaxTime(), 0.0);
         assertEquals("After reset failure", 0, metric.getFailures(), 0.001);
-        metric = null;
     }
 
     private SampleResult createSampleResult(boolean success) {

Modified: jmeter/trunk/test/src/org/apache/jorphan/reflect/TestClassFinder.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jorphan/reflect/TestClassFinder.java?rev=1817424&r1=1817423&r2=1817424&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jorphan/reflect/TestClassFinder.java (original)
+++ jmeter/trunk/test/src/org/apache/jorphan/reflect/TestClassFinder.java Thu Dec  7 21:31:04 2017
@@ -53,23 +53,28 @@ public class TestClassFinder {
 
     @Test
     public void testFindClassesThatExtendStringArrayClassOfQArray() throws IOException {
-        List<String> findClassesThatExtend = ClassFinder.findClassesThatExtend(libDirs,
+        List<String> findClassesThatExtend = ClassFinder.findClassesThatExtend(
+                libDirs,
                 new Class<?>[] { Exception.class });
         Assert.assertThat(findClassesThatExtend, CoreMatchers.hasItem(LoggingException.class.getName()));
     }
 
     @Test
     public void testFindClassesThatExtendStringArrayClassOfQArrayTrue() throws Exception {
-        List<String> findClassesThatExtend = ClassFinder.findClassesThatExtend(libDirs,
-                new Class<?>[] { Object.class }, true);
+        List<String> findClassesThatExtend = ClassFinder.findClassesThatExtend(
+                libDirs,
+                new Class<?>[] { Object.class },
+                true);
         Assert.assertFalse(
                 findClassesThatExtend.stream().filter(s -> s.contains("$")).collect(Collectors.toList()).isEmpty());
     }
 
     @Test
     public void testFindClassesThatExtendStringArrayClassOfQArrayFalse() throws Exception {
-        List<String> findClassesThatExtend = ClassFinder.findClassesThatExtend(libDirs,
-                new Class<?>[] { Exception.class }, false);
+        List<String> findClassesThatExtend = ClassFinder.findClassesThatExtend(
+                libDirs,
+                new Class<?>[] { Exception.class },
+                false);
         Assert.assertTrue(
                 findClassesThatExtend.stream().filter(s -> s.contains("$")).collect(Collectors.toList()).isEmpty());
         Assert.assertThat(findClassesThatExtend, CoreMatchers.hasItem(LoggingException.class.getName()));
@@ -77,8 +82,12 @@ public class TestClassFinder {
 
     @Test
     public void testFindClassesThatExtendStringArrayClassOfQArrayBooleanStringString() throws Exception {
-        List<String> findClassesThatExtend = ClassFinder.findClassesThatExtend(libDirs,
-                new Class<?>[] { Exception.class }, false, "org.apache.log", "core");
+        List<String> findClassesThatExtend = ClassFinder.findClassesThatExtend(
+                libDirs,
+                new Class<?>[] { Exception.class },
+                false,
+                "org.apache.log",
+                "core");
         Assert.assertTrue(
                 findClassesThatExtend.stream().filter(s -> s.contains("core")).collect(Collectors.toList()).isEmpty());
         Assert.assertFalse(findClassesThatExtend.isEmpty());
@@ -86,15 +95,21 @@ public class TestClassFinder {
 
     @Test
     public void testFindClassesThatExtendStringArrayClassOfQArrayBooleanStringStringTrue() throws Exception {
-        List<String> annotatedClasses = ClassFinder.findClassesThatExtend(libDirs,
-                new Class<?>[] { java.beans.Transient.class }, false, null, null, true);
+        List<String> annotatedClasses = ClassFinder.findClassesThatExtend(
+                libDirs,
+                new Class<?>[] { java.beans.Transient.class },
+                false,
+                null,
+                null,
+                true);
         Assert.assertFalse(annotatedClasses.isEmpty());
     }
 
     @Test
     public void testFindAnnotatedClasses() throws Exception {
         @SuppressWarnings("unchecked")
-        List<String> annotatedClasses = ClassFinder.findAnnotatedClasses(libDirs,
+        List<String> annotatedClasses = ClassFinder.findAnnotatedClasses(
+                libDirs,
                 new Class[] { java.beans.Transient.class});
         Assert.assertFalse(annotatedClasses.isEmpty());
     }
@@ -117,8 +132,7 @@ public class TestClassFinder {
         @SuppressWarnings("unchecked")
         List<String> annotatedClasses = ClassFinder.findAnnotatedClasses(libDirs,
                 new Class[] { java.lang.Deprecated.class}, true);
-        Assert.assertTrue(annotatedClasses.stream().filter(s->s.contains("$")).findAny().isPresent());
-        Assert.assertFalse(annotatedClasses.isEmpty());
+        Assert.assertTrue(annotatedClasses.stream().anyMatch(s->s.contains("$")));
     }
 
     @Test