Search in sources :

Example 11 with MigratingProcessInstanceValidationException

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

Example 12 with MigratingProcessInstanceValidationException

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

Example 13 with MigratingProcessInstanceValidationException

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

Example 14 with MigratingProcessInstanceValidationException

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

Example 15 with MigratingProcessInstanceValidationException

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

Aggregations

MigratingProcessInstanceValidationException (org.camunda.bpm.engine.migration.MigratingProcessInstanceValidationException)22 Test (org.junit.Test)22 MigrationPlan (org.camunda.bpm.engine.migration.MigrationPlan)21 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)21 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)12 BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)6 ExternalTask (org.camunda.bpm.engine.externaltask.ExternalTask)1 LockedExternalTask (org.camunda.bpm.engine.externaltask.LockedExternalTask)1 MigratingActivityInstanceValidationReport (org.camunda.bpm.engine.migration.MigratingActivityInstanceValidationReport)1 MigratingProcessInstanceValidationReport (org.camunda.bpm.engine.migration.MigratingProcessInstanceValidationReport)1 MigratingTransitionInstanceValidationReport (org.camunda.bpm.engine.migration.MigratingTransitionInstanceValidationReport)1 MigrationInstruction (org.camunda.bpm.engine.migration.MigrationInstruction)1 MigrationPlanValidationException (org.camunda.bpm.engine.migration.MigrationPlanValidationException)1 MigrationExecutionDtoBuilder (org.camunda.bpm.engine.rest.util.migration.MigrationExecutionDtoBuilder)1 Incident (org.camunda.bpm.engine.runtime.Incident)1 Job (org.camunda.bpm.engine.runtime.Job)1 AlwaysFailingDelegate (org.camunda.bpm.engine.test.api.mgmt.AlwaysFailingDelegate)1 Matchers.anyString (org.mockito.Matchers.anyString)1