public class ClassLoaderTestHelper extends Object
Modifier and Type | Field and Description |
---|---|
private static int |
BUFFER_SIZE |
private static org.slf4j.Logger |
LOG |
Constructor and Description |
---|
ClassLoaderTestHelper() |
Modifier and Type | Method and Description |
---|---|
static void |
addJarFilesToJar(File targetJar,
String libPrefix,
File... srcJars)
Add a list of jar files to another jar file under a specific folder.
|
static File |
buildJar(String testDir,
String className,
String code)
Create a test jar for testing purpose for a given class
name with specified code string: save the class to a file,
compile it, and jar it up.
|
static File |
buildJar(String testDir,
String className,
String code,
String folder)
Create a test jar for testing purpose for a given class
name with specified code string.
|
private static boolean |
createJarArchive(File archiveFile,
File[] tobeJared)
Jar a list of files into a jar archive.
|
(package private) static String |
localDirPath(org.apache.hadoop.conf.Configuration conf) |
private static final org.slf4j.Logger LOG
private static final int BUFFER_SIZE
public ClassLoaderTestHelper()
private static boolean createJarArchive(File archiveFile, File[] tobeJared)
archiveFile
- the target jar archivetobeJared
- a list of files to be jaredpublic static File buildJar(String testDir, String className, String code) throws Exception
testDir
- the folder under which to store the test class and jarclassName
- the test class namecode
- the optional test class code, which can be null.
If null, a bare empty class will be usedException
public static File buildJar(String testDir, String className, String code, String folder) throws Exception
testDir
- the folder under which to store the test classclassName
- the test class namecode
- the optional test class code, which can be null.
If null, an empty class will be usedfolder
- the folder under which to store the generated jarException
public static void addJarFilesToJar(File targetJar, String libPrefix, File... srcJars) throws Exception
targetJar
- the target jar filelibPrefix
- the folder where to put inner jar filessrcJars
- the source inner jar files to be addedException
- if anything doesn't work as expectedstatic String localDirPath(org.apache.hadoop.conf.Configuration conf)
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.