public virtual void testCannotMigrateActivityInstance()
        {
            // given
//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.GetName method:
            var model = ProcessModels.NewModel()
                        .StartEvent()
                        .ServiceTask("serviceTask")
                        .CamundaClass(typeof(SignallableServiceTaskDelegate).FullName)
                        .EndEvent()
                        .Done();

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

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

            // when
            try
            {
                testHelper.CreateProcessInstanceAndMigrate(migrationPlan);
                Assert.Fail("should Assert.Fail");
            }
            catch (MigratingProcessInstanceValidationException e)
            {
                // then
                MigratingProcessInstanceValidationReportAssert.That(e.ValidationReport)
                .HasActivityInstanceFailures("serviceTask",
                                             "The type of the source activity is not supported for activity instance migration");
            }
        }
Esempio n. 2
0
        public virtual void testCallBpmnProcessSimpleMigration()
        {
            // given
            var model = CallActivityModels.oneBpmnCallActivityProcess("oneTaskProcess");

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

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

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

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

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

            // and it is possible to complete the called process instance
            testHelper.CompleteTask("userTask");
            // and the calling process instance
            testHelper.CompleteTask("userTask");

            testHelper.AssertProcessEnded(processInstance.Id);
        }
        public virtual void testUpdateEventMessage()
        {
            // given
            var sourceProcess = EventSubProcessModels.MESSAGE_EVENT_SUBPROCESS_PROCESS;
            IBpmnModelInstance targetProcess = ModifiableBpmnModelInstance.Modify(
                EventSubProcessModels.MESSAGE_EVENT_SUBPROCESS_PROCESS)
                                               .RenameMessage(EventSubProcessModels.MESSAGE_NAME, "new" + EventSubProcessModels.MESSAGE_NAME);

            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(EVENT_SUB_PROCESS_START_ID, EVENT_SUB_PROCESS_START_ID)
                .UpdateEventTrigger()
                .Build();

            // when
            testHelper.CreateProcessInstanceAndMigrate(migrationPlan);

            // then
            testHelper.AssertEventSubscriptionMigrated(EVENT_SUB_PROCESS_START_ID, EventSubProcessModels.MESSAGE_NAME,
                                                       EVENT_SUB_PROCESS_START_ID, "new" + EventSubProcessModels.MESSAGE_NAME);

            // and it is possible to successfully complete the migrated instance
            rule.RuntimeService.CorrelateMessage("new" + EventSubProcessModels.MESSAGE_NAME);
            testHelper.CompleteTask(EVENT_SUB_PROCESS_TASK_ID);
            testHelper.AssertProcessEnded(testHelper.SnapshotBeforeMigration.ProcessInstanceId);
        }
Esempio n. 4
0
        public virtual void testContinueProcess()
        {
            // given
            var sourceProcessDefinition = testHelper.DeployAndGetDefinition(TransactionModels.ONE_TASK_TRANSACTION);
            var targetProcessDefinition = testHelper.DeployAndGetDefinition(TransactionModels.ONE_TASK_TRANSACTION);

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

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

            // then
            testHelper.CompleteTask("userTask");
            testHelper.AssertProcessEnded(processInstance.Id);
        }
Esempio n. 5
0
        public virtual void testMigrateEventSubscription()
        {
            // given
            var sourceProcessDefinition =
                testHelper.DeployAndGetDefinition(MessageReceiveModels.ONE_MESSAGE_CATCH_PROCESS);
            var targetProcessDefinition =
                testHelper.DeployAndGetDefinition(MessageReceiveModels.ONE_MESSAGE_CATCH_PROCESS);

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

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

            testHelper.AssertEventSubscriptionMigrated("messageCatch", "messageCatch", MessageReceiveModels.MESSAGE_NAME);

            // and it is possible to trigger the receive task
            rule.RuntimeService.CorrelateMessage(MessageReceiveModels.MESSAGE_NAME);

            testHelper.CompleteTask("userTask");
            testHelper.AssertProcessEnded(processInstance.Id);
        }
        public virtual void testMigrateEventSubscription()
        {
            // given
            var sourceProcessDefinition = testHelper.DeployAndGetDefinition(ONE_CONDITION_PROCESS);
            var targetProcessDefinition = testHelper.DeployAndGetDefinition(ONE_CONDITION_PROCESS);

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

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

            testHelper.AssertEventSubscriptionMigrated(ConditionalModels.CONDITION_ID, ConditionalModels.CONDITION_ID,
                                                       null);

            //then it is possible to trigger the conditional event
            testHelper.SetVariable(processInstance.Id, VAR_NAME, "1");

            testHelper.CompleteTask(ConditionalModels.USER_TASK_ID);
            testHelper.AssertProcessEnded(processInstance.Id);
        }
