@Test public void testRunCommand() throws Exception { assertEquals(0, execShellCliParser.runCommand()); }
public int runCommand() throws Exception { String command = getCommand(); String stdoutFile = getStdoutPath(); String stderrFile = getStderrPath(); Process p = Runtime.getRuntime().exec(command.split(" ")); String stdout = getOutput(p.getInputStream()); String stderr = getOutput(p.getErrorStream()); writeOutputToFile(stdout, new File(stdoutFile)); writeOutputToFile(stderr, new File(stderrFile)); p.waitFor(); return p.exitValue(); }
ExecShellCliParser { public int runCommand() throws Exception { String command = getCommand(); String stdoutFile = getStdoutPath(); String stderrFile = getStderrPath(); Process p = Runtime.getRuntime().exec(command.split(" ")); String stdout = getOutput(p.getInputStream()); String stderr = getOutput(p.getErrorStream()); writeOutputToFile(stdout, new File(stdoutFile)); writeOutputToFile(stderr, new File(stderrFile)); p.waitFor(); return p.exitValue(); } }
ExecShellCliParser { public int runCommand() throws Exception { String command = getCommand(); String stdoutFile = getStdoutPath(); String stderrFile = getStderrPath(); Process p = Runtime.getRuntime().exec(command.split(" ")); String stdout = getOutput(p.getInputStream()); String stderr = getOutput(p.getErrorStream()); writeOutputToFile(stdout, new File(stdoutFile)); writeOutputToFile(stderr, new File(stderrFile)); p.waitFor(); return p.exitValue(); } ExecShellCliParser(String cliString); }
ExecShellCliParser { public int runCommand() throws Exception { String command = getCommand(); String stdoutFile = getStdoutPath(); String stderrFile = getStderrPath(); Process p = Runtime.getRuntime().exec(command.split(" ")); String stdout = getOutput(p.getInputStream()); String stderr = getOutput(p.getErrorStream()); writeOutputToFile(stdout, new File(stdoutFile)); writeOutputToFile(stderr, new File(stderrFile)); p.waitFor(); return p.exitValue(); } ExecShellCliParser(String cliString); String getCommand(); String getStdoutPath(); String getStderrPath(); int runCommand(); String getOutput(InputStream inputStream); void writeOutputToFile(String output, File outputFile); }
ExecShellCliParser { public int runCommand() throws Exception { String command = getCommand(); String stdoutFile = getStdoutPath(); String stderrFile = getStderrPath(); Process p = Runtime.getRuntime().exec(command.split(" ")); String stdout = getOutput(p.getInputStream()); String stderr = getOutput(p.getErrorStream()); writeOutputToFile(stdout, new File(stdoutFile)); writeOutputToFile(stderr, new File(stderrFile)); p.waitFor(); return p.exitValue(); } ExecShellCliParser(String cliString); String getCommand(); String getStdoutPath(); String getStderrPath(); int runCommand(); String getOutput(InputStream inputStream); void writeOutputToFile(String output, File outputFile);  }