Package org.apache.hadoop.hbase
Class TestClassFinder
java.lang.Object
org.apache.hadoop.hbase.TestClassFinder
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classprivate static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static Stringprivate static final Stringstatic final HBaseClassTestRuleprivate static TestClassFinder.CustomClassloaderprivate static AtomicLongprivate static final org.slf4j.Loggerorg.junit.rules.TestNameprivate static final Stringprivate static AtomicLongprivate static final HBaseCommonTestingUtility -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static TestClassFinder.FileAndPathcompileTestClass(long counter, String packageNameSuffix, String classNamePrefix) Compiles the test class with bogus code into a .class file.private static booleanprivate static StringcreateAndLoadJar(String packageNameSuffix, String classNamePrefix, long counter) static voidstatic voidprivate static Class<?>private static StringmakePackageName(String nestedSuffix, long counter) private static StringpackageAndLoadJar(TestClassFinder.FileAndPath... filesInJar) Makes a jar out of some class files.voidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoid
-
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
-