Skip to content

Commit

Permalink
Handle async wait on PersistenceTest
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasponce committed May 19, 2016
1 parent ccd9722 commit a74bd5a
Showing 1 changed file with 18 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1864,12 +1864,14 @@ public void test0090SearchActionsHistory() throws Exception {
}

logger.info("Actions are asynchronous. Give them some time.");
for (int i = 0; i < 30; i++) {
logger.info(".");
Thread.sleep(200);
}

int tries = 10;
List<Action> actions = actionsService.getActions(TENANT, null, null);
while (actions.size() != (10 * 4) && tries > 0) {
actions = actionsService.getActions(TENANT, null, null);
Thread.sleep(1000);
tries--;
}
assertEquals(10 * 4, actions.size());

ActionsCriteria criteria = new ActionsCriteria();
Expand Down Expand Up @@ -1964,12 +1966,14 @@ public void test00100PaginationActionsHistory() throws Exception {
}

logger.info("Actions are asynchronous. Give them some time.");
for (int i = 0; i < 30; i++) {
logger.info(".");
Thread.sleep(200);
}

int tries = 10;
List<Action> actions = actionsService.getActions(TENANT, null, null);
while (actions.size() != (103 * 4) && tries > 0) {
actions = actionsService.getActions(TENANT, null, null);
Thread.sleep(1000);
tries--;
}
assertEquals(103 * 4, actions.size());

Pager pager = Pager.builder().withPageSize(10).withStartPage(0)
Expand Down Expand Up @@ -2053,14 +2057,16 @@ public void test0110ThinActionsHistory() throws Exception {
}

logger.info("Actions are asynchronous. Give them some time.");
for (int i = 0; i < 30; i++) {
logger.info(".");
Thread.sleep(200);
}

ActionsCriteria criteria = new ActionsCriteria();
criteria.setThin(true);
int tries = 10;
List<Action> actions = actionsService.getActions(TENANT, criteria, null);
while (actions.size() != (103 * 4) && tries > 0) {
actions = actionsService.getActions(TENANT, criteria, null);
Thread.sleep(1000);
tries--;
}
assertEquals(103 * 4, actions.size());

for (Action action : actions) {
Expand Down

0 comments on commit a74bd5a

Please sign in to comment.