Merge "EXTAPI-139 : use fixedDelay"
authorMatthieu Geerebaert <matthieu.geerebaert@orange.com>
Thu, 6 Sep 2018 08:46:44 +0000 (08:46 +0000)
committerGerrit Code Review <gerrit@onap.org>
Thu, 6 Sep 2018 08:46:44 +0000 (08:46 +0000)
14 files changed:
.env
Dockerfile
pom.xml
src/main/java/org/onap/nbi/apis/hub/service/EventFactory.java
src/main/java/org/onap/nbi/apis/serviceorder/SoClient.java
src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/CreateE2EServiceInstanceResponse.java
src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/CreateServiceInstanceResponse.java
src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/GetE2ERequestStatusResponse.java
src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/OperationStatus.java
src/main/java/org/onap/nbi/apis/serviceorder/utils/JsonEntityConverter.java
src/main/java/org/onap/nbi/commons/JacksonFilter.java
src/main/resources/application.properties
src/test/resources/application.properties
version.properties

diff --git a/.env b/.env
index 38d05d7..71f7de7 100644 (file)
--- a/.env
+++ b/.env
@@ -15,7 +15,7 @@
 #
 
 # APPLICATION
-SERVER_CONTEXTPATH=/nbi/api/v1
+SERVER_CONTEXTPATH=/nbi/api/v3
 SERVER_PORT=8080
 
 # ONAP
@@ -25,7 +25,7 @@ ONAP_CLOUDOWNER=
 NEXUS_DOCKER_REPO=nexus3.onap.org:10001
 
 # NBI
-NBI_URL=http://localhost:8080/nbi/api/v1
+NBI_URL=http://localhost:8080/nbi/api/v3
 NBI_CALLFORVNF=false
 
 # SDC
index 7eb5d81..ccf2531 100644 (file)
@@ -17,7 +17,7 @@
 FROM openjdk:8-jre-alpine
 
 ARG SERVER_PORT
-ARG PKG_FILENAME=nbi-rest-services-1.0.0-SNAPSHOT.jar
+ARG PKG_FILENAME=nbi-rest-services-3.0.0-SNAPSHOT.jar
 ADD target/$PKG_FILENAME app.jar
 
 COPY src/main/resources/certificate /certs
diff --git a/pom.xml b/pom.xml
index ddd06a9..1a42cd8 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
 
        <groupId>org.onap.externalapi-nbi</groupId>
        <artifactId>nbi-rest-services</artifactId>
-       <version>1.0.0-SNAPSHOT</version>
+       <version>3.0.0-SNAPSHOT</version>
        <packaging>jar</packaging>
 
        <name>externalapi-nbi</name>
                        </exclusions>
                </dependency>
 
+               <dependency>
+                       <groupId>com.fasterxml.jackson.core</groupId>
+                       <artifactId>jackson-databind</artifactId>
+                       <version>2.8.11.2</version>
+               </dependency>
+
                <dependency>
                        <groupId>org.apache.tomcat.embed</groupId>
                        <artifactId>tomcat-embed-core</artifactId>
                <dependency>
                        <groupId>commons-beanutils</groupId>
                        <artifactId>commons-beanutils</artifactId>
-                       <version>1.7.0</version>
+                       <version>1.9.3</version>
                </dependency>
 
                <dependency>
                        <groupId>com.bazaarvoice.jolt</groupId>
                        <artifactId>json-utils</artifactId>
                        <version>0.1.0</version>
+                       <exclusions>
+                               <exclusion>
+                                       <groupId>com.fasterxml.jackson.core</groupId>
+                                       <artifactId>jackson-databind</artifactId>
+                               </exclusion>
+                       </exclusions>
                </dependency>
 
                <!-- test -->
                        <artifactId>spring-cloud-contract-wiremock</artifactId>
                        <version>1.0.0.RELEASE</version>
                        <scope>test</scope>
+                       <exclusions>
+                               <exclusion>
+                                       <groupId>com.fasterxml.jackson.core</groupId>
+                                       <artifactId>jackson-databind</artifactId>
+                               </exclusion>
+                       </exclusions>
                </dependency>
 
                <dependency>
                        <groupId>org.onap.msb.java-sdk</groupId>
                        <artifactId>msb-java-sdk</artifactId>
                        <version>1.1.1</version>
+                       <exclusions>
+                               <exclusion>
+                                       <groupId>com.fasterxml.jackson.core</groupId>
+                                       <artifactId>jackson-databind</artifactId>
+                               </exclusion>
+                       </exclusions>
                </dependency>
 
        </dependencies>
index 8083fff..b2a017c 100644 (file)
@@ -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();
index 57cb6b5..67421ba 100644 (file)
@@ -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);
index 5c41166..7c75eca 100644 (file)
@@ -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
index 590bace..3389e32 100644 (file)
@@ -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
index 42a6170..9e16181 100644 (file)
@@ -27,4 +27,10 @@ public class GetE2ERequestStatusResponse {
         this.operation = operation;
     }
 
-}
+    @Override
+    public String toString() {
+        return "GetE2ERequestStatusResponse{" +
+            "operation=" + operation +
+            '}';
+    }
+}
\ No newline at end of file
index 2cd7393..4d00e41 100644 (file)
@@ -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
index 7be84c2..1821f0a 100644 (file)
@@ -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();
index 07c113e..97f6cf2 100644 (file)
@@ -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());
     }
 
index 8c07ce0..11638c1 100644 (file)
@@ -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
index 50e0527..c598a89 100644 (file)
@@ -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
index aeb4b21..8c41eda 100644 (file)
@@ -18,9 +18,9 @@
 # Note that these variables cannot be structured (e.g. : version.release or version.snapshot etc... )
 # because they are used in Jenkins, whose plug-in doesn't support...
 
-major=1
-minor=2
-patch=1
+major=3
+minor=0
+patch=0
 
 base_version=${major}.${minor}.${patch}