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.MBeanAttributeInfo;
25 import javax.management.MBeanConstructorInfo;
26 import javax.management.MBeanFeatureInfo;
27 import javax.management.MBeanInfo;
28 import javax.management.MBeanNotificationInfo;
29 import javax.management.MBeanOperationInfo;
30 import javax.management.MBeanParameterInfo;
31 import javax.management.modelmbean.DescriptorSupport;
32 import javax.management.openmbean.SimpleType;
33
34 /*
35 * @test
36 * @bug 8023954
37 * @summary Test that MBean*Info.equals do not throw NPE
38 * @author Shanliang JIANG
39 * @run clean MBeanInfoEqualsNPETest
40 * @run build MBeanInfoEqualsNPETest
41 * @run main MBeanInfoEqualsNPETest
42 */
43 public class MBeanInfoEqualsNPETest {
44 private static int failed = 0;
45
46 public static void main(String[] args) throws Exception {
47 System.out.println("---MBeanInfoEqualsNPETest-main ...");
48
49 // ----
50 System.out.println("\n---Testing on MBeanAttributeInfo...");
51 MBeanAttributeInfo mbeanAttributeInfo0 = new MBeanAttributeInfo(
52 "name", SimpleType.INTEGER.getClassName(), "description", true, true, false);
53 MBeanAttributeInfo mbeanAttributeInfo = new MBeanAttributeInfo(
54 null, SimpleType.INTEGER.getClassName(), "description", true, true, false);
55 test(mbeanAttributeInfo0, mbeanAttributeInfo, "class name");
56
57 mbeanAttributeInfo = new MBeanAttributeInfo(
58 "name", null, "description", true, true, false);
|
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.MBeanAttributeInfo;
25 import javax.management.MBeanConstructorInfo;
26 import javax.management.MBeanFeatureInfo;
27 import javax.management.MBeanInfo;
28 import javax.management.MBeanNotificationInfo;
29 import javax.management.MBeanOperationInfo;
30 import javax.management.MBeanParameterInfo;
31 import javax.management.modelmbean.DescriptorSupport;
32 import javax.management.openmbean.SimpleType;
33
34 /*
35 * @test
36 * @bug 8023954
37 * @summary Test that MBean*Info.equals do not throw NPE
38 * @author Shanliang JIANG
39 * @modules java.management
40 * @run clean MBeanInfoEqualsNPETest
41 * @run build MBeanInfoEqualsNPETest
42 * @run main MBeanInfoEqualsNPETest
43 */
44 public class MBeanInfoEqualsNPETest {
45 private static int failed = 0;
46
47 public static void main(String[] args) throws Exception {
48 System.out.println("---MBeanInfoEqualsNPETest-main ...");
49
50 // ----
51 System.out.println("\n---Testing on MBeanAttributeInfo...");
52 MBeanAttributeInfo mbeanAttributeInfo0 = new MBeanAttributeInfo(
53 "name", SimpleType.INTEGER.getClassName(), "description", true, true, false);
54 MBeanAttributeInfo mbeanAttributeInfo = new MBeanAttributeInfo(
55 null, SimpleType.INTEGER.getClassName(), "description", true, true, false);
56 test(mbeanAttributeInfo0, mbeanAttributeInfo, "class name");
57
58 mbeanAttributeInfo = new MBeanAttributeInfo(
59 "name", null, "description", true, true, false);
|