예제 #1
0
        public virtual void testParallelGatewayContinueExecution()
        {
            // given
            var sourceProcessDefinition = testHelper.DeployAndGetDefinition(GatewayModels.PARALLEL_GW);
            var targetProcessDefinition = testHelper.DeployAndGetDefinition(GatewayModels.PARALLEL_GW);

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

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

            testHelper.CompleteTask("parallel2");

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

            // then
            Assert.AreEqual(1, rule.TaskService.CreateTaskQuery()
                            .Count());
            Assert.AreEqual(0, rule.TaskService.CreateTaskQuery(c => c.TaskDefinitionKeyWithoutCascade == "afterJoin")
                            .Count());

            testHelper.CompleteTask("parallel1");
            testHelper.CompleteTask("afterJoin");
            testHelper.AssertProcessEnded(processInstance.Id);
        }
        public virtual void testCase1()
        {
            // given
            var sourceProcessDefinition =
                testHelper.DeployAndGetDefinition(CompensationModels.COMPENSATION_TWO_TASKS_SUBPROCESS_MODEL);
            var targetProcessDefinition =
                testHelper.DeployAndGetDefinition(CompensationModels.ONE_COMPENSATION_TASK_MODEL);

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

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

            testHelper.CompleteTask("userTask1");

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

            // then
            testHelper.AssertEventSubscriptionMigrated("compensationHandler", "compensationHandler", null);

            // and the compensation can be triggered and completed
            testHelper.CompleteTask("userTask2");
            testHelper.CompleteTask("compensationHandler");

            testHelper.AssertProcessEnded(processInstance.Id);
        }
예제 #3
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);
        }
예제 #4
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);
        }
예제 #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);
        }
예제 #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);
        }
예제 #8
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);
        }
        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);
        }
        public virtual void testMigrateEventSubprocessSignalTrigger()
        {
            var processModel = ProcessModels.OneTaskProcess.Clone();
            var eventTrigger = eventFactory.AddEventSubProcess(rule.ProcessEngine, processModel,
                                                               ProcessModels.ProcessKey, "eventSubProcess", "eventSubProcessStart");

            ModifiableBpmnModelInstance.Wrap(processModel)
            .StartEventBuilder("eventSubProcessStart")
            .UserTask("eventSubProcessTask")
            .EndEvent()
            .Done();

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

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

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

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

            // then
            eventTrigger.AssertEventTriggerMigrated(testHelper, "eventSubProcessStart");

            // and it is possible to trigger the event subprocess
            eventTrigger.Trigger(processInstance.Id);
            Assert.AreEqual(1, rule.TaskService.CreateTaskQuery()
                            .Count());

            // and complete the process instance
            testHelper.CompleteTask("eventSubProcessTask");
            testHelper.AssertProcessEnded(processInstance.Id);
        }
예제 #11
0
        public virtual void testMigrateActiveCompensationEventSubProcess()
        {
            // given
            var processModel = ProcessModels.OneTaskProcess.Clone();
            var eventTrigger = eventFactory.AddEventSubProcess(rule.ProcessEngine, processModel,
                                                               ProcessModels.ProcessKey, "eventSubProcess", "eventSubProcessStart");

            ModifiableBpmnModelInstance.Wrap(processModel)
            .StartEventBuilder("eventSubProcessStart")
            .UserTask("eventSubProcessTask")
            .EndEvent()
            .Done();

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

            IProcessInstance processInstance = rule.RuntimeService.CreateProcessInstanceById(sourceProcessDefinition.Id)
                                               .StartBeforeActivity("eventSubProcessStart")
                                               .ExecuteWithVariablesInReturn();

            var migrationPlan =
                rule.RuntimeService.CreateMigrationPlan(sourceProcessDefinition.Id, targetProcessDefinition.Id)
                .MapActivities("eventSubProcess", "eventSubProcess")
                .MapActivities("eventSubProcessStart", "eventSubProcessStart")
                .UpdateEventTrigger()
                .MapActivities("eventSubProcessTask", "eventSubProcessTask")
                .Build();

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

            // then
            eventTrigger.AssertEventTriggerMigrated(testHelper, "eventSubProcessStart");

            // and it is possible to complete the process instance
            testHelper.CompleteTask("eventSubProcessTask");
            testHelper.AssertProcessEnded(processInstance.Id);
        }
예제 #12
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);
        }
예제 #13
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);
        }
예제 #14
0
        public virtual void testContinueProcess()
        {
            // given
            var sourceProcessDefinition = testHelper.DeployAndGetDefinition(ExternalTaskModels.ONE_EXTERNAL_TASK_PROCESS);
            var targetProcessDefinition = testHelper.DeployAndGetDefinition(ExternalTaskModels.ONE_EXTERNAL_TASK_PROCESS);

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

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

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

            // then it is possible to complete the task
            var task = fetchAndLockSingleTask(ExternalTaskModels.TOPIC);

            rule.ExternalTaskService.Complete(task.Id, WORKER_ID);

            testHelper.AssertProcessEnded(processInstance.Id);
        }
        public virtual void testMigrateActiveEventSubProcess()
        {
            // given
            var sourceProcessDefinition =
                testHelper.DeployAndGetDefinition(EventSubProcessModels.MESSAGE_EVENT_SUBPROCESS_PROCESS);
            var targetProcessDefinition =
                testHelper.DeployAndGetDefinition(EventSubProcessModels.MESSAGE_EVENT_SUBPROCESS_PROCESS);

            var processInstance = rule.RuntimeService.CreateProcessInstanceById(sourceProcessDefinition.Id)
                                  .StartBeforeActivity(EVENT_SUB_PROCESS_TASK_ID)
                                  .Execute();

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

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

            // then
            testHelper.AssertExecutionTreeAfterMigration()
            .HasProcessDefinitionId(targetProcessDefinition.Id)
            .Matches(ExecutionAssert.DescribeExecutionTree(null)
                     .Scope()
                     .Id(processInstance.Id)
                     .Child(EVENT_SUB_PROCESS_TASK_ID)
                     .Scope()
                     .Id(testHelper.GetSingleExecutionIdForActivityBeforeMigration("eventSubProcess"))
                     .Done());

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

            testHelper.AssertEventSubscriptionRemoved(EVENT_SUB_PROCESS_START_ID, EventSubProcessModels.MESSAGE_NAME);
            testHelper.AssertEventSubscriptionCreated(EVENT_SUB_PROCESS_START_ID, EventSubProcessModels.MESSAGE_NAME);

            // and it is possible to complete the process instance
            testHelper.CompleteTask(EVENT_SUB_PROCESS_TASK_ID);
            testHelper.AssertProcessEnded(processInstance.Id);
        }
        public virtual void testMigrateGatewayWithTimerEvent()
        {
            // 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
            var processInstance = testHelper.CreateProcessInstanceAndMigrate(migrationPlan);

            // then
            testHelper.AssertIntermediateTimerJobRemoved("timerCatch");
            testHelper.AssertIntermediateTimerJobCreated("timerCatch");

            var timerJob = testHelper.SnapshotAfterMigration.Jobs[0];

            rule.ManagementService.ExecuteJob(timerJob.Id);

            testHelper.CompleteTask("afterTimerCatch");
            testHelper.AssertProcessEnded(processInstance.Id);
        }
        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);
        }
예제 #18
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);
        }
예제 #19
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);
        }