Esempio n. 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testMigrateEventSubprocessSignalTrigger()
        public virtual void testMigrateEventSubprocessSignalTrigger()
        {
            BpmnModelInstance         processModel = ProcessModels.ONE_TASK_PROCESS.clone();
            MigratingBpmnEventTrigger eventTrigger = eventFactory.addEventSubProcess(rule.ProcessEngine, processModel, ProcessModels.PROCESS_KEY, "eventSubProcess", "eventSubProcessStart");

            ModifiableBpmnModelInstance.wrap(processModel).startEventBuilder("eventSubProcessStart").userTask("eventSubProcessTask").endEvent().done();

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

            ProcessInstance processInstance = rule.RuntimeService.startProcessInstanceById(sourceProcessDefinition.Id);

            MigrationPlan 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.assertEquals(1, rule.TaskService.createTaskQuery().count());

            // and complete the process instance
            testHelper.completeTask("eventSubProcessTask");
            testHelper.assertProcessEnded(processInstance.Id);
        }
Esempio n. 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testMigrateActiveCompensationEventSubProcess()
        public virtual void testMigrateActiveCompensationEventSubProcess()
        {
            // given
            BpmnModelInstance         processModel = ProcessModels.ONE_TASK_PROCESS.clone();
            MigratingBpmnEventTrigger eventTrigger = eventFactory.addEventSubProcess(rule.ProcessEngine, processModel, ProcessModels.PROCESS_KEY, "eventSubProcess", "eventSubProcessStart");

            ModifiableBpmnModelInstance.wrap(processModel).startEventBuilder("eventSubProcessStart").userTask("eventSubProcessTask").endEvent().done();

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

            ProcessInstance processInstance = rule.RuntimeService.createProcessInstanceById(sourceProcessDefinition.Id).startBeforeActivity("eventSubProcessStart").executeWithVariablesInReturn();

            MigrationPlan 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);
        }
Esempio n. 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testCannotMigrateWhenNotAllTransitionInstancesAreMapped()
        public virtual void testCannotMigrateWhenNotAllTransitionInstancesAreMapped()
        {
            // given
            BpmnModelInstance model = ModifiableBpmnModelInstance.modify(ProcessModels.PARALLEL_GATEWAY_PROCESS).activityBuilder("userTask1").camundaAsyncBefore().moveToActivity("userTask2").camundaAsyncBefore().done();

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

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


            // when
            try
            {
                testHelper.createProcessInstanceAndMigrate(migrationPlan);
                Assert.fail("should not succeed because the userTask2 instance is not mapped");
            }
            catch (MigratingProcessInstanceValidationException e)
            {
                assertThat(e.ValidationReport).hasTransitionInstanceFailures("userTask2", "There is no migration instruction for this instance's activity");
            }
        }
Esempio n. 4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testMigrateBoundaryEventToSubProcessWithScopeUserTaskAndTriggerEvent()
        public virtual void testMigrateBoundaryEventToSubProcessWithScopeUserTaskAndTriggerEvent()
        {
            // given
            BpmnModelInstance         sourceProcess = ProcessModels.SCOPE_TASK_SUBPROCESS_PROCESS.clone();
            MigratingBpmnEventTrigger eventTrigger  = eventFactory.addBoundaryEvent(rule.ProcessEngine, sourceProcess, SUB_PROCESS_ID, BOUNDARY_ID);

            ModifiableBpmnModelInstance.wrap(sourceProcess).flowNodeBuilder(BOUNDARY_ID).userTask(AFTER_BOUNDARY_TASK).endEvent().done();

            BpmnModelInstance targetProcess = modify(sourceProcess).changeElementId(BOUNDARY_ID, NEW_BOUNDARY_ID);

            ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(sourceProcess);
            ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(targetProcess);

            MigrationPlan migrationPlan = rule.RuntimeService.createMigrationPlan(sourceProcessDefinition.Id, targetProcessDefinition.Id).mapActivities(SUB_PROCESS_ID, SUB_PROCESS_ID).mapActivities(USER_TASK_ID, USER_TASK_ID).mapActivities(BOUNDARY_ID, NEW_BOUNDARY_ID).updateEventTrigger().build();

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

            // then it is possible to trigger the event and successfully complete the migrated instance
            eventTrigger.inContextOf(NEW_BOUNDARY_ID).trigger(processInstance.Id);
            testHelper.completeTask(AFTER_BOUNDARY_TASK);
            testHelper.assertProcessEnded(testHelper.snapshotBeforeMigration.ProcessInstanceId);
        }