use of org.jboss.modules.ModuleLoadException in project jboss-modules by jboss-modules.
the class __RedirectedUtils method loadProvider.
static <T> Supplier<T> loadProvider(String id, Class<T> intf, ModuleLoader moduleLoader, String name) {
Module module;
try {
module = moduleLoader.loadModule(id);
} catch (ModuleLoadException e) {
getModuleLogger().providerUnloadable(id, null);
return null;
}
ModuleClassLoader classLoader = module.getClassLoader();
return loadProvider(intf, classLoader, name);
}
use of org.jboss.modules.ModuleLoadException in project pentaho-platform by pentaho.
the class SystemPackageExtrapolatorTest method testJBossProvider.
@Test
public void testJBossProvider() {
SystemPackageExtrapolator.JBossModulePackageProvider jBossModulePackageProvider = new SystemPackageExtrapolator.JBossModulePackageProvider();
Set<String> packages = jBossModulePackageProvider.getPackages();
assertThat(packages, is(empty()));
ModuleIdentifier moduleIdentifier = ModuleIdentifier.create("org.pentaho.test.module");
ModuleSpec.Builder builder = ModuleSpec.build(moduleIdentifier);
builder.addDependency(DependencySpec.createSystemDependencySpec(new HashSet<String>(Arrays.asList("org.apache", "org.apache.logging.log4j"))));
final ModuleSpec moduleSpec = builder.create();
ModuleLoader loader = new ModuleLoader(new ModuleFinder[] { new ModuleFinder() {
@Override
public ModuleSpec findModule(ModuleIdentifier moduleIdentifier, ModuleLoader moduleLoader) throws ModuleLoadException {
return moduleSpec;
}
} });
try {
Module module = loader.loadModule(moduleIdentifier);
jBossModulePackageProvider.setModule(module);
} catch (ModuleLoadException e) {
e.printStackTrace();
}
packages = jBossModulePackageProvider.getPackages();
assertThat(packages, contains("org.apache.logging.log4j", "org.apache"));
assertThat(packages, not(contains("org.not.there")));
}
Aggregations