test/jdk/jdk/jfr/api/consumer/TestRecordingFile.java
changeset 58863 c16ac7a2eba4
parent 51214 67736b4846a0
equal deleted inserted replaced
58861:2c3cc4b01880 58863:c16ac7a2eba4
     1 /*
     1 /*
     2  * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    53  * @test
    53  * @test
    54  * @summary Verifies that all methods in RecordingFIle are working
    54  * @summary Verifies that all methods in RecordingFIle are working
    55  * @key jfr
    55  * @key jfr
    56  * @requires vm.hasJFR
    56  * @requires vm.hasJFR
    57  * @library /test/lib
    57  * @library /test/lib
    58  * @run main/othervm jdk.jfr.api.consumer.TestRecordingFile
    58  * @run main/othervm -Xlog:jfr*=info jdk.jfr.api.consumer.TestRecordingFile
    59  */
    59  */
    60 public class TestRecordingFile {
    60 public class TestRecordingFile {
    61 
    61 
    62     static class TestEvent1 extends Event {
    62     static class TestEvent1 extends Event {
    63     }
    63     }
   208            assertUniqueEventTypes(types);
   208            assertUniqueEventTypes(types);
   209            assertHasEventType(types, "Event1");
   209            assertHasEventType(types, "Event1");
   210            assertHasEventType(types, "Event2");
   210            assertHasEventType(types, "Event2");
   211            assertMissingEventType(types, "Event3");
   211            assertMissingEventType(types, "Event3");
   212        }
   212        }
   213        try (RecordingFile f = new RecordingFile(twoEventTypes)) {
   213        try (RecordingFile f = new RecordingFile(threeEventTypes)) {
   214            List<EventType> types = f.readEventTypes();
   214            List<EventType> types = f.readEventTypes();
   215            assertUniqueEventTypes(types);
   215            assertUniqueEventTypes(types);
   216            assertHasEventType(types, "Event1");
   216            assertHasEventType(types, "Event1");
   217            assertHasEventType(types, "Event2");
   217            assertHasEventType(types, "Event2");
   218            assertMissingEventType(types, "Event3");
   218            assertHasEventType(types, "Event3");
   219        }
   219        }
   220 
   220 
   221     }
   221     }
   222 
   222 
   223     private static void assertMissingEventType(List<EventType> types,String name) throws Exception {
   223     private static void assertMissingEventType(List<EventType> types,String name) throws Exception {