1 /*
2 * Copyright (c) 2013, 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 javax.management.MBeanNotificationInfo;
25 import javax.management.modelmbean.DescriptorSupport;
26 import javax.management.openmbean.OpenMBeanAttributeInfo;
27 import javax.management.openmbean.OpenMBeanAttributeInfoSupport;
28 import javax.management.openmbean.OpenMBeanConstructorInfo;
29 import javax.management.openmbean.OpenMBeanConstructorInfoSupport;
30 import javax.management.openmbean.OpenMBeanInfo;
31 import javax.management.openmbean.OpenMBeanInfoSupport;
32 import javax.management.openmbean.OpenMBeanOperationInfo;
33 import javax.management.openmbean.OpenMBeanOperationInfoSupport;
34 import javax.management.openmbean.OpenMBeanParameterInfo;
35 import javax.management.openmbean.OpenMBeanParameterInfoSupport;
36 import javax.management.openmbean.SimpleType;
37
38 /*
39 * @test
40 * @bug 8023529
41 * @summary Test that OpenMBean*Info.hashCode do not throw NPE
42 * @author Shanliang JIANG
43 * @run clean OpenMBeanInfoHashCodeNPETest
44 * @run build OpenMBeanInfoHashCodeNPETest
45 * @run main OpenMBeanInfoHashCodeNPETest
46 */
47 public class OpenMBeanInfoHashCodeNPETest {
48 private static int failed = 0;
49
50 public static void main(String[] args) throws Exception {
51 System.out.println("---OpenMBeanInfoHashCodeNPETest-main ...");
52
53 // ----
54 System.out.println("\n---Testing on OpenMBeanInfohashCodeTest...");
55 OpenMBeanAttributeInfo openMBeanAttributeInfo = new OpenMBeanAttributeInfoSupport(
56 "name", "description", SimpleType.INTEGER, true, true, false, null, new Integer[]{1, 2, 3});
57 test(openMBeanAttributeInfo, "defaultValue");
58
59 openMBeanAttributeInfo = new OpenMBeanAttributeInfoSupport(
60 "name", "description", SimpleType.INTEGER, true, true, false, 1, null);
61 test(openMBeanAttributeInfo, "legalValues");
62
|
1 /*
2 * Copyright (c) 2013, 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 javax.management.MBeanNotificationInfo;
25 import javax.management.modelmbean.DescriptorSupport;
26 import javax.management.openmbean.OpenMBeanAttributeInfo;
27 import javax.management.openmbean.OpenMBeanAttributeInfoSupport;
28 import javax.management.openmbean.OpenMBeanConstructorInfo;
29 import javax.management.openmbean.OpenMBeanConstructorInfoSupport;
30 import javax.management.openmbean.OpenMBeanInfo;
31 import javax.management.openmbean.OpenMBeanInfoSupport;
32 import javax.management.openmbean.OpenMBeanOperationInfo;
33 import javax.management.openmbean.OpenMBeanOperationInfoSupport;
34 import javax.management.openmbean.OpenMBeanParameterInfo;
35 import javax.management.openmbean.OpenMBeanParameterInfoSupport;
36 import javax.management.openmbean.SimpleType;
37
38 /*
39 * @test
40 * @bug 8023529
41 * @summary Test that OpenMBean*Info.hashCode do not throw NPE
42 * @author Shanliang JIANG
43 * @modules java.management
44 * @run clean OpenMBeanInfoHashCodeNPETest
45 * @run build OpenMBeanInfoHashCodeNPETest
46 * @run main OpenMBeanInfoHashCodeNPETest
47 */
48 public class OpenMBeanInfoHashCodeNPETest {
49 private static int failed = 0;
50
51 public static void main(String[] args) throws Exception {
52 System.out.println("---OpenMBeanInfoHashCodeNPETest-main ...");
53
54 // ----
55 System.out.println("\n---Testing on OpenMBeanInfohashCodeTest...");
56 OpenMBeanAttributeInfo openMBeanAttributeInfo = new OpenMBeanAttributeInfoSupport(
57 "name", "description", SimpleType.INTEGER, true, true, false, null, new Integer[]{1, 2, 3});
58 test(openMBeanAttributeInfo, "defaultValue");
59
60 openMBeanAttributeInfo = new OpenMBeanAttributeInfoSupport(
61 "name", "description", SimpleType.INTEGER, true, true, false, 1, null);
62 test(openMBeanAttributeInfo, "legalValues");
63
|