< prev index next >

test/jdk/jdk/jfr/cmd/TestPrintJSON.java

Print this page
rev 51054 : imported patch 9000013-aixDisableJFR-requires.patch


  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package jdk.jfr.cmd;
  27 
  28 import java.nio.file.Path;
  29 
  30 import javax.script.ScriptEngine;
  31 import javax.script.ScriptEngineManager;
  32 
  33 import jdk.jfr.ValueDescriptor;
  34 import jdk.jfr.consumer.RecordedEvent;
  35 import jdk.jfr.consumer.RecordedObject;
  36 import jdk.jfr.consumer.RecordingFile;
  37 import jdk.nashorn.api.scripting.JSObject;
  38 import jdk.test.lib.Asserts;
  39 import jdk.test.lib.process.OutputAnalyzer;
  40 
  41 /*
  42  * @test
  43  * @key jfr
  44  * @summary Tests print --json

  45  *
  46  * @library /test/lib /test/jdk
  47  * @modules jdk.scripting.nashorn
  48  *          jdk.jfr
  49  *
  50  * @run main/othervm jdk.jfr.cmd.TestPrintJSON
  51  */
  52 public class TestPrintJSON {
  53 
  54     public static void main(String... args) throws Exception {
  55 
  56         Path recordingFile = ExecuteHelper.createProfilingRecording().toAbsolutePath();
  57 
  58         OutputAnalyzer output = ExecuteHelper.run("print", "--json", recordingFile.toString());
  59         String json = output.getStdout();
  60 
  61         // Parse JSON using Nashorn
  62         String statement = "var jsonObject = " + json;
  63         ScriptEngineManager factory = new ScriptEngineManager();
  64         ScriptEngine engine = factory.getEngineByName("nashorn");




  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package jdk.jfr.cmd;
  27 
  28 import java.nio.file.Path;
  29 
  30 import javax.script.ScriptEngine;
  31 import javax.script.ScriptEngineManager;
  32 
  33 import jdk.jfr.ValueDescriptor;
  34 import jdk.jfr.consumer.RecordedEvent;
  35 import jdk.jfr.consumer.RecordedObject;
  36 import jdk.jfr.consumer.RecordingFile;
  37 import jdk.nashorn.api.scripting.JSObject;
  38 import jdk.test.lib.Asserts;
  39 import jdk.test.lib.process.OutputAnalyzer;
  40 
  41 /**
  42  * @test
  43  * @key jfr
  44  * @summary Tests print --json
  45  * @requires vm.hasJFR
  46  *
  47  * @library /test/lib /test/jdk
  48  * @modules jdk.scripting.nashorn
  49  *          jdk.jfr
  50  *
  51  * @run main/othervm jdk.jfr.cmd.TestPrintJSON
  52  */
  53 public class TestPrintJSON {
  54 
  55     public static void main(String... args) throws Exception {
  56 
  57         Path recordingFile = ExecuteHelper.createProfilingRecording().toAbsolutePath();
  58 
  59         OutputAnalyzer output = ExecuteHelper.run("print", "--json", recordingFile.toString());
  60         String json = output.getStdout();
  61 
  62         // Parse JSON using Nashorn
  63         String statement = "var jsonObject = " + json;
  64         ScriptEngineManager factory = new ScriptEngineManager();
  65         ScriptEngine engine = factory.getEngineByName("nashorn");


< prev index next >