public virtual void executeModificationJobsForCancelAll()
        {
            var processDefinition = testRule.DeployAndGetDefinition(instance);
            var batch             = helper.CancelAllAsync("process1", 10, "user1", processDefinition.Id);

            helper.ExecuteSeedJob(batch);
            var modificationJobs = helper.GetExecutionJobs(batch);

            // when
            foreach (var modificationJob in modificationJobs)
            {
                helper.ExecuteJob(modificationJob);
            }

            // then all process instances where modified
            foreach (var ProcessInstanceId in helper.CurrentProcessInstances)
            {
                var updatedTree = runtimeService.GetActivityInstance(ProcessInstanceId);
                Assert.IsNull(updatedTree);
            }

            // and the no modification jobs exist
            Assert.AreEqual(0, helper.GetExecutionJobs(batch)
                            .Count);

            // but a monitor job exists
            Assert.NotNull(helper.GetMonitorJob(batch));
        }
        public virtual void testHistoricSeedJobLog()
        {
            // when
            var processDefinition = testRule.DeployAndGetDefinition(instance);
            var batch             = helper.CancelAllAsync("process1", 1, "user1", processDefinition.Id);

            // then a historic job log exists for the seed job
            var jobLog = helper.GetHistoricSeedJobLog(batch)[0];

            Assert.NotNull(jobLog);
            Assert.True(jobLog.CreationLog);
            Assert.AreEqual(batch.SeedJobDefinitionId, jobLog.JobDefinitionId);
            Assert.AreEqual(BatchSeedJobHandler.TYPE, jobLog.JobDefinitionType);
            Assert.AreEqual(batch.Id, jobLog.JobDefinitionConfiguration);
            Assert.AreEqual(START_DATE, jobLog.TimeStamp);
            Assert.IsNull(jobLog.DeploymentId);
            Assert.IsNull(jobLog.ProcessDefinitionId);
            Assert.IsNull(jobLog.ExecutionId);
            Assert.IsNull(jobLog.JobDueDate);

            // when the seed job is executed
            var executionDate = helper.AddSecondsToClock(12);

            helper.ExecuteSeedJob(batch);

            // then a new historic job log exists for the seed job
            jobLog = helper.GetHistoricSeedJobLog(batch)[1];
            Assert.NotNull(jobLog);
            Assert.True(jobLog.SuccessLog);
            Assert.AreEqual(batch.SeedJobDefinitionId, jobLog.JobDefinitionId);
            Assert.AreEqual(BatchSeedJobHandler.TYPE, jobLog.JobDefinitionType);
            Assert.AreEqual(batch.Id, jobLog.JobDefinitionConfiguration);
            Assert.AreEqual(executionDate, jobLog.TimeStamp);
            Assert.IsNull(jobLog.DeploymentId);
            Assert.IsNull(jobLog.ProcessDefinitionId);
            Assert.IsNull(jobLog.ExecutionId);
            Assert.IsNull(jobLog.JobDueDate);
        }