Esempio n. 7
0
        public virtual void testIntermediateConditionalEventWithSetVariableOnEndListener()
        {
            // given
//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.GetName method:
            var sourceProcessDefinition = testHelper.DeployAndGetDefinition(ESS.FW.Bpm.Model.Bpmn.Bpmn.CreateExecutableProcess()
                                                                            .StartEvent()
                                                                            .SubProcess()
                                                                            .CamundaExecutionListenerClass(ExecutionListenerFields.EventNameEnd,
                                                                                                           typeof(SetVariableDelegate).FullName)
                                                                            //.EmbeddedSubProcess()
                                                                            //.StartEvent()
                                                                            .IntermediateCatchEvent(ConditionalModels.CONDITION_ID)
                                                                            .ConditionalEventDefinition()
                                                                            //.Condition(ConditionalModels.VAR_CONDITION)
                                                                            //.ConditionalEventDefinitionDone()
                                                                            //.UserTask(AbstractConditionalEventTestCase.TaskAfterConditionId)
                                                                            //.EndEvent()
                                                                            .SubProcessDone()
                                                                            .EndEvent()
                                                                            .Done());
            var targetProcessDefinition = testHelper.DeployAndGetDefinition(ESS.FW.Bpm.Model.Bpmn.Bpmn.CreateExecutableProcess()
                                                                            .StartEvent()
                                                                            .IntermediateCatchEvent(ConditionalModels.CONDITION_ID)
                                                                            .ConditionalEventDefinition()
                                                                            //.Condition(ConditionalModels.VAR_CONDITION)
                                                                            //.ConditionalEventDefinitionDone()
                                                                            //.UserTask(AbstractConditionalEventTestCase.TaskAfterConditionId)
                                                                            //.EndEvent()
                                                                            .Done());

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

            //when sub process is removed, end listener is called and sets variable
            var processInstance = testHelper.CreateProcessInstanceAndMigrate(migrationPlan);

            testHelper.AssertEventSubscriptionMigrated(ConditionalModels.CONDITION_ID, ConditionalModels.CONDITION_ID,
                                                       null);
            Assert.AreEqual(1, rule.RuntimeService.GetVariable(processInstance.Id, ConditionalModels.VARIABLE_NAME));

            //then conditional event is not triggered
            Assert.IsNull(rule.TaskService.CreateTaskQuery()
                          .First());

            //when any var is set
            testHelper.AnyVariable = processInstance.Id;

            //then condition is satisfied, since variable is already set which satisfies condition
            testHelper.CompleteTask(AbstractConditionalEventTestCase.TaskAfterConditionId);
            testHelper.AssertProcessEnded(processInstance.Id);
        }
Esempio n. 8
0
        public virtual void testRemoveParallelMultiInstanceBody()
        {
            // given
            var sourceProcessDefinition =
                testHelper.DeployAndGetDefinition(MultiInstanceProcessModels.PAR_MI_ONE_TASK_PROCESS);
            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.AssertExecutionTreeAfterMigration()
            .HasProcessDefinitionId(targetProcessDefinition.Id)
            .Matches(ExecutionAssert.DescribeExecutionTree(null)
                     .Scope()
                     .Id(testHelper.SnapshotBeforeMigration.ProcessInstanceId)
                     .Child("userTask")
                     .Concurrent()
                     .NoScope()
                     .Up()
                     .Child("userTask")
                     .Concurrent()
                     .NoScope()
                     .Up()
                     .Child("userTask")
                     .Concurrent()
                     .NoScope()
                     .Done());

            var userTaskInstances = testHelper.SnapshotBeforeMigration.ActivityTree.GetActivityInstances("userTask");

            testHelper.AssertActivityTreeAfterMigration()
            .HasStructure(ActivityInstanceAssert.DescribeActivityInstanceTree(targetProcessDefinition.Id)
                          .Activity("userTask", userTaskInstances[0].Id)
                          .Activity("userTask", userTaskInstances[1].Id)
                          .Activity("userTask", userTaskInstances[2].Id)
                          .Done());

            var migratedTasks = testHelper.SnapshotAfterMigration.Tasks;

            Assert.AreEqual(3, migratedTasks.Count);

            // and it is possible to successfully complete the migrated instance
            foreach (var migratedTask in migratedTasks)
            {
                rule.TaskService.Complete(migratedTask.Id);
            }
            testHelper.AssertProcessEnded(testHelper.SnapshotBeforeMigration.ProcessInstanceId);
        }
        public virtual void testRemoveScopeForNonScopeActivity()
        {
            // given
            var sourceProcessDefinition = testHelper.DeployAndGetDefinition(ProcessModels.SubprocessProcess);
            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.AssertExecutionTreeAfterMigration()
            .HasProcessDefinitionId(targetProcessDefinition.Id)
            .Matches(ExecutionAssert.DescribeExecutionTree("userTask")
                     .Scope()
                     .Id(testHelper.SnapshotBeforeMigration.ProcessInstanceId)
                     .Done());

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

            var migratedTask = testHelper.SnapshotAfterMigration.GetTaskForKey("userTask");

            Assert.NotNull(migratedTask);
            Assert.AreEqual(targetProcessDefinition.Id, migratedTask.ProcessDefinitionId);

            // and it is possible to successfully complete the migrated instance
            rule.TaskService.Complete(migratedTask.Id);
            testHelper.AssertProcessEnded(testHelper.SnapshotBeforeMigration.ProcessInstanceId);
        }
