aboutsummaryrefslogtreecommitdiffstats
path: root/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service
diff options
context:
space:
mode:
authorsourabh_sourabh <sourabh.sourabh@est.tech>2023-08-08 19:30:41 +0100
committersourabh_sourabh <sourabh.sourabh@est.tech>2023-08-09 15:19:44 +0100
commitc38ada1f4b44cf5dcc9f8cc4fb49cd9a8568a774 (patch)
treea6470a025940cb486b08691ef8747369f50b27ce /dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service
parent67b4b3964cb5077c334ea057e9138213e7ac989c (diff)
Modify DmiDataOperationRequest to make it identical as DataOperationRequest
- Modified DmiDataOperationRequest attribute from operationType to operation. - Wrapped operation details to parent attribute operationd array. Issue-ID: CPS-1833 Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech> Change-Id: I79aa943e10e1c32c3252a6eb4375c14496476f8b Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech>
Diffstat (limited to 'dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service')
-rw-r--r--dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/DmiRestStubController.java25
-rw-r--r--dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/model/data/operational/DataOperationRequest.java2
-rw-r--r--dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/model/data/operational/DmiDataOperationRequest.java (renamed from dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/model/data/operational/ResourceDataOperationRequests.java)11
3 files changed, 25 insertions, 13 deletions
diff --git a/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/DmiRestStubController.java b/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/DmiRestStubController.java
index b7e67d7556..275331e186 100644
--- a/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/DmiRestStubController.java
+++ b/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/DmiRestStubController.java
@@ -37,7 +37,7 @@ import org.onap.cps.ncmp.api.NcmpEventResponseCode;
import org.onap.cps.ncmp.api.impl.utils.EventDateTimeFormatter;
import org.onap.cps.ncmp.dmi.rest.stub.model.data.operational.CmHandle;
import org.onap.cps.ncmp.dmi.rest.stub.model.data.operational.DataOperationRequest;
-import org.onap.cps.ncmp.dmi.rest.stub.model.data.operational.ResourceDataOperationRequests;
+import org.onap.cps.ncmp.dmi.rest.stub.model.data.operational.DmiDataOperationRequest;
import org.onap.cps.ncmp.dmi.rest.stub.utils.ResourceFileReaderUtil;
import org.onap.cps.ncmp.events.async1_0_0.Data;
import org.onap.cps.ncmp.events.async1_0_0.DataOperationEvent;
@@ -108,9 +108,9 @@ public class DmiRestStubController {
/**
* This method is not implemented for ONAP DMI plugin.
*
- * @param topic client given topic name
- * @param requestId requestId generated by NCMP as an ack for client
- * @param resourceDataOperationRequests list of operation details
+ * @param topic client given topic name
+ * @param requestId requestId generated by NCMP as an ack for client
+ * @param dmiDataOperationRequest list of operation details
* @return (@ code ResponseEntity) response entity
*/
@PostMapping("/v1/data")
@@ -118,12 +118,17 @@ public class DmiRestStubController {
final String topic,
@RequestParam(value = "requestId")
final String requestId,
- @RequestBody final ResourceDataOperationRequests
- resourceDataOperationRequests) {
- log.info("Request received from the NCMP to DMI Plugin");
- resourceDataOperationRequests.forEach(resourceDataOperationRequest -> {
- final DataOperationEvent dataOperationEvent = getDataOperationEvent(resourceDataOperationRequest);
- resourceDataOperationRequest.getCmHandles().forEach(cmHandle -> {
+ @RequestBody final DmiDataOperationRequest
+ dmiDataOperationRequest) {
+ try {
+ log.info("Request received from the NCMP to DMI Plugin: {}",
+ objectMapper.writeValueAsString(dmiDataOperationRequest));
+ } catch (final JsonProcessingException jsonProcessingException) {
+ log.info("Unable to process dmi data operation request to json string");
+ }
+ dmiDataOperationRequest.getOperations().forEach(dmiDataOperation -> {
+ final DataOperationEvent dataOperationEvent = getDataOperationEvent(dmiDataOperation);
+ dmiDataOperation.getCmHandles().forEach(cmHandle -> {
dataOperationEvent.getData().getResponses().get(0).setIds(List.of(cmHandle.getId()));
final CloudEvent cloudEvent = buildAndGetCloudEvent(topic, requestId, dataOperationEvent);
cloudEventKafkaTemplate.send(ncmpAsyncM2mTopic, UUID.randomUUID().toString(), cloudEvent);
diff --git a/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/model/data/operational/DataOperationRequest.java b/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/model/data/operational/DataOperationRequest.java
index 2c0cb919b9..85c649e233 100644
--- a/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/model/data/operational/DataOperationRequest.java
+++ b/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/model/data/operational/DataOperationRequest.java
@@ -20,11 +20,13 @@
package org.onap.cps.ncmp.dmi.rest.stub.model.data.operational;
+import com.fasterxml.jackson.annotation.JsonInclude;
import java.util.ArrayList;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
+@JsonInclude(JsonInclude.Include.NON_NULL)
@Setter
@Getter
public class DataOperationRequest {
diff --git a/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/model/data/operational/ResourceDataOperationRequests.java b/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/model/data/operational/DmiDataOperationRequest.java
index 68a222a306..0771e7740c 100644
--- a/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/model/data/operational/ResourceDataOperationRequests.java
+++ b/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/model/data/operational/DmiDataOperationRequest.java
@@ -20,8 +20,13 @@
package org.onap.cps.ncmp.dmi.rest.stub.model.data.operational;
-import java.util.ArrayList;
+import java.util.List;
+import lombok.Getter;
+import lombok.Setter;
-public class ResourceDataOperationRequests extends ArrayList<DataOperationRequest> {
- private static final long serialVersionUID = 3553323170854399881L;
+@Setter
+@Getter
+public class DmiDataOperationRequest {
+
+ private List<DataOperationRequest> operations;
}