diff options
Diffstat (limited to 'prh-app-server')
13 files changed, 107 insertions, 96 deletions
diff --git a/prh-app-server/pom.xml b/prh-app-server/pom.xml index c4455e60..7cf99352 100644 --- a/prh-app-server/pom.xml +++ b/prh-app-server/pom.xml @@ -228,10 +228,6 @@ </dependency> <dependency> <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>dmaap-client</artifactId> </dependency> diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/AaiHttpClientConfig.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/AaiHttpClientConfig.java index 71dedba1..9156732d 100644 --- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/AaiHttpClientConfig.java +++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/AaiHttpClientConfig.java @@ -22,55 +22,56 @@ package org.onap.dcaegen2.services.prh.configuration; import java.nio.charset.StandardCharsets; import java.util.function.BiFunction; +import org.onap.dcaegen2.services.prh.adapter.aai.api.AaiClientConfiguration; +import org.onap.dcaegen2.services.prh.adapter.aai.api.AaiHttpClient; +import org.onap.dcaegen2.services.prh.adapter.aai.api.get.AaiGetServiceInstanceClient; +import org.onap.dcaegen2.services.prh.adapter.aai.api.get.AaiHttpGetClient; +import org.onap.dcaegen2.services.prh.adapter.aai.api.patch.AaiHttpPatchClient; +import org.onap.dcaegen2.services.prh.adapter.aai.main.AaiHttpClientFactory; +import org.onap.dcaegen2.services.prh.adapter.aai.model.AaiModel; +import org.onap.dcaegen2.services.prh.adapter.aai.model.AaiServiceInstanceQueryModel; import org.onap.dcaegen2.services.prh.model.AaiJsonBodyBuilderImpl; import org.onap.dcaegen2.services.prh.model.AaiPnfResultModel; import org.onap.dcaegen2.services.prh.model.AaiServiceInstanceResultModel; import org.onap.dcaegen2.services.prh.model.utils.PrhModelAwareGsonBuilder; -import org.onap.dcaegen2.services.sdk.rest.services.aai.client.api.AaiClientConfiguration; -import org.onap.dcaegen2.services.sdk.rest.services.aai.client.main.AaiHttpClientFactory; -import org.onap.dcaegen2.services.sdk.rest.services.aai.client.api.AaiHttpClient; -import org.onap.dcaegen2.services.sdk.rest.services.aai.client.api.get.AaiGetServiceInstanceClient; -import org.onap.dcaegen2.services.sdk.rest.services.aai.client.api.get.AaiHttpGetClient; -import org.onap.dcaegen2.services.sdk.rest.services.aai.client.api.patch.AaiHttpPatchClient; import org.onap.dcaegen2.services.sdk.rest.services.adapters.http.HttpResponse; import org.onap.dcaegen2.services.sdk.rest.services.adapters.http.RxHttpClient; -import org.onap.dcaegen2.services.sdk.rest.services.aai.client.model.AaiModel; -import org.onap.dcaegen2.services.sdk.rest.services.aai.client.model.AaiServiceInstanceQueryModel; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration public class AaiHttpClientConfig { + @Autowired private CbsConfiguration cbsConfiguration; @Bean public AaiHttpClient<AaiModel, HttpResponse> getPatchClientFactory() { return createLazyConfigClient( - (config, client) -> new AaiHttpPatchClient(config, new AaiJsonBodyBuilderImpl(), client)); + (config, client) -> new AaiHttpPatchClient(config, new AaiJsonBodyBuilderImpl(), client)); } @Bean public AaiHttpClient<AaiServiceInstanceQueryModel, AaiServiceInstanceResultModel> getServiceInstanceClient() { return createLazyConfigClient( - (config, client) -> new AaiGetServiceInstanceClient(config, client) - .map(httpResponse -> { - httpResponse.throwIfUnsuccessful(); - return httpResponse.bodyAsJson(StandardCharsets.UTF_8, - PrhModelAwareGsonBuilder.createGson(), AaiServiceInstanceResultModel.class); - })); + (config, client) -> new AaiGetServiceInstanceClient(config, client) + .map(httpResponse -> { + httpResponse.throwIfUnsuccessful(); + return httpResponse.bodyAsJson(StandardCharsets.UTF_8, + PrhModelAwareGsonBuilder.createGson(), AaiServiceInstanceResultModel.class); + })); } @Bean public AaiHttpClient<AaiModel, AaiPnfResultModel> getGetClient() { return createLazyConfigClient( - (config, client) -> new AaiHttpGetClient(config, client) - .map(httpResponse -> { - httpResponse.throwIfUnsuccessful(); - return httpResponse.bodyAsJson(StandardCharsets.UTF_8, - PrhModelAwareGsonBuilder.createGson(), AaiPnfResultModel.class); - })); + (config, client) -> new AaiHttpGetClient(config, client) + .map(httpResponse -> { + httpResponse.throwIfUnsuccessful(); + return httpResponse.bodyAsJson(StandardCharsets.UTF_8, + PrhModelAwareGsonBuilder.createGson(), AaiPnfResultModel.class); + })); } private <T, U> AaiHttpClient<T, U> createLazyConfigClient( @@ -78,7 +79,7 @@ public class AaiHttpClientConfig { return x -> factoryMethod.apply( cbsConfiguration.getAaiClientConfiguration(), - new AaiHttpClientFactory(cbsConfiguration.getAaiClientConfiguration()).build() + new AaiHttpClientFactory(cbsConfiguration.getAaiClientConfiguration()).build() ).getAaiResponse(x); } } diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/CbsConfiguration.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/CbsConfiguration.java index f27d2efc..d594222b 100644 --- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/CbsConfiguration.java +++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/CbsConfiguration.java @@ -21,7 +21,8 @@ package org.onap.dcaegen2.services.prh.configuration; import com.google.gson.JsonObject; -import org.onap.dcaegen2.services.sdk.rest.services.aai.client.api.AaiClientConfiguration; +import java.util.Optional; +import org.onap.dcaegen2.services.prh.adapter.aai.api.AaiClientConfiguration; import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.api.DmaapClientFactory; import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.api.MessageRouterPublisher; import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.api.MessageRouterSubscriber; @@ -30,8 +31,6 @@ import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.model.MessageRo import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.Optional; - public class CbsConfiguration implements Config { private static final Logger LOGGER = LoggerFactory.getLogger(CbsConfiguration.class); diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/CbsContentParser.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/CbsContentParser.java index ee7ff222..869d537f 100644 --- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/CbsContentParser.java +++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/CbsContentParser.java @@ -20,14 +20,19 @@ package org.onap.dcaegen2.services.prh.configuration; +import static org.onap.dcaegen2.services.sdk.rest.services.cbs.client.api.streams.StreamPredicates.streamWithName; + import com.google.common.reflect.TypeToken; import com.google.gson.Gson; import com.google.gson.JsonObject; +import java.nio.file.Paths; +import java.time.Duration; +import java.util.Map; +import org.onap.dcaegen2.services.prh.adapter.aai.api.AaiClientConfiguration; +import org.onap.dcaegen2.services.prh.adapter.aai.api.ImmutableAaiClientConfiguration; import org.onap.dcaegen2.services.sdk.model.streams.RawDataStream; import org.onap.dcaegen2.services.sdk.model.streams.dmaap.MessageRouterSink; import org.onap.dcaegen2.services.sdk.model.streams.dmaap.MessageRouterSource; -import org.onap.dcaegen2.services.sdk.rest.services.aai.client.api.AaiClientConfiguration; -import org.onap.dcaegen2.services.sdk.rest.services.aai.client.api.ImmutableAaiClientConfiguration; import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.api.streams.DataStreams; import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.api.streams.StreamFromGsonParsers; import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.model.ImmutableMessageRouterPublishRequest; @@ -43,12 +48,6 @@ import org.onap.dcaegen2.services.sdk.security.ssl.ImmutableSecurityKeysStore; import org.onap.dcaegen2.services.sdk.security.ssl.Passwords; import org.onap.dcaegen2.services.sdk.security.ssl.SecurityKeys; -import java.nio.file.Paths; -import java.time.Duration; -import java.util.Map; - -import static org.onap.dcaegen2.services.sdk.rest.services.cbs.client.api.streams.StreamPredicates.streamWithName; - /** * @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 8/21/18 */ diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/Config.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/Config.java index bf41a0f2..adfc8c16 100644 --- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/Config.java +++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/Config.java @@ -20,7 +20,7 @@ package org.onap.dcaegen2.services.prh.configuration; -import org.onap.dcaegen2.services.sdk.rest.services.aai.client.api.AaiClientConfiguration; +import org.onap.dcaegen2.services.prh.adapter.aai.api.AaiClientConfiguration; import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.api.MessageRouterPublisher; import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.api.MessageRouterSubscriber; import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.model.MessageRouterPublishRequest; diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTaskImpl.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTaskImpl.java index adf87a41..e0764fd2 100644 --- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTaskImpl.java +++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTaskImpl.java @@ -20,14 +20,14 @@ package org.onap.dcaegen2.services.prh.tasks; +import org.onap.dcaegen2.services.prh.adapter.aai.api.AaiHttpClient; +import org.onap.dcaegen2.services.prh.adapter.aai.model.AaiModel; 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.sdk.rest.services.aai.client.api.AaiHttpClient; import org.onap.dcaegen2.services.sdk.rest.services.adapters.http.HttpResponse; -import org.onap.dcaegen2.services.sdk.rest.services.aai.client.model.AaiModel; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiQueryTask.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiQueryTask.java index 54a3151b..0bcb1dea 100644 --- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiQueryTask.java +++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiQueryTask.java @@ -20,7 +20,7 @@ package org.onap.dcaegen2.services.prh.tasks; -import org.onap.dcaegen2.services.sdk.rest.services.aai.client.model.AaiModel; +import org.onap.dcaegen2.services.prh.adapter.aai.model.AaiModel; import reactor.core.publisher.Mono; @FunctionalInterface diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiQueryTaskImpl.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiQueryTaskImpl.java index 3420bf24..46f9d3d9 100644 --- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiQueryTaskImpl.java +++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiQueryTaskImpl.java @@ -20,18 +20,21 @@ package org.onap.dcaegen2.services.prh.tasks; -import org.onap.dcaegen2.services.prh.model.*; -import org.onap.dcaegen2.services.sdk.rest.services.aai.client.api.AaiHttpClient; -import org.onap.dcaegen2.services.sdk.rest.services.aai.client.model.AaiModel; -import org.onap.dcaegen2.services.sdk.rest.services.aai.client.model.AaiServiceInstanceQueryModel; -import org.onap.dcaegen2.services.sdk.rest.services.aai.client.model.ImmutableAaiServiceInstanceQueryModel; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import reactor.core.publisher.Mono; - import java.util.List; import java.util.Optional; import java.util.stream.Stream; +import org.onap.dcaegen2.services.prh.adapter.aai.api.AaiHttpClient; +import org.onap.dcaegen2.services.prh.adapter.aai.model.AaiModel; +import org.onap.dcaegen2.services.prh.adapter.aai.model.AaiServiceInstanceQueryModel; +import org.onap.dcaegen2.services.prh.adapter.aai.model.ImmutableAaiServiceInstanceQueryModel; +import org.onap.dcaegen2.services.prh.model.AaiPnfResultModel; +import org.onap.dcaegen2.services.prh.model.AaiServiceInstanceResultModel; +import org.onap.dcaegen2.services.prh.model.Relationship; +import org.onap.dcaegen2.services.prh.model.RelationshipData; +import org.onap.dcaegen2.services.prh.model.RelationshipDict; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import reactor.core.publisher.Mono; @Component public class AaiQueryTaskImpl implements AaiQueryTask { diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/TestAppConfiguration.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/TestAppConfiguration.java index b6af3423..a3f024f4 100644 --- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/TestAppConfiguration.java +++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/TestAppConfiguration.java @@ -20,15 +20,14 @@ package org.onap.dcaegen2.services.prh; +import java.time.Duration; +import org.onap.dcaegen2.services.prh.adapter.aai.api.ImmutableAaiClientConfiguration; import org.onap.dcaegen2.services.sdk.model.streams.dmaap.ImmutableMessageRouterSink; import org.onap.dcaegen2.services.sdk.model.streams.dmaap.ImmutableMessageRouterSource; -import org.onap.dcaegen2.services.sdk.rest.services.aai.client.api.ImmutableAaiClientConfiguration; import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.ContentType; import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.model.ImmutableMessageRouterPublishRequest; import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.model.ImmutableMessageRouterSubscribeRequest; -import java.time.Duration; - public class TestAppConfiguration { public static ImmutableMessageRouterSubscribeRequest createDefaultMessageRouterSubscribeRequest() { diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/ConsulConfigurationParserTest.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/ConsulConfigurationParserTest.java index 96594ae4..89717a58 100644 --- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/ConsulConfigurationParserTest.java +++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/ConsulConfigurationParserTest.java @@ -20,13 +20,21 @@ package org.onap.dcaegen2.services.prh.configuration; +import static java.lang.ClassLoader.getSystemResource; +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assumptions.assumeFalse; + import com.google.gson.Gson; import com.google.gson.JsonObject; +import java.net.URISyntaxException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.time.Duration; import org.jetbrains.annotations.Nullable; import org.junit.jupiter.api.Test; import org.onap.dcaegen2.services.prh.TestAppConfiguration; -import org.onap.dcaegen2.services.sdk.rest.services.aai.client.api.AaiClientConfiguration; -import org.onap.dcaegen2.services.sdk.rest.services.aai.client.api.ImmutableAaiClientConfiguration; +import org.onap.dcaegen2.services.prh.adapter.aai.api.AaiClientConfiguration; +import org.onap.dcaegen2.services.prh.adapter.aai.api.ImmutableAaiClientConfiguration; import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.ContentType; import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.model.MessageRouterPublishRequest; import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.model.MessageRouterSubscribeRequest; @@ -34,22 +42,13 @@ import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.model.config.Me import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.model.config.MessageRouterSubscriberConfig; import org.onap.dcaegen2.services.sdk.security.ssl.SecurityKeys; -import java.net.URISyntaxException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.time.Duration; - -import static java.lang.ClassLoader.getSystemResource; -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assumptions.assumeFalse; - class ConsulConfigurationParserTest { private final String correctJson = - new String(Files.readAllBytes(Paths.get(getSystemResource("configurationFromCbs.json").toURI()))); + new String(Files.readAllBytes(Paths.get(getSystemResource("configurationFromCbs.json").toURI()))); private final ImmutableAaiClientConfiguration correctAaiClientConfig = - TestAppConfiguration.createDefaultAaiClientConfiguration(); + TestAppConfiguration.createDefaultAaiClientConfiguration(); private final JsonObject correctConfig = new Gson().fromJson(correctJson, JsonObject.class); private final CbsContentParser consulConfigurationParser = new CbsContentParser(correctConfig); @@ -70,10 +69,12 @@ class ConsulConfigurationParserTest { @Test void shouldCreateMessageRouterSubscribeRequestCorrectly() { // given - MessageRouterSubscribeRequest messageRouterSubscribeRequest = consulConfigurationParser.getMessageRouterSubscribeRequest(); + MessageRouterSubscribeRequest messageRouterSubscribeRequest = consulConfigurationParser + .getMessageRouterSubscribeRequest(); // then - assertThat(messageRouterSubscribeRequest.sourceDefinition().topicUrl()).isEqualTo("http://dmaap-mr:2222/events/unauthenticated.VES_PNFREG_OUTPUT"); + assertThat(messageRouterSubscribeRequest.sourceDefinition().topicUrl()) + .isEqualTo("http://dmaap-mr:2222/events/unauthenticated.VES_PNFREG_OUTPUT"); assertThat(messageRouterSubscribeRequest.consumerGroup()).isEqualTo("OpenDCAE-c12"); assertThat(messageRouterSubscribeRequest.consumerId()).isEqualTo("c12"); assertThat(messageRouterSubscribeRequest.timeout()).isEqualTo(Duration.ofMillis(-1)); @@ -82,28 +83,33 @@ class ConsulConfigurationParserTest { @Test void shouldCreateMessageRouterPublishConfigurationCorrectly() { // when - MessageRouterPublishRequest messageRouterPublishRequest = consulConfigurationParser.getMessageRouterPublishRequest(); + MessageRouterPublishRequest messageRouterPublishRequest = consulConfigurationParser + .getMessageRouterPublishRequest(); // then assertThat(messageRouterPublishRequest.contentType()).isEqualTo(ContentType.APPLICATION_JSON); - assertThat(messageRouterPublishRequest.sinkDefinition().topicUrl()).isEqualTo("http://dmaap-mr:2222/events/unauthenticated.PNF_READY"); + assertThat(messageRouterPublishRequest.sinkDefinition().topicUrl()) + .isEqualTo("http://dmaap-mr:2222/events/unauthenticated.PNF_READY"); } @Test void shouldCreateMessageRouterUpdatePublishConfigurationCorrectly() { // when - MessageRouterPublishRequest messageRouterPublishRequest = consulConfigurationParser.getMessageRouterUpdatePublishRequest(); + MessageRouterPublishRequest messageRouterPublishRequest = consulConfigurationParser + .getMessageRouterUpdatePublishRequest(); // then assertThat(messageRouterPublishRequest.contentType()).isEqualTo(ContentType.APPLICATION_JSON); - assertThat(messageRouterPublishRequest.sinkDefinition().topicUrl()).isEqualTo("http://dmaap-mr:2222/events/unauthenticated.PNF_UPDATE"); + assertThat(messageRouterPublishRequest.sinkDefinition().topicUrl()) + .isEqualTo("http://dmaap-mr:2222/events/unauthenticated.PNF_UPDATE"); } @Test void whenDmaapCertAuthIsDisabled_MessageRouterPublisherConfigSecurityKeysShouldBeIgnored() { assumeFalse(correctConfig.getAsJsonObject("config").get("security.enableDmaapCertAuth").getAsBoolean()); - MessageRouterPublisherConfig messageRouterPublisherConfig = consulConfigurationParser.getMessageRouterPublisherConfig(); + MessageRouterPublisherConfig messageRouterPublisherConfig = consulConfigurationParser + .getMessageRouterPublisherConfig(); assertThat(messageRouterPublisherConfig.securityKeys()).isNull(); } @@ -112,7 +118,8 @@ class ConsulConfigurationParserTest { void whenDmaapCertAuthIsDisabled_MessageRouterSubscriberConfigSecurityKeysShouldBeIgnored() { assumeFalse(correctConfig.getAsJsonObject("config").get("security.enableDmaapCertAuth").getAsBoolean()); - MessageRouterSubscriberConfig messageRouterSubscriberConfig = consulConfigurationParser.getMessageRouterSubscriberConfig(); + MessageRouterSubscriberConfig messageRouterSubscriberConfig = consulConfigurationParser + .getMessageRouterSubscriberConfig(); assertThat(messageRouterSubscriberConfig.securityKeys()).isNull(); } @@ -122,7 +129,8 @@ class ConsulConfigurationParserTest { void whenDmaapCertAuthIsEnabled_MessageRouterPublisherConfigSecurityKeysShouldBeLoaded() { CbsContentParser consulConfigurationParser = new CbsContentParser(getConfigWithSslEnabled(correctJson)); - MessageRouterPublisherConfig messageRouterPublisherConfig = consulConfigurationParser.getMessageRouterPublisherConfig(); + MessageRouterPublisherConfig messageRouterPublisherConfig = consulConfigurationParser + .getMessageRouterPublisherConfig(); verifySecurityKeys(messageRouterPublisherConfig.securityKeys()); } @@ -132,7 +140,8 @@ class ConsulConfigurationParserTest { void whenDmaapCertAuthIsEnabled_MessageRouterSubscriberConfigSecurityKeysShouldBeLoaded() { CbsContentParser consulConfigurationParser = new CbsContentParser(getConfigWithSslEnabled(correctJson)); - MessageRouterSubscriberConfig messageRouterSubscriberConfig = consulConfigurationParser.getMessageRouterSubscriberConfig(); + MessageRouterSubscriberConfig messageRouterSubscriberConfig = consulConfigurationParser + .getMessageRouterSubscriberConfig(); verifySecurityKeys(messageRouterSubscriberConfig.securityKeys()); } @@ -141,8 +150,10 @@ class ConsulConfigurationParserTest { assertThat(securityKeys).isNotNull(); assertThat(securityKeys.trustStore().path().endsWith("org.onap.dcae.trust.jks")).isTrue(); assertThat(securityKeys.keyStore().path().endsWith("org.onap.dcae.jks")).isTrue(); - securityKeys.trustStorePassword().use(chars -> assertThat(new String(chars)).isEqualTo("*TQH?Lnszprs4LmlAj38yds(")); - securityKeys.keyStorePassword().use(chars -> assertThat(new String(chars)).isEqualTo("mYHC98!qX}7h?W}jRv}MIXTJ")); + securityKeys.trustStorePassword() + .use(chars -> assertThat(new String(chars)).isEqualTo("*TQH?Lnszprs4LmlAj38yds(")); + securityKeys.keyStorePassword() + .use(chars -> assertThat(new String(chars)).isEqualTo("mYHC98!qX}7h?W}jRv}MIXTJ")); } private static JsonObject getConfigWithSslEnabled(String configJsonString) { diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTaskImplTest.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTaskImplTest.java index 48494d41..f699a9e4 100644 --- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTaskImplTest.java +++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTaskImplTest.java @@ -20,28 +20,33 @@ package org.onap.dcaegen2.services.prh.tasks; +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.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.mockito.Mockito.when; + import com.google.gson.JsonObject; import io.netty.handler.codec.http.HttpResponseStatus; +import javax.net.ssl.SSLException; import org.junit.jupiter.api.Assertions; 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.adapter.aai.api.AaiClientConfiguration; +import org.onap.dcaegen2.services.prh.adapter.aai.api.patch.AaiHttpPatchClient; import org.onap.dcaegen2.services.prh.configuration.CbsConfiguration; 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.sdk.rest.services.aai.client.api.AaiClientConfiguration; -import org.onap.dcaegen2.services.sdk.rest.services.aai.client.api.patch.AaiHttpPatchClient; import org.onap.dcaegen2.services.sdk.rest.services.adapters.http.HttpResponse; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; -import javax.net.ssl.SSLException; - -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.*; - /** * @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 5/14/18 */ diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiQueryTaskImplTest.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiQueryTaskImplTest.java index c2393b71..f2d562dc 100644 --- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiQueryTaskImplTest.java +++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiQueryTaskImplTest.java @@ -20,6 +20,11 @@ package org.onap.dcaegen2.services.prh.tasks; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.BDDMockito.given; + +import java.util.Collections; +import java.util.List; import org.assertj.core.util.Lists; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; @@ -27,23 +32,17 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; +import org.onap.dcaegen2.services.prh.adapter.aai.api.AaiHttpClient; +import org.onap.dcaegen2.services.prh.adapter.aai.model.AaiModel; +import org.onap.dcaegen2.services.prh.adapter.aai.model.AaiServiceInstanceQueryModel; import org.onap.dcaegen2.services.prh.model.AaiPnfResultModel; import org.onap.dcaegen2.services.prh.model.AaiServiceInstanceResultModel; import org.onap.dcaegen2.services.prh.model.ImmutableRelationshipData; import org.onap.dcaegen2.services.prh.model.Relationship; import org.onap.dcaegen2.services.prh.model.RelationshipData; import org.onap.dcaegen2.services.prh.model.RelationshipDict; -import org.onap.dcaegen2.services.sdk.rest.services.aai.client.api.AaiHttpClient; -import org.onap.dcaegen2.services.sdk.rest.services.aai.client.model.AaiModel; -import org.onap.dcaegen2.services.sdk.rest.services.aai.client.model.AaiServiceInstanceQueryModel; import reactor.core.publisher.Mono; -import java.util.Collections; -import java.util.List; - -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.BDDMockito.given; - @ExtendWith(MockitoExtension.class) class AaiQueryTaskImplTest { @Mock diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/BbsActionsTaskTest.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/BbsActionsTaskTest.java index 399122d9..44c4509c 100644 --- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/BbsActionsTaskTest.java +++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/BbsActionsTaskTest.java @@ -36,7 +36,6 @@ import static org.onap.dcaegen2.services.sdk.rest.services.adapters.http.HttpMet import static org.onap.dcaegen2.services.sdk.rest.services.adapters.http.HttpMethod.PUT; import com.google.gson.JsonObject; -import io.netty.buffer.ByteBuf; import io.netty.handler.codec.http.HttpResponseStatus; import java.nio.charset.StandardCharsets; import java.util.List; @@ -45,11 +44,11 @@ import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.ArgumentMatchers; import org.onap.dcaegen2.services.prh.TestAppConfiguration; +import org.onap.dcaegen2.services.prh.adapter.aai.api.AaiClientConfiguration; import org.onap.dcaegen2.services.prh.configuration.CbsConfiguration; import org.onap.dcaegen2.services.prh.exceptions.AaiFailureException; import org.onap.dcaegen2.services.prh.model.ConsumerDmaapModel; import org.onap.dcaegen2.services.prh.model.ImmutableConsumerDmaapModel; -import org.onap.dcaegen2.services.sdk.rest.services.aai.client.api.AaiClientConfiguration; import org.onap.dcaegen2.services.sdk.rest.services.adapters.http.HttpRequest; import org.onap.dcaegen2.services.sdk.rest.services.adapters.http.HttpResponse; import org.onap.dcaegen2.services.sdk.rest.services.adapters.http.ImmutableHttpResponse; |