Assert.assertTrue(scheduleExecutions.size() > 0);
Assert.assertTrue(Iterators.contains(scheduleExecutions.iterator(), scheduleExecution));
// Make some progress
ScheduleExecutionResult scheduleExecutionResult;
scheduleExecutionResult = scheduleExecutionManagementService.startExecutionResult(scheduleExecutionNode1.getId());
Assert.assertNotNull(scheduleExecutionResult);
scheduleExecutionResult = scheduleExecutionManagementService.finishExecutionResult(scheduleExecutionResult.getId(),
true, null);
Assert.assertNotNull(scheduleExecutionResult);
scheduleExecutionResult = scheduleExecutionManagementService.startExecutionResult(scheduleExecutionNode2.getId());
Assert.assertNotNull(scheduleExecutionResult);
scheduleExecutionResult = scheduleExecutionManagementService.finishExecutionResult(scheduleExecutionResult.getId(),
true, null);
Assert.assertNotNull(scheduleExecutionResult);
scheduleExecutionResult = scheduleExecutionManagementService.startExecutionResult(scheduleExecutionNode3.getId());
Assert.assertNotNull(scheduleExecutionResult);
scheduleExecutionResult = scheduleExecutionManagementService.finishExecutionResult(scheduleExecutionResult.getId(),
false, null);
Assert.assertNotNull(scheduleExecutionResult);
entityManager.flush();
entityManager.clear();
scheduleExecutionModified =
scheduleExecutionManagementService.findExecution(scheduleExecution.getId());
Assert.assertNotNull(scheduleExecutionModified);
Assert.assertEquals(scheduleExecution, scheduleExecutionModified);
Assert.assertEquals(3, scheduleExecutionModified.getResults().size());
scheduleExecutionResult = scheduleExecutionModified.getResults().get(0);
Assert.assertNotNull(scheduleExecutionResult);
Assert.assertEquals(0, scheduleExecutionResult.getOrderIndex());
Assert.assertTrue(scheduleExecutionResult.isSucceed());
scheduleExecutionResult = scheduleExecutionModified.getResults().get(1);
Assert.assertNotNull(scheduleExecutionResult);
Assert.assertEquals(1, scheduleExecutionResult.getOrderIndex());
Assert.assertTrue(scheduleExecutionResult.isSucceed());
scheduleExecutionResult = scheduleExecutionModified.getResults().get(2);
Assert.assertEquals(2, scheduleExecutionResult.getOrderIndex());
Assert.assertNotNull(scheduleExecutionResult);
Assert.assertFalse(scheduleExecutionResult.isSucceed());
// Finish execution
scheduleExecutionModified = scheduleExecutionManagementService.finishExecution(
scheduleExecution.getId(), ScheduleExecutionStatus.SUCCEED);