use of com.cloudbees.sdk.extensibility.ExtensionFinder in project acceptance-test-harness by jenkinsci.
the class AdditionalBinderDsl method subworld.
/**
* Creates another injector and bind them using the given closure.
*
* The newly created injector will be returned.
*/
public SubWorld subworld(final Closure config) {
final Binder binder = getBinder();
// final SubWorldBuilder sub = new SubWorldBuilder(name);
try {
final SubWorld sw = new SubWorld();
World w = World.get();
sw.injector = Guice.createInjector(Modules.override(new ExtensionFinder(w.getClassLoader())).with(new AbstractModule() {
@Override
protected void configure() {
AdditionalBinderDsl.this.setBinder(binder());
config.setDelegate(AdditionalBinderDsl.this);
config.run();
bind(SubWorld.class).toInstance(sw);
}
}));
return sw;
} catch (CreationException e) {
throw new RuntimeException("Failed to create a sub-world", e);
} finally {
setBinder(binder);
}
}
use of com.cloudbees.sdk.extensibility.ExtensionFinder in project acceptance-test-harness by jenkinsci.
the class World method configure.
@Override
protected void configure() {
// lowest priority is our default binding
Module m = new FallbackConfig();
// let extensions override the fallback config
m = Modules.override(m).with(new ExtensionFinder(cl));
// user config trumps everything
m = Modules.override(m).with(new Config());
install(m);
}
Aggregations