public class TestUtils
extends Object
TODO: See if we can move this to the test codebase by specifying test dependencies between projects.
| Constructor and Description | 
|---|
| TestUtils() | 
| Modifier and Type | Method and Description | 
|---|---|
| static <T> void | assertNotSpilled(SparkContext sc,
                String identifier,
                scala.Function0<T> body)Run some code involving jobs submitted to the given context and assert that the jobs
 did not spill. | 
| static <T> void | assertSpilled(SparkContext sc,
             String identifier,
             scala.Function0<T> body)Run some code involving jobs submitted to the given context and assert that the jobs spilled. | 
| static java.io.File | createCompiledClass(String className,
                   java.io.File destDir,
                   String toStringValue,
                   String baseClass,
                   scala.collection.Seq<java.net.URL> classpathUrls)Creates a compiled class with the given name. | 
| static java.io.File | createCompiledClass(String className,
                   java.io.File destDir,
                   org.apache.spark.TestUtils.JavaSourceFromString sourceFile,
                   scala.collection.Seq<java.net.URL> classpathUrls)Creates a compiled class with the source file. | 
| static java.net.URL | createJar(scala.collection.Seq<java.io.File> files,
         java.io.File jarFile,
         scala.Option<String> directoryPrefix)Create a jar file that contains this set of files. | 
| static java.net.URL | createJarWithClasses(scala.collection.Seq<String> classNames,
                    String toStringValue,
                    scala.collection.Seq<scala.Tuple2<String,String>> classNamesWithBase,
                    scala.collection.Seq<java.net.URL> classpathUrls)Create a jar that defines classes with the given names. | 
| static java.net.URL | createJarWithFiles(scala.collection.immutable.Map<String,String> files,
                  java.io.File dir)Create a jar file containing multiple files. | 
| static int | httpResponseCode(java.net.URL url,
                String method,
                scala.collection.Seq<scala.Tuple2<String,String>> headers)Returns the response code from an HTTP(S) URL. | 
| static boolean | testCommandAvailable(String command)Test if a command is available. | 
public static java.net.URL createJarWithClasses(scala.collection.Seq<String> classNames,
                                                String toStringValue,
                                                scala.collection.Seq<scala.Tuple2<String,String>> classNamesWithBase,
                                                scala.collection.Seq<java.net.URL> classpathUrls)
Note: if this is used during class loader tests, class names should be unique in order to avoid interference between tests.
classNames - (undocumented)toStringValue - (undocumented)classNamesWithBase - (undocumented)classpathUrls - (undocumented)public static java.net.URL createJarWithFiles(scala.collection.immutable.Map<String,String> files,
                                              java.io.File dir)
files map contains a mapping of
 file names in the jar file to their contents.files - (undocumented)dir - (undocumented)public static java.net.URL createJar(scala.collection.Seq<java.io.File> files,
                                     java.io.File jarFile,
                                     scala.Option<String> directoryPrefix)
files - (undocumented)jarFile - (undocumented)directoryPrefix - (undocumented)public static java.io.File createCompiledClass(String className,
                                               java.io.File destDir,
                                               org.apache.spark.TestUtils.JavaSourceFromString sourceFile,
                                               scala.collection.Seq<java.net.URL> classpathUrls)
public static java.io.File createCompiledClass(String className,
                                               java.io.File destDir,
                                               String toStringValue,
                                               String baseClass,
                                               scala.collection.Seq<java.net.URL> classpathUrls)
public static <T> void assertSpilled(SparkContext sc, String identifier, scala.Function0<T> body)
sc - (undocumented)identifier - (undocumented)body - (undocumented)public static <T> void assertNotSpilled(SparkContext sc, String identifier, scala.Function0<T> body)
sc - (undocumented)identifier - (undocumented)body - (undocumented)public static boolean testCommandAvailable(String command)
command - (undocumented)public static int httpResponseCode(java.net.URL url,
                                   String method,
                                   scala.collection.Seq<scala.Tuple2<String,String>> headers)
url - (undocumented)method - (undocumented)headers - (undocumented)