22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25 package jdk.jfr.api.recording.settings;
26
27 import java.io.IOException;
28 import java.nio.file.Path;
29 import java.nio.file.Paths;
30 import java.util.HashMap;
31 import java.util.HashSet;
32 import java.util.Map;
33 import java.util.Set;
34
35 import jdk.jfr.EventType;
36 import jdk.jfr.FlightRecorder;
37 import jdk.jfr.Recording;
38 import jdk.jfr.SettingDescriptor;
39 import jdk.jfr.consumer.RecordingFile;
40 import jdk.test.lib.jfr.EventNames;
41
42 /*
43 * @test
44 * @summary Verifies that event types has the correct type of settings
45 * @key jfr
46 * @library /test/lib
47 * @run main/othervm jdk.jfr.api.recording.settings.TestSettingsAvailability
48 */
49 public class TestSettingsAvailability {
50 public static void main(String[] args) throws Throwable {
51 testKnownSettings();
52 testSettingPersistence();
53 }
54
55 private static void testSettingPersistence() throws IOException, Exception {
56 Map<String, EventType> inMemoryTypes = new HashMap<>();
57 for (EventType type : FlightRecorder.getFlightRecorder().getEventTypes()) {
58 inMemoryTypes.put(type.getName(), type);
59 }
60
61 Path p = Paths.get("recording.jfr");
62 try (Recording r = new Recording()) {
63 r.start();
64 r.stop();
65 r.dump(p);
|
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25 package jdk.jfr.api.recording.settings;
26
27 import java.io.IOException;
28 import java.nio.file.Path;
29 import java.nio.file.Paths;
30 import java.util.HashMap;
31 import java.util.HashSet;
32 import java.util.Map;
33 import java.util.Set;
34
35 import jdk.jfr.EventType;
36 import jdk.jfr.FlightRecorder;
37 import jdk.jfr.Recording;
38 import jdk.jfr.SettingDescriptor;
39 import jdk.jfr.consumer.RecordingFile;
40 import jdk.test.lib.jfr.EventNames;
41
42 /**
43 * @test
44 * @summary Verifies that event types has the correct type of settings
45 * @key jfr
46 * @requires vm.hasJFR
47 * @library /test/lib
48 * @run main/othervm jdk.jfr.api.recording.settings.TestSettingsAvailability
49 */
50 public class TestSettingsAvailability {
51 public static void main(String[] args) throws Throwable {
52 testKnownSettings();
53 testSettingPersistence();
54 }
55
56 private static void testSettingPersistence() throws IOException, Exception {
57 Map<String, EventType> inMemoryTypes = new HashMap<>();
58 for (EventType type : FlightRecorder.getFlightRecorder().getEventTypes()) {
59 inMemoryTypes.put(type.getName(), type);
60 }
61
62 Path p = Paths.get("recording.jfr");
63 try (Recording r = new Recording()) {
64 r.start();
65 r.stop();
66 r.dump(p);
|