@Test public void testRollback() throws Exception { KscReportsMigrator obj = new KscReportsMigrator() { protected List<SnmpInterface> getInterfacesToMerge() throws OnmsUpgradeException { throw new OnmsUpgradeException("Forcing rollback"); } }; try { obj.preExecute(); obj.execute(); obj.postExecute(); } catch (OnmsUpgradeException e) { obj.rollback(); return; } Assert.fail(); }
@Override public void rollback() throws OnmsUpgradeException { log("Restoring backup %s\n", configFile); File zip = new File(configFile.getAbsolutePath() + ZIP_EXT); FileUtils.deleteQuietly(configFile); unzipFile(zip, zip.getParentFile()); }
KscReportsMigrator extends AbstractOnmsUpgrade { @Override public void rollback() throws OnmsUpgradeException { log("Restoring backup %s\n", configFile); File zip = new File(configFile.getAbsolutePath() + ZIP_EXT); FileUtils.deleteQuietly(configFile); unzipFile(zip, zip.getParentFile()); } }
KscReportsMigrator extends AbstractOnmsUpgrade { @Override public void rollback() throws OnmsUpgradeException { log("Restoring backup %s\n", configFile); File zip = new File(configFile.getAbsolutePath() + ZIP_EXT); FileUtils.deleteQuietly(configFile); unzipFile(zip, zip.getParentFile()); } KscReportsMigrator(); }
KscReportsMigrator extends AbstractOnmsUpgrade { @Override public void rollback() throws OnmsUpgradeException { log("Restoring backup %s\n", configFile); File zip = new File(configFile.getAbsolutePath() + ZIP_EXT); FileUtils.deleteQuietly(configFile); unzipFile(zip, zip.getParentFile()); } KscReportsMigrator(); int getOrder(); String getDescription(); boolean requiresOnmsRunning(); void preExecute(); void postExecute(); @Override void rollback(); @Override void execute(); }
KscReportsMigrator extends AbstractOnmsUpgrade { @Override public void rollback() throws OnmsUpgradeException { log("Restoring backup %s\n", configFile); File zip = new File(configFile.getAbsolutePath() + ZIP_EXT); FileUtils.deleteQuietly(configFile); unzipFile(zip, zip.getParentFile()); } KscReportsMigrator(); int getOrder(); String getDescription(); boolean requiresOnmsRunning(); void preExecute(); void postExecute(); @Override void rollback(); @Override void execute();  }