test/jdk/jdk/jfr/api/consumer/streaming/TestUnstarted.java
author mseledtsov
Tue, 10 Sep 2019 09:21:23 -0700
branchJEP-349-branch
changeset 58076 ca625d28c580
parent 57755 8173090d2794
permissions -rw-r--r--
JEP-349-branch: fixes to copyright headers
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
58076
ca625d28c580 JEP-349-branch: fixes to copyright headers
mseledtsov
parents: 57755
diff changeset
     1
/*
ca625d28c580 JEP-349-branch: fixes to copyright headers
mseledtsov
parents: 57755
diff changeset
     2
 * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
ca625d28c580 JEP-349-branch: fixes to copyright headers
mseledtsov
parents: 57755
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ca625d28c580 JEP-349-branch: fixes to copyright headers
mseledtsov
parents: 57755
diff changeset
     4
 *
ca625d28c580 JEP-349-branch: fixes to copyright headers
mseledtsov
parents: 57755
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
ca625d28c580 JEP-349-branch: fixes to copyright headers
mseledtsov
parents: 57755
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
ca625d28c580 JEP-349-branch: fixes to copyright headers
mseledtsov
parents: 57755
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
ca625d28c580 JEP-349-branch: fixes to copyright headers
mseledtsov
parents: 57755
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
ca625d28c580 JEP-349-branch: fixes to copyright headers
mseledtsov
parents: 57755
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
ca625d28c580 JEP-349-branch: fixes to copyright headers
mseledtsov
parents: 57755
diff changeset
    10
 *
ca625d28c580 JEP-349-branch: fixes to copyright headers
mseledtsov
parents: 57755
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
ca625d28c580 JEP-349-branch: fixes to copyright headers
mseledtsov
parents: 57755
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ca625d28c580 JEP-349-branch: fixes to copyright headers
mseledtsov
parents: 57755
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
ca625d28c580 JEP-349-branch: fixes to copyright headers
mseledtsov
parents: 57755
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
ca625d28c580 JEP-349-branch: fixes to copyright headers
mseledtsov
parents: 57755
diff changeset
    15
 * accompanied this code).
ca625d28c580 JEP-349-branch: fixes to copyright headers
mseledtsov
parents: 57755
diff changeset
    16
 *
ca625d28c580 JEP-349-branch: fixes to copyright headers
mseledtsov
parents: 57755
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
ca625d28c580 JEP-349-branch: fixes to copyright headers
mseledtsov
parents: 57755
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
ca625d28c580 JEP-349-branch: fixes to copyright headers
mseledtsov
parents: 57755
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ca625d28c580 JEP-349-branch: fixes to copyright headers
mseledtsov
parents: 57755
diff changeset
    20
 *
ca625d28c580 JEP-349-branch: fixes to copyright headers
mseledtsov
parents: 57755
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ca625d28c580 JEP-349-branch: fixes to copyright headers
mseledtsov
parents: 57755
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
ca625d28c580 JEP-349-branch: fixes to copyright headers
mseledtsov
parents: 57755
diff changeset
    23
 * questions.
ca625d28c580 JEP-349-branch: fixes to copyright headers
mseledtsov
parents: 57755
diff changeset
    24
 */
ca625d28c580 JEP-349-branch: fixes to copyright headers
mseledtsov
parents: 57755
diff changeset
    25
57755
8173090d2794 Test streaming without repository being created
egahlin
parents:
diff changeset
    26
package jdk.jfr.api.consumer.streaming;
8173090d2794 Test streaming without repository being created
egahlin
parents:
diff changeset
    27
8173090d2794 Test streaming without repository being created
egahlin
parents:
diff changeset
    28
import jdk.jfr.consumer.EventStream;
8173090d2794 Test streaming without repository being created
egahlin
parents:
diff changeset
    29
8173090d2794 Test streaming without repository being created
egahlin
parents:
diff changeset
    30
/**
8173090d2794 Test streaming without repository being created
egahlin
parents:
diff changeset
    31
 * @test
58076
ca625d28c580 JEP-349-branch: fixes to copyright headers
mseledtsov
parents: 57755
diff changeset
    32
 * @summary Verifies that it is possible to open a stream when a repository doesn't
57755
8173090d2794 Test streaming without repository being created
egahlin
parents:
diff changeset
    33
 *          exists
8173090d2794 Test streaming without repository being created
egahlin
parents:
diff changeset
    34
 * @key jfr
8173090d2794 Test streaming without repository being created
egahlin
parents:
diff changeset
    35
 * @requires vm.hasJFR
8173090d2794 Test streaming without repository being created
egahlin
parents:
diff changeset
    36
 * @library /test/lib
8173090d2794 Test streaming without repository being created
egahlin
parents:
diff changeset
    37
 * @run main/othervm jdk.jfr.api.consumer.streaming.TestUnstarted
8173090d2794 Test streaming without repository being created
egahlin
parents:
diff changeset
    38
 */
8173090d2794 Test streaming without repository being created
egahlin
parents:
diff changeset
    39
public class TestUnstarted {
8173090d2794 Test streaming without repository being created
egahlin
parents:
diff changeset
    40
    public static void main(String... args) throws Exception {
8173090d2794 Test streaming without repository being created
egahlin
parents:
diff changeset
    41
        try (EventStream es = EventStream.openRepository()) {
8173090d2794 Test streaming without repository being created
egahlin
parents:
diff changeset
    42
            es.onEvent(e -> {
8173090d2794 Test streaming without repository being created
egahlin
parents:
diff changeset
    43
                // ignore
8173090d2794 Test streaming without repository being created
egahlin
parents:
diff changeset
    44
            });
8173090d2794 Test streaming without repository being created
egahlin
parents:
diff changeset
    45
            es.startAsync();
8173090d2794 Test streaming without repository being created
egahlin
parents:
diff changeset
    46
        }
8173090d2794 Test streaming without repository being created
egahlin
parents:
diff changeset
    47
    }
8173090d2794 Test streaming without repository being created
egahlin
parents:
diff changeset
    48
}