Search in sources :

Example 16 with MigrationPlanValidationException

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'");
    }
}
Also used : MigrationPlanValidationException(org.camunda.bpm.engine.migration.MigrationPlanValidationException) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) Test(org.junit.Test)

Example 17 with MigrationPlanValidationException

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'");
    }
}
Also used : MigrationPlanValidationException(org.camunda.bpm.engine.migration.MigrationPlanValidationException) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) Test(org.junit.Test)

Example 18 with MigrationPlanValidationException

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.");
    }
}
Also used : UserTaskBuilder(org.camunda.bpm.model.bpmn.builder.UserTaskBuilder) MigrationPlanValidationException(org.camunda.bpm.engine.migration.MigrationPlanValidationException) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance) Test(org.junit.Test)

Example 19 with MigrationPlanValidationException

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'");
    }
}
Also used : MigrationPlanValidationException(org.camunda.bpm.engine.migration.MigrationPlanValidationException) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance) Test(org.junit.Test)

Example 20 with MigrationPlanValidationException

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");
    }
}
Also used : MigrationPlanValidationException(org.camunda.bpm.engine.migration.MigrationPlanValidationException) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) Test(org.junit.Test)

Aggregations

MigrationPlanValidationException (org.camunda.bpm.engine.migration.MigrationPlanValidationException)46 Test (org.junit.Test)46 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)39 MigrationInstructionValidationReport (org.camunda.bpm.engine.migration.MigrationInstructionValidationReport)7 MigrationPlanValidationReport (org.camunda.bpm.engine.migration.MigrationPlanValidationReport)7 Matchers.anyString (org.mockito.Matchers.anyString)7 MigrationExecutionDtoBuilder (org.camunda.bpm.engine.rest.util.migration.MigrationExecutionDtoBuilder)6 BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)5 MigrationInstruction (org.camunda.bpm.engine.migration.MigrationInstruction)3 HashMap (java.util.HashMap)2 Map (java.util.Map)2 MigrationPlanDtoBuilder (org.camunda.bpm.engine.rest.util.migration.MigrationPlanDtoBuilder)1 UserTaskBuilder (org.camunda.bpm.model.bpmn.builder.UserTaskBuilder)1