use of com.netflix.ribbon.examples.rx.proxy.RxMovieProxyExample 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());
}
use of com.netflix.ribbon.examples.rx.proxy.RxMovieProxyExample in project ribbon by Netflix.
the class RxMovieProxyExampleTest method shouldBind.
@Test
public void shouldBind() {
ConfigurationManager.getConfigInstance().setProperty(MovieService.class.getSimpleName() + ".ribbon.listOfServers", "localhost:" + port);
Injector injector = Guice.createInjector(new RibbonModule(), 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