@Test void testUpgradeFromVersion31() { when(molgenisVersionService.getSchemaVersion()).thenReturn(31); assertFalse(molgenisUpgradeServiceImpl.upgrade()); }
@Override public boolean upgrade() { int schemaVersion = versionService.getSchemaVersion(); if (schemaVersion < 31) { throw new UnsupportedOperationException( "Upgrading from schema version below 31 is not supported"); } if (schemaVersion < versionService.getAppVersion()) { LOG.info( "Metadata version:{}, current version:{} upgrade needed", schemaVersion, versionService.getAppVersion()); upgrades.stream() .filter(upgrade -> upgrade.getFromVersion() >= schemaVersion) .forEach(this::runUpgrade); versionService.setSchemaVersion(versionService.getAppVersion()); LOG.info("Metadata upgrade done."); return true; } else { LOG.debug( "Metadata version:{}, current version:{} upgrade not needed", schemaVersion, versionService.getAppVersion()); return false; } }
MolgenisUpgradeServiceImpl implements MolgenisUpgradeService { @Override public boolean upgrade() { int schemaVersion = versionService.getSchemaVersion(); if (schemaVersion < 31) { throw new UnsupportedOperationException( "Upgrading from schema version below 31 is not supported"); } if (schemaVersion < versionService.getAppVersion()) { LOG.info( "Metadata version:{}, current version:{} upgrade needed", schemaVersion, versionService.getAppVersion()); upgrades.stream() .filter(upgrade -> upgrade.getFromVersion() >= schemaVersion) .forEach(this::runUpgrade); versionService.setSchemaVersion(versionService.getAppVersion()); LOG.info("Metadata upgrade done."); return true; } else { LOG.debug( "Metadata version:{}, current version:{} upgrade not needed", schemaVersion, versionService.getAppVersion()); return false; } } }
MolgenisUpgradeServiceImpl implements MolgenisUpgradeService { @Override public boolean upgrade() { int schemaVersion = versionService.getSchemaVersion(); if (schemaVersion < 31) { throw new UnsupportedOperationException( "Upgrading from schema version below 31 is not supported"); } if (schemaVersion < versionService.getAppVersion()) { LOG.info( "Metadata version:{}, current version:{} upgrade needed", schemaVersion, versionService.getAppVersion()); upgrades.stream() .filter(upgrade -> upgrade.getFromVersion() >= schemaVersion) .forEach(this::runUpgrade); versionService.setSchemaVersion(versionService.getAppVersion()); LOG.info("Metadata upgrade done."); return true; } else { LOG.debug( "Metadata version:{}, current version:{} upgrade not needed", schemaVersion, versionService.getAppVersion()); return false; } } MolgenisUpgradeServiceImpl(MolgenisVersionService versionService); }
MolgenisUpgradeServiceImpl implements MolgenisUpgradeService { @Override public boolean upgrade() { int schemaVersion = versionService.getSchemaVersion(); if (schemaVersion < 31) { throw new UnsupportedOperationException( "Upgrading from schema version below 31 is not supported"); } if (schemaVersion < versionService.getAppVersion()) { LOG.info( "Metadata version:{}, current version:{} upgrade needed", schemaVersion, versionService.getAppVersion()); upgrades.stream() .filter(upgrade -> upgrade.getFromVersion() >= schemaVersion) .forEach(this::runUpgrade); versionService.setSchemaVersion(versionService.getAppVersion()); LOG.info("Metadata upgrade done."); return true; } else { LOG.debug( "Metadata version:{}, current version:{} upgrade not needed", schemaVersion, versionService.getAppVersion()); return false; } } MolgenisUpgradeServiceImpl(MolgenisVersionService versionService); void addUpgrade(MolgenisUpgrade upgrade); @Override boolean upgrade(); }
MolgenisUpgradeServiceImpl implements MolgenisUpgradeService { @Override public boolean upgrade() { int schemaVersion = versionService.getSchemaVersion(); if (schemaVersion < 31) { throw new UnsupportedOperationException( "Upgrading from schema version below 31 is not supported"); } if (schemaVersion < versionService.getAppVersion()) { LOG.info( "Metadata version:{}, current version:{} upgrade needed", schemaVersion, versionService.getAppVersion()); upgrades.stream() .filter(upgrade -> upgrade.getFromVersion() >= schemaVersion) .forEach(this::runUpgrade); versionService.setSchemaVersion(versionService.getAppVersion()); LOG.info("Metadata upgrade done."); return true; } else { LOG.debug( "Metadata version:{}, current version:{} upgrade not needed", schemaVersion, versionService.getAppVersion()); return false; } } MolgenisUpgradeServiceImpl(MolgenisVersionService versionService); void addUpgrade(MolgenisUpgrade upgrade); @Override boolean upgrade();  }