Search in sources :

Example 26 with MigrationPlanValidationException

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

the class MigrationCompensationAddSubProcessTest method testCannotAddScopeOnTopOfEventSubProcess.

@Test
public void testCannotAddScopeOnTopOfEventSubProcess() {
    // given
    ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(CompensationModels.COMPENSATION_EVENT_SUBPROCESS_MODEL);
    ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(modify(CompensationModels.DOUBLE_SUBPROCESS_MODEL).addSubProcessTo("innerSubProcess").id("eventSubProcess").triggerByEvent().embeddedSubProcess().startEvent("eventSubProcessStart").compensateEventDefinition().compensateEventDefinitionDone().endEvent().done());
    try {
        // when
        rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("subProcess", "outerSubProcess").mapActivities("eventSubProcessStart", "eventSubProcessStart").mapActivities("compensationBoundary", "compensationBoundary").mapActivities("userTask2", "userTask2").build();
        Assert.fail("exception expected");
    } catch (MigrationPlanValidationException e) {
        // then
        assertThat(e.getValidationReport()).hasInstructionFailures("eventSubProcessStart", "The source activity's event scope (subProcess) must be mapped to the target activity's event scope (innerSubProcess)");
    }
}
Also used : MigrationPlanValidationException(org.camunda.bpm.engine.migration.MigrationPlanValidationException) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) Test(org.junit.Test)

Example 27 with MigrationPlanValidationException

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

the class MigrationCompensationTest method testCannotMapCompensateStartEventWithoutMappingEventScopeCase1.

@Test
public void testCannotMapCompensateStartEventWithoutMappingEventScopeCase1() {
    // given
    ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(CompensationModels.COMPENSATION_EVENT_SUBPROCESS_MODEL);
    ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(CompensationModels.COMPENSATION_EVENT_SUBPROCESS_MODEL);
    try {
        // when
        rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("eventSubProcessStart", "eventSubProcessStart").build();
        Assert.fail("exception expected");
    } catch (MigrationPlanValidationException e) {
        // then
        assertThat(e.getValidationReport()).hasInstructionFailures("eventSubProcessStart", "The source activity's event scope (subProcess) must be mapped to the target activity's event scope (subProcess)");
    }
}
Also used : MigrationPlanValidationException(org.camunda.bpm.engine.migration.MigrationPlanValidationException) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) Test(org.junit.Test)

Example 28 with MigrationPlanValidationException

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

the class MigrationCompensationTest method testEventScopeHierarchyPreservation.

@Test
public void testEventScopeHierarchyPreservation() {
    // given
    ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(CompensationModels.DOUBLE_SUBPROCESS_MODEL);
    ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(CompensationModels.DOUBLE_SUBPROCESS_MODEL);
    try {
        // when
        rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("outerSubProcess", "innerSubProcess").mapActivities("innerSubProcess", "outerSubProcess").build();
        Assert.fail("exception expected");
    } catch (MigrationPlanValidationException e) {
        // then
        assertThat(e.getValidationReport()).hasInstructionFailures("innerSubProcess", "The closest mapped ancestor 'outerSubProcess' is mapped to scope 'innerSubProcess' " + "which is not an ancestor of target scope 'outerSubProcess'");
    }
}
Also used : MigrationPlanValidationException(org.camunda.bpm.engine.migration.MigrationPlanValidationException) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) Test(org.junit.Test)

Example 29 with MigrationPlanValidationException

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

the class MigrationGatewayTest method testCannotMapMultipleGatewaysToOne.

/**
 * Ensures that situations are avoided in which more tokens end up at the target gateway
 * than it has incoming flows
 */
@Test
public void testCannotMapMultipleGatewaysToOne() {
    // given
    ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(GatewayModels.PARALLEL_GW);
    ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(GatewayModels.PARALLEL_GW);
    try {
        rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("join", "join").mapActivities("fork", "join").build();
        Assert.fail("exception expected");
    } catch (MigrationPlanValidationException e) {
        // then
        assertThat(e.getValidationReport()).hasInstructionFailures("join", "Only one gateway can be mapped to gateway 'join'");
    }
}
Also used : MigrationPlanValidationException(org.camunda.bpm.engine.migration.MigrationPlanValidationException) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) Test(org.junit.Test)

Example 30 with MigrationPlanValidationException

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

the class MigrationGatewayTest method testCannotRemoveGatewayIncomingSequenceFlow.

/**
 * Ensures that situations are avoided in which more tokens end up at the target gateway
 * than it has incoming flows
 */
@Test
public void testCannotRemoveGatewayIncomingSequenceFlow() {
    // given
    ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(GatewayModels.PARALLEL_GW);
    ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(modify(GatewayModels.PARALLEL_GW).removeFlowNode("parallel2"));
    try {
        rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("join", "join").build();
        Assert.fail("exception expected");
    } catch (MigrationPlanValidationException e) {
        // then
        assertThat(e.getValidationReport()).hasInstructionFailures("join", "The target gateway must have at least the same number of incoming sequence flows that the source gateway has");
    }
}
Also used : MigrationPlanValidationException(org.camunda.bpm.engine.migration.MigrationPlanValidationException) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) 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