@Test public void test() throws IOException { final List<String> implementationNames; implementationNames = allResourceLines(getClass().getClassLoader(), ScriptEngineService.RESOURCE_NAME); System.out.println(implementationNames); } }
/** * <p> * Equivalent to {@code loadRegisteredImplementations(resourceName, * Object.class, classLoader)}. * </p> * * @param resourceName * The name of the resources to find. * @param classLoader * Classloader to use to load implementations. * @return The implementation classes. * @throws EngineException * If a class could not be loaded. * @see #loadRegisteredImplementations(String, Class, ClassLoader) */ public static List<Class<?>> loadRegisteredImplementations(String resourceName, ClassLoader classLoader) throws EngineException { return loadRegisteredImplementations(resourceName, Object.class, classLoader); }
/** * <p> * Equivalent to {@code loadRegisteredImplementations(resourceName, * cls, cls.getClassLoader())}. * </p> * * @param resourceName * The name of the resources to find. * @param cls * Implementation classes must be assignable to this class. * @return The implementation classes. * @throws EngineException * If a class could not be loaded. * @param <T> * Constrains type of {@code cls}. * @see #loadRegisteredImplementations(String, Class, ClassLoader) */ public static <T> List<Class<? extends T>> loadRegisteredImplementations(String resourceName, Class<T> cls) throws EngineException { return loadRegisteredImplementations(resourceName, cls, cls.getClassLoader()); }
@Test public void testGroovyScriptEngineInclusion() throws IOException { final List<String> implementationNames = allResourceLines(getClass().getClassLoader(), ScriptEngineService.RESOURCE_NAME); assertThat(implementationNames, hasItem("net.grinder.scriptengine.groovy.GroovyScriptEngineService")); }
public ScriptEngineContainer(GrinderProperties properties, Logger logger, DCRContext dcrContext, ScriptLocation scriptLocation) throws EngineException { m_container.addComponent(properties); m_container.addComponent(logger); m_container.addComponent(scriptLocation); if (dcrContext != null) { m_container.addComponent(dcrContext); } for (Class<? extends ScriptEngineService> implementation : loadRegisteredImplementations(ScriptEngineService.RESOURCE_NAME, ScriptEngineService.class)) { m_container.addComponent(implementation); } }
names = allResourceLines(classLoader, resourceName);
loadRegisteredImplementations(DYNAMIC_COMPONENT_RESOURCE_NAME, classLoader)) {