@Test public void shouldUpdateStepRowMetadata() throws Exception { Assert.assertTrue(new File(task.oldRoot).exists()); Assert.assertFalse(new File(task.newRoot).exists()); task.run(); Assert.assertTrue(new File(task.newRoot).exists()); }
@Override public void run() { if (this.haveToBeApply()) { LOGGER.info("Moving dataset content from from {} to {}.", oldRoot, newRoot); try { FileUtils.moveDirectory(new File(oldRoot), new File(tmp)); FileUtils.moveDirectory(new File(tmp), new File(newRoot)); LOGGER.info("Dataset content moved from {} to {}.", oldRoot, newRoot); } catch (IOException e) { LOGGER.error("Unable to move Dataset content from {} to {}.", oldRoot, newRoot); } } else { LOGGER.info("Dataset folder is already compatible with this new version. We don't need to upgrade it"); } }
MoveDatasetContent implements BaseUpgradeTaskTo_2_1_0_PE { @Override public void run() { if (this.haveToBeApply()) { LOGGER.info("Moving dataset content from from {} to {}.", oldRoot, newRoot); try { FileUtils.moveDirectory(new File(oldRoot), new File(tmp)); FileUtils.moveDirectory(new File(tmp), new File(newRoot)); LOGGER.info("Dataset content moved from {} to {}.", oldRoot, newRoot); } catch (IOException e) { LOGGER.error("Unable to move Dataset content from {} to {}.", oldRoot, newRoot); } } else { LOGGER.info("Dataset folder is already compatible with this new version. We don't need to upgrade it"); } } }
MoveDatasetContent implements BaseUpgradeTaskTo_2_1_0_PE { @Override public void run() { if (this.haveToBeApply()) { LOGGER.info("Moving dataset content from from {} to {}.", oldRoot, newRoot); try { FileUtils.moveDirectory(new File(oldRoot), new File(tmp)); FileUtils.moveDirectory(new File(tmp), new File(newRoot)); LOGGER.info("Dataset content moved from {} to {}.", oldRoot, newRoot); } catch (IOException e) { LOGGER.error("Unable to move Dataset content from {} to {}.", oldRoot, newRoot); } } else { LOGGER.info("Dataset folder is already compatible with this new version. We don't need to upgrade it"); } }  }
MoveDatasetContent implements BaseUpgradeTaskTo_2_1_0_PE { @Override public void run() { if (this.haveToBeApply()) { LOGGER.info("Moving dataset content from from {} to {}.", oldRoot, newRoot); try { FileUtils.moveDirectory(new File(oldRoot), new File(tmp)); FileUtils.moveDirectory(new File(tmp), new File(newRoot)); LOGGER.info("Dataset content moved from {} to {}.", oldRoot, newRoot); } catch (IOException e) { LOGGER.error("Unable to move Dataset content from {} to {}.", oldRoot, newRoot); } } else { LOGGER.info("Dataset folder is already compatible with this new version. We don't need to upgrade it"); } }  @Value("${content-service.store.local.path}") void setOldRoot(String basePath); @Value("${content-service.store.local.path}") void setTmp(String basePath); @Value("${content-service.store.local.path}") void setNewRoot(String basePath); @Override void run(); boolean haveToBeApply(); @Override int getOrder(); @Override target getTarget(); }
MoveDatasetContent implements BaseUpgradeTaskTo_2_1_0_PE { @Override public void run() { if (this.haveToBeApply()) { LOGGER.info("Moving dataset content from from {} to {}.", oldRoot, newRoot); try { FileUtils.moveDirectory(new File(oldRoot), new File(tmp)); FileUtils.moveDirectory(new File(tmp), new File(newRoot)); LOGGER.info("Dataset content moved from {} to {}.", oldRoot, newRoot); } catch (IOException e) { LOGGER.error("Unable to move Dataset content from {} to {}.", oldRoot, newRoot); } } else { LOGGER.info("Dataset folder is already compatible with this new version. We don't need to upgrade it"); } }  @Value("${content-service.store.local.path}") void setOldRoot(String basePath); @Value("${content-service.store.local.path}") void setTmp(String basePath); @Value("${content-service.store.local.path}") void setNewRoot(String basePath); @Override void run(); boolean haveToBeApply(); @Override int getOrder(); @Override target getTarget();  }