Java Code Examples for com.oracle.java.testlibrary.ProcessTools#getOutput()
The following examples show how to use
com.oracle.java.testlibrary.ProcessTools#getOutput() .
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: Test8028623.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public static void main (String[] args) { System.out.println(\u00CB); try { if (!Platform.shouldSAAttach()) { System.out.println("SA attach not expected to work - test skipped."); return; } int pid = ProcessTools.getProcessId(); JDKToolLauncher jmap = JDKToolLauncher.create("jmap") .addToolArg("-F") .addToolArg("-dump:live,format=b,file=" + dumpFile) .addToolArg(Integer.toString(pid)); ProcessBuilder pb = new ProcessBuilder(jmap.getCommand()); OutputBuffer output = ProcessTools.getOutput(pb); Process p = pb.start(); int e = p.waitFor(); System.out.println("stdout:"); System.out.println(output.getStdout()); System.out.println("stderr:"); System.out.println(output.getStderr()); if (e != 0) { throw new RuntimeException("jmap returns: " + e); } if (! new File(dumpFile).exists()) { throw new RuntimeException("dump file NOT created: '" + dumpFile + "'"); } } catch (Throwable t) { t.printStackTrace(); throw new RuntimeException("Test failed with: " + t); } }
Example 2
Source File: Test8028623.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public static void main (String[] args) { System.out.println(\u00CB); try { if (!Platform.shouldSAAttach()) { System.out.println("SA attach not expected to work - test skipped."); return; } int pid = ProcessTools.getProcessId(); JDKToolLauncher jmap = JDKToolLauncher.create("jmap") .addToolArg("-F") .addToolArg("-dump:live,format=b,file=" + dumpFile) .addToolArg(Integer.toString(pid)); ProcessBuilder pb = new ProcessBuilder(jmap.getCommand()); OutputBuffer output = ProcessTools.getOutput(pb); Process p = pb.start(); int e = p.waitFor(); System.out.println("stdout:"); System.out.println(output.getStdout()); System.out.println("stderr:"); System.out.println(output.getStderr()); if (e != 0) { throw new RuntimeException("jmap returns: " + e); } if (! new File(dumpFile).exists()) { throw new RuntimeException("dump file NOT created: '" + dumpFile + "'"); } } catch (Throwable t) { t.printStackTrace(); throw new RuntimeException("Test failed with: " + t); } }
Example 3
Source File: Test8028623.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public static void main (String[] args) { System.out.println(\u00CB); try { if (!Platform.shouldSAAttach()) { System.out.println("SA attach not expected to work - test skipped."); return; } int pid = ProcessTools.getProcessId(); JDKToolLauncher jmap = JDKToolLauncher.create("jmap") .addToolArg("-F") .addToolArg("-dump:live,format=b,file=" + dumpFile) .addToolArg(Integer.toString(pid)); ProcessBuilder pb = new ProcessBuilder(jmap.getCommand()); OutputBuffer output = ProcessTools.getOutput(pb); Process p = pb.start(); int e = p.waitFor(); System.out.println("stdout:"); System.out.println(output.getStdout()); System.out.println("stderr:"); System.out.println(output.getStderr()); if (e != 0) { throw new RuntimeException("jmap returns: " + e); } if (! new File(dumpFile).exists()) { throw new RuntimeException("dump file NOT created: '" + dumpFile + "'"); } } catch (Throwable t) { t.printStackTrace(); throw new RuntimeException("Test failed with: " + t); } }
Example 4
Source File: Test8028623.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public static void main (String[] args) { System.out.println(\u00CB); try { if (!Platform.shouldSAAttach()) { System.out.println("SA attach not expected to work - test skipped."); return; } int pid = ProcessTools.getProcessId(); JDKToolLauncher jmap = JDKToolLauncher.create("jmap") .addToolArg("-F") .addToolArg("-dump:live,format=b,file=" + dumpFile) .addToolArg(Integer.toString(pid)); ProcessBuilder pb = new ProcessBuilder(jmap.getCommand()); OutputBuffer output = ProcessTools.getOutput(pb); Process p = pb.start(); int e = p.waitFor(); System.out.println("stdout:"); System.out.println(output.getStdout()); System.out.println("stderr:"); System.out.println(output.getStderr()); if (e != 0) { throw new RuntimeException("jmap returns: " + e); } if (! new File(dumpFile).exists()) { throw new RuntimeException("dump file NOT created: '" + dumpFile + "'"); } } catch (Throwable t) { t.printStackTrace(); throw new RuntimeException("Test failed with: " + t); } }
Example 5
Source File: Test8028623.java From hottub with GNU General Public License v2.0 | 5 votes |
public static void main (String[] args) { System.out.println(\u00CB); try { if (!Platform.shouldSAAttach()) { System.out.println("SA attach not expected to work - test skipped."); return; } int pid = ProcessTools.getProcessId(); JDKToolLauncher jmap = JDKToolLauncher.create("jmap") .addToolArg("-F") .addToolArg("-dump:live,format=b,file=" + dumpFile) .addToolArg(Integer.toString(pid)); ProcessBuilder pb = new ProcessBuilder(jmap.getCommand()); OutputBuffer output = ProcessTools.getOutput(pb); Process p = pb.start(); int e = p.waitFor(); System.out.println("stdout:"); System.out.println(output.getStdout()); System.out.println("stderr:"); System.out.println(output.getStderr()); if (e != 0) { throw new RuntimeException("jmap returns: " + e); } if (! new File(dumpFile).exists()) { throw new RuntimeException("dump file NOT created: '" + dumpFile + "'"); } } catch (Throwable t) { t.printStackTrace(); throw new RuntimeException("Test failed with: " + t); } }