diff options
author | Matthieu Geerebaert <matthieu.geerebaert@orange.com> | 2018-09-13 15:49:43 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-09-13 15:49:43 +0000 |
commit | 956d451af5e5ad5b5f0bbca34c5462455cc6d0ad (patch) | |
tree | a06fd710c885360d7b68e1f76d44538e6103dd95 /src/test/java/org | |
parent | 4835a4603463ab944e366bac369f98476749125d (diff) | |
parent | 5095798889f2bcc0e1122f1ba684848128e74d29 (diff) |
Merge "Poll for 6 hrs instead of 3 times."
Diffstat (limited to 'src/test/java/org')
-rw-r--r-- | src/test/java/org/onap/nbi/apis/ApiTest.java | 25 | ||||
-rw-r--r-- | src/test/java/org/onap/nbi/apis/assertions/ServiceOrderAssertions.java | 8 |
2 files changed, 14 insertions, 19 deletions
diff --git a/src/test/java/org/onap/nbi/apis/ApiTest.java b/src/test/java/org/onap/nbi/apis/ApiTest.java index 22e6200..5bf9983 100644 --- a/src/test/java/org/onap/nbi/apis/ApiTest.java +++ b/src/test/java/org/onap/nbi/apis/ApiTest.java @@ -49,6 +49,7 @@ import org.onap.nbi.apis.serviceorder.repositories.ExecutionTaskRepository; import org.onap.nbi.apis.serviceorder.repositories.ServiceOrderRepository; import org.onap.nbi.apis.serviceorder.workflow.SOTaskProcessor; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.context.embedded.LocalServerPort; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.http.ResponseEntity; @@ -102,6 +103,9 @@ public class ApiTest { static Validator validator; + @Value("${scheduler.pollingDurationInMins}") + private float pollingDurationInMins; + @Before public void before() { MockHttpServletRequest request = new MockHttpServletRequest(); @@ -998,11 +1002,8 @@ public class ApiTest { } } executionTaskA = getExecutionTask("A"); - assertThat(executionTaskA.getNbRetries()).isEqualTo(2); - SoTaskProcessor.processOrderItem(executionTaskA); - executionTaskA = getExecutionTask("A"); - SoTaskProcessor.processOrderItem(executionTaskA); - executionTaskA = getExecutionTask("A"); + assertThat(executionTaskA.getLastAttemptDate().getTime()>executionTaskA.getCreateDate().getTime()).isTrue(); + Thread.sleep((long)(pollingDurationInMins*60000 + 1)); SoTaskProcessor.processOrderItem(executionTaskA); serviceOrderChecked = serviceOrderRepository.findOne("test"); @@ -1038,11 +1039,8 @@ public class ApiTest { } } executionTaskA = getExecutionTask("A"); - assertThat(executionTaskA.getNbRetries()).isEqualTo(2); - SoTaskProcessor.processOrderItem(executionTaskA); - executionTaskA = getExecutionTask("A"); - SoTaskProcessor.processOrderItem(executionTaskA); - executionTaskA = getExecutionTask("A"); + assertThat(executionTaskA.getLastAttemptDate().getTime()>executionTaskA.getCreateDate().getTime()).isTrue(); + Thread.sleep((long)(pollingDurationInMins*60000 + 1)); SoTaskProcessor.processOrderItem(executionTaskA); serviceOrderChecked = serviceOrderRepository.findOne("test"); @@ -1228,11 +1226,8 @@ public class ApiTest { } } executionTaskA = getExecutionTask("A"); - assertThat(executionTaskA.getNbRetries()).isEqualTo(2); - SoTaskProcessor.processOrderItem(executionTaskA); - executionTaskA = getExecutionTask("A"); - SoTaskProcessor.processOrderItem(executionTaskA); - executionTaskA = getExecutionTask("A"); + assertThat(executionTaskA.getLastAttemptDate().getTime()>executionTaskA.getCreateDate().getTime()).isTrue(); + Thread.sleep((long)(pollingDurationInMins*60000 + 1)); SoTaskProcessor.processOrderItem(executionTaskA); serviceOrderChecked = serviceOrderRepository.findOne("test"); diff --git a/src/test/java/org/onap/nbi/apis/assertions/ServiceOrderAssertions.java b/src/test/java/org/onap/nbi/apis/assertions/ServiceOrderAssertions.java index 5ff1816..6bd4bd0 100644 --- a/src/test/java/org/onap/nbi/apis/assertions/ServiceOrderAssertions.java +++ b/src/test/java/org/onap/nbi/apis/assertions/ServiceOrderAssertions.java @@ -205,12 +205,12 @@ public class ServiceOrderAssertions { String json = JsonEntityConverter.convertServiceOrderInfoToJson(serviceOrderInfo); ExecutionTask executionTaskA = new ExecutionTask(); - executionTaskA.setNbRetries(3); + executionTaskA.setCreateDate(new Date()); executionTaskA.setOrderItemId("A"); executionTaskA.setServiceOrderInfoJson(json); executionTaskA = executionTaskRepository.save(executionTaskA); ExecutionTask executionTaskB = new ExecutionTask(); - executionTaskB.setNbRetries(3); + executionTaskB.setCreateDate(new Date()); executionTaskB.setOrderItemId("B"); executionTaskB.setReliedTasks(String.valueOf(executionTaskA.getInternalId())); executionTaskB.setServiceOrderInfoJson(json); @@ -283,12 +283,12 @@ public class ServiceOrderAssertions { String json = JsonEntityConverter.convertServiceOrderInfoToJson(serviceOrderInfo); ExecutionTask executionTaskA = new ExecutionTask(); - executionTaskA.setNbRetries(3); + executionTaskA.setCreateDate(new Date()); executionTaskA.setOrderItemId("A"); executionTaskA.setServiceOrderInfoJson(json); executionTaskA = executionTaskRepository.save(executionTaskA); ExecutionTask executionTaskB = new ExecutionTask(); - executionTaskB.setNbRetries(3); + executionTaskB.setCreateDate(new Date()); executionTaskB.setOrderItemId("B"); executionTaskB.setReliedTasks(String.valueOf(executionTaskA.getInternalId())); executionTaskB.setServiceOrderInfoJson(json); |