Package org.apache.spark.util
Interface SparkTestUtils
public interface SparkTestUtils
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptioncreateCompiledClass(String className, File destDir, String toStringValue, String baseClass, scala.collection.immutable.Seq<URL> classpathUrls, scala.collection.immutable.Seq<String> implementsClasses, String extraCodeBody, scala.Option<String> packageName) Creates a compiled class with the given name.createCompiledClass(String className, File destDir, SparkTestUtils.JavaSourceFromString sourceFile, scala.collection.immutable.Seq<URL> classpathUrls) Creates a compiled class with the source file.createJarWithJavaSources(scala.collection.immutable.Map<String, String> sources, File jarFile, scala.collection.immutable.Seq<URL> classpathUrls) Compile Java source code and package the resulting class files into a JAR.createJarWithScalaSources(scala.collection.immutable.Seq<File> sourceFiles, File jarFile, scala.collection.immutable.Seq<URL> classpathUrls, scala.collection.immutable.Seq<String> excludeClassPrefixes) Compile Scala source files and package the resulting class files into a JAR.scala.collection.immutable.Seq<URL>Ifurlpoints to a "pathing JAR" (a JAR whose manifest declares aClass-Pathattribute), return the URLs referenced by that attribute (resolved relative to the JAR's parent directory) followed by the original URL.scala.collection.immutable.Seq<File>listFilesRecursively(File dir)
-
Method Details
-
createURI
-
createCompiledClass
File createCompiledClass(String className, File destDir, SparkTestUtils.JavaSourceFromString sourceFile, scala.collection.immutable.Seq<URL> classpathUrls) Creates a compiled class with the source file. Class file will be placed in destDir. -
createCompiledClass
File createCompiledClass(String className, File destDir, String toStringValue, String baseClass, scala.collection.immutable.Seq<URL> classpathUrls, scala.collection.immutable.Seq<String> implementsClasses, String extraCodeBody, scala.Option<String> packageName) Creates a compiled class with the given name. Class file will be placed in destDir. -
createJarWithJavaSources
URL createJarWithJavaSources(scala.collection.immutable.Map<String, String> sources, File jarFile, scala.collection.immutable.Seq<URL> classpathUrls) Compile Java source code and package the resulting class files into a JAR. Supports classes with package declarations - the JAR will contain the proper directory structure (e.g., org/apache/spark/Foo.class).- Parameters:
sources- map of fully-qualified class name to Java source codejarFile- the JAR file to createclasspathUrls- additional classpath URLs needed for compilation- Returns:
- URL of the created JAR file
-
createJarWithScalaSources
URL createJarWithScalaSources(scala.collection.immutable.Seq<File> sourceFiles, File jarFile, scala.collection.immutable.Seq<URL> classpathUrls, scala.collection.immutable.Seq<String> excludeClassPrefixes) Compile Scala source files and package the resulting class files into a JAR.- Parameters:
sourceFiles- Scala source files to compilejarFile- the JAR file to createclasspathUrls- additional classpath URLs needed for compilationexcludeClassPrefixes- class name prefixes to exclude from the JAR (e.g., Seq("A") excludes A.class, A$.class)- Returns:
- (undocumented)
-
expandManifestClasspath
Ifurlpoints to a "pathing JAR" (a JAR whose manifest declares aClass-Pathattribute), return the URLs referenced by that attribute (resolved relative to the JAR's parent directory) followed by the original URL. Otherwise return the original URL unchanged.- Parameters:
url- (undocumented)- Returns:
- (undocumented)
-
listFilesRecursively
-