SDK integration: use aai in PRH 27/74127/2
authormicdzied <michal.1.dziedzic@nokia.com>
Mon, 3 Dec 2018 10:01:37 +0000 (11:01 +0100)
committermicdzied <michal.1.dziedzic@nokia.com>
Mon, 3 Dec 2018 13:10:04 +0000 (14:10 +0100)
Change-Id: I68c9a5323e05a27de463bef9dd368f8a092559ae
Issue-ID: DCAEGEN2-1013
Signed-off-by: micdzied <michal.1.dziedzic@nokia.com>
31 files changed:
pom.xml
prh-aai-client/pom.xml [deleted file]
prh-aai-client/src/main/java/org/onap/dcaegen2/services/prh/config/AaiClientConfiguration.java [deleted file]
prh-aai-client/src/main/java/org/onap/dcaegen2/services/prh/service/AaiReactiveWebClientFactory.java [deleted file]
prh-aai-client/src/main/java/org/onap/dcaegen2/services/prh/service/producer/AaiProducerReactiveHttpClient.java [deleted file]
prh-aai-client/src/test/java/org/onap/dcaegen2/services/prh/service/AaiReactiveWebClientFactoryTest.java [deleted file]
prh-aai-client/src/test/java/org/onap/dcaegen2/services/prh/service/producer/AaiProducerReactiveHttpClientTest.java [deleted file]
prh-aai-client/src/test/resources/logback-test.xml [deleted file]
prh-app-server/pom.xml
prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/AppConfig.java
prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/CloudConfigParser.java
prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/CloudConfiguration.java
prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/Config.java
prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfig.java
prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParser.java
prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTask.java
prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTaskImpl.java
prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTask.java
prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImpl.java
prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTask.java
prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTaskImpl.java
prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTasks.java
prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/TestAppConfiguration.java
prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/CloudConfigParserTest.java
prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParserTest.java
prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTaskImplTest.java
prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiPublisherTaskSpy.java
prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImplTest.java
prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskSpy.java
prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapProducerTaskSpy.java
prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTaskImplTest.java

diff --git a/pom.xml b/pom.xml
index 322bf65..1e7c9f0 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -60,7 +60,6 @@
 
   <modules>
     <module>prh-app-server</module>
-    <module>prh-aai-client</module>
     <module>prh-dmaap-client</module>
     <module>prh-commons</module>
   </modules>
         <artifactId>cbs-client</artifactId>
         <version>1.0.0-SNAPSHOT</version>
       </dependency>
+      <dependency>
+        <groupId>org.onap.dcaegen2.services.sdk.rest.services</groupId>
+        <artifactId>aai-client</artifactId>
+        <version>1.0.0-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.onap.dcaegen2.services.sdk.rest.services</groupId>
+        <artifactId>dmaap-client</artifactId>
+        <version>1.0.0-SNAPSHOT</version>
+      </dependency>
 
       <dependency>
         <groupId>ch.qos.logback</groupId>
