From a5d5dbf2039fb04519f09bb8996216663c64b66e Mon Sep 17 00:00:00 2001 From: yogesh-hullatti Date: Mon, 10 Feb 2020 16:23:18 +0000 Subject: [PATCH] Updated the changes for proxy --- .../gov/hmcts/reform/em/FooConfiguration.java | 24 ------------------- .../reform/em/test/idam/DeleteUserApi.java | 3 +-- .../em/test/idam/IdamConfiguration.java | 16 +++++++++++++ 3 files changed, 17 insertions(+), 26 deletions(-) delete mode 100644 src/main/java/uk/gov/hmcts/reform/em/FooConfiguration.java diff --git a/src/main/java/uk/gov/hmcts/reform/em/FooConfiguration.java b/src/main/java/uk/gov/hmcts/reform/em/FooConfiguration.java deleted file mode 100644 index 39d7896..0000000 --- a/src/main/java/uk/gov/hmcts/reform/em/FooConfiguration.java +++ /dev/null @@ -1,24 +0,0 @@ -package uk.gov.hmcts.reform.em; - -import okhttp3.OkHttpClient; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Scope; - -import java.net.InetSocketAddress; -import java.net.Proxy; - -@Configuration -public class FooConfiguration { - - @Bean - @Scope("prototype") - public OkHttpClient client() { - - OkHttpClient okHttpClient = new OkHttpClient.Builder() - .proxy(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("proxyout.reform.hmcts.net", 8080))) - .build(); - - return okHttpClient; - } -} diff --git a/src/main/java/uk/gov/hmcts/reform/em/test/idam/DeleteUserApi.java b/src/main/java/uk/gov/hmcts/reform/em/test/idam/DeleteUserApi.java index dad549c..a9de6c8 100644 --- a/src/main/java/uk/gov/hmcts/reform/em/test/idam/DeleteUserApi.java +++ b/src/main/java/uk/gov/hmcts/reform/em/test/idam/DeleteUserApi.java @@ -6,12 +6,11 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; -import uk.gov.hmcts.reform.em.FooConfiguration; @FeignClient( name = "idam-test-api-delete", url = "${idam.api.url}/testing-support", - configuration = FooConfiguration.class + configuration = IdamConfiguration.class ) @ConditionalOnProperty("idam.api.url") public interface DeleteUserApi { diff --git a/src/main/java/uk/gov/hmcts/reform/em/test/idam/IdamConfiguration.java b/src/main/java/uk/gov/hmcts/reform/em/test/idam/IdamConfiguration.java index 4dbf618..dfccdc6 100644 --- a/src/main/java/uk/gov/hmcts/reform/em/test/idam/IdamConfiguration.java +++ b/src/main/java/uk/gov/hmcts/reform/em/test/idam/IdamConfiguration.java @@ -1,13 +1,18 @@ package uk.gov.hmcts.reform.em.test.idam; +import okhttp3.OkHttpClient; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Scope; import uk.gov.hmcts.reform.idam.client.IdamClient; import uk.gov.hmcts.reform.idam.client.IdamTestApi; +import java.net.InetSocketAddress; +import java.net.Proxy; + @Configuration @ConditionalOnProperty("idam.api.url") @ComponentScan(basePackages = "uk.gov.hmcts.reform.idam.client") @@ -18,4 +23,15 @@ public class IdamConfiguration { IdamHelper idamHelper(IdamClient idamClient, IdamTestApi idamTestApi, DeleteUserApi deleteUserApi) { return new IdamHelper(idamClient, idamTestApi, deleteUserApi); } + + @Bean + @Scope("prototype") + public OkHttpClient client() { + + OkHttpClient okHttpClient = new OkHttpClient.Builder() + .proxy(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("proxyout.reform.hmcts.net", 8080))) + .build(); + + return okHttpClient; + } }