Search in sources :

Example 1 with RibbonModule

use of com.netflix.ribbon.guice.RibbonModule in project ribbon by Netflix.

the class RibbonModuleTest method shouldBind.

@Test
public void shouldBind() {
    Injector injector = Guice.createInjector(new RibbonModule());
    MyService service = injector.getInstance(MyService.class);
    service.runExample();
}
Also used : Injector(com.google.inject.Injector) RibbonModule(com.netflix.ribbon.guice.RibbonModule) Test(org.junit.Test)

Example 2 with RibbonModule

use of com.netflix.ribbon.guice.RibbonModule 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());
}
Also used : MovieService(com.netflix.ribbon.examples.rx.proxy.MovieService) Injector(com.google.inject.Injector) RibbonModule(com.netflix.ribbon.guice.RibbonModule) RxMovieProxyExample(com.netflix.ribbon.examples.rx.proxy.RxMovieProxyExample) AbstractModule(com.google.inject.AbstractModule) Test(org.junit.Test)

Aggregations

Injector (com.google.inject.Injector)2 RibbonModule (com.netflix.ribbon.guice.RibbonModule)2 Test (org.junit.Test)2 AbstractModule (com.google.inject.AbstractModule)1 MovieService (com.netflix.ribbon.examples.rx.proxy.MovieService)1 RxMovieProxyExample (com.netflix.ribbon.examples.rx.proxy.RxMovieProxyExample)1