16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
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 package jdk.jfr.api.recording.misc;
26
27 import jdk.jfr.Recording;
28 import jdk.jfr.RecordingState;
29 import jdk.jfr.consumer.RecordedEvent;
30 import jdk.test.lib.Asserts;
31 import jdk.test.lib.jfr.Events;
32 import jdk.test.lib.jfr.SimpleEvent;
33
34 import java.util.List;
35
36 /*
37 * @test
38 * @summary A simple test for Recording.copy()
39 * @key jfr
40 * @library /test/lib
41 * @run main/othervm jdk.jfr.api.recording.misc.TestRecordingCopy
42 */
43 public class TestRecordingCopy {
44
45 private static final int EVENT_ID = 1001;
46
47 public static void main(String[] args) throws Exception {
48
49 Recording original = new Recording();
50 original.enable(SimpleEvent.class);
51
52 Recording newCopy = original.copy(false);
53 Asserts.assertEquals(newCopy.getState(), RecordingState.NEW);
54
55 Recording newStoppedCopy = original.copy(true);
56 Asserts.assertEquals(newStoppedCopy.getState(), RecordingState.NEW);
57
58 original.start();
59
|
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
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 package jdk.jfr.api.recording.misc;
26
27 import jdk.jfr.Recording;
28 import jdk.jfr.RecordingState;
29 import jdk.jfr.consumer.RecordedEvent;
30 import jdk.test.lib.Asserts;
31 import jdk.test.lib.jfr.Events;
32 import jdk.test.lib.jfr.SimpleEvent;
33
34 import java.util.List;
35
36 /**
37 * @test
38 * @summary A simple test for Recording.copy()
39 * @key jfr
40 * @requires vm.hasJFR
41 * @library /test/lib
42 * @run main/othervm jdk.jfr.api.recording.misc.TestRecordingCopy
43 */
44 public class TestRecordingCopy {
45
46 private static final int EVENT_ID = 1001;
47
48 public static void main(String[] args) throws Exception {
49
50 Recording original = new Recording();
51 original.enable(SimpleEvent.class);
52
53 Recording newCopy = original.copy(false);
54 Asserts.assertEquals(newCopy.getState(), RecordingState.NEW);
55
56 Recording newStoppedCopy = original.copy(true);
57 Asserts.assertEquals(newStoppedCopy.getState(), RecordingState.NEW);
58
59 original.start();
60
|