protected Map<String, List<MigrationInstruction>> organizeInstructionsBySourceScope(MigrationPlan migrationPlan) { Map<String, List<MigrationInstruction>> organizedInstructions = new HashMap<String, List<MigrationInstruction>>(); for (MigrationInstruction instruction : migrationPlan.getInstructions()) { CollectionUtil.addToMapOfLists(organizedInstructions, instruction.getSourceActivityId(), instruction); } return organizedInstructions; }
protected Map<String, List<MigrationInstruction>> organizeInstructionsBySourceScope(MigrationPlan migrationPlan) { Map<String, List<MigrationInstruction>> organizedInstructions = new HashMap<String, List<MigrationInstruction>>(); for (MigrationInstruction instruction : migrationPlan.getInstructions()) { CollectionUtil.addToMapOfLists(organizedInstructions, instruction.getSourceActivityId(), instruction); } return organizedInstructions; }
public static MigrationPlanDto from(MigrationPlan migrationPlan) { MigrationPlanDto dto = new MigrationPlanDto(); dto.setSourceProcessDefinitionId(migrationPlan.getSourceProcessDefinitionId()); dto.setTargetProcessDefinitionId(migrationPlan.getTargetProcessDefinitionId()); ArrayList<MigrationInstructionDto> instructionDtos = new ArrayList<MigrationInstructionDto>(); if (migrationPlan.getInstructions() != null) { for (MigrationInstruction migrationInstruction : migrationPlan.getInstructions()) { MigrationInstructionDto migrationInstructionDto = MigrationInstructionDto.from(migrationInstruction); instructionDtos.add(migrationInstructionDto); } } dto.setInstructions(instructionDtos); return dto; }
public static MigrationPlanDto from(MigrationPlan migrationPlan) { MigrationPlanDto dto = new MigrationPlanDto(); dto.setSourceProcessDefinitionId(migrationPlan.getSourceProcessDefinitionId()); dto.setTargetProcessDefinitionId(migrationPlan.getTargetProcessDefinitionId()); ArrayList<MigrationInstructionDto> instructionDtos = new ArrayList<MigrationInstructionDto>(); if (migrationPlan.getInstructions() != null) { for (MigrationInstruction migrationInstruction : migrationPlan.getInstructions()) { MigrationInstructionDto migrationInstructionDto = MigrationInstructionDto.from(migrationInstruction); instructionDtos.add(migrationInstructionDto); } } dto.setInstructions(instructionDtos); return dto; }
public MigrationPlan build() { MigrationPlan migrationPlanMock = mock(MigrationPlan.class); when(migrationPlanMock.getSourceProcessDefinitionId()).thenReturn(sourceProcessDefinitionId); when(migrationPlanMock.getTargetProcessDefinitionId()).thenReturn(targetProcessDefinitionId); when(migrationPlanMock.getInstructions()).thenReturn(instructions); return migrationPlanMock; }
public MigrationPlanAssert hasEmptyInstructions() { isNotNull(); List<MigrationInstruction> instructions = actual.getInstructions(); assertTrue("Expected migration plan has no instructions but has: " + instructions, instructions.isEmpty()); return this; }
public MigrationPlanAssert hasInstructions(MigrationInstructionAssert... instructionAsserts) { isNotNull(); List<MigrationInstruction> notExpected = new ArrayList<MigrationInstruction>(actual.getInstructions()); List<MigrationInstructionAssert> notFound = new ArrayList<MigrationInstructionAssert>(); Collections.addAll(notFound, instructionAsserts); for (MigrationInstruction instruction : actual.getInstructions()) { if (instructionAssert.sourceActivityId.equals(instruction.getSourceActivityId())) { notFound.remove(instructionAssert); builder.append("\nActual migration instructions:\n\t").append(actual.getInstructions()).append("\n"); if (!notExpected.isEmpty()) { builder.append("Unexpected migration instructions:\n\t").append(notExpected).append("\n");
public JsonObject toJsonObject(MigrationPlan migrationPlan) { JsonObject json = JsonUtil.createObject(); JsonUtil.addField(json, SOURCE_PROCESS_DEFINITION_ID, migrationPlan.getSourceProcessDefinitionId()); JsonUtil.addField(json, TARGET_PROCESS_DEFINITION_ID, migrationPlan.getTargetProcessDefinitionId()); JsonUtil.addListField(json, INSTRUCTIONS, MigrationInstructionJsonConverter.INSTANCE, migrationPlan.getInstructions()); return json; }
public JsonObject toJsonObject(MigrationPlan migrationPlan) { JsonObject json = JsonUtil.createObject(); JsonUtil.addField(json, SOURCE_PROCESS_DEFINITION_ID, migrationPlan.getSourceProcessDefinitionId()); JsonUtil.addField(json, TARGET_PROCESS_DEFINITION_ID, migrationPlan.getTargetProcessDefinitionId()); JsonUtil.addListField(json, INSTRUCTIONS, MigrationInstructionJsonConverter.INSTANCE, migrationPlan.getInstructions()); return json; }
@Test @Deployment(resources = {"org/camunda/bpm/engine/test/api/externaltask/ExternalTaskWithoutIdTest.bpmn"}) public void testProcessDefinitionWithIdField() { // given ProcessDefinition sourceProcessDefinition = testHelper.deploy("org/camunda/bpm/engine/test/api/externaltask/ExternalTaskWithIdTest.bpmn").getDeployedProcessDefinitions().get(0); ProcessDefinition targetProcessDefinition = testHelper.deploy("org/camunda/bpm/engine/test/api/externaltask/ExternalTaskWithIdTest.bpmn").getDeployedProcessDefinitions().get(0); //external task is not mapped to new external task MigrationPlan migrationPlan = rule.getRuntimeService() .createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()) .mapEqualActivities() .build(); List<MigrationInstruction> instructions = migrationPlan.getInstructions(); assertEquals(2, instructions.size()); }
@Test @Deployment(resources = {"org/camunda/bpm/engine/test/api/externaltask/ExternalTaskWithoutIdTest.bpmn"}) public void testProcessDefinitionWithoutIdField() { // given ProcessDefinition sourceProcessDefinition = testHelper.deploy("org/camunda/bpm/engine/test/api/externaltask/ExternalTaskWithoutIdTest.bpmn").getDeployedProcessDefinitions().get(0); ProcessDefinition targetProcessDefinition = testHelper.deploy("org/camunda/bpm/engine/test/api/externaltask/ExternalTaskWithoutIdTest.bpmn").getDeployedProcessDefinitions().get(0); //external task is not mapped to new external task MigrationPlan migrationPlan = rule.getRuntimeService() .createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()) .mapEqualActivities() .build(); List<MigrationInstruction> instructions = migrationPlan.getInstructions(); // test that the messageEventDefinition without an id isn't included assertEquals(2, instructions.size()); }
protected ValidatingMigrationInstructions wrapMigrationInstructions(MigrationPlan migrationPlan, ProcessDefinitionImpl sourceProcessDefinition, ProcessDefinitionImpl targetProcessDefinition, MigrationPlanValidationReportImpl planReport) { ValidatingMigrationInstructions validatingMigrationInstructions = new ValidatingMigrationInstructions(); for (MigrationInstruction migrationInstruction : migrationPlan.getInstructions()) { MigrationInstructionValidationReportImpl instructionReport = new MigrationInstructionValidationReportImpl(migrationInstruction);
protected ValidatingMigrationInstructions wrapMigrationInstructions(MigrationPlan migrationPlan, ProcessDefinitionImpl sourceProcessDefinition, ProcessDefinitionImpl targetProcessDefinition, MigrationPlanValidationReportImpl planReport) { ValidatingMigrationInstructions validatingMigrationInstructions = new ValidatingMigrationInstructions(); for (MigrationInstruction migrationInstruction : migrationPlan.getInstructions()) { MigrationInstructionValidationReportImpl instructionReport = new MigrationInstructionValidationReportImpl(migrationInstruction);
protected Map<String, List<MigrationInstruction>> organizeInstructionsBySourceScope(MigrationPlan migrationPlan) { Map<String, List<MigrationInstruction>> organizedInstructions = new HashMap<String, List<MigrationInstruction>>(); for (MigrationInstruction instruction : migrationPlan.getInstructions()) { CollectionUtil.addToMapOfLists(organizedInstructions, instruction.getSourceActivityId(), instruction); } return organizedInstructions; }
public static MigrationPlanDto from(MigrationPlan migrationPlan) { MigrationPlanDto dto = new MigrationPlanDto(); dto.setSourceProcessDefinitionId(migrationPlan.getSourceProcessDefinitionId()); dto.setTargetProcessDefinitionId(migrationPlan.getTargetProcessDefinitionId()); ArrayList<MigrationInstructionDto> instructionDtos = new ArrayList<MigrationInstructionDto>(); if (migrationPlan.getInstructions() != null) { for (MigrationInstruction migrationInstruction : migrationPlan.getInstructions()) { MigrationInstructionDto migrationInstructionDto = MigrationInstructionDto.from(migrationInstruction); instructionDtos.add(migrationInstructionDto); } } dto.setInstructions(instructionDtos); return dto; }
public MigrationPlanAssert hasEmptyInstructions() { isNotNull(); List<MigrationInstruction> instructions = actual.getInstructions(); assertTrue("Expected migration plan has no instructions but has: " + instructions, instructions.isEmpty()); return this; }
public JSONObject toJsonObject(MigrationPlan migrationPlan) { JSONObject json = new JSONObject(); JsonUtil.addField(json, SOURCE_PROCESS_DEFINITION_ID, migrationPlan.getSourceProcessDefinitionId()); JsonUtil.addField(json, TARGET_PROCESS_DEFINITION_ID, migrationPlan.getTargetProcessDefinitionId()); JsonUtil.addListField(json, INSTRUCTIONS, MigrationInstructionJsonConverter.INSTANCE, migrationPlan.getInstructions()); return json; }
public MigrationPlanAssert hasInstructions(MigrationInstructionAssert... instructionAsserts) { isNotNull(); List<MigrationInstruction> notExpected = new ArrayList<MigrationInstruction>(actual.getInstructions()); List<MigrationInstructionAssert> notFound = new ArrayList<MigrationInstructionAssert>(); Collections.addAll(notFound, instructionAsserts); for (MigrationInstruction instruction : actual.getInstructions()) { if (instructionAssert.sourceActivityId.equals(instruction.getSourceActivityId())) { notFound.remove(instructionAssert); builder.append("\nActual migration instructions:\n\t").append(actual.getInstructions()).append("\n"); if (!notExpected.isEmpty()) { builder.append("Unexpected migration instructions:\n\t").append(notExpected).append("\n");
@Test @Deployment(resources = {"org/camunda/bpm/engine/test/api/externaltask/ExternalTaskWithoutIdTest.bpmn"}) public void testProcessDefinitionWithIdField() { // given ProcessDefinition sourceProcessDefinition = testHelper.deploy("org/camunda/bpm/engine/test/api/externaltask/ExternalTaskWithIdTest.bpmn").getDeployedProcessDefinitions().get(0); ProcessDefinition targetProcessDefinition = testHelper.deploy("org/camunda/bpm/engine/test/api/externaltask/ExternalTaskWithIdTest.bpmn").getDeployedProcessDefinitions().get(0); //external task is not mapped to new external task MigrationPlan migrationPlan = rule.getRuntimeService() .createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()) .mapEqualActivities() .build(); List<MigrationInstruction> instructions = migrationPlan.getInstructions(); assertEquals(2, instructions.size()); }
@Test @Deployment(resources = {"org/camunda/bpm/engine/test/api/externaltask/ExternalTaskWithoutIdTest.bpmn"}) public void testProcessDefinitionWithoutIdField() { // given ProcessDefinition sourceProcessDefinition = testHelper.deploy("org/camunda/bpm/engine/test/api/externaltask/ExternalTaskWithoutIdTest.bpmn").getDeployedProcessDefinitions().get(0); ProcessDefinition targetProcessDefinition = testHelper.deploy("org/camunda/bpm/engine/test/api/externaltask/ExternalTaskWithoutIdTest.bpmn").getDeployedProcessDefinitions().get(0); //external task is not mapped to new external task MigrationPlan migrationPlan = rule.getRuntimeService() .createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()) .mapEqualActivities() .build(); List<MigrationInstruction> instructions = migrationPlan.getInstructions(); // test that the messageEventDefinition without an id isn't included assertEquals(2, instructions.size()); }