< prev index next >

test/jdk/jdk/jfr/jmx/TestClone.java

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


  23  * questions.
  24  */
  25 
  26 package jdk.jfr.jmx;
  27 
  28 import java.nio.file.Path;
  29 import java.nio.file.Paths;
  30 import java.util.Iterator;
  31 import java.util.List;
  32 
  33 import jdk.jfr.RecordingState;
  34 import jdk.jfr.consumer.RecordedEvent;
  35 import jdk.jfr.consumer.RecordingFile;
  36 import jdk.management.jfr.FlightRecorderMXBean;
  37 import jdk.management.jfr.RecordingInfo;
  38 import jdk.test.lib.Asserts;
  39 import jdk.test.lib.jfr.EventField;
  40 import jdk.test.lib.jfr.Events;
  41 import jdk.test.lib.jfr.SimpleEventHelper;
  42 
  43 /*
  44  * @test
  45  * @key jfr

  46  * @library /test/lib /test/jdk
  47  * @run main/othervm jdk.jfr.jmx.TestClone
  48  */
  49 public class TestClone {
  50     public static void main(String[] args) throws Exception {
  51         FlightRecorderMXBean bean = JmxHelper.getFlighteRecorderMXBean();
  52 
  53         long orgId = bean.newRecording();
  54         bean.startRecording(orgId);
  55         SimpleEventHelper.createEvent(1); // Should be in both org and clone
  56 
  57         long cloneId = bean.cloneRecording(orgId, false);
  58         Asserts.assertNotEquals(orgId, cloneId, "clone id should not be same as org id");
  59 
  60         List<RecordingInfo> recordings = bean.getRecordings();
  61         JmxHelper.verifyState(orgId, RecordingState.RUNNING, recordings);
  62         JmxHelper.verifyState(cloneId, RecordingState.RUNNING, recordings);
  63 
  64         bean.stopRecording(orgId);
  65         recordings = bean.getRecordings();




  23  * questions.
  24  */
  25 
  26 package jdk.jfr.jmx;
  27 
  28 import java.nio.file.Path;
  29 import java.nio.file.Paths;
  30 import java.util.Iterator;
  31 import java.util.List;
  32 
  33 import jdk.jfr.RecordingState;
  34 import jdk.jfr.consumer.RecordedEvent;
  35 import jdk.jfr.consumer.RecordingFile;
  36 import jdk.management.jfr.FlightRecorderMXBean;
  37 import jdk.management.jfr.RecordingInfo;
  38 import jdk.test.lib.Asserts;
  39 import jdk.test.lib.jfr.EventField;
  40 import jdk.test.lib.jfr.Events;
  41 import jdk.test.lib.jfr.SimpleEventHelper;
  42 
  43 /**
  44  * @test
  45  * @key jfr
  46  * @requires vm.hasJFR
  47  * @library /test/lib /test/jdk
  48  * @run main/othervm jdk.jfr.jmx.TestClone
  49  */
  50 public class TestClone {
  51     public static void main(String[] args) throws Exception {
  52         FlightRecorderMXBean bean = JmxHelper.getFlighteRecorderMXBean();
  53 
  54         long orgId = bean.newRecording();
  55         bean.startRecording(orgId);
  56         SimpleEventHelper.createEvent(1); // Should be in both org and clone
  57 
  58         long cloneId = bean.cloneRecording(orgId, false);
  59         Asserts.assertNotEquals(orgId, cloneId, "clone id should not be same as org id");
  60 
  61         List<RecordingInfo> recordings = bean.getRecordings();
  62         JmxHelper.verifyState(orgId, RecordingState.RUNNING, recordings);
  63         JmxHelper.verifyState(cloneId, RecordingState.RUNNING, recordings);
  64 
  65         bean.stopRecording(orgId);
  66         recordings = bean.getRecordings();


< prev index next >