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.io.IOException;
29 import java.nio.file.Files;
30 import java.nio.file.Path;
31 import java.nio.file.Paths;
32
33 import jdk.jfr.Recording;
34 import jdk.jfr.consumer.RecordingFile;
35 import jdk.test.lib.Asserts;
36 import jdk.test.lib.jfr.CommonHelper;
37 import jdk.test.lib.jfr.EventNames;
38 import jdk.test.lib.jfr.VoidFunction;
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.TestDumpInvalid
46 */
47 public class TestDumpInvalid {
48
49 public static void main(String[] args) throws Throwable {
50 Recording r = new Recording();
51 r.enable(EventNames.OSInformation);
52 r.start();
53 r.stop();
54
55 verifyNullPointer(()->{r.dump(null);}, "No NullPointerException");
56
57 Path pathNotExists = Paths.get(".", "dirNotExists", "my.jfr");
58 verifyFileNotFound(()->{r.dump(pathNotExists);}, "No Exception with missing dir");
59
60 Path pathEmpty = Paths.get("");
61 verifyFileNotFound(()->{r.dump(pathEmpty);}, "No Exception with empty path");
62
63 Path pathDir = Paths.get(".", "newdir");
|
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.io.IOException;
29 import java.nio.file.Files;
30 import java.nio.file.Path;
31 import java.nio.file.Paths;
32
33 import jdk.jfr.Recording;
34 import jdk.jfr.consumer.RecordingFile;
35 import jdk.test.lib.Asserts;
36 import jdk.test.lib.jfr.CommonHelper;
37 import jdk.test.lib.jfr.EventNames;
38 import jdk.test.lib.jfr.VoidFunction;
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.TestDumpInvalid
47 */
48 public class TestDumpInvalid {
49
50 public static void main(String[] args) throws Throwable {
51 Recording r = new Recording();
52 r.enable(EventNames.OSInformation);
53 r.start();
54 r.stop();
55
56 verifyNullPointer(()->{r.dump(null);}, "No NullPointerException");
57
58 Path pathNotExists = Paths.get(".", "dirNotExists", "my.jfr");
59 verifyFileNotFound(()->{r.dump(pathNotExists);}, "No Exception with missing dir");
60
61 Path pathEmpty = Paths.get("");
62 verifyFileNotFound(()->{r.dump(pathEmpty);}, "No Exception with empty path");
63
64 Path pathDir = Paths.get(".", "newdir");
|