@Test public void testExecWithModulePreCondition() throws Exception { Path[] paths = createEnv(7); Path root = paths[0]; Path fs = paths[1]; Path module = paths[2]; Files.write(PathUtils.get(module, "Module.hook"), buildModuleHookPre()); try { Map<String, Object> props = new HashMap<>(); props.put("var", "var errada"); new EnvConfiguratorMock(build(module, props)).execute(); assertThat(exists(PathUtils.get(fs, "f.txt")), is(false)); assertThat(exists(PathUtils.get(fs, "dir3/f3.txt")), is(false)); } finally { FileUtils.delete(root); } }
public void execute() { conf.prettyPrint(); Path module = conf.getModule(); try { final ModuleHookEvaluator hook = new ModuleHookEvaluator(conf); try{ if (hook.pre()) { deleteFiles(); copyFiles(); hook.post(); } else { LOGGER.warning("Module " + module + " was not installed. Check Module.hook!"); } } finally { hook.finish(); } } catch (final Exception e) { LOGGER.log(Level.SEVERE, "Unexpected Error.", e); throw new RuntimeException("Unexpected Error. Cause: " + e.getMessage(), e); } }
EnvConfigurator { public void execute() { conf.prettyPrint(); Path module = conf.getModule(); try { final ModuleHookEvaluator hook = new ModuleHookEvaluator(conf); try{ if (hook.pre()) { deleteFiles(); copyFiles(); hook.post(); } else { LOGGER.warning("Module " + module + " was not installed. Check Module.hook!"); } } finally { hook.finish(); } } catch (final Exception e) { LOGGER.log(Level.SEVERE, "Unexpected Error.", e); throw new RuntimeException("Unexpected Error. Cause: " + e.getMessage(), e); } } }
EnvConfigurator { public void execute() { conf.prettyPrint(); Path module = conf.getModule(); try { final ModuleHookEvaluator hook = new ModuleHookEvaluator(conf); try{ if (hook.pre()) { deleteFiles(); copyFiles(); hook.post(); } else { LOGGER.warning("Module " + module + " was not installed. Check Module.hook!"); } } finally { hook.finish(); } } catch (final Exception e) { LOGGER.log(Level.SEVERE, "Unexpected Error.", e); throw new RuntimeException("Unexpected Error. Cause: " + e.getMessage(), e); } } EnvConfigurator(Configuration conf); }
EnvConfigurator { public void execute() { conf.prettyPrint(); Path module = conf.getModule(); try { final ModuleHookEvaluator hook = new ModuleHookEvaluator(conf); try{ if (hook.pre()) { deleteFiles(); copyFiles(); hook.post(); } else { LOGGER.warning("Module " + module + " was not installed. Check Module.hook!"); } } finally { hook.finish(); } } catch (final Exception e) { LOGGER.log(Level.SEVERE, "Unexpected Error.", e); throw new RuntimeException("Unexpected Error. Cause: " + e.getMessage(), e); } } EnvConfigurator(Configuration conf); void execute(); }
EnvConfigurator { public void execute() { conf.prettyPrint(); Path module = conf.getModule(); try { final ModuleHookEvaluator hook = new ModuleHookEvaluator(conf); try{ if (hook.pre()) { deleteFiles(); copyFiles(); hook.post(); } else { LOGGER.warning("Module " + module + " was not installed. Check Module.hook!"); } } finally { hook.finish(); } } catch (final Exception e) { LOGGER.log(Level.SEVERE, "Unexpected Error.", e); throw new RuntimeException("Unexpected Error. Cause: " + e.getMessage(), e); } } EnvConfigurator(Configuration conf); void execute();  }