Ejemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testCallCmmnCaseSimpleMigration()
        public virtual void testCallCmmnCaseSimpleMigration()
        {
            // given
            BpmnModelInstance model = CallActivityModels.oneCmmnCallActivityProcess("oneTaskCase");

            ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(model);
            ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(model);

            MigrationPlan migrationPlan = rule.RuntimeService.createMigrationPlan(sourceProcessDefinition.Id, targetProcessDefinition.Id).mapActivities("callActivity", "callActivity").build();

            // when
            ProcessInstance processInstance = testHelper.createProcessInstanceAndMigrate(migrationPlan);

            // then
            testHelper.assertExecutionTreeAfterMigration().hasProcessDefinitionId(targetProcessDefinition.Id).matches(describeExecutionTree(null).scope().id(testHelper.snapshotBeforeMigration.ProcessInstanceId).child("callActivity").scope().id(testHelper.getSingleExecutionIdForActivityBeforeMigration("callActivity")).done());

            testHelper.assertActivityTreeAfterMigration().hasStructure(describeActivityInstanceTree(targetProcessDefinition.Id).activity("callActivity", testHelper.getSingleActivityInstanceBeforeMigration("callActivity").Id).done());

            // and it is possible to complete the called case instance
            CaseExecution caseExecution = rule.CaseService.createCaseExecutionQuery().activityId("PI_HumanTask_1").singleResult();

            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);
        }