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.util.HashMap;
25 import java.util.Map;
26 import javax.management.openmbean.ArrayType;
27 import javax.management.openmbean.CompositeData;
28 import javax.management.openmbean.CompositeDataSupport;
29 import javax.management.openmbean.CompositeType;
30 import javax.management.openmbean.OpenDataException;
31 import javax.management.openmbean.OpenType;
32 import javax.management.openmbean.SimpleType;
33 import sun.management.LazyCompositeData;
34
35 /**
36 * @test
37 * @bug 8139870
38 * @summary sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
39 * @modules java.management/sun.management
40 * @author Jaroslav Bachorik
41 */
42
43 public class LazyCompositeDataTest {
44 private final static CompositeData dataV1, dataV2;
45
46 static {
47 try {
48 // ***
49 // prepare the composite types
50
51 // composite type stored in an array; V1
52 CompositeType subtypeV1 = new CompositeType(
53 "Subtype1",
54 "Version 1",
55 new String[]{"item1"},
56 new String[]{"Item 1"},
57 new OpenType<?>[]{
58 SimpleType.STRING
59 }
144
145 }
146
147 public static void main(String[] args) throws Exception {
148 System.out.println("Checking LazyCompositeData.isTypeMatched()");
149 MyDataV1 v1 = new MyDataV1();
150 MyDataV2 v2 = new MyDataV2();
151
152 if (!v1.isTypeMached(v2.getCompositeType())) {
153 System.err.println("=== FAILED");
154 System.err.println("V1 should be matched by V2");
155 System.err.println("\n=== V1");
156 System.err.println(v1.getCompositeType());
157 System.err.println("\n=== V2");
158 System.err.println(v2.getCompositeType());
159 throw new Error();
160 }
161 System.out.println("=== PASSED");
162 }
163 }
|
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.util.HashMap;
25 import java.util.Map;
26 import javax.management.openmbean.ArrayType;
27 import javax.management.openmbean.CompositeData;
28 import javax.management.openmbean.CompositeDataSupport;
29 import javax.management.openmbean.CompositeType;
30 import javax.management.openmbean.OpenDataException;
31 import javax.management.openmbean.OpenType;
32 import javax.management.openmbean.SimpleType;
33 import sun.management.LazyCompositeData;
34
35 /**
36 * @test
37 * @bug 8139870
38 * @summary sun.management.LazyCompositeData.isTypeMatched() fails for composite types with items of ArrayType
39 * @author Jaroslav Bachorik
40 */
41
42 public class LazyCompositeDataTest {
43 private final static CompositeData dataV1, dataV2;
44
45 static {
46 try {
47 // ***
48 // prepare the composite types
49
50 // composite type stored in an array; V1
51 CompositeType subtypeV1 = new CompositeType(
52 "Subtype1",
53 "Version 1",
54 new String[]{"item1"},
55 new String[]{"Item 1"},
56 new OpenType<?>[]{
57 SimpleType.STRING
58 }
143
144 }
145
146 public static void main(String[] args) throws Exception {
147 System.out.println("Checking LazyCompositeData.isTypeMatched()");
148 MyDataV1 v1 = new MyDataV1();
149 MyDataV2 v2 = new MyDataV2();
150
151 if (!v1.isTypeMached(v2.getCompositeType())) {
152 System.err.println("=== FAILED");
153 System.err.println("V1 should be matched by V2");
154 System.err.println("\n=== V1");
155 System.err.println(v1.getCompositeType());
156 System.err.println("\n=== V2");
157 System.err.println(v2.getCompositeType());
158 throw new Error();
159 }
160 System.out.println("=== PASSED");
161 }
162 }
163
|