Esempio n. 10
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);
        }
Esempio n. 11
0
        public virtual void testMigrateEventSubscription()
        {
            // given
            var sourceProcessDefinition = testHelper.DeployAndGetDefinition(SignalCatchModels.ONE_SIGNAL_CATCH_PROCESS);
            var targetProcessDefinition = testHelper.DeployAndGetDefinition(SignalCatchModels.ONE_SIGNAL_CATCH_PROCESS);

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

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

            // then
            testHelper.AssertEventSubscriptionMigrated("signalCatch", "signalCatch", SignalCatchModels.SIGNAL_NAME);

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

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

            // and it is possible to trigger the event
            rule.RuntimeService.SignalEventReceived(SignalCatchModels.SIGNAL_NAME);

            testHelper.CompleteTask("userTask");
            testHelper.AssertProcessEnded(processInstance.Id);
        }
Esempio n. 12
0
        public virtual void testRemoveMessageBoundaryEventFromUserTask()
        {
            // given
            var sourceProcessDefinition =
                testHelper.DeployAndGetDefinition(ModifiableBpmnModelInstance.Modify(ProcessModels.OneTaskProcess)
                                                  //.ActivityBuilder("userTask")
                                                  //.BoundaryEvent("boundary")
                                                  ////.Message(MESSAGE_NAME)
                                                  //.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.AssertEventSubscriptionRemoved("boundary", MESSAGE_NAME);

            // 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);
        }
        public virtual void testMigrateGatewayExecutionTree()
        {
            // given
            var sourceProcessDefinition =
                testHelper.DeployAndGetDefinition(EventBasedGatewayModels.TIMER_EVENT_BASED_GW_PROCESS);
            var targetProcessDefinition =
                testHelper.DeployAndGetDefinition(EventBasedGatewayModels.TIMER_EVENT_BASED_GW_PROCESS);

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

            // when
            testHelper.CreateProcessInstanceAndMigrate(migrationPlan);

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

            testHelper.AssertActivityTreeAfterMigration()
            .HasStructure(ActivityInstanceAssert.DescribeActivityInstanceTree(targetProcessDefinition.Id)
                          .Activity("eventBasedGateway",
                                    testHelper.GetSingleActivityInstanceBeforeMigration("eventBasedGateway")
                                    .Id)
                          .Done());
        }
Esempio n. 15
0
        public virtual void testMigrateBoundaryEventOnUserTask()
        {
            // given
            var sourceProcess = ProcessModels.OneTaskProcess.Clone();
            var eventTrigger  = eventFactory.AddBoundaryEvent(rule.ProcessEngine, sourceProcess,
                                                              USER_TASK_ID, BOUNDARY_ID);

            ModifiableBpmnModelInstance.Wrap(sourceProcess)
            //.FlowNodeBuilder(BOUNDARY_ID)
            //.UserTask(AFTER_BOUNDARY_TASK)
            //.EndEvent()
            //.Done()
            ;

            IBpmnModelInstance targetProcess = ModifiableBpmnModelInstance.Modify(sourceProcess)
                                               .ChangeElementId(BOUNDARY_ID, NEW_BOUNDARY_ID);

            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, NEW_BOUNDARY_ID)
                .UpdateEventTrigger()
                .Build();

            // when
            testHelper.CreateProcessInstanceAndMigrate(migrationPlan);

            // then
            eventTrigger.AssertEventTriggerMigrated(testHelper, NEW_BOUNDARY_ID);

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