diff --git a/prh-aai-client/pom.xml b/prh-aai-client/pom.xml
deleted file mode 100644 (file)
index 733ce0e..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ ============LICENSE_START=======================================================
-  ~ PNF-REGISTRATION-HANDLER
-  ~ ================================================================================
-  ~ Copyright (C) 2018 NOKIA Intellectual Property. All rights reserved.
-  ~ ================================================================================
-  ~ Licensed under the Apache License, Version 2.0 (the "License");
-  ~ you may not use this file except in compliance with the License.
-  ~ You may obtain a copy of the License at
-  ~
-  ~      http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~ See the License for the specific language governing permissions and
-  ~ limitations under the License.
-  ~ ============LICENSE_END=========================================================
-  -->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-
-  <parent>
-    <groupId>org.onap.dcaegen2.services</groupId>
-    <artifactId>prh</artifactId>
-    <version>1.2.0-SNAPSHOT</version>
-  </parent>
-
-  <groupId>org.onap.dcaegen2.services.prh</groupId>
-  <artifactId>prh-aai-client</artifactId>
-  <packaging>jar</packaging>
-
-  <dependencies>
-    <dependency>
-      <groupId>org.immutables</groupId>
-      <artifactId>value</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.immutables</groupId>
-      <artifactId>gson</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.springframework</groupId>
-      <artifactId>spring-beans</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.springframework</groupId>
-      <artifactId>spring-core</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.springframework</groupId>
-      <artifactId>spring-context</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.springframework</groupId>
-      <artifactId>spring-web</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.springframework</groupId>
-      <artifactId>spring-webflux</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.springframework.boot</groupId>
-      <artifactId>spring-boot-starter-reactor-netty</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>io.projectreactor.netty</groupId>
-      <artifactId>reactor-netty</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.onap.dcaegen2.services.prh</groupId>
-      <artifactId>prh-commons</artifactId>
-      <version>${project.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>ch.qos.logback</groupId>
-      <artifactId>logback-classic</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>jul-to-slf4j</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>log4j-over-slf4j</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.junit.jupiter</groupId>
-      <artifactId>junit-jupiter-api</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.junit.jupiter</groupId>
-      <artifactId>junit-jupiter-engine</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.junit.vintage</groupId>
-      <artifactId>junit-vintage-engine</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.mockito</groupId>
-      <artifactId>mockito-core</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>io.projectreactor</groupId>
-      <artifactId>reactor-test</artifactId>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
-</project>
diff --git a/prh-aai-client/src/main/java/org/onap/dcaegen2/services/prh/config/AaiClientConfiguration.java b/prh-aai-client/src/main/java/org/onap/dcaegen2/services/prh/config/AaiClientConfiguration.java
deleted file mode 100644 (file)
index 23e621f..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * PNF-REGISTRATION-HANDLER
- * ================================================================================
- * Copyright (C) 2018 NOKIA Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.dcaegen2.services.prh.config;
-
-import java.io.Serializable;
-import java.util.Map;
-import org.immutables.gson.Gson;
-import org.immutables.value.Value;
-import org.springframework.stereotype.Component;
-
-
-@Component
-@Value.Immutable(prehash = true)
-@Value.Style(builder = "new")
-@Gson.TypeAdapters
-public abstract class AaiClientConfiguration implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
-    @Value.Parameter
-    public abstract String aaiHost();
-
-    @Value.Parameter
-    public abstract Integer aaiPort();
-
-    @Value.Parameter
-    public abstract String aaiProtocol();
-
-    @Value.Parameter
-    public abstract String aaiUserName();
-
-    @Value.Parameter
-    public abstract String aaiUserPassword();
-
-    @Value.Parameter
-    public abstract Boolean aaiIgnoreSslCertificateErrors();
-
-    @Value.Parameter
-    public abstract String aaiBasePath();
-
-    @Value.Parameter
-    public abstract String aaiPnfPath();
-
-    @Value.Parameter
-    public abstract Map<String, String> aaiHeaders();
-
-    @Value.Parameter
-    public abstract String trustStorePath();
-
-    @Value.Parameter
-    public abstract  String trustStorePasswordPath();
-
-    @Value.Parameter
-    public abstract String keyStorePath();
-
-    @Value.Parameter
-    public abstract String keyStorePasswordPath();
-
-    @Value.Parameter
-    public abstract Boolean enableAaiCertAuth();
-
-}
diff --git a/prh-aai-client/src/main/java/org/onap/dcaegen2/services/prh/service/AaiReactiveWebClientFactory.java b/prh-aai-client/src/main/java/org/onap/dcaegen2/services/prh/service/AaiReactiveWebClientFactory.java
deleted file mode 100644 (file)
index e4f330e..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * PNF-REGISTRATION-HANDLER
- * ================================================================================
- * Copyright (C) 2018 NOKIA Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.dcaegen2.services.prh.service;
-
-import static org.onap.dcaegen2.services.prh.model.logging.MdcVariables.RESPONSE_CODE;
-import static org.onap.dcaegen2.services.prh.model.logging.MdcVariables.SERVICE_NAME;
-import static org.springframework.web.reactive.function.client.ExchangeFilterFunctions.basicAuthentication;
-
-import io.netty.handler.ssl.SslContext;
-import java.util.Map;
-import javax.net.ssl.SSLException;
-import org.onap.dcaegen2.services.prh.config.AaiClientConfiguration;
-import org.onap.dcaegen2.services.prh.ssl.SslFactory;
-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.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 AaiReactiveWebClientFactory {
-
-    private static final Logger LOGGER = LoggerFactory.getLogger(AaiReactiveWebClientFactory.class);
-
-    private final String aaiUserName;
-    private final String aaiUserPassword;
-    private final Map<String, String> aaiHeaders;
-    private final Boolean enableAaiCertAuth;
-    private final String trustStorePath;
-    private final String trustStorePasswordPath;
-    private final String keyStorePath;
-    private final String keyStorePasswordPath;
-    private final SslFactory sslFactory;
-
-    /**
-     * Creating AaiReactiveWebClientFactory.
-     *
-     * @param configuration - configuration object
-     * @param sslFactory - factory for ssl setup
-     */
-    public AaiReactiveWebClientFactory(SslFactory sslFactory, AaiClientConfiguration configuration) {
-        this.aaiUserName = configuration.aaiUserName();
-        this.aaiUserPassword = configuration.aaiUserPassword();
-        this.aaiHeaders = configuration.aaiHeaders();
-        this.trustStorePath = configuration.trustStorePath();
-        this.trustStorePasswordPath = configuration.trustStorePasswordPath();
-        this.keyStorePath = configuration.keyStorePath();
-        this.keyStorePasswordPath = configuration.keyStorePasswordPath();
-        this.enableAaiCertAuth = configuration.enableAaiCertAuth();
-        this.sslFactory = sslFactory;
-    }
-
-    /**
-     * Construct Reactive WebClient with appropriate settings.
-     *
-     * @return WebClient
-     */
-    public WebClient build() throws SSLException {
-        LOGGER.debug("Setting ssl context");
-        
-        SslContext sslContext = createSslContext();
-        
-        ClientHttpConnector reactorClientHttpConnector = new ReactorClientHttpConnector(
-            HttpClient.create().secure(sslContextSpec -> sslContextSpec.sslContext(sslContext)));
-
-        return WebClient.builder()
-            .clientConnector(reactorClientHttpConnector)
-            .defaultHeaders(httpHeaders -> httpHeaders.setAll(aaiHeaders))
-            .filter(basicAuthentication(aaiUserName, aaiUserPassword))
-            .filter(logRequest())
-            .filter(logResponse())
-            .build();
-    }
-
-    private SslContext createSslContext() throws SSLException {
-        if (enableAaiCertAuth) {
-            return sslFactory.createSecureContext(
-                keyStorePath,
-                keyStorePasswordPath,
-                trustStorePath,
-                trustStorePasswordPath
-            );
-        }
-        return sslFactory.createInsecureContext();
-    }
-    
-    private ExchangeFilterFunction logRequest() {
-        return ExchangeFilterFunction.ofRequestProcessor(clientRequest -> {
-            MDC.put(SERVICE_NAME, String.valueOf(clientRequest.url()));
-            LOGGER.info("Request: {} {}", clientRequest.method(), clientRequest.url());
-            clientRequest.headers()
-                .forEach((name, values) -> values.forEach(value -> LOGGER.info("{}={}", name, value)));
-            MDC.remove(SERVICE_NAME);
-            return Mono.just(clientRequest);
-        });
-    }
-
-    private ExchangeFilterFunction logResponse() {
-        return ExchangeFilterFunction.ofResponseProcessor(clientResponse -> {
-            MDC.put(RESPONSE_CODE, String.valueOf(clientResponse.statusCode()));
-            LOGGER.info("Response Status {}", clientResponse.statusCode());
-            MDC.remove(RESPONSE_CODE);
-            return Mono.just(clientResponse);
-        });
-    }
-}
diff --git a/prh-aai-client/src/main/java/org/onap/dcaegen2/services/prh/service/producer/AaiProducerReactiveHttpClient.java b/prh-aai-client/src/main/java/org/onap/dcaegen2/services/prh/service/producer/AaiProducerReactiveHttpClient.java
deleted file mode 100644 (file)
index 43f6ce9..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * PNF-REGISTRATION-HANDLER
- * ================================================================================
- * Copyright (C) 2018 NOKIA Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.dcaegen2.services.prh.service.producer;
-
-import static org.onap.dcaegen2.services.prh.model.CommonFunctions.createJsonBody;
-import static org.onap.dcaegen2.services.prh.model.logging.MdcVariables.REQUEST_ID;
-import static org.onap.dcaegen2.services.prh.model.logging.MdcVariables.X_INVOCATION_ID;
-import static org.onap.dcaegen2.services.prh.model.logging.MdcVariables.X_ONAP_REQUEST_ID;
-
-import java.net.URI;
-import java.util.UUID;
-import org.onap.dcaegen2.services.prh.config.AaiClientConfiguration;
-import org.onap.dcaegen2.services.prh.model.ConsumerDmaapModel;
-import org.slf4j.MDC;
-import org.springframework.web.reactive.function.client.ClientResponse;
-import org.springframework.web.reactive.function.client.WebClient;
-import org.springframework.web.util.DefaultUriBuilderFactory;
-import reactor.core.publisher.Mono;
-
-
-public class AaiProducerReactiveHttpClient {
-
-    private WebClient webClient;
-    private final String aaiHost;
-    private final String aaiProtocol;
-    private final Integer aaiHostPortNumber;
-    private final String aaiBasePath;
-    private final String aaiPnfPath;
-
-    /**
-     * Constructor of AaiProducerReactiveHttpClient.
-     *
-     * @param configuration - AAI producer configuration object
-     */
-    public AaiProducerReactiveHttpClient(AaiClientConfiguration configuration) {
-        this.aaiHost = configuration.aaiHost();
-        this.aaiProtocol = configuration.aaiProtocol();
-        this.aaiHostPortNumber = configuration.aaiPort();
-        this.aaiBasePath = configuration.aaiBasePath();
-        this.aaiPnfPath = configuration.aaiPnfPath();
-    }
-
-    /**
-     * Function for calling AAI Http producer - patch request to AAI database.
-     *
-     * @param consumerDmaapModelMono - object which will be sent to AAI database
-     * @return status code of operation
-     */
-    public Mono<ClientResponse> getAaiProducerResponse(ConsumerDmaapModel consumerDmaapModelMono) {
-        return patchAaiRequest(consumerDmaapModelMono);
-    }
-
-    public AaiProducerReactiveHttpClient createAaiWebClient(WebClient webClient) {
-        this.webClient = webClient;
-        return this;
-    }
-
-    private Mono<ClientResponse> patchAaiRequest(ConsumerDmaapModel dmaapModel) {
-        return
-            webClient.patch()
-                .uri(getUri(dmaapModel.getCorrelationId()))
-                .header(X_ONAP_REQUEST_ID, MDC.get(REQUEST_ID))
-                .header(X_INVOCATION_ID, UUID.randomUUID().toString())
-                .body(Mono.just(createJsonBody(dmaapModel)), String.class)
-                .exchange();
-    }
-
-    URI getUri(String pnfName) {
-        return new DefaultUriBuilderFactory().builder().scheme(aaiProtocol).host(aaiHost).port(aaiHostPortNumber)
-            .path(aaiBasePath + aaiPnfPath + "/" + pnfName).build();
-    }
-}
\ No newline at end of file
diff --git a/prh-aai-client/src/test/java/org/onap/dcaegen2/services/prh/service/AaiReactiveWebClientFactoryTest.java b/prh-aai-client/src/test/java/org/onap/dcaegen2/services/prh/service/AaiReactiveWebClientFactoryTest.java
deleted file mode 100644 (file)
index bd976ab..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * PNF-REGISTRATION-HANDLER
- * ================================================================================
- * Copyright (C) 2018 NOKIA Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.dcaegen2.services.prh.service;
-
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import javax.net.ssl.SSLException;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-import org.onap.dcaegen2.services.prh.config.AaiClientConfiguration;
-import org.onap.dcaegen2.services.prh.ssl.SslFactory;
-
-
-class AaiReactiveWebClientFactoryTest {
-
-    private static final String TRUST_STORE_PATH = "trust_store_path";
-    private static final String TRUST_STORE_PASS_PATH = "trust_store_pass_path";
-    private static final String KEY_STORE_PATH = "key_store_path";
-    private static final String KEY_STORE_PASS_PATH = "key_store_pass_path";
-    private SslFactory sslFactory = mock(SslFactory.class);
-    private AaiClientConfiguration aaiClientConfiguration = mock(AaiClientConfiguration.class);
-    private AaiReactiveWebClientFactory aaiReactiveWebClientFactory;
-
-    @Test
-    void shouldCreateWebClientWithSecureSslContext() throws SSLException {
-        givenEnabledAaiCertAuthConfiguration();
-        aaiReactiveWebClientFactory = new AaiReactiveWebClientFactory(sslFactory, aaiClientConfiguration);
-
-        Assertions.assertNotNull(aaiReactiveWebClientFactory.build());
-        verify(sslFactory).createSecureContext(KEY_STORE_PATH, KEY_STORE_PASS_PATH,
-                TRUST_STORE_PATH, TRUST_STORE_PASS_PATH);
-    }
-
-    @Test
-    void shouldCreateWebClientWithInsecureSslContext() throws SSLException {
-        when(aaiClientConfiguration.enableAaiCertAuth()).thenReturn(false);
-        aaiReactiveWebClientFactory = new AaiReactiveWebClientFactory(sslFactory, aaiClientConfiguration);
-
-        Assertions.assertNotNull(aaiReactiveWebClientFactory.build());
-        verify(sslFactory).createInsecureContext();
-    }
-
-    private void givenEnabledAaiCertAuthConfiguration() {
-        when(aaiClientConfiguration.enableAaiCertAuth()).thenReturn(true);
-        when(aaiClientConfiguration.trustStorePath()).thenReturn(TRUST_STORE_PATH);
-        when(aaiClientConfiguration.trustStorePasswordPath()).thenReturn(TRUST_STORE_PASS_PATH);
-        when(aaiClientConfiguration.keyStorePath()).thenReturn(KEY_STORE_PATH);
-        when(aaiClientConfiguration.keyStorePasswordPath()).thenReturn(KEY_STORE_PASS_PATH);
-    }
-}
\ No newline at end of file
diff --git a/prh-aai-client/src/test/java/org/onap/dcaegen2/services/prh/service/producer/AaiProducerReactiveHttpClientTest.java b/prh-aai-client/src/test/java/org/onap/dcaegen2/services/prh/service/producer/AaiProducerReactiveHttpClientTest.java
deleted file mode 100644 (file)
index de02d62..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * PNF-REGISTRATION-HANDLER
- * ================================================================================
- * Copyright (C) 2018 NOKIA Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.dcaegen2.services.prh.service.producer;
-
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
-import static org.springframework.web.reactive.function.client.ExchangeFilterFunctions.basicAuthentication;
-
-import java.net.URI;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.onap.dcaegen2.services.prh.config.AaiClientConfiguration;
-import org.onap.dcaegen2.services.prh.model.ConsumerDmaapModel;
-import org.onap.dcaegen2.services.prh.model.ConsumerDmaapModelForUnitTest;
-import org.springframework.web.reactive.function.client.ClientResponse;
-import org.springframework.web.reactive.function.client.WebClient;
-import org.springframework.web.reactive.function.client.WebClient.ResponseSpec;
-import reactor.core.publisher.Mono;
-import reactor.test.StepVerifier;
-
-class AaiProducerReactiveHttpClientTest {
-
-    private static final Integer SUCCESS_RESPONSE = 200;
-    private static AaiClientConfiguration aaiConfigurationMock = mock(AaiClientConfiguration.class);
-
-
-    private AaiProducerReactiveHttpClient aaiProducerReactiveHttpClient;
-    private WebClient webClient = mock(WebClient.class);
-    private ConsumerDmaapModel dmaapModel = spy(new ConsumerDmaapModelForUnitTest());
-    private WebClient.RequestBodyUriSpec requestBodyUriSpec;
-    private ResponseSpec responseSpec;
-
-    private Map<String, String> aaiHeaders;
-    private ClientResponse clientResponse;
-    private Mono<ClientResponse> clientResponseMono;
-
-    @BeforeEach
-    void setUp() {
-        setupHeaders();
-        clientResponse = mock(ClientResponse.class);
-        clientResponseMono = Mono.just(clientResponse);
-        when(dmaapModel.getCorrelationId()).thenReturn("NOKnhfsadhff");
-        when(aaiConfigurationMock.aaiHost()).thenReturn("54.45.33.2");
-        when(aaiConfigurationMock.aaiProtocol()).thenReturn("https");
-        when(aaiConfigurationMock.aaiPort()).thenReturn(1234);
-        when(aaiConfigurationMock.aaiUserName()).thenReturn("PRH");
-        when(aaiConfigurationMock.aaiUserPassword()).thenReturn("PRH");
-        when(aaiConfigurationMock.aaiBasePath()).thenReturn("/aai/v11");
-        when(aaiConfigurationMock.aaiPnfPath()).thenReturn("/network/pnfs/pnf");
-        when(aaiConfigurationMock.aaiHeaders()).thenReturn(aaiHeaders);
-
-        aaiProducerReactiveHttpClient = new AaiProducerReactiveHttpClient(aaiConfigurationMock);
-
-        webClient = spy(WebClient.builder()
-            .defaultHeaders(httpHeaders -> httpHeaders.setAll(aaiHeaders))
-            .filter(basicAuthentication(aaiConfigurationMock.aaiUserName(), aaiConfigurationMock.aaiUserPassword()))
-            .build());
-
-        requestBodyUriSpec = mock(WebClient.RequestBodyUriSpec.class);
-        responseSpec = mock(ResponseSpec.class);
-    }
-
-    @Test
-    void getAaiProducerResponse_shouldReturn200() {
-        //given
-        Mono<Integer> expectedResult = Mono.just(SUCCESS_RESPONSE);
-
-        //when
-        mockWebClientDependantObject();
-        doReturn(expectedResult).when(responseSpec).bodyToMono(Integer.class);
-        aaiProducerReactiveHttpClient.createAaiWebClient(webClient);
-
-        //then
-        StepVerifier.create(aaiProducerReactiveHttpClient.getAaiProducerResponse(dmaapModel)).expectSubscription()
-            .expectNextMatches(results -> {
-                Assertions.assertEquals(results, clientResponse);
-                return true;
-            }).verifyComplete();
-    }
-
-
-    @Test
-    void getAppropriateUri_whenPassingCorrectedPathForPnf() {
-        Assertions.assertEquals(aaiProducerReactiveHttpClient.getUri("NOKnhfsadhff"),
-            URI.create("https://54.45.33.2:1234/aai/v11/network/pnfs/pnf/NOKnhfsadhff"));
-    }
-
-
-    private void setupHeaders() {
-        aaiHeaders = new HashMap<>();
-        aaiHeaders.put("X-FromAppId", "PRH");
-        aaiHeaders.put("X-TransactionId", "vv-temp");
-        aaiHeaders.put("Accept", "application/json");
-        aaiHeaders.put("Real-Time", "true");
-        aaiHeaders.put("Content-Type", "application/merge-patch+json");
-    }
-
-    private void mockWebClientDependantObject() {
-        WebClient.RequestHeadersSpec requestHeadersSpec = mock(WebClient.RequestHeadersSpec.class);
-        when(webClient.patch()).thenReturn(requestBodyUriSpec);
-        when(requestBodyUriSpec.uri((URI) any())).thenReturn(requestBodyUriSpec);
-        when(requestBodyUriSpec.header(any(), any())).thenReturn(requestBodyUriSpec);
-        when(requestBodyUriSpec.body(any(), (Class<Object>) any())).thenReturn(requestHeadersSpec);
-        when(requestHeadersSpec.exchange()).thenReturn(clientResponseMono);
-    }
-}
-
diff --git a/prh-aai-client/src/test/resources/logback-test.xml b/prh-aai-client/src/test/resources/logback-test.xml
deleted file mode 100644 (file)
index c1f0066..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ ===============================LICENSE_START======================================
-  ~    Copyright Â© 2017 AT&T Intellectual Property. All rights reserved.
-  ~ ================================================================================
-  ~  Licensed under the Apache License, Version 2.0 (the "License");
-  ~  you may not use this file except in compliance with the License.
-  ~   You may obtain a copy of the License at
-  ~
-  ~          http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~  Unless required by applicable law or agreed to in writing, software
-  ~  distributed under the License is distributed on an "AS IS" BASIS,
-  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~  See the License for the specific language governing permissions and
-  ~  limitations under the License.
-  ~  ============================LICENSE_END===========================================
-  -->
-<configuration>
-  <root level="OFF"/>
-</configuration>
index 2ed127e..0357d79 100644 (file)
       <artifactId>prh-commons</artifactId>
       <version>${project.version}</version>
     </dependency>
