use of org.camunda.bpm.engine.migration.MigrationPlanValidationException in project camunda-bpm-platform by camunda.
the class MigrationPlanCreationTest method testMigrateNonExistingSourceActivityId.
@Test
public void testMigrateNonExistingSourceActivityId() {
ProcessDefinition sourceDefinition = testHelper.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS);
ProcessDefinition targetDefinition = testHelper.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS);
try {
runtimeService.createMigrationPlan(sourceDefinition.getId(), targetDefinition.getId()).mapActivities("thisActivityDoesNotExist", "userTask").build();
fail("Should not succeed");
} catch (MigrationPlanValidationException e) {
assertThat(e.getValidationReport()).hasInstructionFailures("thisActivityDoesNotExist", "Source activity 'thisActivityDoesNotExist' does not exist");
}
}
use of org.camunda.bpm.engine.migration.MigrationPlanValidationException in project camunda-bpm-platform by camunda.
the class MigrationPlanCreationTest method testNotMigrateBoundaryEventsOfDifferentType.
@Test
public void testNotMigrateBoundaryEventsOfDifferentType() {
ProcessDefinition sourceDefinition = testHelper.deployAndGetDefinition(modify(ProcessModels.ONE_TASK_PROCESS).activityBuilder("userTask").boundaryEvent("boundary").message(MESSAGE_NAME).done());
ProcessDefinition targetDefinition = testHelper.deployAndGetDefinition(modify(ProcessModels.ONE_TASK_PROCESS).activityBuilder("userTask").boundaryEvent("boundary").signal(SIGNAL_NAME).done());
try {
runtimeService.createMigrationPlan(sourceDefinition.getId(), targetDefinition.getId()).mapActivities("userTask", "userTask").mapActivities("boundary", "boundary").build();
fail("Should not succeed");
} catch (MigrationPlanValidationException e) {
assertThat(e.getValidationReport()).hasInstructionFailures("boundary", "Events are not of the same type (boundaryMessage != boundarySignal)");
}
}
use of org.camunda.bpm.engine.migration.MigrationPlanValidationException in project camunda-bpm-platform by camunda.
the class MigrationPlanCreationTest method testMigrateNonExistingTargetActivityId.
@Test
public void testMigrateNonExistingTargetActivityId() {
ProcessDefinition sourceDefinition = testHelper.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS);
ProcessDefinition targetDefinition = testHelper.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS);
try {
runtimeService.createMigrationPlan(sourceDefinition.getId(), targetDefinition.getId()).mapActivities("userTask", "thisActivityDoesNotExist").build();
fail("Should not succeed");
} catch (MigrationPlanValidationException e) {
assertThat(e.getValidationReport()).hasInstructionFailures("userTask", "Target activity 'thisActivityDoesNotExist' does not exist");
}
}
use of org.camunda.bpm.engine.migration.MigrationPlanValidationException in project camunda-bpm-platform by camunda.
the class MigrationRestServiceInteractionTest method executeMigrationPlanWithNullInstructions.
@Test
public void executeMigrationPlanWithNullInstructions() {
MigrationInstructionValidationReport instructionReport = mock(MigrationInstructionValidationReport.class);
when(instructionReport.getMigrationInstruction()).thenReturn(null);
when(instructionReport.getFailures()).thenReturn(Collections.singletonList("failure"));
MigrationPlanValidationReport validationReport = mock(MigrationPlanValidationReport.class);
when(validationReport.getInstructionReports()).thenReturn(Collections.singletonList(instructionReport));
when(migrationPlanBuilderMock.build()).thenThrow(new MigrationPlanValidationException("fooo", validationReport));
Map<String, Object> migrationExecution = new MigrationExecutionDtoBuilder().migrationPlan(EXAMPLE_PROCESS_DEFINITION_ID, ANOTHER_EXAMPLE_PROCESS_DEFINITION_ID).done().processInstances(EXAMPLE_PROCESS_INSTANCE_ID, ANOTHER_EXAMPLE_PROCESS_INSTANCE_ID).build();
given().contentType(POST_JSON_CONTENT_TYPE).body(migrationExecution).then().expect().statusCode(Status.BAD_REQUEST.getStatusCode()).body("type", equalTo(MigrationPlanValidationException.class.getSimpleName())).body("message", is("fooo")).body("validationReport.instructionReports", hasSize(1)).body("validationReport.instructionReports[0].instruction", nullValue()).body("validationReport.instructionReports[0].failures", hasSize(1)).body("validationReport.instructionReports[0].failures[0]", is("failure")).when().post(EXECUTE_MIGRATION_URL);
}
use of org.camunda.bpm.engine.migration.MigrationPlanValidationException in project camunda-bpm-platform by camunda.
the class MigrationRestServiceInteractionTest method executeMigrationPlanAsyncWithNullInstructions.
@Test
public void executeMigrationPlanAsyncWithNullInstructions() {
MigrationInstructionValidationReport instructionReport = mock(MigrationInstructionValidationReport.class);
when(instructionReport.getMigrationInstruction()).thenReturn(null);
when(instructionReport.getFailures()).thenReturn(Collections.singletonList("failure"));
MigrationPlanValidationReport validationReport = mock(MigrationPlanValidationReport.class);
when(validationReport.getInstructionReports()).thenReturn(Collections.singletonList(instructionReport));
when(migrationPlanBuilderMock.build()).thenThrow(new MigrationPlanValidationException("fooo", validationReport));
Map<String, Object> migrationExecution = new MigrationExecutionDtoBuilder().migrationPlan(EXAMPLE_PROCESS_DEFINITION_ID, ANOTHER_EXAMPLE_PROCESS_DEFINITION_ID).done().processInstances(EXAMPLE_PROCESS_INSTANCE_ID, ANOTHER_EXAMPLE_PROCESS_INSTANCE_ID).build();
given().contentType(POST_JSON_CONTENT_TYPE).body(migrationExecution).then().expect().statusCode(Status.BAD_REQUEST.getStatusCode()).body("type", equalTo(MigrationPlanValidationException.class.getSimpleName())).body("message", is("fooo")).body("validationReport.instructionReports", hasSize(1)).body("validationReport.instructionReports[0].instruction", nullValue()).body("validationReport.instructionReports[0].failures", hasSize(1)).body("validationReport.instructionReports[0].failures[0]", is("failure")).when().post(EXECUTE_MIGRATION_ASYNC_URL);
}
Aggregations