summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthieu Geerebaert <matthieu.geerebaert@orange.com>2018-09-21 08:46:52 +0000
committerGerrit Code Review <gerrit@onap.org>2018-09-21 08:46:52 +0000
commitf6379fbb659fd22a581a9191b97d235c82b9b745 (patch)
tree043fb52e08ab72d888aace09e1ee96ce725c774c
parent8e403de1407e1ee5488205c9bc665267d9953ff5 (diff)
parentdefa7aebfbc385d7881703284e0292173f40073c (diff)
Merge "Tests failed randomly"
-rw-r--r--src/test/java/org/onap/nbi/apis/ApiTest.java18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/test/java/org/onap/nbi/apis/ApiTest.java b/src/test/java/org/onap/nbi/apis/ApiTest.java
index 3ac2f7e..696aa57 100644
--- a/src/test/java/org/onap/nbi/apis/ApiTest.java
+++ b/src/test/java/org/onap/nbi/apis/ApiTest.java
@@ -21,6 +21,7 @@ import com.github.tomakehurst.wiremock.http.ResponseDefinition;
import com.github.tomakehurst.wiremock.stubbing.ListStubMappingsResult;
import com.github.tomakehurst.wiremock.stubbing.StubMapping;
import java.util.ArrayList;
+import java.util.Calendar;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
@@ -1002,8 +1003,10 @@ public class ApiTest {
}
}
executionTaskA = getExecutionTask("A");
- assertThat(executionTaskA.getLastAttemptDate().getTime()>executionTaskA.getCreateDate().getTime()).isTrue();
- Thread.sleep((long)(pollingDurationInMins*60000 + 1));
+ Date createDate = executionTaskA.getCreateDate();
+ assertThat(executionTaskA.getLastAttemptDate().getTime()> createDate.getTime()).isTrue();
+
+ changeCreationDate(executionTaskA);
SoTaskProcessor.processOrderItem(executionTaskA);
serviceOrderChecked = serviceOrderRepository.findOne("test");
@@ -1018,6 +1021,13 @@ public class ApiTest {
}
+ private void changeCreationDate(ExecutionTask executionTaskA) {
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(executionTaskA.getCreateDate());
+ cal.add(Calendar.SECOND, -30);
+ executionTaskA.setCreateDate(cal.getTime());
+ }
+
@Test
public void testE2EExecutionTaskFailed() throws Exception {
@@ -1040,7 +1050,7 @@ public class ApiTest {
}
executionTaskA = getExecutionTask("A");
assertThat(executionTaskA.getLastAttemptDate().getTime()>executionTaskA.getCreateDate().getTime()).isTrue();
- Thread.sleep((long)(pollingDurationInMins*60000 + 1));
+ changeCreationDate(executionTaskA);
SoTaskProcessor.processOrderItem(executionTaskA);
serviceOrderChecked = serviceOrderRepository.findOne("test");
@@ -1227,7 +1237,7 @@ public class ApiTest {
}
executionTaskA = getExecutionTask("A");
assertThat(executionTaskA.getLastAttemptDate().getTime()>executionTaskA.getCreateDate().getTime()).isTrue();
- Thread.sleep((long)(pollingDurationInMins*60000 + 1));
+ changeCreationDate(executionTaskA);
SoTaskProcessor.processOrderItem(executionTaskA);
serviceOrderChecked = serviceOrderRepository.findOne("test");