Exemple #1
0
        public virtual void testRemoveTimerBoundaryEventFromUserTask()
        {
            // given
            var sourceProcessDefinition =
                testHelper.DeployAndGetDefinition(ModifiableBpmnModelInstance.Modify(ProcessModels.OneTaskProcess)
                                                  //.ActivityBuilder("userTask")
                                                  //.BoundaryEvent("boundary")
                                                  //.TimerWithDate(TIMER_DATE)
                                                  //.UserTask(AFTER_BOUNDARY_TASK)
                                                  //.EndEvent()
                                                  //.Done()
                                                  );
            var targetProcessDefinition = testHelper.DeployAndGetDefinition(ProcessModels.OneTaskProcess);

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

            // when
            testHelper.CreateProcessInstanceAndMigrate(migrationPlan);

            // then
            testHelper.AssertBoundaryTimerJobRemoved("boundary");

            // and it is possible to successfully complete the migrated instance
            testHelper.CompleteTask("userTask");
            testHelper.AssertProcessEnded(testHelper.SnapshotBeforeMigration.ProcessInstanceId);
        }
        public virtual void testMigrateMultipleBoundaryEvents()
        {
            // given
            IBpmnModelInstance testProcess = ModifiableBpmnModelInstance.Modify(ProcessModels.SubprocessProcess)
                                             //.ActivityBuilder("subProcess")
                                             //.BoundaryEvent("timerBoundary1")
                                             //.TimerWithDate(TIMER_DATE)
                                             //.MoveToActivity("subProcess")
                                             //.BoundaryEvent("messageBoundary1")
                                             ////.Message(MESSAGE_NAME)
                                             //.MoveToActivity("subProcess")
                                             //.BoundaryEvent("signalBoundary1")
                                             //.Signal(SIGNAL_NAME)
                                             //.MoveToActivity("subProcess")
                                             //.BoundaryEvent("conditionalBoundary1")
                                             //.Condition(VAR_CONDITION)
                                             //.MoveToActivity(USER_TASK_ID)
                                             //.BoundaryEvent("timerBoundary2")
                                             //.TimerWithDate(TIMER_DATE)
                                             //.MoveToActivity(USER_TASK_ID)
                                             //.BoundaryEvent("messageBoundary2")
                                             ////.Message(MESSAGE_NAME)
                                             //.MoveToActivity(USER_TASK_ID)
                                             //.BoundaryEvent("signalBoundary2")
                                             //.Signal(SIGNAL_NAME)
                                             //.MoveToActivity(USER_TASK_ID)
                                             //.BoundaryEvent("conditionalBoundary2")
                                             //.Condition(VAR_CONDITION)
                                             //.Done()
            ;

            var sourceProcessDefinition = testHelper.DeployAndGetDefinition(testProcess);
            var targetProcessDefinition = testHelper.DeployAndGetDefinition(testProcess);

            var migrationPlan =
                rule.RuntimeService.CreateMigrationPlan(sourceProcessDefinition.Id, targetProcessDefinition.Id)
                .MapActivities("subProcess", "subProcess")
                .MapActivities("timerBoundary1", "timerBoundary1")
                .MapActivities("signalBoundary1", "signalBoundary1")
                .MapActivities("conditionalBoundary1", "conditionalBoundary1")
                .UpdateEventTrigger()
                .MapActivities(USER_TASK_ID, USER_TASK_ID)
                .MapActivities("messageBoundary2", "messageBoundary2")
                .Build();

            // when
            testHelper.CreateProcessInstanceAndMigrate(migrationPlan);

            // then
            testHelper.AssertEventSubscriptionRemoved("messageBoundary1", MESSAGE_NAME);
            testHelper.AssertEventSubscriptionRemoved("signalBoundary2", SIGNAL_NAME);
            testHelper.AssertEventSubscriptionRemoved("conditionalBoundary2", null);
            testHelper.AssertEventSubscriptionMigrated("signalBoundary1", "signalBoundary1", SIGNAL_NAME);
            testHelper.AssertEventSubscriptionMigrated("messageBoundary2", "messageBoundary2", MESSAGE_NAME);
            testHelper.AssertEventSubscriptionMigrated("conditionalBoundary1", "conditionalBoundary1", null);
            testHelper.AssertEventSubscriptionCreated("messageBoundary1", MESSAGE_NAME);
            testHelper.AssertEventSubscriptionCreated("signalBoundary2", SIGNAL_NAME);
            testHelper.AssertEventSubscriptionCreated("conditionalBoundary2", null);
            testHelper.AssertBoundaryTimerJobRemoved("timerBoundary2");
            testHelper.AssertBoundaryTimerJobMigrated("timerBoundary1", "timerBoundary1");
            testHelper.AssertBoundaryTimerJobCreated("timerBoundary2");

            // and it is possible to successfully complete the migrated instance
            testHelper.CompleteTask(USER_TASK_ID);
            testHelper.AssertProcessEnded(testHelper.SnapshotBeforeMigration.ProcessInstanceId);
        }