From 7233b362b6b79adde656c6f7fe79eaf9c0ad4c63 Mon Sep 17 00:00:00 2001 From: romaingimbert Date: Thu, 28 Jun 2018 12:05:39 +0200 Subject: fix service order enum - fix service order enum value for getServiceOrder Change-Id: Ib9aaa3a4efb78f653f240537732374638db83493 Issue-ID: EXTAPI-109 Signed-off-by: romaingimbert --- .../onap/nbi/apis/serviceorder/MultiCriteriaRequestBuilder.java | 4 +++- src/main/java/org/onap/nbi/apis/serviceorder/model/ActionType.java | 6 ++++++ .../org/onap/nbi/apis/serviceorder/model/RelationshipType.java | 6 ++++++ src/main/java/org/onap/nbi/apis/serviceorder/model/StateType.java | 7 +++++++ .../onap/nbi/apis/serviceorder/model/consumer/RequestState.java | 6 ++++++ src/test/java/org/onap/nbi/apis/ApiTest.java | 4 ++-- 6 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/MultiCriteriaRequestBuilder.java b/src/main/java/org/onap/nbi/apis/serviceorder/MultiCriteriaRequestBuilder.java index 4a5ad92..74ee6a6 100644 --- a/src/main/java/org/onap/nbi/apis/serviceorder/MultiCriteriaRequestBuilder.java +++ b/src/main/java/org/onap/nbi/apis/serviceorder/MultiCriteriaRequestBuilder.java @@ -15,6 +15,8 @@ */ package org.onap.nbi.apis.serviceorder; +import java.util.Locale; +import java.util.TimeZone; import org.onap.nbi.apis.serviceorder.model.StateType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -107,7 +109,7 @@ public class MultiCriteriaRequestBuilder { } private Date convertDate(String dateString) { - String dateFormat = "yyyy-MM-dd HH:mm:ss.SSS"; + String dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"; SimpleDateFormat formatter = new SimpleDateFormat(dateFormat); try { return formatter.parse(dateString); diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/ActionType.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/ActionType.java index 6f3499f..7cf4a06 100644 --- a/src/main/java/org/onap/nbi/apis/serviceorder/model/ActionType.java +++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/ActionType.java @@ -37,6 +37,7 @@ package org.onap.nbi.apis.serviceorder.model; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; /** * @@ -71,5 +72,10 @@ public enum ActionType { } return null; } + + @JsonValue + public String value() { + return this.value; + } } diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/RelationshipType.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/RelationshipType.java index 2ebd3fb..93c5006 100644 --- a/src/main/java/org/onap/nbi/apis/serviceorder/model/RelationshipType.java +++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/RelationshipType.java @@ -38,6 +38,7 @@ package org.onap.nbi.apis.serviceorder.model; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; /** * @@ -66,6 +67,11 @@ public enum RelationshipType { } return null; } + + @JsonValue + public String value() { + return this.value; + } } diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/StateType.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/StateType.java index 764c7f1..602f715 100755 --- a/src/main/java/org/onap/nbi/apis/serviceorder/model/StateType.java +++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/StateType.java @@ -39,6 +39,7 @@ package org.onap.nbi.apis.serviceorder.model; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; /** * @@ -83,5 +84,11 @@ public enum StateType { } return null; } + + @JsonValue + public String value() { + return this.value; + } + } diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestState.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestState.java index 90ea666..90059db 100644 --- a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestState.java +++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestState.java @@ -16,6 +16,7 @@ package org.onap.nbi.apis.serviceorder.model.consumer; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; public enum RequestState { @@ -44,6 +45,11 @@ public enum RequestState { return null; } + @JsonValue + public String value() { + return this.value; + } + } diff --git a/src/test/java/org/onap/nbi/apis/ApiTest.java b/src/test/java/org/onap/nbi/apis/ApiTest.java index a650ab5..dbd1a90 100644 --- a/src/test/java/org/onap/nbi/apis/ApiTest.java +++ b/src/test/java/org/onap/nbi/apis/ApiTest.java @@ -572,8 +572,8 @@ public class ApiTest { assertThat(serviceOrders.size()).isEqualTo(1); MultiValueMap paramsDate = new LinkedMultiValueMap<>(); - paramsDate.add("orderDate.gt", "2017-01-01 00:00:00.000"); - paramsDate.add("orderDate.lt", "2030-01-01 00:00:00.000"); + paramsDate.add("orderDate.gt", "2017-01-01T00:00:00.000Z"); + paramsDate.add("orderDate.lt", "2030-01-01T00:00:00.000Z"); paramsDate.add("offset", "0"); paramsDate.add("limit", "2"); -- cgit 1.2.3-korg