Java Code Examples for jdk.test.lib.process.ProcessTools#executeCommand()
The following examples show how to use
jdk.test.lib.process.ProcessTools#executeCommand() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MVJarSigningTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private static OutputAnalyzer jarsigner(List<String> extra) throws Throwable { JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jarsigner") .addVMArg("-Duser.language=en") .addVMArg("-Duser.country=US") .addToolArg("-keystore") .addToolArg(KEYSTORE) .addToolArg("-storepass") .addToolArg(STOREPASS) .addToolArg("-keypass") .addToolArg(KEYPASS); for (String s : extra) { if (s.startsWith("-J")) { launcher.addVMArg(s.substring(2)); } else { launcher.addToolArg(s); } } return ProcessTools.executeCommand(launcher.getCommand()); }
Example 2
Source File: ExecuteHelper.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public static OutputAnalyzer jfr(String... args) throws Throwable { JDKToolLauncher l = JDKToolLauncher.createUsingTestJDK("jfr"); for (String arg : args) { l.addToolArg(arg); } return ProcessTools.executeCommand(l.getCommand()); }
Example 3
Source File: SecurityTools.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static OutputAnalyzer execute(ProcessBuilder pb) throws Exception { try { OutputAnalyzer oa = ProcessTools.executeCommand(pb); System.out.println("Exit value: " + oa.getExitValue()); return oa; } catch (Throwable t) { if (t instanceof Exception) { throw (Exception) t; } else { throw new Exception(t); } } }
Example 4
Source File: ExecuteHelper.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public static OutputAnalyzer jfr(String... args) throws Throwable { JDKToolLauncher l = JDKToolLauncher.createUsingTestJDK("jfr"); for (String arg : args) { l.addToolArg(arg); } return ProcessTools.executeCommand(l.getCommand()); }
Example 5
Source File: SecurityTools.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private static OutputAnalyzer execute(ProcessBuilder pb) throws Exception { try { OutputAnalyzer oa = ProcessTools.executeCommand(pb); System.out.println("Exit value: " + oa.getExitValue()); return oa; } catch (Throwable t) { if (t instanceof Exception) { throw (Exception) t; } else { throw new Exception(t); } } }
Example 6
Source File: PostThruProxy.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private static String getHostname() { try { OutputAnalyzer oa = ProcessTools.executeCommand("hostname"); return oa.getOutput().trim(); } catch (Throwable e) { throw new RuntimeException("Get hostname failed.", e); } }
Example 7
Source File: PostThruProxyWithAuth.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private static String getHostname() { try { OutputAnalyzer oa = ProcessTools.executeCommand("hostname"); return oa.getOutput().trim(); } catch (Throwable e) { throw new RuntimeException("Get hostname failed.", e); } }
Example 8
Source File: MRTestBase.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
OutputAnalyzer jarWithStdin(File stdinSource, String... args) throws Throwable { String jar = JDKToolFinder.getJDKTool("jar"); List<String> commands = new ArrayList<>(); commands.add(jar); commands.addAll(Utils.getForwardVmOptions()); Stream.of(args).forEach(x -> commands.add(x)); ProcessBuilder p = new ProcessBuilder(commands); if (stdinSource != null) p.redirectInput(stdinSource); return ProcessTools.executeCommand(p); }
Example 9
Source File: Utils.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public static OutputAnalyzer uname(String... args) throws Throwable { String[] cmds = new String[args.length + 1]; cmds[0] = "uname"; System.arraycopy(args, 0, cmds, 1, args.length); return ProcessTools.executeCommand(cmds); }
Example 10
Source File: Utils.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public static OutputAnalyzer uname(String... args) throws Throwable { String[] cmds = new String[args.length + 1]; cmds[0] = "uname"; System.arraycopy(args, 0, cmds, 1, args.length); return ProcessTools.executeCommand(cmds); }
Example 11
Source File: MVJarSigningTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
private static OutputAnalyzer jar(String...args) throws Throwable { JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jar"); Stream.of(args).forEach(launcher::addToolArg); return ProcessTools.executeCommand(launcher.getCommand()); }
Example 12
Source File: RuntimeTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
private static OutputAnalyzer jar(String... args) throws Throwable { JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jar"); Stream.of(args).forEach(launcher::addToolArg); return ProcessTools.executeCommand(launcher.getCommand()); }
Example 13
Source File: MultiReleaseJarTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
private OutputAnalyzer jar(String... args) throws Throwable { JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jar"); Stream.of(args).forEach(launcher::addToolArg); return ProcessTools.executeCommand(launcher.getCommand()); }
Example 14
Source File: MultiReleaseJarTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
private OutputAnalyzer jar(String... args) throws Throwable { JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jar"); Stream.of(args).forEach(launcher::addToolArg); return ProcessTools.executeCommand(launcher.getCommand()); }