Skip to content

Commit

Permalink
Clear statistics for iterative scripting tasks
Browse files Browse the repository at this point in the history
When starting, these tasks started progress anew, but other statistics
were accumulating.

This resolves MID-6488.
  • Loading branch information
mederly committed Sep 17, 2020
1 parent c262799 commit 5e6f257
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
Expand Up @@ -44,7 +44,8 @@ public class IterativeScriptExecutionTaskHandler extends AbstractSearchIterative

public IterativeScriptExecutionTaskHandler() {
super("Execute script", OperationConstants.EXECUTE_SCRIPT);
setLogFinishInfo(true); // todo
setPreserveStatistics(false);
setLogFinishInfo(true); // todo
}

@PostConstruct
Expand Down
Expand Up @@ -1224,9 +1224,10 @@ public void test570IterativeScriptingTask() throws Exception {
OperationResult result = task.getResult();

String taskOid = repoAddObjectFromFile(getFile(SCRIPTING_USERS_IN_BACKGROUND_ITERATIVE_TASK), result).getOid();
int numberOfUsers = modelService.countObjects(UserType.class, null, null, task, result);

when();
waitForTaskFinish(taskOid, false);
Task taskAfterFirstRun = waitForTaskFinish(taskOid, false);

then();
PrismObject<UserType> jack = getUser(USER_JACK_OID);
Expand All @@ -1235,6 +1236,21 @@ public void test570IterativeScriptingTask() throws Exception {
display("administrator", administrator);
assertEquals("Wrong jack description", "hello jack", jack.asObjectable().getDescription());
assertEquals("Wrong administrator description", "hello administrator", administrator.asObjectable().getDescription());

assertTask(taskAfterFirstRun, "task after first run")
.assertProgress(numberOfUsers)
.iterativeTaskInformation()
.assertSuccessCount(numberOfUsers);

// Testing for MID-6488
when("second run");
Task taskAfterSecondRun = rerunTask(taskOid, result);

then("second run");
assertTask(taskAfterSecondRun, "task after second run")
.assertProgress(numberOfUsers)
.iterativeTaskInformation()
.assertSuccessCount(numberOfUsers);
}

@Test
Expand Down

0 comments on commit 5e6f257

Please sign in to comment.