1 /*
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 import java.lang.reflect.Method;
25 import java.util.HashMap;
26 import java.util.Map;
27 import javax.management.loading.MLet;
28 import org.testng.annotations.Test;
29 import org.testng.annotations.BeforeClass;
30 import org.testng.annotations.BeforeTest;
31
32 import static org.testng.Assert.*;
33
34 /*
35 * @test
36 * @bug 8058089
37 * @summary Tests various internal functions provided by MLet for correctness
38 * @author Jaroslav Bachorik
39 * @run testng MLetInternalsTest
40 */
41 public class MLetInternalsTest {
42 private final static String CONSTRUCT_PARAMETER = "constructParameter";
43
44 private final static Map<String, Method> testedMethods = new HashMap<>();
45
46 @BeforeClass
47 public static void setupClass() {
48 testedMethods.clear();
49 try {
50 Method m = MLet.class.getDeclaredMethod(
51 CONSTRUCT_PARAMETER,
52 String.class, String.class
53 );
54 m.setAccessible(true);
55
56 testedMethods.put(CONSTRUCT_PARAMETER, m);
57 } catch (Exception ex) {
58 throw new Error(ex);
|
1 /*
2 * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 import java.lang.reflect.Method;
25 import java.util.HashMap;
26 import java.util.Map;
27 import javax.management.loading.MLet;
28 import org.testng.annotations.Test;
29 import org.testng.annotations.BeforeClass;
30 import org.testng.annotations.BeforeTest;
31
32 import static org.testng.Assert.*;
33
34 /*
35 * @test
36 * @bug 8058089
37 * @summary Tests various internal functions provided by MLet for correctness
38 * @author Jaroslav Bachorik
39 * @modules java.management
40 * @run testng MLetInternalsTest
41 */
42 public class MLetInternalsTest {
43 private final static String CONSTRUCT_PARAMETER = "constructParameter";
44
45 private final static Map<String, Method> testedMethods = new HashMap<>();
46
47 @BeforeClass
48 public static void setupClass() {
49 testedMethods.clear();
50 try {
51 Method m = MLet.class.getDeclaredMethod(
52 CONSTRUCT_PARAMETER,
53 String.class, String.class
54 );
55 m.setAccessible(true);
56
57 testedMethods.put(CONSTRUCT_PARAMETER, m);
58 } catch (Exception ex) {
59 throw new Error(ex);
|