From 6c0a183a2f2469d42acd6b32133785329e370155 Mon Sep 17 00:00:00 2001 From: Brian Harrington Date: Wed, 25 Nov 2015 16:13:25 -0800 Subject: [PATCH] verify guice inject works with EurekaClient --- .../main/java/com/netflix/iep/eureka/HandlerProvider.java | 1 - .../java/com/netflix/iep/eureka/EurekaModuleTest.java | 8 ++++++++ .../main/java/com/netflix/iep/rxnetty/RxNettyModule.java | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/iep-module-eureka/src/main/java/com/netflix/iep/eureka/HandlerProvider.java b/iep-module-eureka/src/main/java/com/netflix/iep/eureka/HandlerProvider.java index 16ae87ee..e7f8cf16 100644 --- a/iep-module-eureka/src/main/java/com/netflix/iep/eureka/HandlerProvider.java +++ b/iep-module-eureka/src/main/java/com/netflix/iep/eureka/HandlerProvider.java @@ -17,7 +17,6 @@ import com.google.inject.Inject; import com.netflix.appinfo.HealthCheckHandler; -import com.netflix.discovery.DiscoveryClient; import com.netflix.iep.service.ServiceManager; import javax.inject.Provider; diff --git a/iep-module-eureka/src/test/java/com/netflix/iep/eureka/EurekaModuleTest.java b/iep-module-eureka/src/test/java/com/netflix/iep/eureka/EurekaModuleTest.java index cbb306b4..e587953c 100644 --- a/iep-module-eureka/src/test/java/com/netflix/iep/eureka/EurekaModuleTest.java +++ b/iep-module-eureka/src/test/java/com/netflix/iep/eureka/EurekaModuleTest.java @@ -18,6 +18,7 @@ import com.google.inject.Guice; import com.google.inject.Injector; import com.netflix.discovery.DiscoveryClient; +import com.netflix.discovery.EurekaClient; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; @@ -33,4 +34,11 @@ public void getClient() { Assert.assertNotNull(client); } + @Test + public void getEurekaClient() { + Injector injector = Guice.createInjector(new EurekaModule()); + EurekaClient client = injector.getInstance(EurekaClient.class); + Assert.assertNotNull(client); + } + } diff --git a/iep-module-rxnetty/src/main/java/com/netflix/iep/rxnetty/RxNettyModule.java b/iep-module-rxnetty/src/main/java/com/netflix/iep/rxnetty/RxNettyModule.java index 1b28bb37..87b3b8fd 100644 --- a/iep-module-rxnetty/src/main/java/com/netflix/iep/rxnetty/RxNettyModule.java +++ b/iep-module-rxnetty/src/main/java/com/netflix/iep/rxnetty/RxNettyModule.java @@ -20,7 +20,7 @@ import com.google.inject.Inject; import com.google.inject.Provides; import com.netflix.config.ConfigurationManager; -import com.netflix.discovery.DiscoveryClient; +import com.netflix.discovery.EurekaClient; import com.netflix.iep.http.BasicServerRegistry; import com.netflix.iep.http.EurekaServerRegistry; import com.netflix.iep.http.RxHttp; @@ -41,7 +41,7 @@ private static class OptionalInjections { Configuration configuration; @Inject(optional = true) - DiscoveryClient discovery; + EurekaClient discovery; OptionalInjections() { }