/** * Bulk set the environment from a map. This does * not replace the existing environment, just extend it/overwrite single * entries. * @param map map to add */ public void putEnvMap(Map<String, String> map) { for (Map.Entry<String, String> entry : map.entrySet()) { String val = entry.getValue(); String key = entry.getKey(); setEnv(key, val); } }
/** * Bulk set the environment from a map. This does * not replace the existing environment, just extend it/overwrite single * entries. * @param map map to add */ public void putEnvMap(Map<String, String> map) { for (Map.Entry<String, String> entry : map.entrySet()) { String val = entry.getValue(); String key = entry.getKey(); setEnv(key, val); } }
@Test public void testSetenv() throws Throwable { String var = "TEST_RUN"; String val = "TEST-RUN-ENV-VALUE"; initProcess(commandFactory.env()); process.setEnv(var, val); process.start(); //in-thread wait process.run(); //here stopped assertTrue("process stop callback not received", stopped); assertEquals(0, process.getExitCode().intValue()); assertStringInOutput(val, getFinalOutput()); }
@Test public void testSetenv() throws Throwable { String var = "TEST_RUN"; String val = "TEST-RUN-ENV-VALUE"; initProcess(commandFactory.env()); process.setEnv(var, val); process.start(); //in-thread wait process.run(); //here stopped assertTrue("process stop callback not received", stopped); assertEquals(0, process.getExitCode().intValue()); assertStringInOutput(val, getFinalOutput()); }