summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorPrabhu201713 <prabhu.balan1@vodafone.com>2018-09-11 19:19:30 +0530
committerPrabhu201713 <prabhu.balan1@vodafone.com>2018-09-13 21:05:42 +0530
commit5095798889f2bcc0e1122f1ba684848128e74d29 (patch)
treee2988d069829c98e5b116deaadfd3e91fd809737 /src/test
parentd04ad9a5abd23a93e948ebac2cbe5ae1925e2099 (diff)
Poll for 6 hrs instead of 3 times.
Issue-ID: EXTAPI-140 Change-Id: I7d4bec505cca820ac87826159241e3e91c407b73 Signed-off-by: Prabhu201713 <prabhu.balan1@vodafone.com>
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/onap/nbi/apis/ApiTest.java25
-rw-r--r--src/test/java/org/onap/nbi/apis/assertions/ServiceOrderAssertions.java8
-rw-r--r--src/test/resources/application.properties3
3 files changed, 17 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);
diff --git a/src/test/resources/application.properties b/src/test/resources/application.properties
index c598a89..b214f9a 100644
--- a/src/test/resources/application.properties
+++ b/src/test/resources/application.properties
@@ -30,6 +30,9 @@ onap.cloudOwner=CloudOwner
nbi.url=http://127.0.0.1:8080/nbi/api/v3
nbi.callForVNF=false
+# SCHEDULER
+scheduler.pollingDurationInMins=0.1
+
# SDC
sdc.host=http://127.0.0.1:8091
sdc.header.ecompInstanceId=Rene