Package org.apache.hadoop.hbase
Class TestClassFinder
java.lang.Object
org.apache.hadoop.hbase.TestClassFinder
@Tag("org.apache.hadoop.hbase.testclassification.MiscTests") @Tag("org.apache.hadoop.hbase.testclassification.SmallTests")
public class TestClassFinder
extends Object
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classprivate static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static Stringprivate static final Stringprivate static TestClassFinder.CustomClassloaderprivate static AtomicLongprivate static final org.slf4j.Loggerprivate static final Stringprivate static AtomicLongprivate static final HBaseCommonTestingUtil -
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.voidtestClassFinderCanFindClassesInDirs(org.junit.jupiter.api.TestInfo testInfo) voidvoidvoidtestClassFinderFiltersByClassInDirs(org.junit.jupiter.api.TestInfo testInfo) voidtestClassFinderFiltersByClassInJar(org.junit.jupiter.api.TestInfo testInfo) voidtestClassFinderFiltersByNameInDirs(org.junit.jupiter.api.TestInfo testInfo) voidtestClassFinderFiltersByNameInJar(org.junit.jupiter.api.TestInfo testInfo) voidvoidtestClassFinderFiltersByPathInJar(org.junit.jupiter.api.TestInfo testInfo) voidvoidtestClassFinderHandlesNestedPackages(org.junit.jupiter.api.TestInfo testInfo)
-
Field Details
-
LOG
-
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
@Test public void testClassFinderHandlesNestedPackages(org.junit.jupiter.api.TestInfo testInfo) throws Exception - Throws:
Exception
-
testClassFinderFiltersByNameInJar
@Test public void testClassFinderFiltersByNameInJar(org.junit.jupiter.api.TestInfo testInfo) throws Exception - Throws:
Exception
-
testClassFinderFiltersByClassInJar
@Test public void testClassFinderFiltersByClassInJar(org.junit.jupiter.api.TestInfo testInfo) throws Exception - Throws:
Exception
-
createAndLoadJar
private static String createAndLoadJar(String packageNameSuffix, String classNamePrefix, long counter) throws Exception - Throws:
Exception
-
testClassFinderFiltersByPathInJar
@Test public void testClassFinderFiltersByPathInJar(org.junit.jupiter.api.TestInfo testInfo) throws Exception - Throws:
Exception
-
testClassFinderCanFindClassesInDirs
@Test public void testClassFinderCanFindClassesInDirs(org.junit.jupiter.api.TestInfo testInfo) throws Exception - Throws:
Exception
-
contains
-
testClassFinderFiltersByNameInDirs
@Test public void testClassFinderFiltersByNameInDirs(org.junit.jupiter.api.TestInfo testInfo) throws Exception - Throws:
Exception
-
testClassFinderFiltersByClassInDirs
@Test public void testClassFinderFiltersByClassInDirs(org.junit.jupiter.api.TestInfo testInfo) throws Exception - 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
-