コード例 #1
0
        public virtual void testMigrateEventSubprocessTimerKeepTrigger()
        {
            var sourceProcessDefinition =
                testHelper.DeployAndGetDefinition(EventSubProcessModels.TIMER_EVENT_SUBPROCESS_PROCESS);
            var targetProcessDefinition =
                testHelper.DeployAndGetDefinition(EventSubProcessModels.TIMER_EVENT_SUBPROCESS_PROCESS);

            var processInstance = rule.RuntimeService.StartProcessInstanceById(sourceProcessDefinition.Id);

            var migrationPlan =
                rule.RuntimeService.CreateMigrationPlan(sourceProcessDefinition.Id, targetProcessDefinition.Id)
                .MapActivities(USER_TASK_ID, USER_TASK_ID)
                .MapActivities(EVENT_SUB_PROCESS_START_ID, EVENT_SUB_PROCESS_START_ID)
                .Build();

            // when
            testHelper.MigrateProcessInstance(migrationPlan, processInstance);

            // then
            testHelper.AssertJobMigrated(EVENT_SUB_PROCESS_START_ID, EVENT_SUB_PROCESS_START_ID,
                                         TimerStartEventSubprocessJobHandler.TYPE);

            // and it is possible to trigger the event subprocess
            var timerJob = testHelper.SnapshotAfterMigration.Jobs[0];

            rule.ManagementService.ExecuteJob(timerJob.Id);
            Assert.AreEqual(1, rule.TaskService.CreateTaskQuery()
                            .Count());

            // and complete the process instance
            testHelper.CompleteTask(EVENT_SUB_PROCESS_TASK_ID);
            testHelper.AssertProcessEnded(processInstance.Id);
        }
コード例 #2
0
        public virtual void testUpdateEventTimer()
        {
            // given
            ClockTestUtil.SetClockToDateWithoutMilliseconds();

            IBpmnModelInstance sourceProcess = ModifiableBpmnModelInstance.Modify(ProcessModels.OneTaskProcess)
                                               //.ActivityBuilder(USER_TASK_ID)
                                               //.BoundaryEvent(BOUNDARY_ID)
                                               //.TimerWithDate(TIMER_DATE)
                                               //.UserTask(AFTER_BOUNDARY_TASK)
                                               //.EndEvent()
                                               //.Done()
            ;
            IBpmnModelInstance targetProcess = ModifiableBpmnModelInstance.Modify(ProcessModels.OneTaskProcess)
                                               //.ActivityBuilder(USER_TASK_ID)
                                               //.BoundaryEvent(BOUNDARY_ID)
                                               //.TimerWithDuration("PT50M")
                                               //.UserTask(AFTER_BOUNDARY_TASK)
                                               //.EndEvent()
                                               //.Done()
            ;

            var sourceProcessDefinition = testHelper.DeployAndGetDefinition(sourceProcess);
            var targetProcessDefinition = testHelper.DeployAndGetDefinition(targetProcess);

            var migrationPlan =
                rule.RuntimeService.CreateMigrationPlan(sourceProcessDefinition.Id, targetProcessDefinition.Id)
                .MapActivities(USER_TASK_ID, USER_TASK_ID)
                .MapActivities(BOUNDARY_ID, BOUNDARY_ID)
                .UpdateEventTrigger()
                .Build();

            // when
            testHelper.CreateProcessInstanceAndMigrate(migrationPlan);

            // then
            var newDueDate = new DateTime(ClockUtil.CurrentTime.Ticks).AddMinutes(50);

            testHelper.AssertJobMigrated(testHelper.SnapshotBeforeMigration.Jobs[0], BOUNDARY_ID, newDueDate);

            // and it is possible to successfully complete the migrated instance
            var jobAfterMigration = testHelper.SnapshotAfterMigration.Jobs[0];

            rule.ManagementService.ExecuteJob(jobAfterMigration.Id);

            testHelper.CompleteTask(AFTER_BOUNDARY_TASK);
            testHelper.AssertProcessEnded(testHelper.SnapshotBeforeMigration.ProcessInstanceId);
        }
コード例 #3
0
        public virtual void testMigrateJob()
        {
            // given
            var sourceProcessDefinition = testHelper.DeployAndGetDefinition(TimerCatchModels.ONE_TIMER_CATCH_PROCESS);
            var targetProcessDefinition = testHelper.DeployAndGetDefinition(TimerCatchModels.ONE_TIMER_CATCH_PROCESS);

            var migrationPlan =
                rule.RuntimeService.CreateMigrationPlan(sourceProcessDefinition.Id, targetProcessDefinition.Id)
                .MapActivities("timerCatch", "timerCatch")
                .Build();

            // when
            var processInstance = testHelper.CreateProcessInstanceAndMigrate(migrationPlan);

            testHelper.AssertJobMigrated(testHelper.SnapshotBeforeMigration.Jobs[0], "timerCatch");

            testHelper.AssertExecutionTreeAfterMigration()
            .HasProcessDefinitionId(targetProcessDefinition.Id)
            .Matches(ExecutionAssert.DescribeExecutionTree(null)
                     .Scope()
                     .Id(testHelper.SnapshotBeforeMigration.ProcessInstanceId)
                     .Child("timerCatch")
                     .Scope()
                     .Id(testHelper.GetSingleExecutionIdForActivityBeforeMigration("timerCatch"))
                     .Done());

            testHelper.AssertActivityTreeAfterMigration()
            .HasStructure(ActivityInstanceAssert.DescribeActivityInstanceTree(targetProcessDefinition.Id)
                          .Activity("timerCatch", testHelper.GetSingleActivityInstanceBeforeMigration("timerCatch")
                                    .Id)
                          .Done());

            // and it is possible to trigger the event
            var jobAfterMigration = testHelper.SnapshotAfterMigration.Jobs[0];

            rule.ManagementService.ExecuteJob(jobAfterMigration.Id);

            testHelper.CompleteTask("userTask");
            testHelper.AssertProcessEnded(processInstance.Id);
        }