@Test public void shouldUpdateStepMetadata() { task.run(); List<PersistentPreparation> preparationList = preparationRepository .list(PersistentPreparation.class) .sorted(Comparator.comparingInt(o -> o.getSteps().size())) .collect(Collectors.toList()); assertEquals(4, preparationList.get(0).getSteps().size()); assertEquals(8, preparationList.get(1).getSteps().size()); }
@Override public void run() { LOGGER.info("Migration of step ids in preparation..."); preparationRepository .list(PersistentPreparation.class) .forEach(p -> { LOGGER.info("Migration of preparation #{}", p.getId()); final List<String> stepsIds = preparationUtils.listStepsIds(p.getHeadId(), preparationRepository); p.setSteps(stepsIds); preparationRepository.add(p); LOGGER.info("Migration of preparation #{} done ({} steps)", p.getId(), stepsIds.size()); }); LOGGER.info("Migration of step ids in preparation done."); }
StepListPreparationsMigration implements BaseUpgradeTaskTo_2_1_0_PE { @Override public void run() { LOGGER.info("Migration of step ids in preparation..."); preparationRepository .list(PersistentPreparation.class) .forEach(p -> { LOGGER.info("Migration of preparation #{}", p.getId()); final List<String> stepsIds = preparationUtils.listStepsIds(p.getHeadId(), preparationRepository); p.setSteps(stepsIds); preparationRepository.add(p); LOGGER.info("Migration of preparation #{} done ({} steps)", p.getId(), stepsIds.size()); }); LOGGER.info("Migration of step ids in preparation done."); } }
StepListPreparationsMigration implements BaseUpgradeTaskTo_2_1_0_PE { @Override public void run() { LOGGER.info("Migration of step ids in preparation..."); preparationRepository .list(PersistentPreparation.class) .forEach(p -> { LOGGER.info("Migration of preparation #{}", p.getId()); final List<String> stepsIds = preparationUtils.listStepsIds(p.getHeadId(), preparationRepository); p.setSteps(stepsIds); preparationRepository.add(p); LOGGER.info("Migration of preparation #{} done ({} steps)", p.getId(), stepsIds.size()); }); LOGGER.info("Migration of step ids in preparation done."); }  }
StepListPreparationsMigration implements BaseUpgradeTaskTo_2_1_0_PE { @Override public void run() { LOGGER.info("Migration of step ids in preparation..."); preparationRepository .list(PersistentPreparation.class) .forEach(p -> { LOGGER.info("Migration of preparation #{}", p.getId()); final List<String> stepsIds = preparationUtils.listStepsIds(p.getHeadId(), preparationRepository); p.setSteps(stepsIds); preparationRepository.add(p); LOGGER.info("Migration of preparation #{} done ({} steps)", p.getId(), stepsIds.size()); }); LOGGER.info("Migration of step ids in preparation done."); }  @Override void run(); @Override int getOrder(); @Override UpgradeTask.target getTarget(); }
StepListPreparationsMigration implements BaseUpgradeTaskTo_2_1_0_PE { @Override public void run() { LOGGER.info("Migration of step ids in preparation..."); preparationRepository .list(PersistentPreparation.class) .forEach(p -> { LOGGER.info("Migration of preparation #{}", p.getId()); final List<String> stepsIds = preparationUtils.listStepsIds(p.getHeadId(), preparationRepository); p.setSteps(stepsIds); preparationRepository.add(p); LOGGER.info("Migration of preparation #{} done ({} steps)", p.getId(), stepsIds.size()); }); LOGGER.info("Migration of step ids in preparation done."); }  @Override void run(); @Override int getOrder(); @Override UpgradeTask.target getTarget();  }