Search in sources :

Example 36 with MigrationPlanValidationException

use of org.camunda.bpm.engine.migration.MigrationPlanValidationException in project camunda-bpm-platform by camunda.

the class MigrationMultiInstanceTest method testMigrateSequentialMiBodyAddSubprocess.

@Test
public void testMigrateSequentialMiBodyAddSubprocess() {
    // given
    ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(MultiInstanceProcessModels.SEQ_MI_ONE_TASK_PROCESS);
    ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(MultiInstanceProcessModels.SEQ_MI_SUBPROCESS_PROCESS);
    try {
        rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities(miBodyOf("userTask"), miBodyOf("subProcess")).mapActivities("userTask", "userTask").build();
        fail("Should not succeed");
    } catch (MigrationPlanValidationException e) {
        assertThat(e.getValidationReport()).hasInstructionFailures(miBodyOf("userTask"), "Must map the inner activity of a multi-instance body when the body is mapped");
    }
}
Also used : MigrationPlanValidationException(org.camunda.bpm.engine.migration.MigrationPlanValidationException) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) Test(org.junit.Test)

Example 37 with MigrationPlanValidationException

use of org.camunda.bpm.engine.migration.MigrationPlanValidationException in project camunda-bpm-platform by camunda.

the class MigrationPlanCreationTest method testCannotUpdateEventTriggerForNonEvent.

@Test
public void testCannotUpdateEventTriggerForNonEvent() {
    ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS);
    ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS);
    try {
        runtimeService.createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("userTask", "userTask").updateEventTrigger().build();
        fail("Should not succeed");
    } catch (MigrationPlanValidationException e) {
        assertThat(e.getValidationReport()).hasInstructionFailures("userTask", "Cannot update event trigger because the activity does not define a persistent event trigger");
    }
}
Also used : MigrationPlanValidationException(org.camunda.bpm.engine.migration.MigrationPlanValidationException) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) Test(org.junit.Test)

Example 38 with MigrationPlanValidationException

use of org.camunda.bpm.engine.migration.MigrationPlanValidationException in project camunda-bpm-platform by camunda.

the class MigrationPlanCreationTest method testNotMigrateActivitiesOfDifferentType.

@Test
public void testNotMigrateActivitiesOfDifferentType() {
    ProcessDefinition sourceDefinition = testHelper.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS);
    ProcessDefinition targetDefinition = testHelper.deployAndGetDefinition(modify(ProcessModels.SUBPROCESS_PROCESS).swapElementIds("userTask", "subProcess"));
    try {
        runtimeService.createMigrationPlan(sourceDefinition.getId(), targetDefinition.getId()).mapActivities("userTask", "userTask").build();
        fail("Should not succeed");
    } catch (MigrationPlanValidationException e) {
        assertThat(e.getValidationReport()).hasInstructionFailures("userTask", "Activities have incompatible types (UserTaskActivityBehavior is not " + "compatible with SubProcessActivityBehavior)");
    }
}
Also used : MigrationPlanValidationException(org.camunda.bpm.engine.migration.MigrationPlanValidationException) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) Test(org.junit.Test)

Example 39 with MigrationPlanValidationException

use of org.camunda.bpm.engine.migration.MigrationPlanValidationException in project camunda-bpm-platform by camunda.

the class MigrationPlanCreationTest method testMapBoundaryToChildActivity.

@Test
public void testMapBoundaryToChildActivity() {
    BpmnModelInstance sourceProcess = modify(ProcessModels.SUBPROCESS_PROCESS).activityBuilder("subProcess").boundaryEvent("boundary").message(MESSAGE_NAME).done();
    BpmnModelInstance targetProcess = modify(ProcessModels.SUBPROCESS_PROCESS).activityBuilder("userTask").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 (subProcess) must be mapped to the target activity's event scope (userTask)");
    }
}
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 40 with MigrationPlanValidationException

use of org.camunda.bpm.engine.migration.MigrationPlanValidationException in project camunda-bpm-platform by camunda.

the class MigrationPlanCreationTest method testMapBoundaryToParallelActivity.

@Test
public void testMapBoundaryToParallelActivity() {
    BpmnModelInstance sourceProcess = modify(ProcessModels.PARALLEL_GATEWAY_PROCESS).activityBuilder("userTask1").boundaryEvent("boundary").message(MESSAGE_NAME).done();
    BpmnModelInstance targetProcess = modify(ProcessModels.PARALLEL_GATEWAY_PROCESS).activityBuilder("userTask2").boundaryEvent("boundary").message(MESSAGE_NAME).done();
    ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(sourceProcess);
    ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(targetProcess);
    try {
        runtimeService.createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("userTask1", "userTask1").mapActivities("userTask2", "userTask2").mapActivities("boundary", "boundary").build();
        fail("Should not succeed");
    } catch (MigrationPlanValidationException e) {
        assertThat(e.getValidationReport()).hasInstructionFailures("boundary", "The source activity's event scope (userTask1) must be mapped to the target activity's event scope (userTask2)");
    }
}
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)

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