Beispiel #1
0
        public virtual void testCallCmmnCaseSimpleMigration()
        {
            // given
            var model = CallActivityModels.oneCmmnCallActivityProcess("oneTaskCase");

            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 case instance
            var caseExecution = rule.CaseService.CreateCaseExecutionQuery(c => c.ActivityId == "PI_HumanTask_1")
                                .First();

            testHelper.CompleteTask("PI_HumanTask_1");
            // and the calling process instance
            testHelper.CompleteTask("userTask");

            testHelper.AssertProcessEnded(processInstance.Id);

            // and close the called case instance
            rule.CaseService.WithCaseExecution(caseExecution.CaseInstanceId)
            .Close();
            testHelper.AssertCaseEnded(caseExecution.CaseInstanceId);
        }