aboutsummaryrefslogtreecommitdiffstats
path: root/a1-policy-management/src
diff options
context:
space:
mode:
authorPatrikBuhr <patrik.buhr@est.tech>2023-02-23 12:39:31 +0100
committerKAPIL SINGAL <ks220y@att.com>2023-02-27 14:38:18 +0000
commit1c317ebe1323f5f749adad062ec3486612ef7a25 (patch)
tree35d33696fdde90b1c71d05dbdcca99bc41464ad8 /a1-policy-management/src
parent4f8895586f154a6ad56774314d9caf714d944ed9 (diff)
Removal of usage of DMaaP
Issue-ID: CCSDK-3852 Signed-off-by: PatrikBuhr <patrik.buhr@est.tech> Change-Id: I88a370ea81f56763f54fde472c30d894c0df04e3
Diffstat (limited to 'a1-policy-management/src')
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/Application.java16
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/aspect/LogAspect.java2
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1AdapterJsonHelper.java2
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1ClientFactory.java2
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1UriBuilder.java2
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/CcsdkA1AdapterClient.java2
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/OscA1Client.java2
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientVersion2.java2
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfig.java10
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigParser.java33
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ConfigurationFile.java2
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/WebClientConfig.java2
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/ServiceCallbackInfo.java2
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/ServiceCallbacks.java2
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/VoidResponse.java2
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationController.java2
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/Consts.java2
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ErrorResponse.java2
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyIdList.java2
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyInfoList.java2
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyTypeIdList.java2
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyTypeInfo.java2
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicInfo.java2
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicInfoList.java2
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceStatusList.java2
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapMessageConsumer.java235
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapMessageHandler.java144
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapRequestMessage.java55
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapResponseMessage.java45
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSupervision.java2
-rw-r--r--a1-policy-management/src/main/resources/application_configuration_schema.json74
-rw-r--r--a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/aspect/LogAspectTest.java2
-rw-r--r--a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1ClientFactoryTest.java2
-rw-r--r--a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1ClientHelper.java2
-rw-r--r--a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/AsyncRestClientTest.java2
-rw-r--r--a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/CcsdkA1AdapterClientTest.java2
-rw-r--r--a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/OscA1ClientTest.java2
-rw-r--r--a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientV2Test.java2
-rw-r--r--a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigParserTest.java78
-rw-r--r--a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigTest.java4
-rw-r--r--a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ConfigurationFileTest.java2
-rw-r--r--a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConcurrencyTestRunnable.java2
-rw-r--r--a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationControllerTest.java6
-rw-r--r--a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RappSimulatorController.java2
-rw-r--r--a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapMessageConsumerTest.java215
-rw-r--r--a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapMessageHandlerTest.java254
-rw-r--r--a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RefreshConfigTaskTest.java13
-rw-r--r--a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSupervisionTest.java2
-rw-r--r--a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSynchronizationTaskTest.java2
-rw-r--r--a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/utils/MockA1Client.java2
-rw-r--r--a1-policy-management/src/test/resources/test_application_configuration.json43
-rw-r--r--a1-policy-management/src/test/resources/test_application_configuration_with_dmaap_config.json57
52 files changed, 69 insertions, 1285 deletions
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/Application.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/Application.java
index 259a5ba9..6f458647 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/Application.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/Application.java
@@ -22,7 +22,6 @@ package org.onap.ccsdk.oran.a1policymanagementservice;
import java.lang.invoke.MethodHandles;
-import org.onap.ccsdk.oran.a1policymanagementservice.dmaap.DmaapMessageConsumer;
import org.onap.ccsdk.oran.a1policymanagementservice.tasks.RefreshConfigTask;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -40,9 +39,6 @@ public class Application {
@Autowired
private RefreshConfigTask configRefresh;
- @Autowired
- private DmaapMessageConsumer dmaapMessageConsumer;
-
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
public static void main(String[] args) {
@@ -68,16 +64,4 @@ public class Application {
public CommandLineRunner configRefreshRunner(ApplicationContext ctx) {
return args -> configRefresh.start();
}
-
- /**
- * Starts the DMaaP message consumer service.
- *
- * @param ctx the application context.
- *
- * @return the command line runner for the DMaaP message consumer service.
- */
- @Bean
- public CommandLineRunner dmaapMessageConsumerRunner(ApplicationContext ctx) {
- return args -> dmaapMessageConsumer.start();
- }
}
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/aspect/LogAspect.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/aspect/LogAspect.java
index 1c40f04f..e41ebe16 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/aspect/LogAspect.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/aspect/LogAspect.java
@@ -2,7 +2,7 @@
* ========================LICENSE_START=================================
* ONAP : ccsdk oran
* ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 Nordix Foundation. 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.
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1AdapterJsonHelper.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1AdapterJsonHelper.java
index 60dca3b4..ab93ea3e 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1AdapterJsonHelper.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1AdapterJsonHelper.java
@@ -2,7 +2,7 @@
* ========================LICENSE_START=================================
* ONAP : ccsdk oran
* ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 Nordix Foundation. 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.
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1ClientFactory.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1ClientFactory.java
index 0956aa13..14738a91 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1ClientFactory.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1ClientFactory.java
@@ -2,7 +2,7 @@
* ========================LICENSE_START=================================
* ONAP : ccsdk oran
* ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 Nordix Foundation. 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.
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1UriBuilder.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1UriBuilder.java
index 801cb4d5..d6d890d4 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1UriBuilder.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1UriBuilder.java
@@ -2,7 +2,7 @@
* ========================LICENSE_START=================================
* ONAP : ccsdk oran
* ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 Nordix Foundation. 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.
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/CcsdkA1AdapterClient.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/CcsdkA1AdapterClient.java
index 9c32d79c..225d2f71 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/CcsdkA1AdapterClient.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/CcsdkA1AdapterClient.java
@@ -2,7 +2,7 @@
* ========================LICENSE_START=================================
* ONAP : ccsdk oran
* ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 Nordix Foundation. 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.
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/OscA1Client.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/OscA1Client.java
index 1d567a89..62115b5a 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/OscA1Client.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/OscA1Client.java
@@ -2,7 +2,7 @@
* ========================LICENSE_START=================================
* ONAP : ccsdk oran
* ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 Nordix Foundation. 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.
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientVersion2.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientVersion2.java
index 24990a1a..c61ecb86 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientVersion2.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientVersion2.java
@@ -2,7 +2,7 @@
* ========================LICENSE_START=================================
* ONAP : ccsdk oran
* ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 Nordix Foundation. 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.
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfig.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfig.java
index 796d6ad9..358680a0 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfig.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfig.java
@@ -100,12 +100,6 @@ public class ApplicationConfig {
private Map<String, RicConfig> ricConfigs = new HashMap<>();
- @Getter
- private String dmaapConsumerTopicUrl;
-
- @Getter
- private String dmaapProducerTopicUrl;
-
private Map<String, ControllerConfig> controllerConfigs = new HashMap<>();
private WebClientConfig webClientConfig = null;
@@ -174,9 +168,6 @@ public class ApplicationConfig {
Collection<RicConfigUpdate> modifications = new ArrayList<>();
this.controllerConfigs = parserResult.getControllerConfigs();
- this.dmaapConsumerTopicUrl = parserResult.getDmaapConsumerTopicUrl();
- this.dmaapProducerTopicUrl = parserResult.getDmaapProducerTopicUrl();
-
Map<String, RicConfig> newRicConfigs = new HashMap<>();
for (RicConfig newConfig : parserResult.getRicConfigs()) {
RicConfig oldConfig = this.ricConfigs.get(newConfig.getRicId());
@@ -202,5 +193,4 @@ public class ApplicationConfig {
public boolean isS3Enabled() {
return !(Strings.isNullOrEmpty(s3EndpointOverride) || Strings.isNullOrEmpty(s3Bucket));
}
-
}
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigParser.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigParser.java
index 6c178d36..9df901fa 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigParser.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigParser.java
@@ -36,7 +36,6 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.Map.Entry;
import java.util.Set;
import lombok.Builder;
@@ -70,44 +69,23 @@ public class ApplicationConfigParser {
@Builder.Default
private Map<String, ControllerConfig> controllerConfigs = new HashMap<>();
- @Builder.Default
- private String dmaapConsumerTopicUrl = "";
-
- @Builder.Default
- private String dmaapProducerTopicUrl = "";
-
}
public ConfigParserResult parse(JsonObject root) throws ServiceException {
validateJsonObjectAgainstSchema(root);
- String dmaapProducerTopicUrl = "";
- String dmaapConsumerTopicUrl = "";
-
JsonObject pmsConfigJson = root.getAsJsonObject(CONFIG);
if (pmsConfigJson == null) {
throw new ServiceException("Missing root configuration \"" + CONFIG + "\" in JSON: " + root);
}
- JsonObject json = pmsConfigJson.getAsJsonObject("streams_publishes");
- if (json != null) {
- dmaapProducerTopicUrl = parseDmaapConfig(json);
- }
-
- json = pmsConfigJson.getAsJsonObject("streams_subscribes");
- if (json != null) {
- dmaapConsumerTopicUrl = parseDmaapConfig(json);
- }
-
List<RicConfig> ricConfigs = parseRics(pmsConfigJson);
Map<String, ControllerConfig> controllerConfigs = parseControllerConfigs(pmsConfigJson);
checkConfigurationConsistency(ricConfigs, controllerConfigs);
return ConfigParserResult.builder() //
- .dmaapConsumerTopicUrl(dmaapConsumerTopicUrl) //
- .dmaapProducerTopicUrl(dmaapProducerTopicUrl) //
.ricConfigs(ricConfigs) //
.controllerConfigs(controllerConfigs) //
.build();
@@ -236,17 +214,6 @@ public class ApplicationConfigParser {
return get(obj, memberName).getAsJsonArray();
}
- private String parseDmaapConfig(JsonObject streamCfg) throws ServiceException {
- Set<Entry<String, JsonElement>> streamConfigEntries = streamCfg.entrySet();
- if (streamConfigEntries.size() != 1) {
- throw new ServiceException(
- "Invalid configuration. Number of streams must be one, config: " + streamConfigEntries);
- }
- JsonObject streamConfigEntry = streamConfigEntries.iterator().next().getValue().getAsJsonObject();
- JsonObject dmaapInfo = get(streamConfigEntry, "dmaap_info").getAsJsonObject();
- return getAsString(dmaapInfo, "topic_url");
- }
-
private static String getAsString(JsonObject obj, String memberName) throws ServiceException {
return get(obj, memberName).getAsString();
}
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ConfigurationFile.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ConfigurationFile.java
index efe2fa2e..7f5af451 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ConfigurationFile.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ConfigurationFile.java
@@ -1,6 +1,6 @@
/*-
* ========================LICENSE_START=================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 Nordix Foundation. 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.
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/WebClientConfig.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/WebClientConfig.java
index e71f8557..04367e0e 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/WebClientConfig.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/WebClientConfig.java
@@ -2,7 +2,7 @@
* ========================LICENSE_START=================================
* ONAP : ccsdk oran
* ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 Nordix Foundation. 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.
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/ServiceCallbackInfo.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/ServiceCallbackInfo.java
index c5436cd3..ec23f838 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/ServiceCallbackInfo.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/ServiceCallbackInfo.java
@@ -2,7 +2,7 @@
* ========================LICENSE_START=================================
* ONAP : ccsdk oran
* ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 Nordix Foundation. 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.
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/ServiceCallbacks.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/ServiceCallbacks.java
index b028cd63..67b56f8e 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/ServiceCallbacks.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/ServiceCallbacks.java
@@ -2,7 +2,7 @@
* ========================LICENSE_START=================================
* ONAP : ccsdk oran
* ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 Nordix Foundation. 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.
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/VoidResponse.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/VoidResponse.java
index 6470abfe..001226d2 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/VoidResponse.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/VoidResponse.java
@@ -2,7 +2,7 @@
* ========================LICENSE_START=================================
* ONAP : ccsdk oran
* ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 Nordix Foundation. 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.
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationController.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationController.java
index c8d9e4c7..0d0919d8 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationController.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationController.java
@@ -1,6 +1,6 @@
/*-
* ========================LICENSE_START=================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 Nordix Foundation. 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.
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/Consts.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/Consts.java
index 56421003..7f954e90 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/Consts.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/Consts.java
@@ -2,7 +2,7 @@
* ========================LICENSE_START=================================
* ONAP : ccsdk oran
* ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 Nordix Foundation. 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.
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ErrorResponse.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ErrorResponse.java
index 82a21ae2..6bc5a6dd 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ErrorResponse.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ErrorResponse.java
@@ -2,7 +2,7 @@
* ========================LICENSE_START=================================
* ONAP : ccsdk oran
* ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 Nordix Foundation. 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.
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyIdList.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyIdList.java
index 4e55c506..35c1c947 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyIdList.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyIdList.java
@@ -2,7 +2,7 @@
* ========================LICENSE_START=================================
* ONAP : ccsdk oran
* ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 Nordix Foundation. 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.
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyInfoList.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyInfoList.java
index 04f7e1ec..ae1aed95 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyInfoList.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyInfoList.java
@@ -2,7 +2,7 @@
* ========================LICENSE_START=================================
* ONAP : ccsdk oran
* ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 Nordix Foundation. 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.
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyTypeIdList.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyTypeIdList.java
index c2610b07..0da2e654 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyTypeIdList.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyTypeIdList.java
@@ -2,7 +2,7 @@
* ========================LICENSE_START=================================
* ONAP : ccsdk oran
* ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 Nordix Foundation. 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.
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyTypeInfo.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyTypeInfo.java
index 591c1caf..1f0e4476 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyTypeInfo.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyTypeInfo.java
@@ -2,7 +2,7 @@
* ========================LICENSE_START=================================
* ONAP : ccsdk oran
* ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 Nordix Foundation. 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.
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicInfo.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicInfo.java
index 44927707..6843cd1e 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicInfo.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicInfo.java
@@ -2,7 +2,7 @@
* ========================LICENSE_START=================================
* ONAP : ccsdk oran
* ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 Nordix Foundation. 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.
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicInfoList.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicInfoList.java
index f5612f9c..715c15b4 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicInfoList.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicInfoList.java
@@ -2,7 +2,7 @@
* ========================LICENSE_START=================================
* ONAP : ccsdk oran
* ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 Nordix Foundation. 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.
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceStatusList.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceStatusList.java
index e6aa8d41..55593894 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceStatusList.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceStatusList.java
@@ -2,7 +2,7 @@
* ========================LICENSE_START=================================
* ONAP : ccsdk oran
* ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 Nordix Foundation. 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.
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapMessageConsumer.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapMessageConsumer.java
deleted file mode 100644
index 94888c38..00000000
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapMessageConsumer.java
+++ /dev/null
@@ -1,235 +0,0 @@
-/*-
- * ========================LICENSE_START=================================
- * ONAP : ccsdk oran
- * ======================================================================
- * Copyright (C) 2020 Nordix Foundation. 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.ccsdk.oran.a1policymanagementservice.dmaap;
-
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonParser;
-
-import java.lang.invoke.MethodHandles;
-import java.time.Duration;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.onap.ccsdk.oran.a1policymanagementservice.clients.AsyncRestClient;
-import org.onap.ccsdk.oran.a1policymanagementservice.clients.AsyncRestClientFactory;
-import org.onap.ccsdk.oran.a1policymanagementservice.clients.SecurityContext;
-import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ApplicationConfig;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.http.HttpStatus;
-import org.springframework.stereotype.Component;
-
-import reactor.core.publisher.Flux;
-import reactor.core.publisher.FluxSink;
-import reactor.core.publisher.Mono;
-
-/**
- * The class fetches incoming requests from DMAAP. It uses the timeout parameter
- * that lets the MessageRouter keep the connection with the Kafka open until
- * requests are sent in.
- *
- * <p>
- * this service will regularly check the configuration and start polling DMaaP
- * if the configuration is added. If the DMaaP configuration is removed, then
- * the service will stop polling and resume checking for configuration.
- *
- * <p>
- * Each received request is processed by {@link DmaapMessageHandler}.
- */
-@Component
-public class DmaapMessageConsumer {
-
- protected static final Duration TIME_BETWEEN_DMAAP_RETRIES = Duration.ofSeconds(10);
-
- private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-
- private final ApplicationConfig applicationConfig;
-
- private DmaapMessageHandler dmaapMessageHandler = null;
-
- private final Gson gson;
-
- private final AsyncRestClientFactory restClientFactory;
-
- private final InfiniteFlux infiniteSubmitter = new InfiniteFlux();
-
- @Value("${server.http-port}")
- private int localServerHttpPort;
-
- private static class InfiniteFlux {
- private FluxSink<Integer> sink;
- private int counter = 0;
-
- public synchronized Flux<Integer> start() {
- stop();
- return Flux.create(this::next).doOnRequest(this::onRequest);
- }
-
- public synchronized void stop() {
- if (this.sink != null) {
- this.sink.complete();
- this.sink = null;
- }
- }
-
- void onRequest(long no) {
- for (long i = 0; i < no; ++i) {
- sink.next(counter++);
- }
- }
-
- void next(FluxSink<Integer> sink) {
- this.sink = sink;
- sink.next(counter++);
- }
-
- }
-
- @Autowired
- public DmaapMessageConsumer(ApplicationConfig applicationConfig, SecurityContext securityContext) {
- this.applicationConfig = applicationConfig;
- GsonBuilder gsonBuilder = new GsonBuilder();
- this.gson = gsonBuilder.create();
- this.restClientFactory = new AsyncRestClientFactory(applicationConfig.getWebClientConfig(), securityContext);
- }
-
- /**
- * Starts the DMAAP consumer. If there is a DMaaP configuration, it will start
- * polling for messages. Otherwise it will check regularly for the
- * configuration.
- *
- */
- public void start() {
- infiniteSubmitter.stop();
-
- createTask().subscribe(//
- value -> logger.debug("DmaapMessageConsumer next: {}", value), //
- throwable -> logger.error("DmaapMessageConsumer error: {}", throwable.getMessage()), //
- () -> logger.warn("DmaapMessageConsumer stopped") //
- );
- }
-
- protected Flux<String> createTask() {
- return infiniteFlux() //
- .flatMap(notUsed -> fetchFromDmaap(), 1) //
- .doOnNext(message -> logger.debug("Message Reveived from DMAAP : {}", message)) //
- .flatMap(this::parseReceivedMessage, 1)//
- .flatMap(this::handleDmaapMsg, 1) //
- .onErrorResume(throwable -> Mono.empty());
- }
-
- protected Flux<Integer> infiniteFlux() {
- return infiniteSubmitter.start();
- }
-
- protected Mono<Object> delay() {
- return Mono.delay(TIME_BETWEEN_DMAAP_RETRIES).flatMap(o -> Mono.empty());
- }
-
- private <T> List<T> parseList(String jsonString, Class<T> clazz) {
- List<T> result = new ArrayList<>();
- JsonArray jsonArr = JsonParser.parseString(jsonString).getAsJsonArray();
- for (JsonElement jsonElement : jsonArr) {
- // The element can either be a JsonObject or a JsonString
- if (jsonElement.isJsonPrimitive()) {
- T json = gson.fromJson(jsonElement.getAsString(), clazz);
- result.add(json);
- } else {
- T json = gson.fromJson(jsonElement.toString(), clazz);
- result.add(json);
- }
- }
- return result;
- }
-
- protected boolean isDmaapConfigured() {
- String producerTopicUrl = applicationConfig.getDmaapProducerTopicUrl();
- String consumerTopicUrl = applicationConfig.getDmaapConsumerTopicUrl();
- return (producerTopicUrl != null && consumerTopicUrl != null && !producerTopicUrl.isEmpty()
- && !consumerTopicUrl.isEmpty());
- }
-
- protected Mono<String> handleDmaapMsg(DmaapRequestMessage dmaapRequestMessage) {
- return getDmaapMessageHandler().handleDmaapMsg(dmaapRequestMessage);
- }
-
- protected Mono<String> getFromMessageRouter(String topicUrl) {
- logger.trace("getFromMessageRouter {}", topicUrl);
- AsyncRestClient c = restClientFactory.createRestClientNoHttpProxy("");
- return c.get(topicUrl);
- }
-
- protected Flux<DmaapRequestMessage> parseReceivedMessage(String jsonString) {
- try {
- logger.trace("parseMessages {}", jsonString);
- return Flux.fromIterable(parseList(jsonString, DmaapRequestMessage.class));
- } catch (Exception e) {
- logger.error("parseMessages error {}", jsonString);
- return sendErrorResponse("Could not parse: " + jsonString) //
- .flatMapMany(s -> Flux.empty());
- }
- }
-
- protected Mono<String> sendErrorResponse(String response) {
- logger.debug("sendErrorResponse {}", response);
- DmaapRequestMessage fakeRequest = DmaapRequestMessage.builder() //
- .apiVersion("") //
- .correlationId("") //
- .operation(DmaapRequestMessage.Operation.PUT) //
- .originatorId("") //
- .payload(null) //
- .requestId("") //
- .target("") //
- .timestamp("") //
- .url("URL") //
- .build();
- return getDmaapMessageHandler().sendDmaapResponse(response, fakeRequest, HttpStatus.BAD_REQUEST) //
- .onErrorResume(e -> Mono.empty());
- }
-
- private Mono<String> fetchFromDmaap() {
- if (!this.isDmaapConfigured()) {
- return delay().flatMap(o -> Mono.empty());
- }
- logger.debug("fetchFromDmaap");
- String topicUrl = this.applicationConfig.getDmaapConsumerTopicUrl();
-
- return getFromMessageRouter(topicUrl) //
- .onErrorResume(throwable -> delay().flatMap(o -> Mono.empty()));
- }
-
- private DmaapMessageHandler getDmaapMessageHandler() {
- if (this.dmaapMessageHandler == null) {
- String pmsBaseUrl = "http://localhost:" + this.localServerHttpPort;
- AsyncRestClient pmsClient = restClientFactory.createRestClientNoHttpProxy(pmsBaseUrl);
- AsyncRestClient producer =
- restClientFactory.createRestClientNoHttpProxy(this.applicationConfig.getDmaapProducerTopicUrl());
- this.dmaapMessageHandler = new DmaapMessageHandler(producer, pmsClient);
- }
- return this.dmaapMessageHandler;
- }
-
-}
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapMessageHandler.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapMessageHandler.java
deleted file mode 100644
index 022dec05..00000000
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapMessageHandler.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*-
- * ========================LICENSE_START=================================
- * ONAP : ccsdk oran
- * ======================================================================
- * Copyright (C) 2020 Nordix Foundation. 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.ccsdk.oran.a1policymanagementservice.dmaap;
-
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import com.google.gson.JsonObject;
-
-import java.lang.invoke.MethodHandles;
-
-import org.onap.ccsdk.oran.a1policymanagementservice.clients.AsyncRestClient;
-import org.onap.ccsdk.oran.a1policymanagementservice.dmaap.DmaapRequestMessage.Operation;
-import org.onap.ccsdk.oran.a1policymanagementservice.exceptions.ServiceException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.reactive.function.client.WebClientException;
-import org.springframework.web.reactive.function.client.WebClientResponseException;
-import reactor.core.publisher.Mono;
-
-/**
- * The class handles incoming requests from DMAAP.
- * <p>
- * That means: invoke a REST call towards this services and to send back a
- * response though DMAAP
- */
-public class DmaapMessageHandler {
- private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
- private static Gson gson = new GsonBuilder().create();
- private final AsyncRestClient dmaapClient;
- private final AsyncRestClient pmsClient;
-
- public DmaapMessageHandler(AsyncRestClient dmaapClient, AsyncRestClient pmsClient) {
- this.pmsClient = pmsClient;
- this.dmaapClient = dmaapClient;
- }
-
- public Mono<String> handleDmaapMsg(DmaapRequestMessage dmaapRequestMessage) {
- return this.invokePolicyManagementService(dmaapRequestMessage) //
- .onErrorResume(t -> handlePolicyManagementServiceCallError(t, dmaapRequestMessage)) //
- .flatMap(response -> sendDmaapResponse(response.getBody(), dmaapRequestMessage,
- response.getStatusCode()))
- .doOnError(t -> logger.warn("Failed to handle DMAAP message : {}", t.getMessage()))//
- .onErrorResume(t -> Mono.empty());
- }
-
- private Mono<ResponseEntity<String>> handlePolicyManagementServiceCallError(Throwable error,
- DmaapRequestMessage dmaapRequestMessage) {
- logger.debug("Policy Management Service call failed: {}", error.getMessage());
- HttpStatus status = HttpStatus.INTERNAL_SERVER_ERROR;
- String errorMessage = error.getMessage();
- if (error instanceof WebClientResponseException) {
- WebClientResponseException exception = (WebClientResponseException) error;
- status = exception.getStatusCode();
- errorMessage = exception.getResponseBodyAsString();
- } else if (error instanceof ServiceException) {
- status = HttpStatus.BAD_REQUEST;
- errorMessage = error.getMessage();
- } else if (!(error instanceof WebClientException)) {
- logger.warn("Unexpected exception ", error);
- }
- return sendDmaapResponse(errorMessage, dmaapRequestMessage, status) //
- .flatMap(notUsed -> Mono.empty());
- }
-
- public Mono<String> sendDmaapResponse(String response, DmaapRequestMessage dmaapRequestMessage, HttpStatus status) {
- return createDmaapResponseMessage(dmaapRequestMessage, response, status) //
- .flatMap(this::sendToDmaap) //
- .onErrorResume(this::handleResponseCallError);
- }
-
- private Mono<ResponseEntity<String>> invokePolicyManagementService(DmaapRequestMessage dmaapRequestMessage) {
- DmaapRequestMessage.Operation operation = dmaapRequestMessage.getOperation();
- String uri = dmaapRequestMessage.getUrl();
-
- if (operation == Operation.DELETE) {
- return pmsClient.deleteForEntity(uri);
- } else if (operation == Operation.GET) {
- return pmsClient.getForEntity(uri);
- } else if (operation == Operation.PUT) {
- return pmsClient.putForEntity(uri, payload(dmaapRequestMessage));
- } else if (operation == Operation.POST) {
- return pmsClient.postForEntity(uri, payload(dmaapRequestMessage));
- } else {
- return Mono.error(new ServiceException("Not implemented operation: " + operation));
- }
- }
-
- private String payload(DmaapRequestMessage message) {
- JsonObject payload = message.getPayload();
- if (payload != null) {
- return gson.toJson(payload);
- } else {
- logger.warn("Expected payload in message from DMAAP: {}", message);
- return "";
- }
- }
-
- private Mono<String> sendToDmaap(String body) {
- logger.debug("sendToDmaap: {} ", body);
- return dmaapClient.post("", "[" + body + "]");
- }
-
- private Mono<String> handleResponseCallError(Throwable t) {
- logger.warn("Failed to send response to DMaaP: {}", t.getMessage());
- return Mono.empty();
- }
-
- private Mono<String> createDmaapResponseMessage(DmaapRequestMessage dmaapRequestMessage, String response,
- HttpStatus status) {
- DmaapResponseMessage dmaapResponseMessage = DmaapResponseMessage.builder() //
- .status(status.toString()) //
- .message(response == null ? "" : response) //
- .type("response") //
- .correlationId(
- dmaapRequestMessage.getCorrelationId() == null ? "" : dmaapRequestMessage.getCorrelationId()) //
- .originatorId(
- dmaapRequestMessage.getOriginatorId() == null ? "" : dmaapRequestMessage.getOriginatorId()) //
- .requestId(dmaapRequestMessage.getRequestId() == null ? "" : dmaapRequestMessage.getRequestId()) //
- .timestamp(dmaapRequestMessage.getTimestamp() == null ? "" : dmaapRequestMessage.getTimestamp()) //
- .build();
- String str = gson.toJson(dmaapResponseMessage);
- return Mono.just(str);
- }
-}
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapRequestMessage.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapRequestMessage.java
deleted file mode 100644
index 10dc981e..00000000
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapRequestMessage.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*-
- * ========================LICENSE_START=================================
- * ONAP : ccsdk oran
- * ======================================================================
- * Copyright (C) 2020 Nordix Foundation. 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.ccsdk.oran.a1policymanagementservice.dmaap;
-
-import com.google.gson.JsonObject;
-
-import lombok.Builder;
-import lombok.EqualsAndHashCode;
-import lombok.Getter;
-
-@Getter
-@Builder
-@EqualsAndHashCode
-public class DmaapRequestMessage {
-
- public enum Operation {
- PUT, GET, DELETE, POST
- }
-
- String correlationId;
-
- String target;
-
- String timestamp;
-
- String apiVersion;
-
- String originatorId;
-
- String requestId;
-
- Operation operation;
-
- String url;
-
- JsonObject payload;
-}
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapResponseMessage.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapResponseMessage.java
deleted file mode 100644
index 64778551..00000000
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapResponseMessage.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*-
- * ========================LICENSE_START=================================
- * ONAP : ccsdk oran
- * ======================================================================
- * Copyright (C) 2020 Nordix Foundation. 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.ccsdk.oran.a1policymanagementservice.dmaap;
-
-import lombok.Builder;
-import lombok.EqualsAndHashCode;
-import lombok.Getter;
-
-@Getter
-@Builder
-@EqualsAndHashCode
-public class DmaapResponseMessage {
-
- String type;
-
- String correlationId;
-
- String timestamp;
-
- String originatorId;
-
- String requestId;
-
- String status;
-
- String message;
-}
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSupervision.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSupervision.java
index 3f0d3a0c..f11e30f3 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSupervision.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSupervision.java
@@ -2,7 +2,7 @@
* ========================LICENSE_START=================================
* ONAP : ccsdk oran
* ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 Nordix Foundation. 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.
diff --git a/a1-policy-management/src/main/resources/application_configuration_schema.json b/a1-policy-management/src/main/resources/application_configuration_schema.json
index 947db33e..8476951c 100644
--- a/a1-policy-management/src/main/resources/application_configuration_schema.json
+++ b/a1-policy-management/src/main/resources/application_configuration_schema.json
@@ -54,8 +54,8 @@
},
"controller": {
"type": "string"
- },
- "customAdapterClass" : {
+ },
+ "customAdapterClass": {
"type": "string"
},
"managedElementIds": {
@@ -78,80 +78,12 @@
"additionalProperties": false
}
]
- },
- "streams_publishes": {
- "type": "object",
- "properties": {
- "dmaap_publisher": {
- "type": "object",
- "properties": {
- "type": {
- "type": "string"
- },
- "dmaap_info": {
- "type": "object",
- "properties": {
- "topic_url": {
- "type": "string"
- }
- },
- "required": [
- "topic_url"
- ],
- "additionalProperties": false
- }
- },
- "required": [
- "type",
- "dmaap_info"
- ],
- "additionalProperties": false
- }
- },
- "required": [
- "dmaap_publisher"
- ],
- "additionalProperties": false
- },
- "streams_subscribes": {
- "type": "object",
- "properties": {
- "dmaap_subscriber": {
- "type": "object",
- "properties": {
- "type": {
- "type": "string"
- },
- "dmaap_info": {
- "type": "object",
- "properties": {
- "topic_url": {
- "type": "string"
- }
- },
- "required": [
- "topic_url"
- ],
- "additionalProperties": false
- }
- },
- "required": [
- "type",
- "dmaap_info"
- ],
- "additionalProperties": false
- }
- },
- "required": [
- "dmaap_subscriber"
- ],
- "additionalProperties": false
}
},
"required": [
"ric"
],
- "additionalProperties": false
+ "additionalProperties": true
}
},
"required": [
diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/aspect/LogAspectTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/aspect/LogAspectTest.java
index f8882440..cada8bc5 100644
--- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/aspect/LogAspectTest.java
+++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/aspect/LogAspectTest.java
@@ -2,7 +2,7 @@
* ========================LICENSE_START=================================
* ONAP : ccsdk oran
* ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 Nordix Foundation. 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.
diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1ClientFactoryTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1ClientFactoryTest.java
index a715191b..ef4ad1c8 100644
--- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1ClientFactoryTest.java
+++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1ClientFactoryTest.java
@@ -2,7 +2,7 @@
* ========================LICENSE_START=================================
* ONAP : ccsdk oran
* ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 Nordix Foundation. 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.
diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1ClientHelper.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1ClientHelper.java
index 56dc7ed6..b42edb8f 100644
--- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1ClientHelper.java
+++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1ClientHelper.java
@@ -2,7 +2,7 @@
* ========================LICENSE_START=================================
* ONAP : ccsdk oran
* ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 Nordix Foundation. 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.
diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/AsyncRestClientTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/AsyncRestClientTest.java
index 96769427..12ac46de 100644
--- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/AsyncRestClientTest.java
+++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/AsyncRestClientTest.java
@@ -2,7 +2,7 @@
* ========================LICENSE_START=================================
* ONAP : ccsdk oran
* ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 Nordix Foundation. 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.
diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/CcsdkA1AdapterClientTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/CcsdkA1AdapterClientTest.java
index b2fc84a6..9bd10f3a 100644
--- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/CcsdkA1AdapterClientTest.java
+++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/CcsdkA1AdapterClientTest.java
@@ -2,7 +2,7 @@
* ========================LICENSE_START=================================
* ONAP : ccsdk oran
* ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 Nordix Foundation. 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.
diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/OscA1ClientTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/OscA1ClientTest.java
index 731c83a4..c376d90f 100644
--- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/OscA1ClientTest.java
+++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/OscA1ClientTest.java
@@ -2,7 +2,7 @@
* ========================LICENSE_START=================================
* ONAP : ccsdk oran
* ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 Nordix Foundation. 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.
diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientV2Test.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientV2Test.java
index 0af8a17c..40154b4f 100644
--- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientV2Test.java
+++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientV2Test.java
@@ -2,7 +2,7 @@
* ========================LICENSE_START=================================
* ONAP : ccsdk oran
* ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 Nordix Foundation. 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.
diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigParserTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigParserTest.java
index 61543c0b..e43f4015 100644
--- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigParserTest.java
+++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigParserTest.java
@@ -2,7 +2,7 @@
* ========================LICENSE_START=================================
* ONAP : ccsdk oran
* ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 Nordix Foundation. 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.
@@ -28,7 +28,6 @@ import static org.mockito.Mockito.when;
import com.google.common.base.Charsets;
import com.google.common.io.Resources;
-import com.google.gson.Gson;
import com.google.gson.JsonIOException;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
@@ -61,14 +60,6 @@ class ApplicationConfigParserTest {
ApplicationConfigParser.ConfigParserResult result = parserUnderTest.parse(jsonRootObject);
- String topicUrl = result.getDmaapProducerTopicUrl();
- assertEquals("http://admin:admin@localhost:6845/events/A1-POLICY-AGENT-WRITE", topicUrl, "controller contents");
-
- topicUrl = result.getDmaapConsumerTopicUrl();
- assertEquals(
- "http://admin:admin@localhost:6845/events/A1-POLICY-AGENT-READ/users/policy-agent?timeout=15000&limit=100",
- topicUrl, "controller contents");
-
Map<String, ControllerConfig> controllers = result.getControllerConfigs();
assertEquals(1, controllers.size(), "size");
ControllerConfig expectedControllerConfig = ControllerConfig.builder() //
@@ -90,71 +81,12 @@ class ApplicationConfigParserTest {
}
private static InputStream getCorrectJson() throws IOException {
- URL url = ApplicationConfigParser.class.getClassLoader()
- .getResource("test_application_configuration_with_dmaap_config.json");
+ URL url = ApplicationConfigParser.class.getClassLoader().getResource("test_application_configuration.json");
String string = Resources.toString(url, Charsets.UTF_8);
return new ByteArrayInputStream((string.getBytes(StandardCharsets.UTF_8)));
}
@Test
- @DisplayName("test when Dmaap Config Has Several Streams Publishing")
- void whenDmaapConfigHasSeveralStreamsPublishing() throws Exception {
- JsonObject jsonRootObject = getJsonRootObject();
- JsonObject json = jsonRootObject.getAsJsonObject("config").getAsJsonObject("streams_publishes");
- JsonObject fake_info_object = new JsonObject();
- fake_info_object.addProperty("fake_info", "fake");
- json.add("fake_info_object", new Gson().toJsonTree(fake_info_object));
- DataPublishing data = new Gson().fromJson(json.toString(), DataPublishing.class);
- final String expectedMessage =
- "Invalid configuration. Number of streams must be one, config: " + data.toString();
-
- Exception actualException = assertThrows(ServiceException.class, () -> parserUnderTest.parse(jsonRootObject));
-
- assertEquals(expectedMessage, actualException.getMessage(),
- "Wrong error message when the DMaaP config has several streams publishing");
- }
-
- class DataPublishing {
- private JsonObject dmaap_publisher;
- private JsonObject fake_info_object;
-
- @Override
- public String toString() {
- return String.format("[dmaap_publisher=%s, fake_info_object=%s]", dmaap_publisher.toString(),
- fake_info_object.toString());
- }
- }
-
- @Test
- @DisplayName("test when Dmaap Config Has Several Streams Subscribing")
- void whenDmaapConfigHasSeveralStreamsSubscribing() throws Exception {
- JsonObject jsonRootObject = getJsonRootObject();
- JsonObject json = jsonRootObject.getAsJsonObject("config").getAsJsonObject("streams_subscribes");
- JsonObject fake_info_object = new JsonObject();
- fake_info_object.addProperty("fake_info", "fake");
- json.add("fake_info_object", new Gson().toJsonTree(fake_info_object));
- DataSubscribing data = new Gson().fromJson(json.toString(), DataSubscribing.class);
- final String expectedMessage =
- "Invalid configuration. Number of streams must be one, config: " + data.toString();
-
- Exception actualException = assertThrows(ServiceException.class, () -> parserUnderTest.parse(jsonRootObject));
-
- assertEquals(expectedMessage, actualException.getMessage(),
- "Wrong error message when the DMaaP config has several streams subscribing");
- }
-
- private class DataSubscribing {
- private JsonObject dmaap_subscriber;
- private JsonObject fake_info_object;
-
- @Override
- public String toString() {
- return String.format("[dmaap_subscriber=%s, fake_info_object=%s]", dmaap_subscriber.toString(),
- fake_info_object.toString());
- }
- }
-
- @Test
@DisplayName("test when Wrong Member Name In Object")
void whenWrongMemberNameInObject() throws Exception {
JsonObject jsonRootObject = getJsonRootObject();
@@ -180,10 +112,4 @@ class ApplicationConfigParserTest {
assertThat(actualException.getMessage()).contains("Json schema validation failure");
}
-
- JsonObject getDmaapInfo(JsonObject jsonRootObject, String streamsPublishesOrSubscribes,
- String dmaapPublisherOrSubscriber) throws Exception {
- return jsonRootObject.getAsJsonObject("config").getAsJsonObject(streamsPublishesOrSubscribes)
- .getAsJsonObject(dmaapPublisherOrSubscriber).getAsJsonObject("dmaap_info");
- }
}
diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigTest.java
index 39a8aa89..15e4739a 100644
--- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigTest.java
+++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfigTest.java
@@ -2,7 +2,7 @@
* ========================LICENSE_START=================================
* ONAP : ccsdk oran
* ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 Nordix Foundation. 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.
@@ -55,8 +55,6 @@ class ApplicationConfigTest {
ConfigParserResult configParserResult(RicConfig... rics) {
return ConfigParserResult.builder() //
.ricConfigs(Arrays.asList(rics)) //
- .dmaapConsumerTopicUrl("dmaapConsumerTopicUrl") //
- .dmaapProducerTopicUrl("dmaapProducerTopicUrl") //
.controllerConfigs(new HashMap<>()) //
.build();
}
diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ConfigurationFileTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ConfigurationFileTest.java
index 7875cfb5..b79a4ca8 100644
--- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ConfigurationFileTest.java
+++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ConfigurationFileTest.java
@@ -1,6 +1,6 @@
/*-
* ========================LICENSE_START=================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 Nordix Foundation. 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.
diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConcurrencyTestRunnable.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConcurrencyTestRunnable.java
index 4e535ab2..0bf212a7 100644
--- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConcurrencyTestRunnable.java
+++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConcurrencyTestRunnable.java
@@ -2,7 +2,7 @@
* ========================LICENSE_START=================================
* ONAP : ccsdk oran
* ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 Nordix Foundation. 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.
diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationControllerTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationControllerTest.java
index 3c5b1d9e..c0a6b4e4 100644
--- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationControllerTest.java
+++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationControllerTest.java
@@ -1,6 +1,6 @@
/*-
* ========================LICENSE_START=================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 Nordix Foundation. 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.
@@ -134,8 +134,8 @@ class ConfigurationControllerTest {
}
private String configAsString() throws Exception {
- File configFile = new File(getClass().getClassLoader()
- .getResource("test_application_configuration_with_dmaap_config.json").getFile());
+ File configFile =
+ new File(getClass().getClassLoader().getResource("test_application_configuration.json").getFile());
return FileUtils.readFileToString(configFile, "UTF-8");
}
diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RappSimulatorController.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RappSimulatorController.java
index 371bd959..337c4798 100644
--- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RappSimulatorController.java
+++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RappSimulatorController.java
@@ -2,7 +2,7 @@
* ========================LICENSE_START=================================
* O-RAN-SC
* %%
- * Copyright (C) 2020 Nordix Foundation
+ * Copyright (C) 2020-2023 Nordix Foundation
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapMessageConsumerTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapMessageConsumerTest.java
deleted file mode 100644
index 7abc5db8..00000000
--- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapMessageConsumerTest.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*-
- * ========================LICENSE_START=================================
- * ONAP : ccsdk oran
- * ======================================================================
- * Copyright (C) 2020 Nordix Foundation. 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.ccsdk.oran.a1policymanagementservice.dmaap;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import com.google.gson.JsonObject;
-
-import java.util.ArrayList;
-
-import org.junit.Assert;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.DisplayName;
-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.ccsdk.oran.a1policymanagementservice.clients.AsyncRestClient;
-import org.onap.ccsdk.oran.a1policymanagementservice.clients.SecurityContext;
-import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ApplicationConfig;
-import org.onap.ccsdk.oran.a1policymanagementservice.dmaap.DmaapRequestMessage.Operation;
-import org.onap.ccsdk.oran.a1policymanagementservice.exceptions.ServiceException;
-import org.onap.ccsdk.oran.a1policymanagementservice.utils.LoggingUtils;
-
-import reactor.core.publisher.Flux;
-import reactor.core.publisher.Mono;
-
-@ExtendWith(MockitoExtension.class)
-class DmaapMessageConsumerTest {
- @Mock
- private ApplicationConfig applicationConfigMock;
- @Mock
- private AsyncRestClient messageRouterConsumerMock;
- @Mock
- private DmaapMessageHandler messageHandlerMock;
-
- private DmaapMessageConsumer messageConsumerUnderTest;
-
- private Gson gson = new GsonBuilder().create();
-
- @AfterEach
- void resetLogging() {
- LoggingUtils.getLogListAppender(DmaapMessageConsumer.class);
- }
-
- private void setTaskNumberOfLoops(int number) {
- ArrayList<Integer> l = new ArrayList<>();
- for (int i = 0; i < number; ++i) {
- l.add(i);
- }
- Flux<Integer> f = Flux.fromIterable(l);
- doReturn(f).when(messageConsumerUnderTest).infiniteFlux();
- }
-
- private void disableTaskDelay() {
- doReturn(Mono.empty()).when(messageConsumerUnderTest).delay();
- }
-
- @Test
- @DisplayName("successful Case dmaap Not Configured then Sleep And Retry Until Config")
- void successfulCase_dmaapNotConfigured_thenSleepAndRetryUntilConfig() throws Exception {
- messageConsumerUnderTest = spy(new DmaapMessageConsumer(applicationConfigMock, new SecurityContext("")));
-
- setTaskNumberOfLoops(3);
- disableTaskDelay();
-
- when(this.applicationConfigMock.getDmaapConsumerTopicUrl()).thenReturn("getDmaapConsumerTopicUrl");
- doReturn(false, false, true).when(messageConsumerUnderTest).isDmaapConfigured();
- doReturn(Mono.just(dmaapRequestMessageString())).when(messageConsumerUnderTest)
- .getFromMessageRouter(anyString());
-
- doReturn(Mono.just("responseFromHandler")).when(messageConsumerUnderTest).handleDmaapMsg(any());
-
- String s = messageConsumerUnderTest.createTask().blockLast();
- assertEquals("responseFromHandler", s);
- verify(messageConsumerUnderTest, times(2)).delay();
- verify(messageConsumerUnderTest, times(1)).handleDmaapMsg(any());
- }
-
- @Test
- @DisplayName("return Error From Dmapp then Sleep And Retry")
- void returnErrorFromDmapp_thenSleepAndRetry() throws Exception {
- messageConsumerUnderTest = spy(new DmaapMessageConsumer(applicationConfigMock, new SecurityContext("")));
-
- setTaskNumberOfLoops(2);
- disableTaskDelay();
- setUpMrConfig();
-
- {
- Mono<String> dmaapError = Mono.error(new ServiceException("dmaapError"));
- Mono<String> dmaapResponse = Mono.just(dmaapRequestMessageString());
- doReturn(dmaapError, dmaapResponse).when(messageConsumerUnderTest).getFromMessageRouter(anyString());
- }
-
- doReturn(Mono.just("response1")).when(messageConsumerUnderTest).handleDmaapMsg(any());
-
- String s = messageConsumerUnderTest.createTask().blockLast();
-
- verify(messageConsumerUnderTest, times(2)).getFromMessageRouter(anyString());
- verify(messageConsumerUnderTest, times(0)).sendErrorResponse(anyString());
- verify(messageConsumerUnderTest, times(1)).delay();
- verify(messageConsumerUnderTest, times(1)).handleDmaapMsg(any());
- assertEquals("response1", s);
- }
-
- @Test
- @DisplayName("unParsable Message then Send Response And Continue")
- void unParsableMessage_thenSendResponseAndContinue() throws Exception {
- messageConsumerUnderTest = spy(new DmaapMessageConsumer(applicationConfigMock, new SecurityContext("")));
- setTaskNumberOfLoops(2);
- setUpMrConfig();
-
- {
- Mono<String> dmaapError = Mono.just("Non valid JSON \"");
- Mono<String> dmaapResponse = Mono.just(dmaapRequestMessageString());
- doReturn(dmaapError, dmaapResponse).when(messageConsumerUnderTest).getFromMessageRouter(anyString());
- }
-
- doReturn(Mono.just("response1")).when(messageConsumerUnderTest).handleDmaapMsg(any());
-
- String s = messageConsumerUnderTest.createTask().blockLast();
- assertEquals("response1", s);
-
- verify(messageConsumerUnderTest, times(2)).getFromMessageRouter(anyString());
- verify(messageConsumerUnderTest, times(1)).sendErrorResponse(anyString());
- verify(messageConsumerUnderTest, times(0)).delay();
- verify(messageConsumerUnderTest, times(1)).handleDmaapMsg(dmaapRequestMessage());
- }
-
- private String dmaapRequestMessageString() {
- String json = gson.toJson(dmaapRequestMessage());
- return jsonArray(json);
- }
-
- @Test
- @DisplayName("test Message Parsing")
- void testMessageParsing() throws ServiceException {
- messageConsumerUnderTest = new DmaapMessageConsumer(applicationConfigMock, new SecurityContext(""));
- String json = gson.toJson(dmaapRequestMessage());
- {
- String jsonArrayOfObject = jsonArray(json);
- DmaapRequestMessage parsedMessage =
- messageConsumerUnderTest.parseReceivedMessage(jsonArrayOfObject).blockLast();
- assertNotNull(parsedMessage);
- assertNotNull(parsedMessage.getPayload());
-
- Assert.assertEquals(dmaapRequestMessage(), parsedMessage);
- }
- {
- String jsonArrayOfString = jsonArray(quote(json));
- DmaapRequestMessage parsedMessage =
- messageConsumerUnderTest.parseReceivedMessage(jsonArrayOfString).blockLast();
- assertNotNull(parsedMessage);
- assertNotNull(parsedMessage.getPayload());
- Assert.assertEquals(dmaapRequestMessage(), parsedMessage);
- }
-
- }
-
- private void setUpMrConfig() {
- when(applicationConfigMock.getDmaapConsumerTopicUrl()).thenReturn("url");
- when(applicationConfigMock.getDmaapProducerTopicUrl()).thenReturn("url");
- }
-
- private String jsonArray(String s) {
- return "[" + s + "]";
- }
-
- private String quote(String s) {
- return "\"" + s.replace("\"", "\\\"") + "\"";
- }
-
- private DmaapRequestMessage dmaapRequestMessage() {
- return DmaapRequestMessage.builder() //
- .apiVersion("apiVersion") //
- .correlationId("correlationId") //
- .operation(Operation.PUT) //
- .originatorId("originatorId") //
- .payload(new JsonObject()) //
- .requestId("requestId") //
- .target("target") //
- .timestamp("timestamp") //
- .url("URL") //
- .build();
- }
-
-}
diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapMessageHandlerTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapMessageHandlerTest.java
deleted file mode 100644
index 2ec3664c..00000000
--- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapMessageHandlerTest.java
+++ /dev/null
@@ -1,254 +0,0 @@
-/*-
- * ========================LICENSE_START=================================
- * ONAP : ccsdk oran
- * ======================================================================
- * Copyright (C) 2019-2020 Nordix Foundation. 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.ccsdk.oran.a1policymanagementservice.dmaap;
-
-import static ch.qos.logback.classic.Level.WARN;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.ArgumentMatchers.anyString;
-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.verifyNoMoreInteractions;
-
-import ch.qos.logback.classic.spi.ILoggingEvent;
-import ch.qos.logback.core.read.ListAppender;
-
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import com.google.gson.JsonObject;
-
-import java.io.IOException;
-import java.nio.charset.Charset;
-
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.DisplayName;
-import org.junit.jupiter.api.Test;
-import org.mockito.ArgumentCaptor;
-import org.onap.ccsdk.oran.a1policymanagementservice.clients.AsyncRestClient;
-import org.onap.ccsdk.oran.a1policymanagementservice.dmaap.DmaapRequestMessage.Operation;
-import org.onap.ccsdk.oran.a1policymanagementservice.utils.LoggingUtils;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.reactive.function.client.WebClientResponseException;
-
-import reactor.core.publisher.Mono;
-import reactor.test.StepVerifier;
-
-class DmaapMessageHandlerTest {
- private static final String URL = "url";
-
- private final AsyncRestClient dmaapClient = mock(AsyncRestClient.class);
- private final AsyncRestClient pmsClient = mock(AsyncRestClient.class);
- private DmaapMessageHandler testedObject;
- private Gson gson = new GsonBuilder().create(); //
-
- @BeforeEach
- private void setUp() throws Exception {
- testedObject = spy(new DmaapMessageHandler(dmaapClient, pmsClient));
- }
-
- JsonObject payloadAsJson() {
- return gson.fromJson(payloadAsString(), JsonObject.class);
- }
-
- String payloadAsString() {
- return "{\"param\":\"value\"}";
- }
-
- DmaapRequestMessage dmaapRequestMessage(Operation operation) {
- JsonObject payload = ((operation == Operation.PUT || operation == Operation.POST) ? payloadAsJson() : null);
- return DmaapRequestMessage.builder() //
- .apiVersion("apiVersion") //
- .correlationId("correlationId") //
- .operation(operation) //
- .originatorId("originatorId") //
- .payload(payload) //
- .requestId("requestId") //
- .target("target") //
- .timestamp("timestamp") //
- .url(URL) //
- .build();
- }
-
- private Mono<ResponseEntity<String>> okResponse() {
- ResponseEntity<String> entity = new ResponseEntity<>("OK", HttpStatus.OK);
- return Mono.just(entity);
- }
-
- private Mono<ResponseEntity<String>> notOkResponse() {
- ResponseEntity<String> entity = new ResponseEntity<>("NOK", HttpStatus.BAD_GATEWAY);
- return Mono.just(entity);
- }
-
- @Test
- @DisplayName("test successful Delete")
- void successfulDelete() throws IOException {
- doReturn(okResponse()).when(pmsClient).deleteForEntity(anyString());
- doReturn(Mono.just("OK")).when(dmaapClient).post(anyString(), anyString());
-
- DmaapRequestMessage message = dmaapRequestMessage(Operation.DELETE);
-
- StepVerifier //
- .create(testedObject.handleDmaapMsg(message)) //
- .expectSubscription() //
- .expectNext("OK") //
- .verifyComplete(); //
-
- verify(pmsClient).deleteForEntity(URL);
- verifyNoMoreInteractions(pmsClient);
-
- verify(dmaapClient).post(anyString(), anyString());
-
- verifyNoMoreInteractions(dmaapClient);
- }
-
- @Test
- @DisplayName("test successful Get")
- void successfulGet() throws IOException {
- doReturn(okResponse()).when(pmsClient).getForEntity(anyString());
- doReturn(Mono.just("OK")).when(dmaapClient).post(anyString(), anyString());
-
- DmaapRequestMessage message = dmaapRequestMessage(Operation.GET);
- StepVerifier //
- .create(testedObject.handleDmaapMsg(message)) //
- .expectSubscription() //
- .expectNext("OK") //
- .verifyComplete(); //
-
- verify(pmsClient).getForEntity(URL);
- verifyNoMoreInteractions(pmsClient);
-
- verify(dmaapClient).post(anyString(), anyString());
- verifyNoMoreInteractions(dmaapClient);
- }
-
- @Test
- @DisplayName("test exception From Pms When Get then Post Error")
- void exceptionFromPmsWhenGet_thenPostError() throws IOException {
- String errorBody = "Unavailable";
- WebClientResponseException webClientResponseException = new WebClientResponseException(
- HttpStatus.SERVICE_UNAVAILABLE.value(), "", (HttpHeaders) null, errorBody.getBytes(), (Charset) null);
- doReturn(Mono.error(webClientResponseException)).when(pmsClient).getForEntity(anyString());
- doReturn(Mono.just("OK")).when(dmaapClient).post(anyString(), anyString());
-
- DmaapRequestMessage message = dmaapRequestMessage(Operation.GET);
- StepVerifier //
- .create(testedObject.handleDmaapMsg(message)) //
- .expectSubscription() //
- .verifyComplete(); //
-
- ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
- verify(dmaapClient).post(anyString(), captor.capture());
- String actualMessage = captor.getValue();
- assertThat(actualMessage).contains(HttpStatus.SERVICE_UNAVAILABLE.toString()) //
- .contains(errorBody);
- }
-
- @Test
- @DisplayName("test successful Put")
- void successfulPut() throws IOException {
- doReturn(okResponse()).when(pmsClient).putForEntity(anyString(), anyString());
- doReturn(Mono.just("OK")).when(dmaapClient).post(anyString(), anyString());
-
- DmaapRequestMessage message = dmaapRequestMessage(Operation.PUT);
- StepVerifier //
- .create(testedObject.handleDmaapMsg(message)) //
- .expectSubscription() //
- .expectNext("OK") //
- .verifyComplete(); //
-
- verify(pmsClient).putForEntity(URL, payloadAsString());
- verifyNoMoreInteractions(pmsClient);
-
- verify(dmaapClient).post(anyString(), anyString());
- verifyNoMoreInteractions(dmaapClient);
- }
-
- @Test
- @DisplayName("test successful Post")
- void successfulPost() throws IOException {
- doReturn(okResponse()).when(pmsClient).postForEntity(anyString(), anyString());
- doReturn(Mono.just("OK")).when(dmaapClient).post(anyString(), anyString());
-
- DmaapRequestMessage message = dmaapRequestMessage(Operation.POST);
- StepVerifier //
- .create(testedObject.handleDmaapMsg(message)) //
- .expectSubscription() //
- .expectNext("OK") //
- .verifyComplete(); //
-
- verify(pmsClient).postForEntity(URL, payloadAsString());
- verifyNoMoreInteractions(pmsClient);
-
- verify(dmaapClient).post(anyString(), anyString());
- verifyNoMoreInteractions(dmaapClient);
- }
-
- @Test
- @DisplayName("test exception When Calling Pms then Error Response")
- void exceptionWhenCallingPms_thenErrorResponse() throws IOException {
-
- doReturn(notOkResponse()).when(pmsClient).putForEntity(anyString(), anyString());
- doReturn(Mono.just("OK")).when(dmaapClient).post(anyString(), anyString());
-
- DmaapRequestMessage message = dmaapRequestMessage(Operation.PUT);
- testedObject.handleDmaapMsg(message).block();
-
- verify(pmsClient).putForEntity(anyString(), anyString());
- verifyNoMoreInteractions(pmsClient);
-
- ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
- verify(dmaapClient).post(anyString(), captor.capture());
- String actualMessage = captor.getValue();
- assertThat(actualMessage).as("Message \"%s\" sent to DMaaP contains %s", actualMessage, HttpStatus.BAD_GATEWAY)
- .contains(HttpStatus.BAD_GATEWAY.toString());
-
- verifyNoMoreInteractions(dmaapClient);
- }
-
- @Test
- @DisplayName("test put Without Payload then Not Found Response With Warning")
- void putWithoutPayload_thenNotFoundResponseWithWarning() throws Exception {
- DmaapRequestMessage message = DmaapRequestMessage.builder() //
- .apiVersion("apiVersion") //
- .correlationId("correlationId") //
- .operation(DmaapRequestMessage.Operation.PUT) //
- .originatorId("originatorId") //
- .payload(null) //
- .requestId("requestId") //
- .target("target") //
- .timestamp("timestamp") //
- .url(URL) //
- .build();
-
- final ListAppender<ILoggingEvent> logAppender =
- LoggingUtils.getLogListAppender(DmaapMessageHandler.class, WARN);
-
- doReturn(notOkResponse()).when(pmsClient).putForEntity(anyString(), anyString());
- testedObject.handleDmaapMsg(message).block();
-
- assertThat(logAppender.list.get(0).getFormattedMessage())
- .startsWith("Expected payload in message from DMAAP: ");
- }
-
-}
diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RefreshConfigTaskTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RefreshConfigTaskTest.java
index a2d20ac2..d84359ad 100644
--- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RefreshConfigTaskTest.java
+++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RefreshConfigTaskTest.java
@@ -40,7 +40,6 @@ import java.time.Duration;
import java.util.Arrays;
import java.util.Optional;
import java.util.Properties;
-import java.util.Vector;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
@@ -74,13 +73,6 @@ class RefreshConfigTaskTest {
@Mock
ConfigurationFile configurationFileMock;
- private static final String RIC_1_NAME = "ric1";
- private static final RicConfig CORRECT_RIC_CONIFG = RicConfig.builder() //
- .ricId(RIC_1_NAME) //
- .baseUrl("http://localhost:8080/") //
- .managedElementIds(new Vector<String>(Arrays.asList("kista_1", "kista_2"))) //
- .build();
-
private RefreshConfigTask createTestObject(boolean configFileExists) {
return createTestObject(configFileExists, spy(new Rics()), new Policies(appConfig), true);
}
@@ -120,10 +112,9 @@ class RefreshConfigTaskTest {
verify(refreshTaskUnderTest.rics, times(2)).put(any(Ric.class));
- Iterable<RicConfig> ricConfigs = appConfig.getRicConfigs();
- RicConfig ricConfig = ricConfigs.iterator().next();
+ java.util.Collection<RicConfig> ricConfigs = appConfig.getRicConfigs();
assertThat(ricConfigs).isNotNull();
- assertThat(ricConfig).isEqualTo(CORRECT_RIC_CONIFG);
+ assertThat(ricConfigs).hasSize(2);
}
@Test
diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSupervisionTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSupervisionTest.java
index 7b5e9768..1b41ce08 100644
--- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSupervisionTest.java
+++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSupervisionTest.java
@@ -2,7 +2,7 @@
* ========================LICENSE_START=================================
* ONAP : ccsdk oran
* ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 Nordix Foundation. 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.
diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSynchronizationTaskTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSynchronizationTaskTest.java
index 1f933cde..c2f419fb 100644
--- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSynchronizationTaskTest.java
+++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSynchronizationTaskTest.java
@@ -2,7 +2,7 @@
* ========================LICENSE_START=================================
* ONAP : ccsdk oran
* ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 Nordix Foundation. 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.
diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/utils/MockA1Client.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/utils/MockA1Client.java
index 80bfff72..91b762c5 100644
--- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/utils/MockA1Client.java
+++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/utils/MockA1Client.java
@@ -2,7 +2,7 @@
* ========================LICENSE_START=================================
* ONAP : ccsdk oran
* ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2020-2023 Nordix Foundation. 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.
diff --git a/a1-policy-management/src/test/resources/test_application_configuration.json b/a1-policy-management/src/test/resources/test_application_configuration.json
index fef2382a..c9f67a46 100644
--- a/a1-policy-management/src/test/resources/test_application_configuration.json
+++ b/a1-policy-management/src/test/resources/test_application_configuration.json
@@ -1,10 +1,20 @@
{
"config": {
- "description": "Application configuration",
+ "description": "Test",
+ "controller": [
+ {
+ "name": "controller1",
+ "baseUrl": "http://localhost:8083/",
+ "userName": "user",
+ "password": "password"
+ }
+ ],
"ric": [
{
"name": "ric1",
- "baseUrl": "http://localhost:8080/",
+ "controller": "controller1",
+ "baseUrl": "http://localhost:8083/",
+ "customAdapterClass": "org.onap.ccsdk.oran.a1policymanagementservice.clients.StdA1ClientVersion2$Factory",
"managedElementIds": [
"kista_1",
"kista_2"
@@ -12,29 +22,20 @@
},
{
"name": "ric2",
- "baseUrl": "http://localhost:8081/",
- "customAdapterClass": "org.onap.ccsdk.oran.a1policymanagementservice.clients.StdA1ClientVersion2$Factory",
+ "baseUrl": "http://localhost:8085/",
+ "managedElementIds": [
+ "kista_3",
+ "kista_4"
+ ]
+ },
+ {
+ "name": "ric3_noBaseURL",
+ "baseUrl": "",
"managedElementIds": [
"kista_3",
"kista_4"
]
}
- ],
- "streams_publishes": {
- "dmaap_publisher": {
- "type": "message_router",
- "dmaap_info": {
- "topic_url": "http://admin:admin@localhost:6845/events/A1-POLICY-AGENT-WRITE"
- }
- }
- },
- "streams_subscribes": {
- "dmaap_subscriber": {
- "type": "message_router",
- "dmaap_info": {
- "topic_url": "http://admin:admin@localhost:6845/events/A1-POLICY-AGENT-READ/users/policy-agent?timeout=15000&limit=100"
- }
- }
- }
+ ]
}
}
diff --git a/a1-policy-management/src/test/resources/test_application_configuration_with_dmaap_config.json b/a1-policy-management/src/test/resources/test_application_configuration_with_dmaap_config.json
deleted file mode 100644
index 6e1de75e..00000000
--- a/a1-policy-management/src/test/resources/test_application_configuration_with_dmaap_config.json
+++ /dev/null
@@ -1,57 +0,0 @@
-{
- "config": {
- "description": "Test",
- "controller": [
- {
- "name": "controller1",
- "baseUrl": "http://localhost:8083/",
- "userName": "user",
- "password": "password"
- }
- ],
- "ric": [
- {
- "name": "ric1",
- "controller": "controller1",
- "baseUrl": "http://localhost:8083/",
- "customAdapterClass": "org.onap.ccsdk.oran.a1policymanagementservice.clients.StdA1ClientVersion2$Factory",
- "managedElementIds": [
- "kista_1",
- "kista_2"
- ]
- },
- {
- "name": "ric2",
- "baseUrl": "http://localhost:8085/",
- "managedElementIds": [
- "kista_3",
- "kista_4"
- ]
- },
- {
- "name": "ric3_noBaseURL",
- "baseUrl": "",
- "managedElementIds": [
- "kista_3",
- "kista_4"
- ]
- }
- ],
- "streams_publishes": {
- "dmaap_publisher": {
- "type": "message_router",
- "dmaap_info": {
- "topic_url": "http://admin:admin@localhost:6845/events/A1-POLICY-AGENT-WRITE"
- }
- }
- },
- "streams_subscribes": {
- "dmaap_subscriber": {
- "type": "message_router",
- "dmaap_info": {
- "topic_url": "http://admin:admin@localhost:6845/events/A1-POLICY-AGENT-READ/users/policy-agent?timeout=15000&limit=100"
- }
- }
- }
- }
-} \ No newline at end of file