From ac288d7c7e1fa60949fe83307a84465b3f488f0c Mon Sep 17 00:00:00 2001 From: romaingimbert Date: Mon, 23 Apr 2018 16:15:53 +0200 Subject: fix NPE SO Response -change requestReference to requestReferences -change mocks Change-Id: Ia8173b6286d04ab78bd6c5766ad1e9c2c61ab153 Issue-ID: EXTAPI-68 Signed-off-by: romaingimbert --- .../consumer/CreateServiceInstanceResponse.java | 10 ++--- .../model/consumer/RequestReference.java | 44 ---------------------- .../model/consumer/RequestReferences.java | 44 ++++++++++++++++++++++ .../serviceorder/workflow/SOTaskProcessor.java | 6 +-- .../mappings/so_delete_service_instance.json | 2 +- .../mappings/so_post_create_service_instance.json | 2 +- 6 files changed, 54 insertions(+), 54 deletions(-) delete mode 100644 src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestReference.java create mode 100644 src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestReferences.java (limited to 'src') diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/CreateServiceInstanceResponse.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/CreateServiceInstanceResponse.java index bfda46e..590bace 100644 --- a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/CreateServiceInstanceResponse.java +++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/CreateServiceInstanceResponse.java @@ -17,13 +17,13 @@ package org.onap.nbi.apis.serviceorder.model.consumer; public class CreateServiceInstanceResponse { - public RequestReference getRequestReference() { - return requestReference; + public RequestReferences getRequestReferences() { + return requestReferences; } - public void setRequestReference(RequestReference requestReference) { - this.requestReference = requestReference; + public void setRequestReferences(RequestReferences requestReferences) { + this.requestReferences = requestReferences; } - private RequestReference requestReference; + private RequestReferences requestReferences; } diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestReference.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestReference.java deleted file mode 100644 index 2d0b7c9..0000000 --- a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestReference.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright (c) 2018 Orange - * - * 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. - */ -package org.onap.nbi.apis.serviceorder.model.consumer; - -public class RequestReference { - - private String instanceId; - - private String requestId; - - public String getInstanceId() { - return instanceId; - } - - public void setInstanceId(String instanceId) { - this.instanceId = instanceId; - } - - public String getRequestId() { - return requestId; - } - - public void setRequestId(String requestId) { - this.requestId = requestId; - } - - @Override - public String toString() { - return "RequestReference{" + "instanceId='" + instanceId + '\'' + ", requestId='" + requestId + '\'' + '}'; - } -} diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestReferences.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestReferences.java new file mode 100644 index 0000000..2f74f73 --- /dev/null +++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestReferences.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) 2018 Orange + * + * 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. + */ +package org.onap.nbi.apis.serviceorder.model.consumer; + +public class RequestReferences { + + private String instanceId; + + private String requestId; + + public String getInstanceId() { + return instanceId; + } + + public void setInstanceId(String instanceId) { + this.instanceId = instanceId; + } + + public String getRequestId() { + return requestId; + } + + public void setRequestId(String requestId) { + this.requestId = requestId; + } + + @Override + public String toString() { + return "RequestReferences{" + "instanceId='" + instanceId + '\'' + ", requestId='" + requestId + '\'' + '}'; + } +} diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskProcessor.java b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskProcessor.java index 84a198c..f39ad1f 100644 --- a/src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskProcessor.java +++ b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskProcessor.java @@ -115,7 +115,7 @@ public class SOTaskProcessor { updateServiceOrderItem(response.getBody(), serviceOrderItem); if (response.getStatusCode() != HttpStatus.CREATED || response.getBody() == null - || response.getBody().getRequestReference() == null) { + || response.getBody().getRequestReferences() == null) { serviceOrderItem.setState(StateType.FAILED); } else { serviceOrderItem.setState(StateType.INPROGRESS); @@ -311,8 +311,8 @@ public class SOTaskProcessor { ServiceOrderItem orderItem) { if (createServiceInstanceResponse != null && !orderItem.getState().equals(StateType.FAILED)) { - orderItem.getService().setId(createServiceInstanceResponse.getRequestReference().getInstanceId()); - orderItem.setRequestId(createServiceInstanceResponse.getRequestReference().getRequestId()); + orderItem.getService().setId(createServiceInstanceResponse.getRequestReferences().getInstanceId()); + orderItem.setRequestId(createServiceInstanceResponse.getRequestReferences().getRequestId()); } } diff --git a/src/test/resources/mappings/so_delete_service_instance.json b/src/test/resources/mappings/so_delete_service_instance.json index fae7b9e..d89c184 100644 --- a/src/test/resources/mappings/so_delete_service_instance.json +++ b/src/test/resources/mappings/so_delete_service_instance.json @@ -9,7 +9,7 @@ "Content-Type": "application/json" }, "jsonBody": { - "requestReference": { + "requestReferences": { "instanceId": "instanceId", "requestId": "requestId" } diff --git a/src/test/resources/mappings/so_post_create_service_instance.json b/src/test/resources/mappings/so_post_create_service_instance.json index 239aecb..f5aaa90 100644 --- a/src/test/resources/mappings/so_post_create_service_instance.json +++ b/src/test/resources/mappings/so_post_create_service_instance.json @@ -9,7 +9,7 @@ "Content-Type": "application/json" }, "jsonBody": { - "requestReference": { + "requestReferences": { "instanceId": "instanceId", "requestId": "requestId" } -- cgit 1.2.3-korg