14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
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.metadata.annotations;
27
28 import jdk.jfr.Event;
29 import jdk.jfr.EventType;
30 import jdk.jfr.Threshold;
31 import jdk.test.lib.Asserts;
32 import jdk.test.lib.jfr.Events;
33
34 /*
35 * @test
36 * @key jfr
37 * @library /test/lib
38 * @run main/othervm jdk.jfr.api.metadata.annotations.TestThreshold
39 */
40 public class TestThreshold {
41
42 @Threshold("23 s")
43 static class PeriodicEvent extends Event {
44 }
45
46 public static void main(String[] args) throws Exception {
47 EventType thresholdEvent = EventType.getEventType(PeriodicEvent.class);
48 String defaultValue = Events.getSetting(thresholdEvent,Threshold.NAME).getDefaultValue();
49 Asserts.assertEquals(defaultValue, "23 s", "@Threshold(\"23 s\") Should result in threshold '23 s'");
50 }
51 }
|
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
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.metadata.annotations;
27
28 import jdk.jfr.Event;
29 import jdk.jfr.EventType;
30 import jdk.jfr.Threshold;
31 import jdk.test.lib.Asserts;
32 import jdk.test.lib.jfr.Events;
33
34 /**
35 * @test
36 * @key jfr
37 * @requires vm.hasJFR
38 * @library /test/lib
39 * @run main/othervm jdk.jfr.api.metadata.annotations.TestThreshold
40 */
41 public class TestThreshold {
42
43 @Threshold("23 s")
44 static class PeriodicEvent extends Event {
45 }
46
47 public static void main(String[] args) throws Exception {
48 EventType thresholdEvent = EventType.getEventType(PeriodicEvent.class);
49 String defaultValue = Events.getSetting(thresholdEvent,Threshold.NAME).getDefaultValue();
50 Asserts.assertEquals(defaultValue, "23 s", "@Threshold(\"23 s\") Should result in threshold '23 s'");
51 }
52 }
|