diff options
author | Seshu Kumar M <seshu.kumar.m@huawei.com> | 2020-09-26 16:34:50 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-09-26 16:34:50 +0000 |
commit | 38ba6377d605cce14275ccc3973d8abe7ffb3abc (patch) | |
tree | 0ff16022d269e2c9337750a672a5aec99cc18d00 | |
parent | 0bc6a8ae47eee8bc017a64ad7474a1d085cfa21c (diff) | |
parent | 641412584427fb9ed7eed0f340dcfb2a12726c79 (diff) |
Merge "Changed the object mapper to ignore unknown fields"
3 files changed, 8 insertions, 3 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java index 9205cae5ed..afd7f6433c 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java @@ -87,7 +87,6 @@ import com.fasterxml.jackson.databind.type.TypeFactory; public class BBInputSetupUtils { private static final Logger logger = LoggerFactory.getLogger(BBInputSetupUtils.class); - private ObjectMapper objectMapper = new ObjectMapper(); private static final String REQUEST_ERROR = "Could not find request."; private static final String DATA_LOAD_ERROR = "Could not process loading data from database"; private static final String DATA_PARSE_ERROR = "Could not parse data"; @@ -190,7 +189,8 @@ public class BBInputSetupUtils { request.getOriginalRequestId(), PROCESSING_DATA_NAME_EXECUTION_FLOWS); try { ObjectMapper om = new ObjectMapper(); - TypeFactory typeFactory = objectMapper.getTypeFactory(); + TypeFactory typeFactory = om.getTypeFactory(); + om.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); return om.readValue(requestProcessingData.getValue(), typeFactory.constructCollectionType(List.class, ExecuteBuildingBlock.class)); } catch (Exception e) { @@ -246,6 +246,8 @@ public class BBInputSetupUtils { if (requestId != null && !requestId.isEmpty()) { InfraActiveRequests activeRequest = this.getInfraActiveRequest(requestId); String requestBody = activeRequest.getRequestBody().replaceAll("\\\\", ""); + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); objectMapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); objectMapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); return objectMapper.readValue(requestBody, RequestDetails.class); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java index c65b36a40c..85774ec23c 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java @@ -42,6 +42,7 @@ import java.nio.file.Paths; import java.util.Arrays; import java.util.List; import java.util.Optional; +import com.fasterxml.jackson.databind.DeserializationFeature; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -115,6 +116,7 @@ public class BBInputSetupUtilsTest { @Before public void setup() { + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient(); } diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/FlowsToExecute.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/FlowsToExecute.json index fa271b9e8d..7bbc287bad 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/FlowsToExecute.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/FlowsToExecute.json @@ -58,7 +58,8 @@ "vnfResourceCustomizationUUID": "a80f05b8-d651-44af-b999-8ed78fb4582f", "cvnfcCustomizationUUID": "69cce457-9ffd-4359-962b-0596a1e83ad1", "vnfcName": "zauk51bmcmr01mcm001" - } + }, + "resume": null }, { "buildingBlock": { |