/** * Create a classloader * * @param domain the domain * @param policy the policy * @return the classloader * @throws Exception for any error */ public ClassLoader createClassLoader(ClassLoaderDomain domain, MockClassLoaderPolicy policy) throws Exception { ClassLoaderSystem system = getSystem(); return MockClassLoaderHelper.registerMockClassLoader(system, domain, policy); }
/** * Create a scoped classloader domain using the test domain as parent * using the parent first policy * * @param name the name * @return the domain */ public ClassLoaderDomain createScopedClassLoaderDomainParentFirst(String name) { return createScopedClassLoaderDomain(name, ParentPolicy.BEFORE, getDomain()); }
/** * Create a classloader * * @param policy the policy * @return the classloader * @throws Exception for any error */ public ClassLoader createClassLoader(MockClassLoaderPolicy policy) throws Exception { ClassLoaderDomain domain = getDomain(); return createClassLoader(domain, policy); }
/** * Set the paths and the exported package names * * @param classes the classes to reference */ public void setPathsAndPackageNames(Class<?>... classes) { setPaths(classes); setPackageNames(classes); }
/** * Create the default delegate loader * * @return the loaders */ public List<? extends DelegateLoader> createDefaultDelegates() { return createDelegates(getPolicy()); }
/** * Initialize the classloader system * * @param clazz the original clazz * @param system the system * @param policy the policy * @return the clazz loaded from the new classloading system */ public Class<?> initializeClassLoader(Class<?> clazz, ClassLoaderSystem system, ClassLoaderPolicy policy) { return initializeClassLoader(clazz, system, policy, getParentPackages()); }
/** * Set the path to expose * * @param path the path */ public void setPath(String path) { setPaths(path); }
/** * Get the classloader system, this will be configured with * a domain called TEST that includes the test case's classloader * * @return the classloader */ public static ClassLoaderSystem getClassLoaderSystem() { return helper.getSystem(); }
/** * Unregister a classloader * * @param classLoader the classloader * @throws Exception for any error */ protected static void unregisterClassLoader(ClassLoader classLoader) throws Exception { helper.unregisterClassLoader(classLoader); } }
public MockClassLoaderPolicy run() { return new MockClassLoaderPolicy(name); } });
/** * Set the paths and the exported package names * * @param classes the classes to reference */ public void setPathsAndPackageNames(Class<?>... classes) { setPaths(classes); setPackageNames(classes); }
/** * Create a scoped classloader domain using the test domain as parent * using the parent last policy * * @param name the name * @return the domain */ public ClassLoaderDomain createScopedClassLoaderDomainParentLast(String name) { return createScopedClassLoaderDomain(name, ParentPolicy.AFTER_BUT_JAVA_BEFORE, getDomain()); }
/** * Create a classloader * * @param domain the domain * @param policy the policy * @return the classloader * @throws Exception for any error */ public ClassLoader createClassLoader(ClassLoaderDomain domain, MockClassLoaderPolicy policy) throws Exception { ClassLoaderSystem system = getSystem(); return MockClassLoaderHelper.registerMockClassLoader(system, domain, policy); }
/** * Create a classloader * * @param policy the policy * @return the classloader * @throws Exception for any error */ public ClassLoader createClassLoader(MockClassLoaderPolicy policy) throws Exception { ClassLoaderDomain domain = getDomain(); return createClassLoader(domain, policy); }
/** * Create the default delegate loader * * @return the loaders */ public List<? extends DelegateLoader> createDefaultDelegates() { return createDelegates(getPolicy()); }
/** * Set the path to expose * * @param path the path */ public void setPath(String path) { setPaths(path); }
/** * Get the classloader system, this will be configured with * a domain called TEST that includes the test case's classloader * * @return the classloader */ public static ClassLoaderSystem getClassLoaderSystem() { return helper.getSystem(); }
/** * Unregister a classloader * * @param classLoader the classloader * @throws Exception for any error */ protected static void unregisterClassLoader(ClassLoader classLoader) throws Exception { helper.unregisterClassLoader(classLoader); } }
/** * Create a scoped classloader domain using the test domain as parent * * @param name the name * @param parentPolicy the parent policy * @return the domain */ public ClassLoaderDomain createScopedClassLoaderDomain(String name, ParentPolicy parentPolicy) { return createScopedClassLoaderDomain(name, parentPolicy, getDomain()); }
/** * Create a scoped classloader domain using the test domain as parent * using the parent last policy * * @param name the name * @return the domain */ public ClassLoaderDomain createScopedClassLoaderDomainParentLast(String name) { return createScopedClassLoaderDomain(name, ParentPolicy.AFTER_BUT_JAVA_BEFORE, getDomain()); }