summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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");