use of org.camunda.bpm.engine.migration.MigratingProcessInstanceValidationException in project camunda-bpm-platform by camunda.
the class MigrationCompensationTest method testCannotMigrateActivityInstanceForCompensationThrowingEvent.
@Test
public void testCannotMigrateActivityInstanceForCompensationThrowingEvent() {
// 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("compensationEvent", "compensationEvent").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", "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 MigrationSignallableServiceTaskTest method testCannotMigrateAsyncActivityInstance.
@Test
public void testCannotMigrateAsyncActivityInstance() {
// given
BpmnModelInstance model = ProcessModels.newModel().startEvent().serviceTask("serviceTask").camundaAsyncBefore().camundaClass(SignallableServiceTaskDelegate.class.getName()).endEvent().done();
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(model);
ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(model);
MigrationPlan migrationPlan = rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("serviceTask", "serviceTask").build();
String processInstanceId = rule.getRuntimeService().startProcessInstanceById(sourceProcessDefinition.getId()).getId();
testHelper.executeAvailableJobs();
// when
try {
rule.getRuntimeService().newMigration(migrationPlan).processInstanceIds(processInstanceId).execute();
Assert.fail("should fail");
} catch (MigratingProcessInstanceValidationException e) {
// then
assertThat(e.getValidationReport()).hasActivityInstanceFailures("serviceTask", "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 MigrationTransitionInstancesTest method testMigrateAsyncBeforeStartEventTransitionInstanceCase2.
@Test
public void testMigrateAsyncBeforeStartEventTransitionInstanceCase2() {
// given
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(AsyncProcessModels.ASYNC_BEFORE_START_EVENT_PROCESS);
ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(AsyncProcessModels.ASYNC_BEFORE_SUBPROCESS_START_EVENT_PROCESS);
MigrationPlan migrationPlan = rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("startEvent", "subProcessStart").build();
// when
try {
testHelper.createProcessInstanceAndMigrate(migrationPlan);
Assert.fail("should fail");
} catch (MigratingProcessInstanceValidationException e) {
assertThat(e.getValidationReport()).hasTransitionInstanceFailures("startEvent", "A transition instance that instantiates the process can only be migrated to a process-level flow node");
}
}
use of org.camunda.bpm.engine.migration.MigratingProcessInstanceValidationException in project camunda-bpm-platform by camunda.
the class MigrationTransitionInstancesTest method testCannotMigrateUnmappedTransitionInstance.
@Test
public void testCannotMigrateUnmappedTransitionInstance() {
// given
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(AsyncProcessModels.ASYNC_BEFORE_USER_TASK_PROCESS);
ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(AsyncProcessModels.ASYNC_BEFORE_USER_TASK_PROCESS);
MigrationPlan migrationPlan = rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).build();
// when
try {
testHelper.createProcessInstanceAndMigrate(migrationPlan);
Assert.fail("should fail");
} catch (MigratingProcessInstanceValidationException e) {
// then
assertThat(e.getValidationReport()).hasTransitionInstanceFailures("userTask", "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 MigrationTransitionInstancesTest method testCannotMigrateUnmappedTransitionInstanceAtNonLeafActivity.
@Test
public void testCannotMigrateUnmappedTransitionInstanceAtNonLeafActivity() {
// given
BpmnModelInstance model = modify(ProcessModels.SUBPROCESS_PROCESS).activityBuilder("subProcess").camundaAsyncBefore(true).done();
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(model);
ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(model);
MigrationPlan migrationPlan = rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).build();
// when
try {
testHelper.createProcessInstanceAndMigrate(migrationPlan);
Assert.fail("should fail");
} catch (MigratingProcessInstanceValidationException e) {
// then
assertThat(e.getValidationReport()).hasTransitionInstanceFailures("subProcess", "There is no migration instruction for this instance's activity");
}
}
Aggregations