Test streaming without repository being created JEP-349-branch
authoregahlin
Thu, 15 Aug 2019 03:00:02 +0200
branchJEP-349-branch
changeset 57755 8173090d2794
parent 57754 5693904ecbde
child 57780 d8a436dfa041
Test streaming without repository being created
test/jdk/jdk/jfr/api/consumer/streaming/TestUnstarted.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestUnstarted.java	Thu Aug 15 03:00:02 2019 +0200
@@ -0,0 +1,23 @@
+package jdk.jfr.api.consumer.streaming;
+
+import jdk.jfr.consumer.EventStream;
+
+/**
+ * @test
+ * @summary Verifies that is possible to open a stream when a repository doesn't
+ *          exists
+ * @key jfr
+ * @requires vm.hasJFR
+ * @library /test/lib
+ * @run main/othervm jdk.jfr.api.consumer.streaming.TestUnstarted
+ */
+public class TestUnstarted {
+    public static void main(String... args) throws Exception {
+        try (EventStream es = EventStream.openRepository()) {
+            es.onEvent(e -> {
+                // ignore
+            });
+            es.startAsync();
+        }
+    }
+}