コード例 #1
0
        public virtual void testCallBpmnProcessParallelMultiInstance()
        {
            // given
            IBpmnModelInstance model =
                ModifiableBpmnModelInstance.Modify(CallActivityModels.oneBpmnCallActivityProcess("oneTaskProcess"))
                //.ActivityBuilder("callActivity")
                //.MultiInstance()
                //.Parallel()
                //.Cardinality("1")
                //.Done()
            ;

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

            var migrationPlan =
                rule.RuntimeService.CreateMigrationPlan(sourceProcessDefinition.Id, targetProcessDefinition.Id)
                .MapActivities("callActivity#multiInstanceBody", "callActivity#multiInstanceBody")
                .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(null)
                     .Scope()
                     .Id(testHelper.GetSingleExecutionIdForActivityBeforeMigration("callActivity#multiInstanceBody"))
                     .Child("callActivity")
                     .Concurrent()
                     .NoScope()
                     .Id(testHelper.GetSingleExecutionIdForActivityBeforeMigration("callActivity"))
                     .Done());

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

            // and the link between calling and called instance is maintained correctly

            testHelper.AssertSuperExecutionOfProcessInstance(rule.RuntimeService.CreateProcessInstanceQuery()
                                                             ////.SetProcessDefinitionKey("oneTaskProcess")
                                                             .First()
                                                             .Id, testHelper.GetSingleExecutionIdForActivityAfterMigration("callActivity"));

            // 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);
        }
コード例 #2
0
        public virtual void testCallBpmnProcessReconfigureCallActivity()
        {
            // given
            var model = CallActivityModels.oneBpmnCallActivityProcess("oneTaskProcess");

            var sourceProcessDefinition = testHelper.DeployAndGetDefinition(model);
            var targetProcessDefinition = testHelper.DeployAndGetDefinition(ModifiableBpmnModelInstance.Modify(model)
                                                                            .CallActivityBuilder("callActivity")
                                                                            .CalledElement("foo")
                                                                            .Done());

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

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

            // then the called instance has not changed (e.g. not been migrated to a different process definition)
            var calledInstance = rule.RuntimeService.CreateProcessInstanceQuery()
                                 ////.SetProcessDefinitionKey("oneTaskProcess")
                                 .First();

            Assert.NotNull(calledInstance);

            // 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);
        }
コード例 #3
0
        public virtual void testCallBpmnProcessAddParentScope()
        {
            // given
            var sourceProcessDefinition =
                testHelper.DeployAndGetDefinition(CallActivityModels.oneBpmnCallActivityProcess("oneTaskProcess"));
            var targetProcessDefinition =
                testHelper.DeployAndGetDefinition(CallActivityModels.subProcessBpmnCallActivityProcess("oneTaskProcess"));

            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(null)
                     .Scope()
                     .Child("callActivity")
                     .Scope()
                     .Id(testHelper.GetSingleExecutionIdForActivityBeforeMigration("callActivity"))
                     .Done());

            testHelper.AssertActivityTreeAfterMigration()
            .HasStructure(ActivityInstanceAssert.DescribeActivityInstanceTree(targetProcessDefinition.Id)
                          .BeginScope("subProcess")
                          .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);
        }