KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > serialization > SerializeTestCase


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7
8 package test.serialization;
9
10 import java.io.ByteArrayInputStream;
11 import java.io.ByteArrayOutputStream;
12 import java.io.IOException;
13 import java.io.ObjectInputStream;
14 import java.io.ObjectOutputStream;
15 import java.lang.reflect.Array;
16 import java.lang.reflect.Constructor;
17 import java.lang.reflect.Method;
18 import java.util.ArrayList;
19 import java.util.List;
20
21 import junit.framework.TestCase;
22
23 /**
24  * Tests serialization with the RI
25  *
26  * @todo Proper equality tests instead of toString()
27  *
28  * @author <a HREF="mailto:Adrian.Brock@HappeningTimes.com">Adrian Brock</a>.
29  */

30 public class SerializeTestCase
31    extends TestCase
32 {
33    // Attributes ----------------------------------------------------------------
34

35    // Constructor ---------------------------------------------------------------
36

37    /**
38     * Construct the test
39     */

40    public SerializeTestCase(String s)
41    {
42       super(s);
43    }
44
45    public void testArrayType()
46       throws Exception
47    {
48       if (SerializationSUITE.form < 11)
49          return;
50       Class clazz = loadClass("javax.management.openmbean.SimpleType");
51       Object elementType = clazz.getField("BIGDECIMAL").get(null);
52       Object obj = instantiate(
53          "javax.management.openmbean.ArrayType",
54          new Class[] { Integer.TYPE,
55                        loadClass("javax.management.openmbean.OpenType") },
56          new Object[] { new Integer(3), elementType }
57       );
58       Object result = runTest(obj);
59       assertEquals(obj, result);
60    }
61
62    public void testAttribute()
63       throws Exception
64    {
65       Object obj = instantiate(
66          "javax.management.Attribute",
67          new Class[] { String.class, Object.class },
68          new Object[] { "name", "value" }
69       );
70       Object result = runTest(obj);
71       assertEquals(obj, result);
72    }
73
74    public void testAttributeChangeNotification()
75       throws Exception
76    {
77       Object obj = instantiate(
78          "javax.management.AttributeChangeNotification",
79          new Class[] { Object.class, Long.TYPE, Long.TYPE,
80                        String.class, String.class, String.class,
81                        Object.class, Object.class },
82          new Object[] { "source", new Long(1), new Long(2), "message", "name",
83                         "type", "old", "new" }
84       );
85       Object result = runTest(obj);
86       assertEquals(obj.toString(), result.toString());
87    }
88
89    public void testAttributeChangeNotificationFilter()
90       throws Exception
91    {
92       Object obj = instantiate(
93          "javax.management.AttributeChangeNotificationFilter",
94          new Class[0],
95          new Object[0]
96       );
97       Method method = obj.getClass().getMethod("enableAttribute",
98           new Class[] { String.class });
99       method.invoke(obj, new Object[] { "attribute" });
100       Object result = runTest(obj);
101       assertEquals(obj.toString(), result.toString());
102    }
103
104    public void testAttributeList()
105       throws Exception
106    {
107       Object obj = instantiate(
108          "javax.management.AttributeList",
109          new Class[0],
110          new Object[0]
111       );
112       Object attr = instantiate(
113          "javax.management.Attribute",
114          new Class[] { String.class, Object.class },
115          new Object[] { "name", "value" }
116       );
117       Method method = obj.getClass().getMethod("add",
118           new Class[] { attr.getClass() });
119       method.invoke(obj, new Object[] { attr });
120       Object result = runTest(obj);
121       assertEquals(obj.toString(), result.toString());
122    }
123
124    public void testAttributeNotFoundException()
125       throws Exception
126    {
127       Object obj = instantiate(
128          "javax.management.AttributeNotFoundException",
129          new Class[] { String.class },
130          new Object[] { "message" }
131       );
132       Object result = runTest(obj);
133       assertEquals(obj.toString(), result.toString());
134    }
135
136    public void testAttributeValueExp()
137       throws Exception
138    {
139       Object obj = instantiate(
140          "javax.management.AttributeValueExp",
141          new Class[] { String.class },
142          new Object[] { "attr" }
143       );
144       Object result = runTest(obj);
145       assertEquals(obj.toString(), result.toString());
146    }
147
148    public void testBadAttributeValueExpException()
149       throws Exception
150    {
151       Object obj = instantiate(
152          "javax.management.BadAttributeValueExpException",
153          new Class[] { Object.class },
154          new Object[] { "value" }
155       );
156       Object result = runTest(obj);
157       assertEquals(obj.toString(), result.toString());
158    }
159
160    public void testBadBinaryOpValueExpException()
161       throws Exception
162    {
163       Object exp = instantiate(
164          "javax.management.AttributeValueExp",
165          new Class[] { String.class },
166          new Object[] { "attr" }
167       );
168
169       Object obj = instantiate(
170          "javax.management.BadBinaryOpValueExpException",
171          new Class[] { loadClass("javax.management.ValueExp") },
172          new Object[] { exp }
173       );
174       Object result = runTest(obj);
175       assertEquals(obj.toString(), result.toString());
176    }
177
178    public void testBadStringOperationException()
179       throws Exception
180    {
181       Object obj = instantiate(
182          "javax.management.BadStringOperationException",
183          new Class[] { String.class },
184          new Object[] { "message" }
185       );
186       Object result = runTest(obj);
187       assertEquals(obj.toString(), result.toString());
188    }
189
190    public void testCompositeDataSupport()
191       throws Exception
192    {
193       if (SerializationSUITE.form < 11)
194          return;
195       Class clazz = loadClass("javax.management.openmbean.SimpleType");
196       Object openType = clazz.getField("STRING").get(null);
197
198       Class elementClass = loadClass("javax.management.openmbean.OpenType");
199       Object array = Array.newInstance(elementClass, 2);
200       Array.set(array, 0, openType);
201       Array.set(array, 1, openType);
202
203       Object compositeType = instantiate(
204          "javax.management.openmbean.CompositeType",
205          new Class[] { String.class, String.class, String[].class, String[].class, array.getClass() },
206          new Object[] { "typeName", "description", new String[] { "name1", "name2" },
207             new String[] { "desc1", "desc2" }, array }
208       );
209       Object obj = instantiate(
210          "javax.management.openmbean.CompositeDataSupport",
211          new Class[] { compositeType.getClass(), String[].class, Object[].class },
212          new Object[] { compositeType, new String[] { "name1", "name2" },
213             new Object[] { "itemValue1", "itemValue2" } }
214       );
215       Object result = runTest(obj);
216       assertEquals(obj, result);
217    }
218
219    public void testCompositeType()
220       throws Exception
221    {
222       if (SerializationSUITE.form < 11)
223          return;
224       Class clazz = loadClass("javax.management.openmbean.SimpleType");
225       Object openType = clazz.getField("STRING").get(null);
226
227       Class elementClass = loadClass("javax.management.openmbean.OpenType");
228       Object array = Array.newInstance(elementClass, 2);
229       Array.set(array, 0, openType);
230       Array.set(array, 1, openType);
231
232       Object obj = instantiate(
233          "javax.management.openmbean.CompositeType",
234          new Class[] { String.class, String.class, String[].class, String[].class, array.getClass() },
235          new Object[] { "typeName", "description", new String[] { "name1", "name2" },
236             new String[] { "desc1", "desc2" }, array }
237       );
238       Object result = runTest(obj);
239       assertEquals(obj, result);
240    }
241
242    public void testDescriptorSupport()
243       throws Exception
244    {
245       Object obj = instantiate(
246          "javax.management.modelmbean.DescriptorSupport",
247          new Class[] { new String[0].getClass(), new Object[0].getClass() },
248          new Object[] { new String[] { "name1", "name2"},
249                         new Object[] { "value1", "value2" } }
250       );
251       Object result = runTest(obj);
252       assertEquals(obj.toString(), result.toString());
253    }
254
255    public void testInstanceAlreadyExistsException()
256       throws Exception
257    {
258       Object obj = instantiate(
259          "javax.management.InstanceAlreadyExistsException",
260          new Class[] { String.class },
261          new Object[] { "message" }
262       );
263       Object result = runTest(obj);
264       assertEquals(obj.toString(), result.toString());
265    }
266
267    public void testInstanceNotFoundException()
268       throws Exception
269    {
270       Object obj = instantiate(
271          "javax.management.InstanceNotFoundException",
272          new Class[] { String.class },
273          new Object[] { "message" }
274       );
275       Object result = runTest(obj);
276       assertEquals(obj.toString(), result.toString());
277    }
278
279    public void testIntrospectionException()
280       throws Exception
281    {
282       Object obj = instantiate(
283          "javax.management.IntrospectionException",
284          new Class[] { String.class },
285          new Object[] { "message" }
286       );
287       Object result = runTest(obj);
288       assertEquals(obj.toString(), result.toString());
289    }
290
291    public void testInvalidApplicationException()
292       throws Exception
293    {
294       Object obj = instantiate(
295          "javax.management.InvalidApplicationException",
296          new Class[] { Object.class },
297          new Object[] { "value" }
298       );
299       Object result = runTest(obj);
300       assertEquals(obj.toString(), result.toString());
301    }
302
303    public void testInvalidAttributeValueException()
304       throws Exception
305    {
306       Object obj = instantiate(
307          "javax.management.InvalidAttributeValueException",
308          new Class[] { String.class },
309          new Object[] { "message" }
310       );
311       Object result = runTest(obj);
312       assertEquals(obj.toString(), result.toString());
313    }
314
315    public void testInvalidKeyException()
316       throws Exception
317    {
318       if (SerializationSUITE.form < 11)
319          return;
320       Object obj = instantiate(
321          "javax.management.openmbean.InvalidKeyException",
322          new Class[] { String.class },
323          new Object[] { "message" }
324       );
325       Object result = runTest(obj);
326       assertEquals(obj.toString(), result.toString());
327    }
328
329    public void testInvalidOpenTypeException()
330       throws Exception
331    {
332       if (SerializationSUITE.form < 11)
333          return;
334       Object obj = instantiate(
335          "javax.management.openmbean.InvalidOpenTypeException",
336          new Class[] { String.class },
337          new Object[] { "message" }
338       );
339       Object result = runTest(obj);
340       assertEquals(obj.toString(), result.toString());
341    }
342
343    public void testInvalidRelationIdException()
344       throws Exception
345    {
346       Object obj = instantiate(
347          "javax.management.relation.InvalidRelationIdException",
348          new Class[] { String.class },
349          new Object[] { "message" }
350       );
351       Object result = runTest(obj);
352       assertEquals(obj.toString(), result.toString());
353    }
354
355    public void testInvalidRelationServiceException()
356       throws Exception
357    {
358       Object obj = instantiate(
359          "javax.management.relation.InvalidRelationServiceException",
360          new Class[] { String.class },
361          new Object[] { "message" }
362       );
363       Object result = runTest(obj);
364       assertEquals(obj.toString(), result.toString());
365    }
366
367    public void testInvalidRelationTypeException()
368       throws Exception
369    {
370       Object obj = instantiate(
371          "javax.management.relation.InvalidRelationTypeException",
372          new Class[] { String.class },
373          new Object[] { "message" }
374       );
375       Object result = runTest(obj);
376       assertEquals(obj.toString(), result.toString());
377    }
378
379    public void testInvalidRoleInfoException()
380       throws Exception
381    {
382       Object obj = instantiate(
383          "javax.management.relation.InvalidRoleInfoException",
384          new Class[] { String.class },
385          new Object[] { "message" }
386       );
387       Object result = runTest(obj);
388       assertEquals(obj.toString(), result.toString());
389    }
390
391    public void testInvalidRoleValueException()
392       throws Exception
393    {
394       Object obj = instantiate(
395          "javax.management.relation.InvalidRoleValueException",
396          new Class[] { String.class },
397          new Object[] { "message" }
398       );
399       Object result = runTest(obj);
400       assertEquals(obj.toString(), result.toString());
401    }
402
403    public void testInvalidTargetObjectTypeException()
404       throws Exception
405    {
406       Object obj = instantiate(
407          "javax.management.modelmbean.InvalidTargetObjectTypeException",
408          new Class[] { Exception.class, String.class },
409          new Object[] { new Exception("exception"), "message" }
410       );
411       Object result = runTest(obj);
412       assertEquals(obj.toString(), result.toString());
413    }
414
415    public void testKeyAlreadyExistsException()
416       throws Exception
417    {
418       if (SerializationSUITE.form < 11)
419          return;
420       Object obj = instantiate(
421          "javax.management.openmbean.KeyAlreadyExistsException",
422          new Class[] { String.class },
423          new Object[] { "message" }
424       );
425       Object result = runTest(obj);
426       assertEquals(obj.toString(), result.toString());
427    }
428
429    public void testJMException()
430       throws Exception
431    {
432       Object obj = instantiate(
433          "javax.management.JMException",
434          new Class[] { String.class },
435          new Object[] { "message" }
436       );
437       Object result = runTest(obj);
438       assertEquals(obj.toString(), result.toString());
439    }
440
441    public void testJMRuntimeException()
442       throws Exception
443    {
444       Object obj = instantiate(
445          "javax.management.JMRuntimeException",
446          new Class[] { String.class },
447          new Object[] { "message" }
448       );
449       Object result = runTest(obj);
450       assertEquals(obj.toString(), result.toString());
451    }
452
453    public void testListenerNotFoundException()
454       throws Exception
455    {
456       Object obj = instantiate(
457          "javax.management.ListenerNotFoundException",
458          new Class[] { String.class },
459          new Object[] { "message" }
460       );
461       Object result = runTest(obj);
462       assertEquals(obj.toString(), result.toString());
463    }
464
465    public void testMalformedObjectNameException()
466       throws Exception
467    {
468       Object obj = instantiate(
469          "javax.management.MalformedObjectNameException",
470          new Class[] { String.class },
471          new Object[] { "message" }
472       );
473       Object result = runTest(obj);
474       assertEquals(obj.toString(), result.toString());
475    }
476
477    public void testMBeanAttributeInfo()
478       throws Exception
479    {
480       Object obj = instantiate(
481          "javax.management.MBeanAttributeInfo",
482          new Class[] { String.class, String.class, String.class,
483                        Boolean.TYPE, Boolean.TYPE, Boolean.TYPE },
484          new Object[] { "name", "type", "description", new Boolean(true),
485                         new Boolean(true), new Boolean(false)}
486       );
487       try
488       {
489          Object result = runTest(obj);
490          assertEquals(obj.toString(), result.toString());
491       }
492       catch (java.io.InvalidClassException e)
493       {
494          fail("FAILS IN RI 1.1: Wrong serialization for form 1.0");
495       }
496    }
497
498    public void testMBeanConstructorInfo()
499       throws Exception
500    {
501       Object parm = instantiate(
502          "javax.management.MBeanParameterInfo",
503          new Class[] { String.class, String.class, String.class },
504          new Object[] { "name", "type", "description" }
505       );
506       Object array = Array.newInstance(parm.getClass(), 1);
507       Array.set(array, 0, parm);
508       Object obj = instantiate(
509          "javax.management.MBeanConstructorInfo",
510          new Class[] { String.class, String.class, array.getClass() },
511          new Object[] { "name", "description", array }
512       );
513       Object result = runTest(obj);
514       assertEquals(obj.toString(), result.toString());
515    }
516
517    public void testMBeanException()
518       throws Exception
519    {
520       Object obj = instantiate(
521          "javax.management.MBeanException",
522          new Class[] { Exception.class, String.class },
523          new Object[] { new Exception("Cause"), "message" }
524       );
525       Object result = runTest(obj);
526       assertEquals(obj.toString(), result.toString());
527    }
528
529    public void testMBeanFeatureInfo()
530       throws Exception
531    {
532       Object obj = instantiate(
533          "javax.management.MBeanFeatureInfo",
534          new Class[] { String.class, String.class },
535          new Object[] { "name", "description" }
536       );
537       Object result = runTest(obj);
538       assertEquals(obj.toString(), result.toString());
539    }
540
541    public void testMBeanInfo()
542       throws Exception
543    {
544       Object parm = instantiate(
545          "javax.management.MBeanParameterInfo",
546          new Class[] { String.class, String.class, String.class },
547          new Object[] { "name", "type", "description" }
548       );
549       Object parms = Array.newInstance(parm.getClass(), 1);
550       Array.set(parms, 0, parm);
551
552       Object att = instantiate(
553          "javax.management.MBeanAttributeInfo",
554          new Class[] { String.class, String.class, String.class,
555                        Boolean.TYPE, Boolean.TYPE, Boolean.TYPE },
556          new Object[] { "name", "type", "description", new Boolean(true),
557                         new Boolean(true), new Boolean(false)}
558       );
559       Object atts = Array.newInstance(att.getClass(), 1);
560       Array.set(atts, 0, att);
561
562       Object con = instantiate(
563          "javax.management.MBeanConstructorInfo",
564          new Class[] { String.class, String.class, parms.getClass() },
565          new Object[] { "name", "description", parms }
566       );
567       Object cons = Array.newInstance(con.getClass(), 1);
568       Array.set(cons, 0, con);
569
570       Class clazz = loadClass("javax.management.MBeanOperationInfo");
571       Integer impact = new Integer(clazz.getField("ACTION").getInt(null));
572       Object op = instantiate(
573          "javax.management.MBeanOperationInfo",
574          new Class[] { String.class, String.class, parms.getClass(),
575                        String.class, Integer.TYPE },
576          new Object[] { "name", "description", parms, "type", impact }
577       );
578       Object ops = Array.newInstance(op.getClass(), 1);
579       Array.set(ops, 0, op);
580
581       String[] types = { "type1", "type2" };
582       Object not = instantiate(
583          "javax.management.MBeanNotificationInfo",
584          new Class[] { types.getClass(), String.class, String.class },
585          new Object[] { types, "name", "description" }
586       );
587       Object nots = Array.newInstance(not.getClass(), 1);
588       Array.set(nots, 0, not);
589
590       Object obj = instantiate(
591          "javax.management.MBeanInfo",
592          new Class[] { String.class, String.class, atts.getClass(),
593                        cons.getClass(), ops.getClass(), nots.getClass() },
594          new Object[] { "className", "description", atts, cons, ops, nots }
595       );
596       try
597       {
598          Object result = runTest(obj);
599          assertEquals(obj.toString(), result.toString());
600       }
601       catch (java.io.InvalidClassException e)
602       {
603          fail("FAILS IN RI 1.1: Wrong serialization for form 1.0 " +
604               "The real error is in MBeanAttributeInfo");
605       }
606    }
607
608    public void testMBeanNotificationInfo()
609       throws Exception
610    {
611       String[] types = { "type1", "type2" };
612       Object obj = instantiate(
613          "javax.management.MBeanNotificationInfo",
614          new Class[] { types.getClass(), String.class, String.class },
615          new Object[] { types, "name", "description" }
616       );
617       Object result = runTest(obj);
618       assertEquals(obj.toString(), result.toString());
619    }
620
621    public void testMBeanOperationInfo()
622       throws Exception
623    {
624       Object parm = instantiate(
625          "javax.management.MBeanParameterInfo",
626          new Class[] { String.class, String.class, String.class },
627          new Object[] { "name", "type", "description" }
628       );
629       Object array = Array.newInstance(parm.getClass(), 1);
630       Array.set(array, 0, parm);
631       Class clazz = loadClass("javax.management.MBeanOperationInfo");
632       Integer impact = new Integer(clazz.getField("ACTION").getInt(null));
633       Object obj = instantiate(
634          "javax.management.MBeanOperationInfo",
635          new Class[] { String.class, String.class, array.getClass(),
636                        String.class, Integer.TYPE },
637          new Object[] { "name", "description", array, "type", impact }
638       );
639       Object result = runTest(obj);
640       assertEquals(obj.toString(), result.toString());
641    }
642
643    public void testMBeanParameterInfo()
644       throws Exception
645    {
646       Object obj = instantiate(
647          "javax.management.MBeanParameterInfo",
648          new Class[] { String.class, String.class, String.class },
649          new Object[] { "name", "type", "description" }
650       );
651       Object result = runTest(obj);
652       assertEquals(obj.toString(), result.toString());
653    }
654
655    public void testMBeanRegistrationException()
656       throws Exception
657    {
658       Object obj = instantiate(
659          "javax.management.MBeanRegistrationException",
660          new Class[] { Exception.class, String.class },
661          new Object[] { new Exception("Cause"), "message" }
662       );
663       Object result = runTest(obj);
664       assertEquals(obj.toString(), result.toString());
665    }
666
667    public void testMBeanServerNotification()
668       throws Exception
669    {
670       Object objectName = instantiate(
671          "javax.management.ObjectName",
672          new Class[] { String.class },
673          new Object[] { "domain:x=y" }
674       );
675
676       Class clazz = loadClass("javax.management.MBeanServerNotification");
677       String type = (String) clazz.getField("REGISTRATION_NOTIFICATION").get(null);
678
679       Object obj = instantiate(
680          "javax.management.MBeanServerNotification",
681          new Class[] { String.class, Object.class, Long.TYPE,
682                        objectName.getClass() },
683          new Object[] { type, "source", new Long(1), objectName }
684       );
685       Object result = runTest(obj);
686       assertEquals(obj.toString(), result.toString());
687    }
688
689    public void testMBeanServerNotificationFilter()
690       throws Exception
691    {
692       Object objectName = instantiate(
693          "javax.management.ObjectName",
694          new Class[] { String.class },
695          new Object[] { "domain:x=y" }
696       );
697       Object obj = instantiate(
698          "javax.management.relation.MBeanServerNotificationFilter",
699          new Class[0],
700          new Object[0]
701       );
702       Method method = obj.getClass().getMethod("enableType",
703           new Class[] { String.class });
704       method.invoke(obj, new Object[] { "prefix" });
705       method = obj.getClass().getMethod("enableObjectName",
706           new Class[] { objectName.getClass() });
707       method.invoke(obj, new Object[] { objectName });
708       Object result = runTest(obj);
709       assertEquals(obj.toString(), result.toString());
710    }
711
712    public void testMBeanServerPermission()
713       throws Exception
714    {
715       if (SerializationSUITE.form < 11)
716          return;
717       Object obj = instantiate(
718          "javax.management.MBeanServerPermission",
719          new Class[] { String.class },
720          new Object[] { "*" }
721       );
722       Object result = runTest(obj);
723       assertEquals(obj.toString(), result.toString());
724    }
725
726    public void testModelMBeanAttributeInfo()
727       throws Exception
728    {
729       Object obj = instantiate(
730          "javax.management.modelmbean.ModelMBeanAttributeInfo",
731          new Class[] { String.class, String.class, String.class,
732                        Boolean.TYPE, Boolean.TYPE, Boolean.TYPE },
733          new Object[] { "name", "type", "description", new Boolean(true),
734                         new Boolean(true), new Boolean(false)}
735       );
736       try
737       {
738          Object result = runTest(obj);
739          assertEquals(obj.toString(), result.toString());
740       }
741       catch (java.io.InvalidClassException e)
742       {
743          fail("FAILS IN RI 1.1: Wrong serialization for form 1.0 ");
744       }
745    }
746
747    /**
748     * @todo equals test
749     */

750    public void testModelMBeanConstructorInfo()
751       throws Exception
752    {
753       Object parm = instantiate(
754          "javax.management.MBeanParameterInfo",
755          new Class[] { String.class, String.class, String.class },
756          new Object[] { "name", "type", "description" }
757       );
758       Object array = Array.newInstance(parm.getClass(), 1);
759       Array.set(array, 0, parm);
760       Object obj = instantiate(
761          "javax.management.modelmbean.ModelMBeanConstructorInfo",
762          new Class[] { String.class, String.class, array.getClass() },
763          new Object[] { "name", "description", array }
764       );
765       Object result = runTest(obj);
766    }
767
768    /**
769     * @todo equals test
770     */

771    public void testModelMBeanInfoSupport()
772       throws Exception
773    {
774       Object parm = instantiate(
775          "javax.management.MBeanParameterInfo",
776          new Class[] { String.class, String.class, String.class },
777          new Object[] { "name", "type", "description" }
778       );
779       Object parms = Array.newInstance(parm.getClass(), 1);
780       Array.set(parms, 0, parm);
781
782       Object att = instantiate(
783          "javax.management.modelmbean.ModelMBeanAttributeInfo",
784          new Class[] { String.class, String.class, String.class,
785                        Boolean.TYPE, Boolean.TYPE, Boolean.TYPE },
786          new Object[] { "name", "type", "description", new Boolean(true),
787                         new Boolean(true), new Boolean(false)}
788       );
789       Object atts = Array.newInstance(att.getClass(), 1);
790       Array.set(atts, 0, att);
791
792       Object con = instantiate(
793          "javax.management.modelmbean.ModelMBeanConstructorInfo",
794          new Class[] { String.class, String.class, parms.getClass() },
795          new Object[] { "name", "description", parms }
796       );
797       Object cons = Array.newInstance(con.getClass(), 1);
798       Array.set(cons, 0, con);
799
800       Class clazz = loadClass("javax.management.modelmbean.ModelMBeanOperationInfo");
801       Integer impact = new Integer(clazz.getField("ACTION").getInt(null));
802       Object op = instantiate(
803          "javax.management.modelmbean.ModelMBeanOperationInfo",
804          new Class[] { String.class, String.class, parms.getClass(),
805                        String.class, Integer.TYPE },
806          new Object[] { "name", "description", parms, "type", impact }
807       );
808       Object ops = Array.newInstance(op.getClass(), 1);
809       Array.set(ops, 0, op);
810
811       String[] types = { "type1", "type2" };
812       Object not = instantiate(
813          "javax.management.modelmbean.ModelMBeanNotificationInfo",
814          new Class[] { types.getClass(), String.class, String.class },
815          new Object[] { types, "name", "description" }
816       );
817       Object nots = Array.newInstance(not.getClass(), 1);
818       Array.set(nots, 0, not);
819
820       Object obj = instantiate(
821          "javax.management.modelmbean.ModelMBeanInfoSupport",
822          new Class[] { String.class, String.class, atts.getClass(),
823                        cons.getClass(), ops.getClass(), nots.getClass() },
824          new Object[] { "className", "description", atts, cons, ops, nots }
825       );
826       try
827       {
828          Object result = runTest(obj);
829       }
830       catch (java.io.InvalidClassException e)
831       {
832          fail("FAILS IN RI 1.1: Wrong serialization for form 1.0 ");
833       }
834    }
835
836    /**