+
     <dependency>
-      <groupId>org.onap.dcaegen2.services.prh</groupId>
-      <artifactId>prh-aai-client</artifactId>
-      <version>${project.version}</version>
+      <groupId>org.onap.dcaegen2.services.sdk.rest.services</groupId>
+      <artifactId>cbs-client</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.onap.dcaegen2.services.prh</groupId>
-      <artifactId>prh-dmaap-client</artifactId>
-      <version>${project.version}</version>
+      <groupId>org.onap.dcaegen2.services.sdk.rest.services</groupId>
+      <artifactId>aai-client</artifactId>
     </dependency>
     <dependency>
       <groupId>org.onap.dcaegen2.services.sdk.rest.services</groupId>
-      <artifactId>cbs-client</artifactId>
+      <artifactId>dmaap-client</artifactId>
     </dependency>
 
     <dependency>
index fd7c892..9988630 100644 (file)
@@ -23,12 +23,12 @@ package org.onap.dcaegen2.services.prh.configuration;
 import java.util.Objects;
 import java.util.Optional;
 import java.util.function.Predicate;
-import org.onap.dcaegen2.services.prh.config.AaiClientConfiguration;
-import org.onap.dcaegen2.services.prh.config.DmaapConsumerConfiguration;
-import org.onap.dcaegen2.services.prh.config.DmaapPublisherConfiguration;
-import org.onap.dcaegen2.services.prh.config.ImmutableAaiClientConfiguration;
-import org.onap.dcaegen2.services.prh.config.ImmutableDmaapConsumerConfiguration;
-import org.onap.dcaegen2.services.prh.config.ImmutableDmaapPublisherConfiguration;
+import org.onap.dcaegen2.services.sdk.rest.services.aai.client.config.AaiClientConfiguration;
+import org.onap.dcaegen2.services.sdk.rest.services.aai.client.config.ImmutableAaiClientConfiguration;
+import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.config.DmaapConsumerConfiguration;
+import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.config.DmaapPublisherConfiguration;
+import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.config.ImmutableDmaapConsumerConfiguration;
+import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.config.ImmutableDmaapPublisherConfiguration;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.context.properties.EnableConfigurationProperties;
 import org.springframework.context.annotation.Configuration;
