public virtual void testHistoricBatchCompletion()
        {
            var processDefinition = testRule.DeployAndGetDefinition(instance);
            var batch             = helper.StartAfterAsync("process1", 1, "user1", processDefinition.Id);

            helper.ExecuteSeedJob(batch);
            helper.ExecuteJobs(batch);

            var endDate = helper.AddSecondsToClock(12);

            // when
            helper.ExecuteMonitorJob(batch);

            // then the historic batch has an end time set
            var historicBatch = helper.GetHistoricBatch(batch);

            Assert.NotNull(historicBatch);
            Assert.AreEqual(endDate, historicBatch.EndTime);
        }
Exemplo n.º 2
0
        public virtual void testNoCreationOnSyncBatchJobExecution()
        {
            // given
            var processDefinition = testRule.DeployAndGetDefinition(instance);

            var processInstance = runtimeService.StartProcessInstanceById(processDefinition.Id);

            var batch = runtimeService.CreateModification(processDefinition.Id)
                        .StartAfterActivity("user2")
                        .SetProcessInstanceIds(processInstance.Id)
                        .ExecuteAsync();

            helper.ExecuteSeedJob(batch);

            // when
            rule.IdentityService.AuthenticatedUserId = "userId";
            helper.ExecuteJobs(batch);
            rule.IdentityService.ClearAuthentication();

            // then
            Assert.AreEqual(0, rule.HistoryService.CreateUserOperationLogQuery()
                            .Count());
        }
        public virtual void testMonitorJobRemovesBatchAfterCompletion()
        {
            var processDefinition = testRule.DeployAndGetDefinition(instance);
            var batch             = helper.StartBeforeAsync("process1", 10, "user2", processDefinition.Id);

            helper.ExecuteSeedJob(batch);
            helper.ExecuteJobs(batch);

            // when
            helper.ExecuteMonitorJob(batch);

            // then the batch was completed and removed
            Assert.AreEqual(0, rule.ManagementService.CreateBatchQuery()
                            .Count());

            // and the seed jobs was removed
            Assert.AreEqual(0, rule.ManagementService.CreateJobQuery()
                            .Count());
        }