@Test
 public void testLaneUnmarshalling() throws Exception {
   Bpmn2JsonUnmarshaller unmarshaller = new Bpmn2JsonUnmarshaller();
   Definitions definitions =
       ((Definitions)
           unmarshaller.unmarshall(getTestJsonFile("pool.json"), "").getContents().get(0));
   assertTrue(definitions.getRootElements().size() == 1);
   assertTrue(definitions.getRootElements().get(0) instanceof Process);
   Process process = getRootProcess(definitions);
   assertTrue(process.getLaneSets().size() == 1);
   assertTrue(process.getLaneSets().get(0).getLanes().size() == 1);
   Lane l = process.getLaneSets().get(0).getLanes().get(0);
   assertEquals("my first lane", l.getName());
   definitions.eResource().save(System.out, Collections.emptyMap());
 }
 public void laneToTop(Lane lane) {
   LaneSet laneSet = FACTORY.createLaneSet();
   //		laneSet.setId(EcoreUtil.generateUUID());
   ModelUtil.setID(laneSet, resource);
   laneSet.getLanes().add(lane);
   Process process = getOrCreateProcess(getInternalParticipant());
   process.getLaneSets().add(laneSet);
 }
  private void modifyModelStructure(IMoveShapeContext context) {
    Lane movedLane = getMovedLane(context);
    Process sourceProcess = getProcess(context.getSourceContainer());
    Process targetProcess = getProcess(context.getTargetContainer());
    moveLane(movedLane, sourceProcess, targetProcess);

    for (LaneSet laneSet : sourceProcess.getLaneSets()) {
      if (laneSet.getLanes().contains(movedLane)) {
        laneSet.getLanes().remove(movedLane);
        if (laneSet.getLanes().isEmpty()) {
          sourceProcess.getLaneSets().remove(laneSet);
        }

        if (targetProcess.getLaneSets().isEmpty()) {
          LaneSet newLaneSet = createLaneSet();
          targetProcess.getLaneSets().add(newLaneSet);
        }
        targetProcess.getLaneSets().get(0).getLanes().add(movedLane);
        break;
      }
    }
  }
  private void modifyModelStructure(IMoveShapeContext context) {
    Lane movedLane = getMovedLane(context);
    Participant sourceParticipant =
        (Participant) getBusinessObjectForPictogramElement(context.getSourceContainer());
    Participant internalParticipant = null;

    try {
      ModelHandler handler = ModelHandler.getInstance(getDiagram());
      internalParticipant = handler.getInternalParticipant();
      handler.moveLane(movedLane, internalParticipant);
    } catch (IOException e) {
      Activator.logError(e);
    }

    LaneSet laneSet = null;
    for (LaneSet set : sourceParticipant.getProcessRef().getLaneSets()) {
      if (set.getLanes().contains(movedLane)) {
        laneSet = set;
        break;
      }
    }

    if (laneSet != null) {
      laneSet.getLanes().remove(movedLane);
      if (laneSet.getLanes().isEmpty()) {
        sourceParticipant.getProcessRef().getLaneSets().remove(laneSet);
      }

      Process process = internalParticipant.getProcessRef();
      if (process.getLaneSets().isEmpty()) {
        LaneSet createLaneSet = ModelHandler.FACTORY.createLaneSet();
        //				createLaneSet.setId(EcoreUtil.generateUUID());
        process.getLaneSets().add(createLaneSet);
        ModelUtil.setID(createLaneSet);
      }
      process.getLaneSets().get(0).getLanes().add(movedLane);
    }
  }
 @Test
 public void testSimpleChainUnmarshalling() throws Exception {
   Bpmn2JsonUnmarshaller unmarshaller = new Bpmn2JsonUnmarshaller();
   Definitions definitions =
       ((Definitions)
           unmarshaller
               .unmarshall(getTestJsonFile("startEvent-task-endEvent.json"), "")
               .getContents()
               .get(0));
   assertTrue(definitions.getRootElements().size() == 1);
   Process process = getRootProcess(definitions);
   assertTrue(process.getFlowElements().size() == 5);
   assertTrue(process.getLaneSets().size() == 1);
   assertTrue(process.getLaneSets().get(0).getLanes().size() == 1);
   definitions.eResource().save(System.out, Collections.emptyMap());
 }