Class FacadeClassLoader
java.lang.Object
java.lang.ClassLoader
io.quarkus.test.junit.classloading.FacadeClassLoader
- All Implemented Interfaces:
Closeable,AutoCloseable
JUnit has many interceptors and listeners, but it does not allow us to intercept test discovery in a fine-grained way that
would allow us to swap the thread context classloader.
Since we can't intercept with a JUnit hook, we hijack from inside the classloader.
We need to load all our test classes in one go, during the discovery phase, before we start the applications. We may need several applications and therefore, several classloaders, depending on what profiles are set. To solve that, we prepare the applications, to get classloaders, and file them here.
Final, since some code does instanceof checks using the class name.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionFacadeClassLoader(ClassLoader parent) FacadeClassLoader(ClassLoader parent, boolean isAuxiliaryApplication, io.quarkus.bootstrap.app.CuratedApplication curatedApplication, Map<String, String> profileNames, Set<String> quarkusTestClasses, String classesPath) -
Method Summary
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findClass, findLibrary, findLoadedClass, findResource, findResource, findResources, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getPackage, getPackages, getParent, getPlatformClassLoader, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
Field Details
-
VALUE
- See Also:
-
KEY_PREFIX
- See Also:
-
DISPLAY_NAME_PREFIX
- See Also:
-
-
Constructor Details
-
FacadeClassLoader
-
FacadeClassLoader
-
-
Method Details
-
loadClass
- Overrides:
loadClassin classClassLoader- Throws:
ClassNotFoundException
-
isServiceLoaderMechanism
public boolean isServiceLoaderMechanism() -
getName
- Overrides:
getNamein classClassLoader
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-