use of org.camunda.bpm.engine.migration.MigrationPlanValidationException in project camunda-bpm-platform by camunda.
the class MigrationFlipScopesTest method testCannotFlipAncestorScopes.
@Test
public void testCannotFlipAncestorScopes() {
// given
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(ProcessModels.DOUBLE_SUBPROCESS_PROCESS);
ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(ProcessModels.DOUBLE_SUBPROCESS_PROCESS);
// when
try {
rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("outerSubProcess", "innerSubProcess").mapActivities("innerSubProcess", "outerSubProcess").mapActivities("userTask", "userTask").build();
Assert.fail("should not validate");
} catch (MigrationPlanValidationException e) {
MigrationPlanValidationReportAssert.assertThat(e.getValidationReport()).hasInstructionFailures("innerSubProcess", "The closest mapped ancestor 'outerSubProcess' is mapped to scope 'innerSubProcess' which is not an ancestor of target scope 'outerSubProcess'");
}
}
use of org.camunda.bpm.engine.migration.MigrationPlanValidationException in project camunda-bpm-platform by camunda.
the class MigrationHorizontalScopeChangeTest method testCannotMigrateHorizontallyBetweenScopes.
@Test
public void testCannotMigrateHorizontallyBetweenScopes() {
// given
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(ProcessModels.PARALLEL_SUBPROCESS_PROCESS);
ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(ProcessModels.PARALLEL_SUBPROCESS_PROCESS);
// when
try {
rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("subProcess1", "subProcess1").mapActivities("subProcess2", "subProcess2").mapActivities("userTask1", "userTask2").mapActivities("userTask2", "userTask1").build();
Assert.fail("should fail");
} catch (MigrationPlanValidationException e) {
MigrationPlanValidationReportAssert.assertThat(e.getValidationReport()).hasInstructionFailures("userTask1", "The closest mapped ancestor 'subProcess1' is mapped to scope 'subProcess1' which is not an ancestor of target scope 'userTask2'").hasInstructionFailures("userTask2", "The closest mapped ancestor 'subProcess2' is mapped to scope 'subProcess2' which is not an ancestor of target scope 'userTask1'");
}
}
use of org.camunda.bpm.engine.migration.MigrationPlanValidationException in project camunda-bpm-platform by camunda.
the class MigrationPlanCreationTest method testMapEqualActivitiesWithParallelMultiInstance.
@Test
public void testMapEqualActivitiesWithParallelMultiInstance() {
// given
BpmnModelInstance testProcess = modify(ProcessModels.ONE_TASK_PROCESS).getBuilderForElementById("userTask", UserTaskBuilder.class).multiInstance().parallel().cardinality("3").multiInstanceDone().done();
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(testProcess);
ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(testProcess);
// when
try {
runtimeService.createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("userTask", "userTask").build();
fail("Should not succeed");
} catch (MigrationPlanValidationException e) {
assertThat(e.getValidationReport()).hasInstructionFailures("userTask", "Target activity 'userTask' is a descendant of multi-instance body 'userTask#multiInstanceBody' " + "that is not mapped from the source process definition.");
}
}
use of org.camunda.bpm.engine.migration.MigrationPlanValidationException in project camunda-bpm-platform by camunda.
the class MigrationPlanCreationTest method testMapBoundaryToParentActivity.
@Test
public void testMapBoundaryToParentActivity() {
BpmnModelInstance sourceProcess = modify(ProcessModels.SUBPROCESS_PROCESS).activityBuilder("userTask").boundaryEvent("boundary").message(MESSAGE_NAME).done();
BpmnModelInstance targetProcess = modify(ProcessModels.SUBPROCESS_PROCESS).activityBuilder("subProcess").boundaryEvent("boundary").message(MESSAGE_NAME).done();
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(sourceProcess);
ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(targetProcess);
try {
runtimeService.createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("subProcess", "subProcess").mapActivities("userTask", "userTask").mapActivities("boundary", "boundary").build();
fail("Should not succeed");
} catch (MigrationPlanValidationException e) {
assertThat(e.getValidationReport()).hasInstructionFailures("boundary", "The source activity's event scope (userTask) must be mapped to the target activity's event scope (subProcess)", "The closest mapped ancestor 'subProcess' is mapped to scope 'subProcess' which is not an ancestor of target scope 'boundary'");
}
}
use of org.camunda.bpm.engine.migration.MigrationPlanValidationException in project camunda-bpm-platform by camunda.
the class MigrationPlanCreationTest method testMigrateSubProcessToProcessDefinition.
@Test
public void testMigrateSubProcessToProcessDefinition() {
ProcessDefinition sourceDefinition = testHelper.deployAndGetDefinition(ProcessModels.SUBPROCESS_PROCESS);
ProcessDefinition targetDefinition = testHelper.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS);
try {
runtimeService.createMigrationPlan(sourceDefinition.getId(), targetDefinition.getId()).mapActivities("subProcess", targetDefinition.getId()).build();
fail("Should not succeed");
} catch (MigrationPlanValidationException e) {
assertThat(e.getValidationReport()).hasInstructionFailures("subProcess", "Target activity '" + targetDefinition.getId() + "' does not exist");
}
}
Aggregations