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
26 package jdk.jfr.api.recording.dump;
27
28 import java.nio.file.Files;
29 import java.nio.file.Path;
30 import java.nio.file.Paths;
31 import java.util.List;
32
33 import jdk.jfr.Recording;
34 import jdk.jfr.consumer.RecordedEvent;
35 import jdk.jfr.consumer.RecordingFile;
36 import jdk.test.lib.Asserts;
37 import jdk.test.lib.jfr.EventNames;
38 import jdk.test.lib.jfr.FileHelper;
39
40 /*
41 * @test
42 * @summary Test copyTo and parse file
43 * @key jfr
44 * @library /test/lib
45 * @run main/othervm jdk.jfr.api.recording.dump.TestDumpLongPath
46 */
47 public class TestDumpLongPath {
48
49 public static void main(String[] args) throws Exception {
50 Recording r = new Recording();
51 final String eventPath = EventNames.OSInformation;
52 r.enable(eventPath);
53 r.start();
54 r.stop();
55
56 Path dir = FileHelper.createLongDir(Paths.get("."));
57 Path path = Paths.get(dir.toString(), "my.jfr");
58 r.dump(path);
59 r.close();
60
61 Asserts.assertTrue(Files.exists(path), "Recording file does not exist: " + path);
62 List<RecordedEvent> events = RecordingFile.readAllEvents(path);
63 Asserts.assertFalse(events.isEmpty(), "No events found");
|
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
26 package jdk.jfr.api.recording.dump;
27
28 import java.nio.file.Files;
29 import java.nio.file.Path;
30 import java.nio.file.Paths;
31 import java.util.List;
32
33 import jdk.jfr.Recording;
34 import jdk.jfr.consumer.RecordedEvent;
35 import jdk.jfr.consumer.RecordingFile;
36 import jdk.test.lib.Asserts;
37 import jdk.test.lib.jfr.EventNames;
38 import jdk.test.lib.jfr.FileHelper;
39
40 /**
41 * @test
42 * @summary Test copyTo and parse file
43 * @key jfr
44 * @requires vm.hasJFR
45 * @library /test/lib
46 * @run main/othervm jdk.jfr.api.recording.dump.TestDumpLongPath
47 */
48 public class TestDumpLongPath {
49
50 public static void main(String[] args) throws Exception {
51 Recording r = new Recording();
52 final String eventPath = EventNames.OSInformation;
53 r.enable(eventPath);
54 r.start();
55 r.stop();
56
57 Path dir = FileHelper.createLongDir(Paths.get("."));
58 Path path = Paths.get(dir.toString(), "my.jfr");
59 r.dump(path);
60 r.close();
61
62 Asserts.assertTrue(Files.exists(path), "Recording file does not exist: " + path);
63 List<RecordedEvent> events = RecordingFile.readAllEvents(path);
64 Asserts.assertFalse(events.isEmpty(), "No events found");
|