use of org.camunda.bpm.engine.migration.MigratingProcessInstanceValidationException in project camunda-bpm-platform by camunda.
the class MigrationUserTaskTest method testCannotMigrateWhenNotAllActivityInstancesAreMapped.
@Test
public void testCannotMigrateWhenNotAllActivityInstancesAreMapped() {
// given
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(ProcessModels.PARALLEL_GATEWAY_PROCESS);
ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(ProcessModels.PARALLEL_GATEWAY_PROCESS);
MigrationPlan migrationPlan = rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("userTask1", "userTask1").build();
// when
try {
testHelper.createProcessInstanceAndMigrate(migrationPlan);
Assert.fail("should not succeed because the userTask2 instance is not mapped");
} catch (MigratingProcessInstanceValidationException e) {
assertThat(e.getValidationReport()).hasActivityInstanceFailures("userTask2", "There is no migration instruction for this instance's activity");
}
}
use of org.camunda.bpm.engine.migration.MigratingProcessInstanceValidationException in project camunda-bpm-platform by camunda.
the class MigrationCompensationTest method testCannotMigrateActiveCompensationWithoutInstructionForThrowingEventCase2.
@Test
public void testCannotMigrateActiveCompensationWithoutInstructionForThrowingEventCase2() {
// given
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(CompensationModels.COMPENSATION_END_EVENT_MODEL);
ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(CompensationModels.COMPENSATION_END_EVENT_MODEL);
ProcessInstance processInstance = rule.getRuntimeService().startProcessInstanceById(sourceProcessDefinition.getId());
testHelper.completeTask("userTask1");
testHelper.completeTask("userTask2");
MigrationPlan migrationPlan = rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("compensationHandler", "compensationHandler").build();
// when
try {
testHelper.migrateProcessInstance(migrationPlan, processInstance);
Assert.fail("should fail");
} catch (MigratingProcessInstanceValidationException e) {
// then
assertThat(e.getValidationReport()).hasProcessInstanceId(testHelper.snapshotBeforeMigration.getProcessInstanceId()).hasActivityInstanceFailures("compensationEvent", "There is no migration instruction for this instance's activity", "The type of the source activity is not supported for activity instance migration");
}
}
use of org.camunda.bpm.engine.migration.MigratingProcessInstanceValidationException in project camunda-bpm-platform by camunda.
the class MigrationCompensationTest method testCannotMigrateWithoutMappingCompensationBoundaryEvents.
@Test
public void testCannotMigrateWithoutMappingCompensationBoundaryEvents() {
// given
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(CompensationModels.ONE_COMPENSATION_TASK_MODEL);
ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(CompensationModels.ONE_COMPENSATION_TASK_MODEL);
ProcessInstance processInstance = rule.getRuntimeService().startProcessInstanceById(sourceProcessDefinition.getId());
testHelper.completeTask("userTask1");
MigrationPlan migrationPlan = rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("userTask2", "userTask2").build();
// when
try {
testHelper.migrateProcessInstance(migrationPlan, processInstance);
Assert.fail("should fail");
} catch (MigratingProcessInstanceValidationException e) {
// then
assertThat(e.getValidationReport()).hasProcessInstanceId(testHelper.snapshotBeforeMigration.getProcessInstanceId()).hasActivityInstanceFailures(sourceProcessDefinition.getId(), "Cannot migrate subscription for compensation handler 'compensationHandler'. " + "There is no migration instruction for the compensation boundary event");
}
}
use of org.camunda.bpm.engine.migration.MigratingProcessInstanceValidationException in project camunda-bpm-platform by camunda.
the class MigrationCompensationTest method testCannotMigrateWithoutCompensationStartEventCase2.
@Test
public void testCannotMigrateWithoutCompensationStartEventCase2() {
// given
BpmnModelInstance model = modify(CompensationModels.COMPENSATION_EVENT_SUBPROCESS_MODEL).removeFlowNode("compensationBoundary");
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(model);
ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(model);
ProcessInstance processInstance = rule.getRuntimeService().startProcessInstanceById(sourceProcessDefinition.getId());
testHelper.completeTask("userTask1");
MigrationPlan migrationPlan = rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("subProcess", "subProcess").mapActivities("userTask2", "userTask2").build();
// when
try {
testHelper.migrateProcessInstance(migrationPlan, processInstance);
Assert.fail("should fail");
} catch (MigratingProcessInstanceValidationException e) {
// then
assertThat(e.getValidationReport()).hasProcessInstanceId(testHelper.snapshotBeforeMigration.getProcessInstanceId()).hasActivityInstanceFailures(sourceProcessDefinition.getId(), "Cannot migrate subscription for compensation handler 'eventSubProcess'. " + "There is no migration instruction for the compensation start event");
}
}
use of org.camunda.bpm.engine.migration.MigratingProcessInstanceValidationException in project camunda-bpm-platform by camunda.
the class MigrationCompensationTest method testCannotMigrateActiveCompensationWithoutInstructionForThrowingEventCase1.
@Test
public void testCannotMigrateActiveCompensationWithoutInstructionForThrowingEventCase1() {
// given
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(CompensationModels.ONE_COMPENSATION_TASK_MODEL);
ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(CompensationModels.ONE_COMPENSATION_TASK_MODEL);
ProcessInstance processInstance = rule.getRuntimeService().startProcessInstanceById(sourceProcessDefinition.getId());
testHelper.completeTask("userTask1");
testHelper.completeTask("userTask2");
MigrationPlan migrationPlan = rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("compensationHandler", "compensationHandler").build();
// when
try {
testHelper.migrateProcessInstance(migrationPlan, processInstance);
Assert.fail("should fail");
} catch (MigratingProcessInstanceValidationException e) {
// then
assertThat(e.getValidationReport()).hasProcessInstanceId(testHelper.snapshotBeforeMigration.getProcessInstanceId()).hasActivityInstanceFailures("compensationEvent", "There is no migration instruction for this instance's activity", "The type of the source activity is not supported for activity instance migration");
}
}
Aggregations