use of org.camunda.bpm.engine.migration.MigrationPlan in project camunda-bpm-platform by camunda.
the class MigrationBoundaryEventsParameterizedTest method testMigrateBoundaryEventToParallelSubProcessAndTriggerEvent.
@Test
public void testMigrateBoundaryEventToParallelSubProcessAndTriggerEvent() {
// given
BpmnModelInstance sourceProcess = ProcessModels.PARALLEL_SUBPROCESS_PROCESS.clone();
MigratingBpmnEventTrigger eventTrigger = eventFactory.addBoundaryEvent(rule.getProcessEngine(), sourceProcess, "subProcess1", 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.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("subProcess1", "subProcess1").mapActivities(USER_TASK_1_ID, USER_TASK_1_ID).mapActivities("subProcess2", "subProcess2").mapActivities(USER_TASK_2_ID, USER_TASK_2_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.getId());
testHelper.completeTask(AFTER_BOUNDARY_TASK);
testHelper.completeTask(USER_TASK_2_ID);
testHelper.assertProcessEnded(testHelper.snapshotBeforeMigration.getProcessInstanceId());
}
use of org.camunda.bpm.engine.migration.MigrationPlan in project camunda-bpm-platform by camunda.
the class MigrationBoundaryEventsParameterizedTest method testMigrateBoundaryEventToSubProcessWithScopeUserTask.
@Test
public void testMigrateBoundaryEventToSubProcessWithScopeUserTask() {
// given
BpmnModelInstance sourceProcess = ProcessModels.SCOPE_TASK_SUBPROCESS_PROCESS.clone();
MigratingBpmnEventTrigger eventTrigger = eventFactory.addBoundaryEvent(rule.getProcessEngine(), 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.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities(SUB_PROCESS_ID, SUB_PROCESS_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.getProcessInstanceId());
}
use of org.camunda.bpm.engine.migration.MigrationPlan in project camunda-bpm-platform by camunda.
the class MigrationBoundaryEventsParameterizedTest method testMigrateBoundaryEventToParallelSubProcess.
@Test
public void testMigrateBoundaryEventToParallelSubProcess() {
// given
BpmnModelInstance sourceProcess = ProcessModels.PARALLEL_SUBPROCESS_PROCESS.clone();
MigratingBpmnEventTrigger eventTrigger = eventFactory.addBoundaryEvent(rule.getProcessEngine(), sourceProcess, "subProcess1", 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.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("subProcess1", "subProcess1").mapActivities(USER_TASK_1_ID, USER_TASK_1_ID).mapActivities("subProcess2", "subProcess2").mapActivities(USER_TASK_2_ID, USER_TASK_2_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_1_ID);
testHelper.completeTask(USER_TASK_2_ID);
testHelper.assertProcessEnded(testHelper.snapshotBeforeMigration.getProcessInstanceId());
}
use of org.camunda.bpm.engine.migration.MigrationPlan in project camunda-bpm-platform by camunda.
the class MigrationCallActivityTest method testCallBpmnProcessSimpleMigration.
@Test
public void testCallBpmnProcessSimpleMigration() {
// given
BpmnModelInstance model = CallActivityModels.oneBpmnCallActivityProcess("oneTaskProcess");
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(model);
ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(model);
MigrationPlan migrationPlan = rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("callActivity", "callActivity").build();
// when
ProcessInstance processInstance = testHelper.createProcessInstanceAndMigrate(migrationPlan);
// then
testHelper.assertExecutionTreeAfterMigration().hasProcessDefinitionId(targetProcessDefinition.getId()).matches(describeExecutionTree(null).scope().id(testHelper.snapshotBeforeMigration.getProcessInstanceId()).child("callActivity").scope().id(testHelper.getSingleExecutionIdForActivityBeforeMigration("callActivity")).done());
testHelper.assertActivityTreeAfterMigration().hasStructure(describeActivityInstanceTree(targetProcessDefinition.getId()).activity("callActivity", testHelper.getSingleActivityInstanceBeforeMigration("callActivity").getId()).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.getId());
}
use of org.camunda.bpm.engine.migration.MigrationPlan in project camunda-bpm-platform by camunda.
the class MigrationCallActivityTest method testCallBpmnProcessAddParentScope.
@Test
public void testCallBpmnProcessAddParentScope() {
// given
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(CallActivityModels.oneBpmnCallActivityProcess("oneTaskProcess"));
ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(CallActivityModels.subProcessBpmnCallActivityProcess("oneTaskProcess"));
MigrationPlan migrationPlan = rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("callActivity", "callActivity").build();
// when
ProcessInstance processInstance = testHelper.createProcessInstanceAndMigrate(migrationPlan);
// then
testHelper.assertExecutionTreeAfterMigration().hasProcessDefinitionId(targetProcessDefinition.getId()).matches(describeExecutionTree(null).scope().id(testHelper.snapshotBeforeMigration.getProcessInstanceId()).child(null).scope().child("callActivity").scope().id(testHelper.getSingleExecutionIdForActivityBeforeMigration("callActivity")).done());
testHelper.assertActivityTreeAfterMigration().hasStructure(describeActivityInstanceTree(targetProcessDefinition.getId()).beginScope("subProcess").activity("callActivity", testHelper.getSingleActivityInstanceBeforeMigration("callActivity").getId()).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.getId());
}
Aggregations