use of com.google.inject.Injector in project hadoop by apache.
the class TestHSWebApp method testLogsView1.
@Test
public void testLogsView1() throws IOException {
LOG.info("HsLogsPage");
Injector injector = WebAppTests.testPage(AggregatedLogsPage.class, AppContext.class, new MockAppContext(0, 1, 1, 1));
PrintWriter spyPw = WebAppTests.getPrintWriter(injector);
verify(spyPw).write("Cannot get container logs without a ContainerId");
verify(spyPw).write("Cannot get container logs without a NodeId");
verify(spyPw).write("Cannot get container logs without an app owner");
}
use of com.google.inject.Injector in project useful-java-links by Vedenin.
the class GuiceConstructor method main.
public static void main(String[] args) throws Exception {
Injector injector = Guice.createInjector(new TestModule());
Notifier notifier = injector.getInstance(Notifier.class);
// Print "I send email: Hello world!"
notifier.send("Hello world!");
}
use of com.google.inject.Injector in project useful-java-links by Vedenin.
the class GuiceFieldInject method main.
public static void main(String[] args) throws Exception {
Injector injector = Guice.createInjector(new TestModule());
Notifier notifier = injector.getInstance(Notifier.class);
// Print "I send email: Hello world!"
notifier.send("Hello world!");
}
use of com.google.inject.Injector in project useful-java-links by Vedenin.
the class GuiceSetterInject method main.
public static void main(String[] args) throws Exception {
Injector injector = Guice.createInjector(new TestModule());
Notifier notifier = injector.getInstance(Notifier.class);
// Print "I send email: Hello world!"
notifier.send("Hello world!");
}
use of com.google.inject.Injector in project ribbon by Netflix.
the class RxMovieProxyExampleTest method shouldBindCustomClientConfigFactory.
@Test
public void shouldBindCustomClientConfigFactory() {
ConfigurationManager.getConfigInstance().setProperty(MovieService.class.getSimpleName() + ".MyConfig.listOfServers", "localhost:" + port);
Injector injector = Guice.createInjector(new AbstractModule() {
@Override
protected void configure() {
bind(RibbonResourceFactory.class).to(DefaultResourceFactory.class).in(Scopes.SINGLETON);
bind(RibbonTransportFactory.class).to(DefaultRibbonTransportFactory.class).in(Scopes.SINGLETON);
bind(AnnotationProcessorsProvider.class).to(DefaultAnnotationProcessorsProvider.class).in(Scopes.SINGLETON);
bind(ClientConfigFactory.class).to(MyClientConfigFactory.class).in(Scopes.SINGLETON);
}
}, new AbstractModule() {
@Override
protected void configure() {
bind(MovieService.class).toProvider(new RibbonResourceProvider<MovieService>(MovieService.class)).asEagerSingleton();
}
});
RxMovieProxyExample example = injector.getInstance(RxMovieProxyExample.class);
assertTrue(example.runExample());
}
Aggregations