use of org.camunda.bpm.engine.migration.MigrationPlan in project camunda-bpm-platform by camunda.
the class MigrationTransitionInstancesTest method testMigrateAsyncAfterBoundaryEventWithChangedEventScope.
/**
* Does not apply since asyncAfter cannot be used with boundary events
*/
@Ignore
@Test
public void testMigrateAsyncAfterBoundaryEventWithChangedEventScope() {
BpmnModelInstance sourceProcess = modify(ProcessModels.PARALLEL_GATEWAY_PROCESS).activityBuilder("userTask1").boundaryEvent("boundary").message("Message").camundaAsyncAfter().userTask("afterBoundaryTask").endEvent().done();
BpmnModelInstance targetProcess = modify(sourceProcess).swapElementIds("userTask1", "userTask2");
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(sourceProcess);
ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(targetProcess);
MigrationPlan migrationPlan = rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("boundary", "boundary").mapActivities("userTask1", "userTask1").mapActivities("userTask2", "userTask2").build();
ProcessInstance processInstance = rule.getRuntimeService().startProcessInstanceById(sourceProcessDefinition.getId());
// when
testHelper.migrateProcessInstance(migrationPlan, processInstance);
// then
testHelper.assertJobMigrated("boundary", "boundary", AsyncContinuationJobHandler.TYPE);
}
use of org.camunda.bpm.engine.migration.MigrationPlan in project camunda-bpm-platform by camunda.
the class MigrationTransitionInstancesTest method testMigrateAsyncBeforeStartEventTransitionInstanceCase4.
@Test
public void testMigrateAsyncBeforeStartEventTransitionInstanceCase4() {
// given
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(AsyncProcessModels.ASYNC_BEFORE_SUBPROCESS_START_EVENT_PROCESS);
ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(AsyncProcessModels.ASYNC_BEFORE_START_EVENT_PROCESS);
MigrationPlan migrationPlan = rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("subProcessStart", "startEvent").build();
// when
testHelper.createProcessInstanceAndMigrate(migrationPlan);
// then
testHelper.assertJobMigrated("subProcessStart", "startEvent", AsyncContinuationJobHandler.TYPE);
// and it is possible to successfully execute the migrated job
Job job = testHelper.snapshotAfterMigration.getJobs().get(0);
rule.getManagementService().executeJob(job.getId());
// and complete the task and process instance
testHelper.completeTask("userTask");
testHelper.assertProcessEnded(testHelper.snapshotBeforeMigration.getProcessInstanceId());
}
use of org.camunda.bpm.engine.migration.MigrationPlan in project camunda-bpm-platform by camunda.
the class MigrationTransitionInstancesTest method testMigrateAsyncBeforeTransitionInstanceAddParentScope.
@Test
public void testMigrateAsyncBeforeTransitionInstanceAddParentScope() {
// given
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(AsyncProcessModels.ASYNC_BEFORE_USER_TASK_PROCESS);
ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(AsyncProcessModels.ASYNC_BEFORE_SUBPROCESS_USER_TASK_PROCESS);
MigrationPlan migrationPlan = rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("userTask", "userTask").build();
// when
testHelper.createProcessInstanceAndMigrate(migrationPlan);
// then
testHelper.assertExecutionTreeAfterMigration().hasProcessDefinitionId(targetProcessDefinition.getId()).matches(describeExecutionTree(null).scope().id(testHelper.snapshotBeforeMigration.getProcessInstanceId()).child("userTask").scope().done());
testHelper.assertActivityTreeAfterMigration().hasStructure(describeActivityInstanceTree(targetProcessDefinition.getId()).beginScope("subProcess").transition("userTask").done());
testHelper.assertJobMigrated("userTask", "userTask", AsyncContinuationJobHandler.TYPE);
// and it is possible to successfully execute the migrated job
Job job = testHelper.snapshotAfterMigration.getJobs().get(0);
rule.getManagementService().executeJob(job.getId());
// and complete the task and process instance
testHelper.completeTask("userTask");
testHelper.assertProcessEnded(testHelper.snapshotBeforeMigration.getProcessInstanceId());
}
use of org.camunda.bpm.engine.migration.MigrationPlan in project camunda-bpm-platform by camunda.
the class MigrationTransitionInstancesTest method testMigrateAsyncBeforeTransitionInstanceToDifferentProcessKey.
@Test
public void testMigrateAsyncBeforeTransitionInstanceToDifferentProcessKey() {
// given
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(AsyncProcessModels.ASYNC_BEFORE_USER_TASK_PROCESS);
ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(modify(AsyncProcessModels.ASYNC_BEFORE_USER_TASK_PROCESS).changeElementId(ProcessModels.PROCESS_KEY, "new" + ProcessModels.PROCESS_KEY));
MigrationPlan migrationPlan = rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapEqualActivities().build();
// when
testHelper.createProcessInstanceAndMigrate(migrationPlan);
// then
testHelper.assertJobMigrated("userTask", "userTask", AsyncContinuationJobHandler.TYPE);
}
use of org.camunda.bpm.engine.migration.MigrationPlan in project camunda-bpm-platform by camunda.
the class MigrationTransitionInstancesTest method testMigrateAsyncAfterTransitionInstanceAddOutgoingFlowCase2.
@Test
public void testMigrateAsyncAfterTransitionInstanceAddOutgoingFlowCase2() {
// given
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(AsyncProcessModels.ASYNC_AFTER_USER_TASK_PROCESS);
ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(modify(AsyncProcessModels.ASYNC_AFTER_USER_TASK_PROCESS).activityBuilder("userTask1").userTask("userTask3").endEvent().done());
MigrationPlan migrationPlan = rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapEqualActivities().build();
ProcessInstance processInstance = rule.getRuntimeService().startProcessInstanceById(sourceProcessDefinition.getId());
testHelper.completeTask("userTask1");
// when
testHelper.migrateProcessInstance(migrationPlan, processInstance);
// then
testHelper.assertJobMigrated("userTask1", "userTask1", AsyncContinuationJobHandler.TYPE);
// and it is possible to successfully execute the migrated job
Job job = testHelper.snapshotAfterMigration.getJobs().get(0);
rule.getManagementService().executeJob(job.getId());
// and complete the process instance
testHelper.completeTask("userTask2");
testHelper.assertProcessEnded(testHelper.snapshotBeforeMigration.getProcessInstanceId());
}
Aggregations