diff options
Diffstat (limited to 'src')
10 files changed, 68 insertions, 25 deletions
diff --git a/src/main/java/org/onap/nbi/apis/hub/service/EventFactory.java b/src/main/java/org/onap/nbi/apis/hub/service/EventFactory.java index 8083fff..b2a017c 100644 --- a/src/main/java/org/onap/nbi/apis/hub/service/EventFactory.java +++ b/src/main/java/org/onap/nbi/apis/hub/service/EventFactory.java @@ -16,6 +16,7 @@ package org.onap.nbi.apis.hub.service; import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MappingJsonFactory; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; import org.onap.nbi.apis.hub.model.Event; @@ -30,7 +31,7 @@ import java.util.UUID; public class EventFactory { - private static final ObjectMapper mapper = new ObjectMapper(); + private static final ObjectMapper mapper = new ObjectMapper(new MappingJsonFactory()); public static Event getEvent(EventType eventType, ServiceOrder serviceOrder, ServiceOrderItem serviceOrderItem) { Event event = new Event(); diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/SoClient.java b/src/main/java/org/onap/nbi/apis/serviceorder/SoClient.java index 57cb6b5..67421ba 100644 --- a/src/main/java/org/onap/nbi/apis/serviceorder/SoClient.java +++ b/src/main/java/org/onap/nbi/apis/serviceorder/SoClient.java @@ -76,10 +76,10 @@ public class SoClient { return response; } catch (BackendFunctionalException e) { - LOGGER.error("error on calling " + url + " ," + e); + LOGGER.error(ERROR_ON_CALLING + url + " ," + e); return new ResponseEntity(e.getBodyResponse(),e.getHttpStatus()); } catch (ResourceAccessException e) { - LOGGER.error("error on calling " + url + " ," + e); + LOGGER.error(ERROR_ON_CALLING + url + " ," + e); return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR); } } @@ -100,10 +100,10 @@ public class SoClient { return response; } catch (BackendFunctionalException e) { - LOGGER.error("error on calling " + url + " ," + e); + LOGGER.error(ERROR_ON_CALLING + url + " ," + e); return new ResponseEntity(e.getBodyResponse(),e.getHttpStatus()); } catch (ResourceAccessException e) { - LOGGER.error("error on calling " + url + " ," + e); + LOGGER.error(ERROR_ON_CALLING + url + " ," + e); return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR); } } @@ -124,10 +124,10 @@ public class SoClient { return response; } catch (BackendFunctionalException e) { - LOGGER.error("error on calling " + url + " ," + e); + LOGGER.error(ERROR_ON_CALLING + url + " ," + e); return new ResponseEntity<>(e.getHttpStatus()); } catch (ResourceAccessException e) { - LOGGER.error("error on calling " + url + " ," + e); + LOGGER.error(ERROR_ON_CALLING + url + " ," + e); return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR); } @@ -162,10 +162,10 @@ public class SoClient { return response; } catch (BackendFunctionalException e) { - LOGGER.error("error on calling " + url + " ," + e); + LOGGER.error(ERROR_ON_CALLING + url + " ," + e); return new ResponseEntity<>(e.getHttpStatus()); } catch (ResourceAccessException e) { - LOGGER.error("error on calling " + url + " ," + e); + LOGGER.error(ERROR_ON_CALLING + url + " ," + e); return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR); } } @@ -202,7 +202,10 @@ public class SoClient { ResponseEntity<GetRequestStatusResponse> response = restTemplate.exchange(url, HttpMethod.GET, new HttpEntity<>(buildRequestHeader()), GetRequestStatusResponse.class); logResponseGet(url, response); - return response.getBody(); + if (null == response) + return null; + else + return response.getBody(); } catch (BackendFunctionalException | ResourceAccessException e) { LOGGER.error(ERROR_ON_CALLING + url + " ," + e); @@ -226,7 +229,10 @@ public GetE2ERequestStatusResponse callE2EGetRequestStatus(String operationId, S ResponseEntity<GetE2ERequestStatusResponse> response = restTemplate.exchange(callUrlFormated, HttpMethod.GET, new HttpEntity<>(buildRequestHeader()), GetE2ERequestStatusResponse.class); logE2EResponseGet(callUrlFormated, response); - return response.getBody(); + if (null == response) + return null; + else + return response.getBody(); } catch (BackendFunctionalException|ResourceAccessException e) { LOGGER.error(ERROR_ON_CALLING + callUrlFormated + " ," + e); diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/CreateE2EServiceInstanceResponse.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/CreateE2EServiceInstanceResponse.java index 5c41166..7c75eca 100644 --- a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/CreateE2EServiceInstanceResponse.java +++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/CreateE2EServiceInstanceResponse.java @@ -17,6 +17,8 @@ package org.onap.nbi.apis.serviceorder.model.consumer; public class CreateE2EServiceInstanceResponse { + private ServiceResponse service; + public ServiceResponse getService() { return service; } @@ -25,6 +27,10 @@ public class CreateE2EServiceInstanceResponse { this.service = service; } - private ServiceResponse service; - -} + @Override + public String toString() { + return "CreateE2EServiceInstanceResponse{" + + "service=" + service + + '}'; + } +}
\ No newline at end of file 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 590bace..3389e32 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,6 +17,8 @@ package org.onap.nbi.apis.serviceorder.model.consumer; public class CreateServiceInstanceResponse { + private RequestReferences requestReferences; + public RequestReferences getRequestReferences() { return requestReferences; } @@ -25,5 +27,10 @@ public class CreateServiceInstanceResponse { this.requestReferences = requestReferences; } - private RequestReferences requestReferences; -} + @Override + public String toString() { + return "CreateServiceInstanceResponse{" + + "requestReferences=" + requestReferences + + '}'; + } +}
\ No newline at end of file diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/GetE2ERequestStatusResponse.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/GetE2ERequestStatusResponse.java index 42a6170..9e16181 100644 --- a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/GetE2ERequestStatusResponse.java +++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/GetE2ERequestStatusResponse.java @@ -27,4 +27,10 @@ public class GetE2ERequestStatusResponse { this.operation = operation; } -} + @Override + public String toString() { + return "GetE2ERequestStatusResponse{" + + "operation=" + operation + + '}'; + } +}
\ No newline at end of file diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/OperationStatus.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/OperationStatus.java index 2cd7393..4d00e41 100644 --- a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/OperationStatus.java +++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/OperationStatus.java @@ -209,5 +209,20 @@ public class OperationStatus implements Serializable { return true; } - -} + @Override + public String toString() { + return "OperationStatus{" + + "serviceId='" + serviceId + '\'' + + ", operationId='" + operationId + '\'' + + ", serviceName='" + serviceName + '\'' + + ", operation='" + operation + '\'' + + ", userId='" + userId + '\'' + + ", result='" + result + '\'' + + ", operationContent='" + operationContent + '\'' + + ", progress='" + progress + '\'' + + ", reason='" + reason + '\'' + + ", operateAt=" + operateAt + + ", finishedAt=" + finishedAt + + '}'; + } +}
\ No newline at end of file diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/utils/JsonEntityConverter.java b/src/main/java/org/onap/nbi/apis/serviceorder/utils/JsonEntityConverter.java index 7be84c2..1821f0a 100644 --- a/src/main/java/org/onap/nbi/apis/serviceorder/utils/JsonEntityConverter.java +++ b/src/main/java/org/onap/nbi/apis/serviceorder/utils/JsonEntityConverter.java @@ -15,6 +15,7 @@ */ package org.onap.nbi.apis.serviceorder.utils; +import com.fasterxml.jackson.databind.MappingJsonFactory; import java.io.IOException; import org.onap.nbi.apis.serviceorder.model.orchestrator.ServiceOrderInfo; import com.fasterxml.jackson.databind.ObjectMapper; @@ -24,7 +25,7 @@ public final class JsonEntityConverter { private JsonEntityConverter() { } - private static final ObjectMapper MAPPER = new ObjectMapper(); + private static final ObjectMapper MAPPER = new ObjectMapper(new MappingJsonFactory()); public static String convertServiceOrderInfoToJson(ServiceOrderInfo serviceOrderInfo) { return MAPPER.valueToTree(serviceOrderInfo).toString(); diff --git a/src/main/java/org/onap/nbi/commons/JacksonFilter.java b/src/main/java/org/onap/nbi/commons/JacksonFilter.java index 07c113e..97f6cf2 100644 --- a/src/main/java/org/onap/nbi/commons/JacksonFilter.java +++ b/src/main/java/org/onap/nbi/commons/JacksonFilter.java @@ -15,6 +15,7 @@ */ package org.onap.nbi.commons; +import com.fasterxml.jackson.databind.MappingJsonFactory; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Arrays; @@ -59,7 +60,7 @@ public class JacksonFilter { } public static <R> ObjectNode createNode(R bean, JsonRepresentation jsonRepresentation) { - ObjectMapper mapper = new ObjectMapper(); + ObjectMapper mapper = new ObjectMapper(new MappingJsonFactory()); return JacksonFilter.createNode(mapper, bean, jsonRepresentation.getAttributes()); } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 8c07ce0..11638c1 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -15,7 +15,7 @@ # # SERVER -server.contextPath=/nbi/api/v1 +server.contextPath=/nbi/api/v3 server.port=8080 # LOGGING @@ -27,7 +27,7 @@ onap.tenantId=6e97a2bd51d74f6db5671d8dc1517d82 onap.cloudOwner=CloudOwner # NBI -nbi.url=http://localhost:8080/nbi/api/v1 +nbi.url=http://localhost:8080/nbi/api/v3 nbi.callForVNF=false # SDC diff --git a/src/test/resources/application.properties b/src/test/resources/application.properties index 50e0527..c598a89 100644 --- a/src/test/resources/application.properties +++ b/src/test/resources/application.properties @@ -15,7 +15,7 @@ # # SERVER -server.contextPath=/nbi/api/v1 +server.contextPath=/nbi/api/v3 server.port = 8080 # LOGGING @@ -27,7 +27,7 @@ onap.tenantId=31047205ce114b60833b23e400d6a535 onap.cloudOwner=CloudOwner # NBI -nbi.url=http://127.0.0.1:8080/nbi/api/v1 +nbi.url=http://127.0.0.1:8080/nbi/api/v3 nbi.callForVNF=false # SDC |