// read executions before sync (dryrun test could be executed before)
int preSyncSize = actual.getExecutions().size();
// trigger SyncTask execution
TaskExecTO execution = restTemplate.postForObject(BASE_URL + "task/execute/{taskId}", null, TaskExecTO.class,
actual.getId());
assertEquals("JOB_FIRED", execution.getStatus());
// wait for sync completion (executions incremented)
int i = 0;
final int maxit = 20;
do {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
actual = restTemplate.getForObject(BASE_URL + "task/read/{taskId}", SyncTaskTO.class, actual.getId());
assertNotNull(actual);
assertNotNull(actual.getExecutions());
i++;
} while (preSyncSize == actual.getExecutions().size() && i < maxit);
assertEquals(preSyncSize + 1, actual.getExecutions().size());
String status = actual.getExecutions().get(0).getStatus();
assertNotNull(status);
assertTrue(PropagationTaskExecStatus.valueOf(status).isSuccessful());
UserTO userTO =
restTemplate.getForObject(BASE_URL + "user/readByUsername/{username}.json", UserTO.class, "testuser1");
assertNotNull(userTO);
assertEquals("reconciled@syncope.apache.org", userTO.getAttributeMap().get("userId").getValues().get(0));
assertEquals("suspended", userTO.getStatus());
// enable user on external resource
JdbcTemplate jdbcTemplate = new JdbcTemplate(testDataSource);
jdbcTemplate.execute("UPDATE TEST SET STATUS=TRUE");
// re-execute the same SyncTask: now user must be active
preSyncSize = actual.getExecutions().size();
execution = restTemplate.postForObject(BASE_URL + "task/execute/{taskId}", null, TaskExecTO.class,
actual.getId());
assertEquals("JOB_FIRED", execution.getStatus());
// wait for sync completion (executions incremented)
i = 0;
do {
try {