index 660cdeb..9d7b339 100644 (file)
 package org.onap.dcaegen2.services.prh.configuration;
 
 import com.google.gson.JsonObject;
-import org.onap.dcaegen2.services.prh.config.AaiClientConfiguration;
-import org.onap.dcaegen2.services.prh.config.DmaapConsumerConfiguration;
-import org.onap.dcaegen2.services.prh.config.DmaapPublisherConfiguration;
-import org.onap.dcaegen2.services.prh.config.ImmutableAaiClientConfiguration;
-import org.onap.dcaegen2.services.prh.config.ImmutableDmaapConsumerConfiguration;
-import org.onap.dcaegen2.services.prh.config.ImmutableDmaapPublisherConfiguration;
+import org.onap.dcaegen2.services.sdk.rest.services.aai.client.config.AaiClientConfiguration;
+import org.onap.dcaegen2.services.sdk.rest.services.aai.client.config.ImmutableAaiClientConfiguration;
+import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.config.DmaapConsumerConfiguration;
+import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.config.DmaapPublisherConfiguration;
+import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.config.ImmutableDmaapConsumerConfiguration;
+import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.config.ImmutableDmaapPublisherConfiguration;
 
 /**
  * @author <a href="mailto:przemyslaw.wasala@nokia.com">PrzemysÅ‚aw WÄ…sala</a> on 8/21/18
index c862274..08c9962 100644 (file)
 package org.onap.dcaegen2.services.prh.configuration;
 
 import com.google.gson.JsonObject;
-import org.onap.dcaegen2.services.prh.config.*;
+import org.onap.dcaegen2.services.sdk.rest.services.aai.client.config.AaiClientConfiguration;
+import org.onap.dcaegen2.services.sdk.rest.services.aai.client.config.ImmutableAaiClientConfiguration;
 import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.http.configuration.EnvProperties;
 import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.providers.CloudConfigurationClient;
+import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.config.DmaapConsumerConfiguration;
+import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.config.DmaapPublisherConfiguration;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
index 776ece6..613e9a8 100644 (file)
@@ -20,9 +20,9 @@
 
 package org.onap.dcaegen2.services.prh.configuration;
 
-import org.onap.dcaegen2.services.prh.config.AaiClientConfiguration;
-import org.onap.dcaegen2.services.prh.config.DmaapConsumerConfiguration;
-import org.onap.dcaegen2.services.prh.config.DmaapPublisherConfiguration;
+import org.onap.dcaegen2.services.sdk.rest.services.aai.client.config.AaiClientConfiguration;
+import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.config.DmaapConsumerConfiguration;
+import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.config.DmaapPublisherConfiguration;
 
 /**
  * @author <a href="mailto:przemyslaw.wasala@nokia.com">PrzemysÅ‚aw WÄ…sala</a> on 4/25/18
index f66924b..612fab4 100644 (file)
@@ -32,9 +32,9 @@ import java.io.InputStreamReader;
 import java.nio.charset.StandardCharsets;
 import java.util.ServiceLoader;
 import javax.validation.constraints.NotNull;
-import org.onap.dcaegen2.services.prh.config.AaiClientConfiguration;
-import org.onap.dcaegen2.services.prh.config.DmaapConsumerConfiguration;
-import org.onap.dcaegen2.services.prh.config.DmaapPublisherConfiguration;
+import org.onap.dcaegen2.services.sdk.rest.services.aai.client.config.AaiClientConfiguration;
+import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.config.DmaapConsumerConfiguration;
+import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.config.DmaapPublisherConfiguration;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Value;
index 4749b52..b054213 100644 (file)
@@ -26,8 +26,8 @@ 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;
+import org.onap.dcaegen2.services.sdk.rest.services.model.ConsumerDmaapModel;
+import org.onap.dcaegen2.services.sdk.rest.services.model.ImmutableConsumerDmaapModel;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.util.StringUtils;
index 711d808..ecc9758 100644 (file)
 package org.onap.dcaegen2.services.prh.tasks;
 
 import javax.net.ssl.SSLException;
-import org.onap.dcaegen2.services.prh.config.AaiClientConfiguration;
 import org.onap.dcaegen2.services.prh.exceptions.AaiNotFoundException;
 import org.onap.dcaegen2.services.prh.exceptions.PrhTaskException;
-import org.onap.dcaegen2.services.prh.model.ConsumerDmaapModel;
-import org.onap.dcaegen2.services.prh.service.AaiReactiveWebClientFactory;
-import org.onap.dcaegen2.services.prh.service.producer.AaiProducerReactiveHttpClient;
-import org.onap.dcaegen2.services.prh.ssl.SslFactory;
+import org.onap.dcaegen2.services.sdk.rest.services.aai.client.config.AaiClientConfiguration;
+import org.onap.dcaegen2.services.sdk.rest.services.aai.client.service.AaiReactiveWebClientFactory;
+import org.onap.dcaegen2.services.sdk.rest.services.aai.client.service.http.patch.AaiReactiveHttpPatchClient;
+import org.onap.dcaegen2.services.sdk.rest.services.model.ConsumerDmaapModel;
+import org.onap.dcaegen2.services.sdk.rest.services.ssl.SslFactory;
 import org.springframework.web.reactive.function.client.WebClient;
 import reactor.core.publisher.Mono;
 
@@ -39,7 +39,7 @@ public abstract class AaiProducerTask {
 
     abstract Mono<ConsumerDmaapModel> publish(ConsumerDmaapModel message) throws AaiNotFoundException;
 
-    abstract AaiProducerReactiveHttpClient resolveClient() throws SSLException;
+    abstract AaiReactiveHttpPatchClient resolveClient() throws SSLException;
 
     protected abstract AaiClientConfiguration resolveConfiguration();
 
index a276d56..54d5710 100644 (file)
 package org.onap.dcaegen2.services.prh.tasks;
 
 import javax.net.ssl.SSLException;
-import org.onap.dcaegen2.services.prh.config.AaiClientConfiguration;
 import org.onap.dcaegen2.services.prh.configuration.Config;
 import org.onap.dcaegen2.services.prh.exceptions.AaiNotFoundException;
 import org.onap.dcaegen2.services.prh.exceptions.DmaapNotFoundException;
 import org.onap.dcaegen2.services.prh.exceptions.PrhTaskException;
-import org.onap.dcaegen2.services.prh.model.ConsumerDmaapModel;
 import org.onap.dcaegen2.services.prh.model.utils.HttpUtils;
-import org.onap.dcaegen2.services.prh.service.producer.AaiProducerReactiveHttpClient;
+import org.onap.dcaegen2.services.sdk.rest.services.aai.client.config.AaiClientConfiguration;
+import org.onap.dcaegen2.services.sdk.rest.services.aai.client.service.http.patch.AaiReactiveHttpPatchClient;
+import org.onap.dcaegen2.services.sdk.rest.services.model.ConsumerDmaapModel;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -46,7 +46,7 @@ public class AaiProducerTaskImpl extends
     private static final Logger LOGGER = LoggerFactory.getLogger(AaiProducerTaskImpl.class);
 
     private final Config config;
-    private AaiProducerReactiveHttpClient aaiProducerReactiveHttpClient;
+    private AaiReactiveHttpPatchClient aaiReactiveHttpPatchClient;
 
     @Autowired
     public AaiProducerTaskImpl(Config config) {
@@ -56,7 +56,7 @@ public class AaiProducerTaskImpl extends
     @Override
     Mono<ConsumerDmaapModel> publish(ConsumerDmaapModel consumerDmaapModel) {
         LOGGER.info("Publish to AAI DmaapModel");
-        return aaiProducerReactiveHttpClient.getAaiProducerResponse(consumerDmaapModel)
+        return aaiReactiveHttpPatchClient.getAaiProducerResponse(consumerDmaapModel)
             .flatMap(response -> {
                 if (HttpUtils.isSuccessfulResponseCode(response.statusCode().value())) {
                     return Mono.just(consumerDmaapModel);
@@ -67,8 +67,8 @@ public class AaiProducerTaskImpl extends
     }
 
     @Override
-    AaiProducerReactiveHttpClient resolveClient() throws SSLException {
-        return new AaiProducerReactiveHttpClient(resolveConfiguration()).createAaiWebClient(buildWebClient());
+    AaiReactiveHttpPatchClient resolveClient() throws SSLException {
+        return new AaiReactiveHttpPatchClient(resolveConfiguration()).createAaiWebClient(buildWebClient());
     }
 
     @Override
@@ -82,7 +82,7 @@ public class AaiProducerTaskImpl extends
         if (consumerDmaapModel == null) {
             throw new DmaapNotFoundException("Invoked null object to DMaaP task");
         }
-        aaiProducerReactiveHttpClient = resolveClient();
+        aaiReactiveHttpPatchClient = resolveClient();
         LOGGER.debug("Method called with arg {}", consumerDmaapModel);
         return publish(consumerDmaapModel);
 
index 005cc62..b44e54d 100644 (file)
@@ -21,8 +21,8 @@
 package org.onap.dcaegen2.services.prh.tasks;
 
 import javax.net.ssl.SSLException;
-import org.onap.dcaegen2.services.prh.model.ConsumerDmaapModel;
-import org.onap.dcaegen2.services.prh.service.consumer.DMaaPConsumerReactiveHttpClient;
+import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.service.consumer.DMaaPConsumerReactiveHttpClient;
+import org.onap.dcaegen2.services.sdk.rest.services.model.ConsumerDmaapModel;
 import reactor.core.publisher.Flux;
 
 
index e46ee89..eab14db 100644 (file)
@@ -22,11 +22,11 @@ package org.onap.dcaegen2.services.prh.tasks;
 
 import javax.net.ssl.SSLException;
 import org.onap.dcaegen2.services.prh.configuration.Config;
-import org.onap.dcaegen2.services.prh.model.ConsumerDmaapModel;
 import org.onap.dcaegen2.services.prh.service.DmaapConsumerJsonParser;
-import org.onap.dcaegen2.services.prh.service.consumer.ConsumerReactiveHttpClientFactory;
-import org.onap.dcaegen2.services.prh.service.consumer.DMaaPConsumerReactiveHttpClient;
-import org.onap.dcaegen2.services.prh.service.consumer.DMaaPReactiveWebClientFactory;
+import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.service.consumer.ConsumerReactiveHttpClientFactory;
+import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.service.consumer.DMaaPConsumerReactiveHttpClient;
+import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.service.consumer.DMaaPReactiveWebClientFactory;
+import org.onap.dcaegen2.services.sdk.rest.services.model.ConsumerDmaapModel;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
index 3f59815..1307968 100644 (file)
@@ -21,8 +21,8 @@
 package org.onap.dcaegen2.services.prh.tasks;
 
 import org.onap.dcaegen2.services.prh.exceptions.PrhTaskException;
-import org.onap.dcaegen2.services.prh.model.ConsumerDmaapModel;
-import org.onap.dcaegen2.services.prh.service.producer.DMaaPPublisherReactiveHttpClient;
+import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.service.producer.DMaaPPublisherReactiveHttpClient;
+import org.onap.dcaegen2.services.sdk.rest.services.model.ConsumerDmaapModel;
 import org.springframework.http.ResponseEntity;
 import reactor.core.publisher.Mono;
 
index d6ad540..259f16b 100644 (file)
@@ -22,10 +22,10 @@ package org.onap.dcaegen2.services.prh.tasks;
 
 import org.onap.dcaegen2.services.prh.configuration.Config;
 import org.onap.dcaegen2.services.prh.exceptions.DmaapNotFoundException;
-import org.onap.dcaegen2.services.prh.model.ConsumerDmaapModel;
-import org.onap.dcaegen2.services.prh.service.producer.DMaaPPublisherReactiveHttpClient;
-import org.onap.dcaegen2.services.prh.service.producer.DmaaPRestTemplateFactory;
-import org.onap.dcaegen2.services.prh.service.producer.PublisherReactiveHttpClientFactory;
+import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.service.producer.DMaaPPublisherReactiveHttpClient;
+import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.service.producer.DmaaPRestTemplateFactory;
+import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.service.producer.PublisherReactiveHttpClientFactory;
+import org.onap.dcaegen2.services.sdk.rest.services.model.ConsumerDmaapModel;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
index d6814ed..5f23def 100644 (file)
@@ -30,8 +30,8 @@ import java.util.function.Predicate;
 import javax.net.ssl.SSLException;
 import org.onap.dcaegen2.services.prh.exceptions.DmaapEmptyResponseException;
 import org.onap.dcaegen2.services.prh.exceptions.PrhTaskException;
-import org.onap.dcaegen2.services.prh.model.ConsumerDmaapModel;
 import org.onap.dcaegen2.services.prh.model.logging.MdcVariables;
+import org.onap.dcaegen2.services.sdk.rest.services.model.ConsumerDmaapModel;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.MDC;
index 3746357..cdfffbd 100644 (file)
@@ -20,9 +20,9 @@
 
 package org.onap.dcaegen2.services.prh;
 
-import org.onap.dcaegen2.services.prh.config.ImmutableAaiClientConfiguration;
-import org.onap.dcaegen2.services.prh.config.ImmutableDmaapConsumerConfiguration;
-import org.onap.dcaegen2.services.prh.config.ImmutableDmaapPublisherConfiguration;
+import org.onap.dcaegen2.services.sdk.rest.services.aai.client.config.ImmutableAaiClientConfiguration;
+import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.config.ImmutableDmaapConsumerConfiguration;
+import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.config.ImmutableDmaapPublisherConfiguration;
 
 
 public class TestAppConfiguration {
index f05dfa7..8f42103 100644 (file)
@@ -29,12 +29,12 @@ import java.nio.file.Files;
 import java.nio.file.Paths;
 import org.junit.jupiter.api.Test;
 import org.onap.dcaegen2.services.prh.TestAppConfiguration;
-import org.onap.dcaegen2.services.prh.config.AaiClientConfiguration;
-import org.onap.dcaegen2.services.prh.config.DmaapConsumerConfiguration;
-import org.onap.dcaegen2.services.prh.config.DmaapPublisherConfiguration;
-import org.onap.dcaegen2.services.prh.config.ImmutableAaiClientConfiguration;
-import org.onap.dcaegen2.services.prh.config.ImmutableDmaapConsumerConfiguration;
-import org.onap.dcaegen2.services.prh.config.ImmutableDmaapPublisherConfiguration;
+import org.onap.dcaegen2.services.sdk.rest.services.aai.client.config.AaiClientConfiguration;
+import org.onap.dcaegen2.services.sdk.rest.services.aai.client.config.ImmutableAaiClientConfiguration;
+import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.config.DmaapConsumerConfiguration;
+import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.config.DmaapPublisherConfiguration;
+import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.config.ImmutableDmaapConsumerConfiguration;
+import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.config.ImmutableDmaapPublisherConfiguration;
 
 
 class CloudConfigParserTest {
index 01ce741..be705c1 100644 (file)
@@ -28,8 +28,8 @@ import java.util.Optional;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
 import org.mockito.Mockito;
-import org.onap.dcaegen2.services.prh.model.ConsumerDmaapModel;
-import org.onap.dcaegen2.services.prh.model.ImmutableConsumerDmaapModel;
+import org.onap.dcaegen2.services.sdk.rest.services.model.ConsumerDmaapModel;
+import org.onap.dcaegen2.services.sdk.rest.services.model.ImmutableConsumerDmaapModel;
 import reactor.core.publisher.Mono;
 import reactor.test.StepVerifier;
 
index 56d7b81..f234f74 100644 (file)
@@ -36,12 +36,12 @@ import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.function.Executable;
 import org.onap.dcaegen2.services.prh.TestAppConfiguration;
-import org.onap.dcaegen2.services.prh.config.AaiClientConfiguration;
 import org.onap.dcaegen2.services.prh.configuration.AppConfig;
 import org.onap.dcaegen2.services.prh.exceptions.PrhTaskException;
-import org.onap.dcaegen2.services.prh.model.ConsumerDmaapModel;
-import org.onap.dcaegen2.services.prh.model.ImmutableConsumerDmaapModel;
-import org.onap.dcaegen2.services.prh.service.producer.AaiProducerReactiveHttpClient;
+import org.onap.dcaegen2.services.sdk.rest.services.aai.client.config.AaiClientConfiguration;
+import org.onap.dcaegen2.services.sdk.rest.services.aai.client.service.http.patch.AaiReactiveHttpPatchClient;
+import org.onap.dcaegen2.services.sdk.rest.services.model.ConsumerDmaapModel;
+import org.onap.dcaegen2.services.sdk.rest.services.model.ImmutableConsumerDmaapModel;
 import org.springframework.http.HttpStatus;
 import org.springframework.web.reactive.function.client.ClientResponse;
 import reactor.core.publisher.Mono;
@@ -55,7 +55,7 @@ class AaiProducerTaskImplTest {
     private ConsumerDmaapModel consumerDmaapModel;
     private AaiProducerTaskImpl aaiProducerTask;
     private AaiClientConfiguration aaiClientConfiguration;
-    private AaiProducerReactiveHttpClient aaiProducerReactiveHttpClient;
+    private AaiReactiveHttpPatchClient aaiReactiveHttpPatchClient;
     private AppConfig appConfig;
     private ClientResponse clientResponse;
 
@@ -89,8 +89,8 @@ class AaiProducerTaskImplTest {
         Mono<ConsumerDmaapModel> response = aaiProducerTask.execute(consumerDmaapModel);
 
         //then
-        verify(aaiProducerReactiveHttpClient, times(1)).getAaiProducerResponse(any());
-        verifyNoMoreInteractions(aaiProducerReactiveHttpClient);
+        verify(aaiReactiveHttpPatchClient, times(1)).getAaiProducerResponse(any());
+        verifyNoMoreInteractions(aaiReactiveHttpPatchClient);
         Assertions.assertEquals(consumerDmaapModel, response.block());
 
     }
@@ -102,20 +102,20 @@ class AaiProducerTaskImplTest {
         StepVerifier.create(aaiProducerTask.execute(consumerDmaapModel)).expectSubscription()
             .expectError(PrhTaskException.class).verify();
         //then
-        verify(aaiProducerReactiveHttpClient, times(1)).getAaiProducerResponse(any());
-        verifyNoMoreInteractions(aaiProducerReactiveHttpClient);
+        verify(aaiReactiveHttpPatchClient, times(1)).getAaiProducerResponse(any());
+        verifyNoMoreInteractions(aaiReactiveHttpPatchClient);
     }
 
     private void getAaiProducerTask_whenMockingResponseObject(int statusCode) throws SSLException {
         //given
         doReturn(HttpStatus.valueOf(statusCode)).when(clientResponse).statusCode();
         Mono<ClientResponse> clientResponseMono = Mono.just(clientResponse);
-        aaiProducerReactiveHttpClient = mock(AaiProducerReactiveHttpClient.class);
-        when(aaiProducerReactiveHttpClient.getAaiProducerResponse(any()))
+        aaiReactiveHttpPatchClient = mock(AaiReactiveHttpPatchClient.class);
+        when(aaiReactiveHttpPatchClient.getAaiProducerResponse(any()))
             .thenReturn(clientResponseMono);
         when(appConfig.getAaiClientConfiguration()).thenReturn(aaiClientConfiguration);
         aaiProducerTask = spy(new AaiProducerTaskImpl(appConfig));
         when(aaiProducerTask.resolveConfiguration()).thenReturn(aaiClientConfiguration);
-        doReturn(aaiProducerReactiveHttpClient).when(aaiProducerTask).resolveClient();
+        doReturn(aaiReactiveHttpPatchClient).when(aaiProducerTask).resolveClient();
     }
 }
\ No newline at end of file
index 5b0979a..165b0fd 100644 (file)
@@ -25,9 +25,9 @@ import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.spy;
 
 import javax.net.ssl.SSLException;
-import org.onap.dcaegen2.services.prh.config.AaiClientConfiguration;
 import org.onap.dcaegen2.services.prh.configuration.AppConfig;
-import org.onap.dcaegen2.services.prh.service.producer.AaiProducerReactiveHttpClient;
+import org.onap.dcaegen2.services.sdk.rest.services.aai.client.config.AaiClientConfiguration;
+import org.onap.dcaegen2.services.sdk.rest.services.aai.client.service.http.patch.AaiReactiveHttpPatchClient;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Primary;
@@ -51,9 +51,9 @@ public class AaiPublisherTaskSpy {
         AppConfig appConfig = spy(AppConfig.class);
         doReturn(mock(AaiClientConfiguration.class)).when(appConfig).getAaiClientConfiguration();
         AaiProducerTaskImpl aaiProducerTask = spy(new AaiProducerTaskImpl(appConfig));
-        AaiProducerReactiveHttpClient aaiProducerReactiveHttpClient = mock(AaiProducerReactiveHttpClient.class);
+        AaiReactiveHttpPatchClient aaiReactiveHttpPatchClient = mock(AaiReactiveHttpPatchClient.class);
         doReturn(mock(AaiClientConfiguration.class)).when(aaiProducerTask).resolveConfiguration();
-        doReturn(aaiProducerReactiveHttpClient).when(aaiProducerTask).resolveClient();
+        doReturn(aaiReactiveHttpPatchClient).when(aaiProducerTask).resolveClient();
         return aaiProducerTask;
     }
 }
index 35da332..29ae1bf 100644 (file)
@@ -24,7 +24,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNull;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 import static org.onap.dcaegen2.services.prh.TestAppConfiguration.createDefaultDmaapConsumerConfiguration;
@@ -32,13 +31,13 @@ import static org.onap.dcaegen2.services.prh.TestAppConfiguration.createDefaultD
 import java.util.Optional;
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
-import org.onap.dcaegen2.services.prh.config.DmaapConsumerConfiguration;
 import org.onap.dcaegen2.services.prh.configuration.AppConfig;
-import org.onap.dcaegen2.services.prh.model.ConsumerDmaapModel;
-import org.onap.dcaegen2.services.prh.model.ImmutableConsumerDmaapModel;
 import org.onap.dcaegen2.services.prh.service.DmaapConsumerJsonParser;
-import org.onap.dcaegen2.services.prh.service.consumer.ConsumerReactiveHttpClientFactory;
-import org.onap.dcaegen2.services.prh.service.consumer.DMaaPConsumerReactiveHttpClient;
+import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.config.DmaapConsumerConfiguration;
+import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.service.consumer.ConsumerReactiveHttpClientFactory;
+import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.service.consumer.DMaaPConsumerReactiveHttpClient;
+import org.onap.dcaegen2.services.sdk.rest.services.model.ConsumerDmaapModel;
+import org.onap.dcaegen2.services.sdk.rest.services.model.ImmutableConsumerDmaapModel;
 import reactor.core.publisher.Flux;
 import reactor.core.publisher.Mono;
 
index d2eabfc..cb31c86 100644 (file)
@@ -25,9 +25,9 @@ import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.spy;
 
 import javax.net.ssl.SSLException;
-import org.onap.dcaegen2.services.prh.config.DmaapConsumerConfiguration;
 import org.onap.dcaegen2.services.prh.configuration.AppConfig;
-import org.onap.dcaegen2.services.prh.service.consumer.DMaaPConsumerReactiveHttpClient;
+import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.config.DmaapConsumerConfiguration;
+import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.service.consumer.DMaaPConsumerReactiveHttpClient;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Primary;
index 7ed6c5a..07cdc5d 100644 (file)
@@ -24,9 +24,9 @@ import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.spy;
 
-import org.onap.dcaegen2.services.prh.config.DmaapPublisherConfiguration;
 import org.onap.dcaegen2.services.prh.configuration.AppConfig;
-import org.onap.dcaegen2.services.prh.service.producer.DMaaPPublisherReactiveHttpClient;
+import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.config.DmaapPublisherConfiguration;
+import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.service.producer.DMaaPPublisherReactiveHttpClient;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Primary;
index 538c197..4f5136e 100644 (file)
@@ -33,14 +33,14 @@ import static org.onap.dcaegen2.services.prh.TestAppConfiguration.createDefaultD
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.function.Executable;
-import org.onap.dcaegen2.services.prh.config.DmaapPublisherConfiguration;
 import org.onap.dcaegen2.services.prh.configuration.AppConfig;
 import org.onap.dcaegen2.services.prh.exceptions.DmaapNotFoundException;
 import org.onap.dcaegen2.services.prh.exceptions.PrhTaskException;
-import org.onap.dcaegen2.services.prh.model.ConsumerDmaapModel;
-import org.onap.dcaegen2.services.prh.model.ImmutableConsumerDmaapModel;
-import org.onap.dcaegen2.services.prh.service.producer.DMaaPPublisherReactiveHttpClient;
-import org.onap.dcaegen2.services.prh.service.producer.PublisherReactiveHttpClientFactory;
+import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.config.DmaapPublisherConfiguration;
+import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.service.producer.DMaaPPublisherReactiveHttpClient;
+import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.service.producer.PublisherReactiveHttpClientFactory;
+import org.onap.dcaegen2.services.sdk.rest.services.model.ConsumerDmaapModel;
+import org.onap.dcaegen2.services.sdk.rest.services.model.ImmutableConsumerDmaapModel;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
 import reactor.core.publisher.Mono;