Fixed Reactor-Netty SSL_conf 09/70709/2 1.1.1 3.0.0-ONAP 3.0.1-ONAP
authorwasala <przemyslaw.wasala@nokia.com>
Thu, 18 Oct 2018 06:07:37 +0000 (08:07 +0200)
committerwasala <przemyslaw.wasala@nokia.com>
Thu, 18 Oct 2018 08:24:00 +0000 (10:24 +0200)
*Error calling secure AAI http client

Change-Id: Ie4ba090f9ed33e134d584270e3ae875cd54472b6
Issue-ID: DCAEGEN2-870
Signed-off-by: wasala <przemyslaw.wasala@nokia.com>
prh-aai-client/src/main/java/org/onap/dcaegen2/services/prh/service/AaiReactiveWebClient.java
prh-aai-client/src/test/java/org/onap/dcaegen2/services/prh/service/producer/AaiProducerReactiveHttpClientTest.java
prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParser.java
prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfigTest.java

index 256aa3b..5963d9c 100644 (file)
@@ -27,20 +27,18 @@ import static org.springframework.web.reactive.function.client.ExchangeFilterFun
 import io.netty.handler.ssl.SslContext;
 import io.netty.handler.ssl.SslContextBuilder;
 import io.netty.handler.ssl.util.InsecureTrustManagerFactory;
-
 import java.util.Map;
 import javax.net.ssl.SSLException;
-
 import org.onap.dcaegen2.services.prh.config.AaiClientConfiguration;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.MDC;
 import org.springframework.http.client.reactive.ClientHttpConnector;
 import org.springframework.http.client.reactive.ReactorClientHttpConnector;
-import org.springframework.http.client.reactive.ReactorResourceFactory;
 import org.springframework.web.reactive.function.client.ExchangeFilterFunction;
 import org.springframework.web.reactive.function.client.WebClient;
 import reactor.core.publisher.Mono;
+import reactor.netty.http.client.HttpClient;
 
 
 public class AaiReactiveWebClient {
@@ -75,8 +73,8 @@ public class AaiReactiveWebClient {
             .forClient()
             .trustManager(InsecureTrustManagerFactory.INSTANCE)
             .build();
-        ClientHttpConnector reactorClientHttpConnector = new ReactorClientHttpConnector(new ReactorResourceFactory(),
-            httpClient -> httpClient.secure(sslContextSpec -> sslContextSpec.sslContext(sslContext)));
+        ClientHttpConnector reactorClientHttpConnector = new ReactorClientHttpConnector(
+            HttpClient.create().secure(sslContextSpec -> sslContextSpec.sslContext(sslContext)));
         return WebClient.builder()
             .clientConnector(reactorClientHttpConnector)
             .defaultHeaders(httpHeaders -> httpHeaders.setAll(aaiHeaders))
index 5fd966d..d8002fb 100644 (file)
@@ -48,11 +48,11 @@ import reactor.test.StepVerifier;
 class AaiProducerReactiveHttpClientTest {
 
     private static final Integer SUCCESS_RESPONSE = 200;
-    private static AaiProducerReactiveHttpClient aaiProducerReactiveHttpClient;
     private static AaiClientConfiguration aaiConfigurationMock = mock(AaiClientConfiguration.class);
-    private static WebClient webClient = mock(WebClient.class);
 
 
+    private AaiProducerReactiveHttpClient aaiProducerReactiveHttpClient;
+    private WebClient webClient = mock(WebClient.class);
     private ConsumerDmaapModel dmaapModel = spy(new ConsumerDmaapModelForUnitTest());
     private WebClient.RequestBodyUriSpec requestBodyUriSpec;
     private ResponseSpec responseSpec;
index bf3987c..4749b52 100644 (file)
@@ -23,6 +23,8 @@ package org.onap.dcaegen2.services.prh.service;
 import com.google.gson.JsonElement;
 import com.google.gson.JsonObject;
 import com.google.gson.JsonParser;
+import java.util.Optional;
+import java.util.stream.StreamSupport;
 import org.onap.dcaegen2.services.prh.exceptions.DmaapNotFoundException;
 import org.onap.dcaegen2.services.prh.model.ConsumerDmaapModel;
 import org.onap.dcaegen2.services.prh.model.ImmutableConsumerDmaapModel;
@@ -32,8 +34,6 @@ import org.springframework.util.StringUtils;
 import reactor.core.publisher.Flux;
 import reactor.core.publisher.Mono;
 
-import java.util.Optional;
-import java.util.stream.StreamSupport;
 
 /**
  * @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 5/8/18
index 0186630..c4c86db 100644 (file)
@@ -77,8 +77,8 @@ class PrhAppConfigTest {
         + "\"dmaapHostName\":\"localhost\",\"dmaapPortNumber\":2223,\"dmaapProtocol\":\"http\",\"dmaaptopicName\""
         + ":\"temp\",\"dmaapuserName\":\"admin\",\"dmaapuserPassword\":\"admin\"}}}}";
 
-    private static PrhAppConfig prhAppConfig;
-    private static AppConfig appConfig;
+    private PrhAppConfig prhAppConfig;
+    private AppConfig appConfig;
 
     private static InputStream inputStream;