Package org.apache.hadoop.hbase
Class TestClassFinder
java.lang.Object
org.apache.hadoop.hbase.TestClassFinder
-
Nested Class Summary
Modifier and TypeClassDescriptionprivate static class
private static class
-
Field Summary
Modifier and TypeFieldDescriptionprivate static String
private static final String
static final HBaseClassTestRule
private static TestClassFinder.CustomClassloader
private static AtomicLong
private static final org.slf4j.Logger
org.junit.rules.TestName
private static final String
private static AtomicLong
private static final HBaseCommonTestingUtil
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate static TestClassFinder.FileAndPath
compileTestClass
(long counter, String packageNameSuffix, String classNamePrefix) Compiles the test class with bogus code into a .class file.private static boolean
private static String
createAndLoadJar
(String packageNameSuffix, String classNamePrefix, long counter) static void
static void
private static Class<?>
private static String
makePackageName
(String nestedSuffix, long counter) private static String
packageAndLoadJar
(TestClassFinder.FileAndPath... filesInJar) Makes a jar out of some class files.void
void
void
void
void
void
void
void
void
void
void
-
Field Details
-
CLASS_RULE
-
LOG
-
name
-
testUtil
-
BASEPKG
- See Also:
-
PREFIX
- See Also:
-
testCounter
-
jarCounter
-
basePath
-
classLoader
-
-
Constructor Details
-
TestClassFinder
public TestClassFinder()
-
-
Method Details
-
createTestDir
- Throws:
IOException
-
deleteTestDir
-
testClassFinderCanFindClassesInJars
- Throws:
Exception
-
testClassFinderHandlesConflicts
- Throws:
Exception
-
testClassFinderHandlesNestedPackages
- Throws:
Exception
-
testClassFinderFiltersByNameInJar
- Throws:
Exception
-
testClassFinderFiltersByClassInJar
- Throws:
Exception
-
createAndLoadJar
private static String createAndLoadJar(String packageNameSuffix, String classNamePrefix, long counter) throws Exception - Throws:
Exception
-
testClassFinderFiltersByPathInJar
- Throws:
Exception
-
testClassFinderCanFindClassesInDirs
- Throws:
Exception
-
contains
-
testClassFinderFiltersByNameInDirs
- Throws:
Exception
-
testClassFinderFiltersByClassInDirs
- Throws:
Exception
-
testClassFinderFiltersByPathInDirs
- Throws:
Exception
-
testClassFinderDefaultsToOwnPackage
- Throws:
Exception
-
makeClass
private static Class<?> makeClass(String nestedPkgSuffix, String className, long counter) throws ClassNotFoundException - Throws:
ClassNotFoundException
-
makePackageName
-
compileTestClass
private static TestClassFinder.FileAndPath compileTestClass(long counter, String packageNameSuffix, String classNamePrefix) throws Exception Compiles the test class with bogus code into a .class file. Unfortunately it's very tedious.- Parameters:
counter
- Unique test counter.packageNameSuffix
- Package name suffix (e.g. ".suffix") for nesting, or "".- Returns:
- The resulting .class file and the location in jar it is supposed to go to.
- Throws:
Exception
-
packageAndLoadJar
Makes a jar out of some class files. Unfortunately it's very tedious.- Parameters:
filesInJar
- Files created via compileTestClass.- Returns:
- path to the resulting jar file.
- Throws:
Exception
-