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.event;
27
28 import java.io.IOException;
29 import java.util.List;
30
31 import jdk.jfr.Event;
32 import jdk.jfr.EventType;
33 import jdk.jfr.FlightRecorder;
34 import jdk.jfr.Recording;
35 import jdk.jfr.Registered;
36 import jdk.jfr.consumer.RecordedEvent;
37 import jdk.test.lib.Asserts;
38 import jdk.test.lib.jfr.Events;
39
40 /*
41 * @test
42 * @summary Test enable/disable event and verify recording has expected events.
43 * @key jfr
44 * @library /test/lib
45 * @run main/othervm jdk.jfr.api.event.TestClinitRegistration
46 */
47
48 public class TestClinitRegistration {
49
50 public static void main(String[] args) throws Exception {
51 // Test basic registration with or without auto registration
52 assertClinitRegister(AutoRegisteredEvent.class, true, false);
53 assertClinitRegister(NotAutoRegisterededEvent.class, false, false);
54 assertClinitRegister(AutoRegisteredUserClinit.class, true, true);
55 assertClinitRegister(NotAutoRegisteredUserClinit.class, false, true);
56
57 // Test complex <clinit>
58 assertClinitRegister(ComplexClInit.class, true, true);
59
60 // Test hierarchy
61 assertClinitRegister(DerivedClinit.class, true, true);
62 if (!isClinitExecuted(Base.class)) {
63 Asserts.fail("Expected <clinit> of base class to be executed");
|
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.event;
27
28 import java.io.IOException;
29 import java.util.List;
30
31 import jdk.jfr.Event;
32 import jdk.jfr.EventType;
33 import jdk.jfr.FlightRecorder;
34 import jdk.jfr.Recording;
35 import jdk.jfr.Registered;
36 import jdk.jfr.consumer.RecordedEvent;
37 import jdk.test.lib.Asserts;
38 import jdk.test.lib.jfr.Events;
39
40 /**
41 * @test
42 * @summary Test enable/disable event and verify recording has expected events.
43 * @key jfr
44 * @requires vm.hasJFR
45 * @library /test/lib
46 * @run main/othervm jdk.jfr.api.event.TestClinitRegistration
47 */
48
49 public class TestClinitRegistration {
50
51 public static void main(String[] args) throws Exception {
52 // Test basic registration with or without auto registration
53 assertClinitRegister(AutoRegisteredEvent.class, true, false);
54 assertClinitRegister(NotAutoRegisterededEvent.class, false, false);
55 assertClinitRegister(AutoRegisteredUserClinit.class, true, true);
56 assertClinitRegister(NotAutoRegisteredUserClinit.class, false, true);
57
58 // Test complex <clinit>
59 assertClinitRegister(ComplexClInit.class, true, true);
60
61 // Test hierarchy
62 assertClinitRegister(DerivedClinit.class, true, true);
63 if (!isClinitExecuted(Base.class)) {
64 Asserts.fail("Expected <clinit> of base class to be executed");
|