xref: /aoo41x/main/cli_ure/qa/climaker/climaker.cs (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 using System;
29 using System.Reflection;
30 using System.Diagnostics;
31 using uno;
32 
33 
34 using unoidl.test.cliure.climaker;
35 //using unoidl.com.sun.star.uno;
36 using ucss=unoidl.com.sun.star;
37 
38 /** This class is for testing the generated code in the uno services
39  */
40 
41 public class Context: ucss.uno.XComponentContext
42 {
43     public enum test_kind {
44         NORMAL,
45         NO_FACTORY,
46         TEST_EXCEPTION,
47         CREATION_FAILED
48     }
49 
50     public Context(test_kind k, params object[] args)
51     {
52         kind = k;
53 		factory = new Factory(k, args);
54     }
55 
56     public ucss.lang.XMultiComponentFactory getServiceManager()
57     {
58         if (kind == test_kind.NO_FACTORY)
59             return null;
60         return factory;
61     }
62 
63     public Any  getValueByName(string Name)
64     {
65         if (kind == test_kind.NORMAL)
66         {
67             if (Name == "/singletons/unoidl.test.cliure.climaker.S4")
68             {
69                 Component c = new Component(this);
70                 return new Any(typeof(object), c);
71             }
72         }
73         else if (kind == test_kind.CREATION_FAILED)
74         {
75             return new Any();
76         }
77         return new Any();
78     }
79 
80     class Factory: ucss.lang.XMultiComponentFactory
81     {
82         public Factory(Context.test_kind k, params object[] args) {
83             kind2 = k;
84             if (k == Context.test_kind.TEST_EXCEPTION)
85                 exception = (ucss.uno.Exception) args[0];
86         }
87         public object  createInstanceWithArgumentsAndContext(
88             string ServiceSpecifier,
89             uno.Any[] Arguments,
90             unoidl.com.sun.star.uno.XComponentContext Context) {
91             switch (kind2) {
92             case test_kind.NORMAL:
93                 return new Component(Context, Arguments);
94             case test_kind.CREATION_FAILED :
95                 return null;
96             case test_kind.TEST_EXCEPTION:
97                 throw exception;
98             default:
99                 throw new Exception("Factory not properly initialized");
100             }
101         }
102         public object  createInstanceWithContext(
103             string aServiceSpecifier,
104             unoidl.com.sun.star.uno.XComponentContext Context) {
105             switch (kind2) {
106             case test_kind.NORMAL:
107                 return  new Component(Context);
108             case test_kind.CREATION_FAILED:
109                 return null;
110             case test_kind.TEST_EXCEPTION:
111                 throw exception;
112             default:
113                 throw new Exception("Factory not properly initialized");
114             }
115         }
116 
117         public string[]  getAvailableServiceNames()
118         {
119             return new string[]{};
120         }
121         ucss.uno.Exception exception;
122         test_kind kind2;
123     }
124 
125 
126     Factory factory;
127     test_kind kind;
128 }
129 
130 
131 public class Logger
132 {
133     String m_sFunction;
134     int m_nErrors;
135     public Logger() {
136     }
137 
138 	public String Function
139 	{
140 		set
141 		{
142 			m_sFunction = value;
143 		}
144 		get
145 		{
146 			return m_sFunction;
147 		}
148 	}
149 
150     public void assure(bool b) {
151         if (b == false)
152         {
153             Console.WriteLine(m_sFunction + " failed!");
154             m_nErrors++;
155         }
156     }
157 
158     public void printStatus() {
159         Console.WriteLine("\n=====================================");
160 
161 
162         String msg;
163         if (m_nErrors > 0)
164             msg = "Test failed! " + m_nErrors.ToString() + " Errors.";
165         else
166             msg = "Test succeeded!";
167 
168         Console.WriteLine(msg + "\n=====================================");
169     }
170 
171     public int Errors
172     {
173         get
174             {
175                 return m_nErrors;
176             }
177     }
178 }
179 
180 public sealed class Test
181 {
182     public static int Main(String[] args)
183     {
184 
185 //        System.Diagnostics.Debugger.Launch();
186 		try
187 		{
188 			Logger log = new Logger();
189 			Test t = new Test();
190 			t.testEnum1(log);
191 			t.testEnum2(log);
192 			t.testPolyStruct(log);
193 			t.testEmptyStruct2(log);
194 			t.testFullStruct2(log);
195 			t.testS1(log);
196 			t.testSingletons(log);
197 			t.testAttributes(log);
198 			t.testPolyStructAttributes(log);
199 			t.testPolymorphicType(log);
200             t.testInterface(log);
201             t.testAny(log);
202 			log.printStatus();
203 			if (log.Errors == 0)
204 				return 0;
205 			return -1;
206 		}
207 		catch(Exception e)
208 		{
209 			Console.Write(e.Message);
210 		}
211 		return -1;
212 
213 	}
214 
215 
216     public void testEnum1(Logger l) {
217         l.Function = "testEnum1";
218         l.assure(((int)Enum1.VALUE1) == -100);
219         l.assure(((int)Enum1.VALUE2) == 100);
220     }
221 
222     public void testEnum2(Logger l) {
223         l.Function = "testEnum2";
224         l.assure( ((int) Enum2.VALUE0) == 0);
225         l.assure( ((int) Enum2.VALUE1) == 1);
226         l.assure( ((int) Enum2.VALUE2) == 2);
227         l.assure( ((int) Enum2.VALUE4) == 4);
228     }
229 
230     public void testPolyStruct(Logger l) {
231         l.Function = "testPolyStruct";
232         PolyStruct s = new PolyStruct();
233         l.assure(s.member1 == null);
234         l.assure(s.member2 == 0);
235         s = new PolyStruct("ABC", 5);
236         l.assure(s.member1.Equals("ABC"));
237         l.assure(s.member2 == 5);
238     }
239 
240     public void testEmptyStruct2(Logger l) {
241         l.Function = "testEmptyStruct2";
242         Struct2 s = new Struct2();
243         l.assure(s.p1 == false);
244         l.assure(s.p2 == 0);
245         l.assure(s.p3 == 0);
246         l.assure(s.p4 == 0);
247         l.assure(s.p5 == 0);
248         l.assure(s.p6 == 0);
249         l.assure(s.p7 == 0L);
250         l.assure(s.p8 == 0L);
251         l.assure(s.p9 == 0.0f);
252         l.assure(s.p10 == 0.0);
253         l.assure(s.p11 == '\u0000');
254         l.assure(s.p12.Equals(""));
255         l.assure(s.p13.Equals(typeof(void)));
256         l.assure(s.p14.Equals(Any.VOID));
257         l.assure(s.p15 == Enum2.VALUE0);
258         l.assure(s.p16.member1 == 0);
259         l.assure(s.p17 == null);
260         l.assure(s.p18 == null);
261         l.assure(s.t1 == false);
262         l.assure(s.t2 == 0);
263         l.assure(s.t3 == 0);
264         l.assure(s.t4 == 0);
265         l.assure(s.t5 == 0);
266         l.assure(s.t6 == 0);
267         l.assure(s.t7 == 0L);
268         l.assure(s.t8 == 0L);
269         l.assure(s.t9 == 0.0f);
270         l.assure(s.t10 == 0.0);
271         l.assure(s.t11 == '\u0000');
272         l.assure(s.t12.Equals(""));
273         l.assure(s.t13.Equals(typeof(void)));
274         l.assure(s.t14.Equals(Any.VOID));
275         l.assure(s.t15 == Enum2.VALUE0);
276         l.assure(s.t16.member1 == 0);
277         l.assure(s.t17 == null);
278         l.assure(s.t18 == null);
279         l.assure(s.a1.Length == 0);
280         l.assure(s.a2.Length == 0);
281         l.assure(s.a3.Length == 0);
282         l.assure(s.a4.Length == 0);
283         l.assure(s.a5.Length == 0);
284         l.assure(s.a6.Length == 0);
285         l.assure(s.a7.Length == 0);
286         l.assure(s.a8.Length == 0);
287         l.assure(s.a9.Length == 0);
288         l.assure(s.a10.Length == 0);
289         l.assure(s.a11.Length == 0);
290         l.assure(s.a12.Length == 0);
291         l.assure(s.a13.Length == 0);
292         l.assure(s.a14.Length == 0);
293         l.assure(s.a15.Length == 0);
294         l.assure(s.a16.Length == 0);
295         l.assure(s.a17.Length == 0);
296         l.assure(s.a18.Length == 0);
297         l.assure(s.aa1.Length == 0);
298         l.assure(s.aa2.Length == 0);
299         l.assure(s.aa3.Length == 0);
300         l.assure(s.aa4.Length == 0);
301         l.assure(s.aa5.Length == 0);
302         l.assure(s.aa6.Length == 0);
303         l.assure(s.aa7.Length == 0);
304         l.assure(s.aa8.Length == 0);
305         l.assure(s.aa9.Length == 0);
306         l.assure(s.aa10.Length == 0);
307         l.assure(s.aa11.Length == 0);
308         l.assure(s.aa12.Length == 0);
309         l.assure(s.aa13.Length == 0);
310         l.assure(s.aa14.Length == 0);
311         l.assure(s.aa15.Length == 0);
312         l.assure(s.aa16.Length == 0);
313         l.assure(s.aa17.Length == 0);
314         l.assure(s.aa18.Length == 0);
315         l.assure(s.at1.Length == 0);
316         l.assure(s.at2.Length == 0);
317         l.assure(s.at3.Length == 0);
318         l.assure(s.at4.Length == 0);
319         l.assure(s.at5.Length == 0);
320         l.assure(s.at6.Length == 0);
321         l.assure(s.at7.Length == 0);
322         l.assure(s.at8.Length == 0);
323         l.assure(s.at9.Length == 0);
324         l.assure(s.at10.Length == 0);
325         l.assure(s.at11.Length == 0);
326         l.assure(s.at12.Length == 0);
327         l.assure(s.at13.Length == 0);
328         l.assure(s.at14.Length == 0);
329         l.assure(s.at15.Length == 0);
330         l.assure(s.at16.Length == 0);
331         l.assure(s.at17.Length == 0);
332         l.assure(s.at18.Length == 0);
333     }
334 
335     public void testFullStruct2(Logger l) {
336         //TODO:
337         Struct2 s = new Struct2(
338             true, (byte) 1, (short) 2, (ushort) 3, 4, 5, 6L, 7L, 0.8f, 0.9d, 'A',
339             "BCD", typeof(ulong), new Any(22), Enum2.VALUE4,
340             new Struct1(1), null, null, false, (byte) 0, (short) 0, (ushort) 0,
341             0, 0, 0L, 0L, 0.0f, 0.0, '\u0000', "", typeof(void), Any.VOID,
342             Enum2.VALUE0, new Struct1(), null, null,
343             new bool[] { false, true }, new byte[] { (byte) 1, (byte) 2 },
344             new short[0], new ushort[0], new int[0], new uint[0],
345             new long[0], new ulong[0], new float[0], new double[0], new char[0],
346             new String[0], new Type[0], new Any[0], new Enum2[0],
347             new Struct1[] { new Struct1(1), new Struct1(2) }, new Object[0],
348             new ucss.uno.XNamingService[0], new bool[0][], new byte[0][],
349             new short[0][], new ushort[0][], new int[0][], new uint[0][],
350             new long[0][], new ulong[0][], new float[0][], new double[0][],
351             new char[0][], new String[0][], new Type[0][], new Any[0][],
352             new Enum2[0][], new Struct1[0][], new Object[0][],
353             new ucss.uno.XNamingService[0][], new bool[0][], new byte[0][],
354             new short[0][], new ushort[0][], new int[0][], new uint[0][],
355             new long[0][], new ulong[0][], new float[0][], new double[0][],
356             new char[0][], new String[0][], new Type[0][], new Any[0][],
357             new Enum2[0][], new Struct1[0][], new Object[0][],
358             new ucss.uno.XNamingService[0][]);
359         l.assure(s.p1 == true);
360         l.assure(s.p2 == 1);
361         l.assure(s.p3 == 2);
362         l.assure(s.p4 == 3);
363         l.assure(s.p5 == 4);
364         l.assure(s.p6 == 5);
365         l.assure(s.p7 == 6L);
366         l.assure(s.p8 == 7L);
367         l.assure(s.p9 == 0.8f);
368         l.assure(s.p10 == 0.9);
369         l.assure(s.p11 == 'A');
370         l.assure(s.p12.Equals("BCD"));
371         l.assure(s.p13.Equals(typeof(ulong)));
372         l.assure(s.p14.Equals(new Any(22)));
373         l.assure(s.p15 == Enum2.VALUE4);
374         l.assure(s.p16.member1 == 1);
375         l.assure(s.p17 == null);
376         l.assure(s.p18 == null);
377         l.assure(s.t1 == false);
378         l.assure(s.t2 == 0);
379         l.assure(s.t3 == 0);
380         l.assure(s.t4 == 0);
381         l.assure(s.t5 == 0);
382         l.assure(s.t6 == 0);
383         l.assure(s.t7 == 0L);
384         l.assure(s.t8 == 0L);
385         l.assure(s.t9 == 0.0f);
386         l.assure(s.t10 == 0.0);
387         l.assure(s.t11 == '\u0000');
388         l.assure(s.t12.Equals(""));
389         l.assure(s.t13.Equals(typeof(void)));
390         l.assure(s.t14.Equals(Any.VOID));
391         l.assure(s.t15 == Enum2.VALUE0);
392         l.assure(s.t16.member1 == 0);
393         l.assure(s.t17 == null);
394         l.assure(s.t18 == null);
395         l.assure(s.a1.Length == 2);
396         l.assure(s.a1[0] == false);
397         l.assure(s.a1[1] == true);
398         l.assure(s.a2.Length == 2);
399         l.assure(s.a2[0] == 1);
400         l.assure(s.a2[1] == 2);
401         l.assure(s.a3.Length == 0);
402         l.assure(s.a4.Length == 0);
403         l.assure(s.a5.Length == 0);
404         l.assure(s.a6.Length == 0);
405         l.assure(s.a7.Length == 0);
406         l.assure(s.a8.Length == 0);
407         l.assure(s.a9.Length == 0);
408         l.assure(s.a10.Length == 0);
409         l.assure(s.a11.Length == 0);
410         l.assure(s.a12.Length == 0);
411         l.assure(s.a13.Length == 0);
412         l.assure(s.a14.Length == 0);
413         l.assure(s.a15.Length == 0);
414         l.assure(s.a16.Length == 2);
415         l.assure(s.a16[0].member1 == 1);
416         l.assure(s.a16[1].member1 == 2);
417         l.assure(s.a17.Length == 0);
418         l.assure(s.a18.Length == 0);
419         l.assure(s.aa1.Length == 0);
420         l.assure(s.aa2.Length == 0);
421         l.assure(s.aa3.Length == 0);
422         l.assure(s.aa4.Length == 0);
423         l.assure(s.aa5.Length == 0);
424         l.assure(s.aa6.Length == 0);
425         l.assure(s.aa7.Length == 0);
426         l.assure(s.aa8.Length == 0);
427         l.assure(s.aa9.Length == 0);
428         l.assure(s.aa10.Length == 0);
429         l.assure(s.aa11.Length == 0);
430         l.assure(s.aa12.Length == 0);
431         l.assure(s.aa13.Length == 0);
432         l.assure(s.aa14.Length == 0);
433         l.assure(s.aa15.Length == 0);
434         l.assure(s.aa16.Length == 0);
435         l.assure(s.aa17.Length == 0);
436         l.assure(s.aa18.Length == 0);
437         l.assure(s.at1.Length == 0);
438         l.assure(s.at2.Length == 0);
439         l.assure(s.at3.Length == 0);
440         l.assure(s.at4.Length == 0);
441         l.assure(s.at5.Length == 0);
442         l.assure(s.at6.Length == 0);
443         l.assure(s.at7.Length == 0);
444         l.assure(s.at8.Length == 0);
445         l.assure(s.at9.Length == 0);
446         l.assure(s.at10.Length == 0);
447         l.assure(s.at11.Length == 0);
448         l.assure(s.at12.Length == 0);
449         l.assure(s.at13.Length == 0);
450         l.assure(s.at14.Length == 0);
451         l.assure(s.at15.Length == 0);
452         l.assure(s.at16.Length == 0);
453         l.assure(s.at17.Length == 0);
454         l.assure(s.at18.Length == 0);
455     }
456 
457     public void testS1(Logger l) {
458         l.Function = "testS1";
459         object obj = new Object();
460         ucss.uno.RuntimeException excRuntime =
461             new ucss.uno.RuntimeException("RuntimeException", obj);
462         ucss.uno.Exception excException =
463             new ucss.uno.Exception("Exception", obj);
464         ucss.lang.IllegalAccessException excIllegalAccess =
465             new ucss.lang.IllegalAccessException("IllegalAccessException", obj);
466         ucss.uno.DeploymentException excDeployment =
467             new ucss.uno.DeploymentException("DeploymentException", obj);
468         ucss.lang.InvalidListenerException excInvalidListener =
469             new ucss.lang.InvalidListenerException("ListenerException", obj);
470 
471         /* create1 does not specify exceptions. Therefore RuntimeExceptions
472            fly through and other exceptions cause a DeploymentException.
473         */
474         try {
475             S1.create1(new Context(Context.test_kind.TEST_EXCEPTION, excRuntime));
476         } catch (ucss.uno.RuntimeException e) {
477             l.assure(e.Message == excRuntime.Message
478                      && e.Context == obj);
479         } catch (System.Exception) {
480             l.assure(false);
481         }
482 
483         Context c = new Context(Context.test_kind.TEST_EXCEPTION, excException);
484         try {
485             S1.create1(c);
486         } catch (ucss.uno.DeploymentException e) {
487             //The message of the original exception should be contained
488             // in the Deploymentexception
489             l.assure(e.Message.IndexOf(excException.Message) != -1 && e.Context == c);
490         } catch (System.Exception) {
491             l.assure(false);
492         }
493 
494         /* create2 specifies many exceptions, including RuntimeException and Exception.
495            Because Exception is specified all exceptions are allowed, hence all thrown
496            exceptions fly through.
497          */
498         try {
499             S1.create2(new Context(Context.test_kind.TEST_EXCEPTION, excRuntime));
500         } catch (ucss.uno.RuntimeException e) {
501             l.assure(e.Message == excRuntime.Message
502                      && e.Context == obj);
503         } catch (System.Exception) {
504             l.assure(false);
505         }
506 
507         try {
508             S1.create2(new Context(Context.test_kind.TEST_EXCEPTION, excIllegalAccess));
509         } catch (ucss.lang.IllegalAccessException e) {
510             l.assure(e.Message == excIllegalAccess.Message
511                      && e.Context == obj);
512         } catch (System.Exception) {
513             l.assure(false);
514         }
515 
516         try {
517             S1.create2(new Context(Context.test_kind.TEST_EXCEPTION, excException));
518         } catch (ucss.uno.Exception e) {
519             l.assure(e.Message == excException.Message
520                      && e.Context == obj);
521         } catch (System.Exception) {
522             l.assure(false);
523         }
524 
525         /* create3 specifies exceptions but no com.sun.star.uno.Exception. RuntimeException
526            and derived fly through. Other specified exceptions are rethrown and all other
527            exceptions cause a DeploymentException.
528         */
529         try {
530             S1.create3(new Context(Context.test_kind.TEST_EXCEPTION, excDeployment),
531                        new Any[]{});
532         } catch (ucss.uno.DeploymentException e) {
533             l.assure(e.Message == excDeployment.Message
534                      && e.Context == obj);
535         } catch (System.Exception) {
536             l.assure(false);
537         }
538 
539         try {
540             S1.create3(new Context(Context.test_kind.TEST_EXCEPTION, excIllegalAccess),
541                        new Any[0]);
542         } catch (ucss.lang.IllegalAccessException e) {
543             l.assure(e.Message == excIllegalAccess.Message
544                      && e.Context == obj);
545         } catch (System.Exception) {
546             l.assure(false);
547         }
548 
549         c = new Context(Context.test_kind.TEST_EXCEPTION, excInvalidListener);
550         try {
551             S1.create3(c, new Any[0]);
552         } catch (ucss.uno.DeploymentException e) {
553             l.assure(e.Message.IndexOf(excInvalidListener.Message) != -1
554                      && e.Context == c);
555         } catch (System.Exception) {
556             l.assure(false);
557         }
558 
559         /* test the case when the context cannot provide a service manager.
560          */
561         try {
562             S1.create2(new Context(Context.test_kind.NO_FACTORY));
563         } catch (ucss.uno.DeploymentException e) {
564             l.assure(e.Message.Length > 0);
565         } catch (System.Exception) {
566             l.assure(false);
567         }
568 
569         /* When the service manager returns a null pointer then a DeploymentException
570          * is to be thrown.
571          */
572         try {
573             S1.create2(new Context(Context.test_kind.CREATION_FAILED));
574         } catch (ucss.uno.DeploymentException e) {
575             l.assure(e.Message.Length > 0);
576         } catch (System.Exception) {
577             l.assure(false);
578         }
579 
580 
581         /** Test creation of components and if the passing of parameters works.
582          */
583         c = new Context(Context.test_kind.NORMAL);
584         try {
585             XTest xTest = S1.create1(c);
586             Component cobj = (Component) xTest;
587             l.assure(cobj.Args[0].Value == c);
588 
589             Any a1 = new Any("bla");
590             Any a2 = new Any(3.14f);
591             Any a3 = new Any(3.145d);
592             xTest = S1.create2(c, a1, a2, a3);
593             cobj = (Component) xTest;
594             l.assure(cobj.Args[0].Value == c
595                      && a1.Equals(cobj.Args[1])
596                      && a2.Equals(cobj.Args[2])
597                      && a3.Equals(cobj.Args[3]));
598 
599             bool b1 = true;
600             byte b2 = 1;
601             short b3 = 2;
602             ushort b4 = 3;
603             int b5 = 4;
604             uint b6 = 5;
605             long b7 = 6;
606             ulong b8 = 7;
607             float b9 = 0.8f;
608             double b10 = 0.9;
609             char b11 = 'A';
610             string b12 = "BCD";
611             Type b13 = typeof(ulong);
612             Any b14 = new Any(22);
613             Enum2 b15 = Enum2.VALUE4;
614             Struct1 b16 = new Struct1(1);
615             PolyStruct b17 = new PolyStruct('A', 1);
616             PolyStruct b18 = new PolyStruct(new Any(true), 1);
617             object b19 = new uno.util.WeakComponentBase();
618             ucss.lang.XComponent b20 = (ucss.lang.XComponent) b19;
619             bool b21 = b1;
620             byte b22 = b2;
621             short b23 = b3;
622             ushort b24 = b4;
623             int b25 = b5;
624             uint b26 = b6;
625             long b27 = b7;
626             ulong b28 = b8;
627             float b29 = b9;
628             double b30 = b10;
629             char b31 = b11;
630             string b32 = b12;
631             Type b33 = b13;
632             Any b34 = b14;
633             Enum2 b35 = b15;
634             Struct1 b36 = b16;
635             object b37 = b19;
636             ucss.lang.XComponent b38 = b20;
637             bool[] b39 = new bool[] { false, true };
638             byte[] b40 = new byte[] { (byte) 1, (byte) 2 };
639             short[] b41 = new short[] { (short) 123, (short) 456};
640             ushort[] b42 = new ushort[] { (ushort) 789, (ushort) 101};
641             int[] b43 = new int[] {1, 2, 3};
642             uint[] b44 = new uint[] {4, 5, 6};
643             long[] b45 = new long[] {7,8,9};
644             ulong[] b46 = new ulong[] {123, 4356};
645             float[] b47 = new float[] {2435f,87f};
646             double[] b48 = new double[] {234d,45.2134d};
647             char[] b49 = new char[] {'\u1234', 'A'};
648             string[] b50 = new string[] {"a","bc"};
649             Type[] b51 = new Type[] {typeof(int), typeof(long)};
650             Any[] b52 = new Any[] {new Any(1), new Any("adf")};
651             Enum2[] b53 = new Enum2[] {Enum2.VALUE2};
652             Struct1[] b54 = new Struct1[] {new Struct1(11), new Struct1(22)};
653             object[] b55 = new object[0];
654             ucss.lang.XComponent[] b56 = new ucss.lang.XComponent[]{
655                 new uno.util.WeakComponentBase(), new uno.util.WeakComponentBase()};
656             bool[][] b57 = new bool[][] {new bool[]{true,false}, new  bool[] {true}};
657             byte[][] b58 = new byte[][]{new byte[] {(byte) 1}, new byte[]{(byte) 2}};
658             short[][] b59 = new short[][] {new short[]{(short)6, (short)7}, new short[] {(short)9}};
659             ushort[][] b60 = new ushort[][] { new ushort[]{(ushort) 11}};
660             int[][] b61 = new int[][] {new int[]{1}, new int[]{2,3}, new int[]{4,5,6}};
661             uint[][] b62 = new uint[][] {new uint[]{10U}, new uint[]{20U,30U}, new uint[]{40U,50U,60}};
662             long[][] b63 = new long[][] {new long[]{10L}, new long[]{20L,30}, new long[]{40,50,60}};
663             ulong[][] b64 = new ulong[][] { new ulong[]{10L}, new ulong[]{20L, 30L}, new ulong[]{40,50,60}};
664             float[][] b65 = new float[][] {new float[]{10f}, new float[]{20f,30f}, new float[]{40f,50f,60f}};
665             double[][] b66 = new double[][]{new double[]{10d}, new double[]{20d,30d}};
666             char[][] b67 = new char[][] {new char[]{'a'}, new char[]{'b', 'c'}};
667             string[][] b68 = new String[][] {new string[]{"a"}, new string[]{"ad", "lkj"}};
668             Type[][] b69 = new Type[][] {new Type[]{typeof(byte), typeof(long)}, new Type[]{typeof(Any)}};
669             Any[][] b70 = new Any[][] {new Any[]{new Any(1f), new Any(2d)}, new Any[]{new Any(34U)}};
670             Enum2[][] b71 = new Enum2[][] {new Enum2[]{Enum2.VALUE2}};
671             Struct1[][] b72 = new Struct1[][] {new Struct1[]{new Struct1(2), new Struct1(3)}};
672             object[][] b73 =  new Object[0][];
673             ucss.lang.XComponent[][] b74 = new uno.util.WeakComponentBase[0][];
674             bool[][] b75 = b57;
675             byte[][] b76 = b58;
676             short[][] b77 = b59;
677             ushort[][] b78 = b60;
678             int[][] b79 = b61;
679             uint[][] b80 = b62;
680             long[][] b81 = b63;
681             ulong[][] b82 = b64;
682             float[][] b83 = b65;
683             double[][] b84 = b66;
684             char[][] b85 = b67;
685             String[][] b86 = b68;
686             Type[][] b87 =b69;
687             Any[][] b88 = b70;
688             Enum2[][] b89 = b71;
689             Struct1[][] b90 = b72;
690             Object[][] b91 = b73;
691             ucss.lang.XComponent[][] b92 = b74;
692 
693             xTest = S1.create5(
694                 c,
695                 b1, b2, b3, b4, b5, b6, b7 ,b8, b9, b10,
696                 b11, b12, b13,
697                 b14,
698                 b15, b16, b17, b18, b19, b20,
699                 b21, b22, b23, b24, b25, b26, b27, b28, b29, b30,
700                 b31, b32, b33,
701                 b34,
702                 b35, b36, b37, b38, b39, b40,
703                 b41, b42, b43, b44, b45, b46, b47, b48, b49, b50,
704                 b51, b52, b53, b54, b55, b56, b57, b58, b59, b60,
705                 b61, b62, b63, b64, b65, b66, b67, b68, b69, b70,
706                 b71, b72, b73, b74, b75, b76, b77, b78, b79, b80,
707                 b81, b82, b83, b84, b85, b86, b87, b88, b89, b90,
708                 b91, b92
709                  );
710 
711             cobj = (Component) xTest;
712             l.assure(cobj.Args[0].Value == c);
713             l.assure(b1.Equals(cobj.Args[1].Value));
714             l.assure(b2.Equals(cobj.Args[2].Value));
715             l.assure(b3.Equals(cobj.Args[3].Value));
716             l.assure(b4.Equals(cobj.Args[4].Value));
717             l.assure(b5.Equals(cobj.Args[5].Value));
718             l.assure(b6.Equals(cobj.Args[6].Value));
719             l.assure(b7.Equals(cobj.Args[7].Value));
720             l.assure(b8.Equals(cobj.Args[8].Value));
721             l.assure(b9.Equals(cobj.Args[9].Value));
722             l.assure(b10.Equals(cobj.Args[10].Value));
723             l.assure(b11.Equals(cobj.Args[11].Value));
724             l.assure(b12.Equals(cobj.Args[12].Value));
725             l.assure(b13.Equals(cobj.Args[13].Value));
726 			//Anys are not wrapped by the generated code
727             l.assure(b14.Equals(cobj.Args[14]));
728             l.assure(b15.Equals(cobj.Args[15].Value));
729             l.assure(b16.Equals(cobj.Args[16].Value));
730             l.assure(b17.Equals(cobj.Args[17].Value));
731             l.assure(b18.Equals(cobj.Args[18].Value));
732             l.assure(b19.Equals(cobj.Args[19].Value));
733             l.assure(b20.Equals(cobj.Args[20].Value));
734             l.assure(b21.Equals(cobj.Args[21].Value));
735             l.assure(b22.Equals(cobj.Args[22].Value));
736             l.assure(b23.Equals(cobj.Args[23].Value));
737             l.assure(b24.Equals(cobj.Args[24].Value));
738             l.assure(b25.Equals(cobj.Args[25].Value));
739             l.assure(b26.Equals(cobj.Args[26].Value));
740             l.assure(b27.Equals(cobj.Args[27].Value));
741             l.assure(b28.Equals(cobj.Args[28].Value));
742             l.assure(b29.Equals(cobj.Args[29].Value));
743             l.assure(b30.Equals(cobj.Args[30].Value));
744             l.assure(b31.Equals(cobj.Args[31].Value));
745             l.assure(b32.Equals(cobj.Args[32].Value));
746             l.assure(b33.Equals(cobj.Args[33].Value));
747 			//Anys are not wrapped by the generated code
748             l.assure(b34.Equals(cobj.Args[34]));
749             l.assure(b35.Equals(cobj.Args[35].Value));
750             l.assure(b36.Equals(cobj.Args[36].Value));
751             l.assure(b37.Equals(cobj.Args[37].Value));
752             l.assure(b38.Equals(cobj.Args[38].Value));
753             l.assure(b39.Equals(cobj.Args[39].Value));
754             l.assure(b40.Equals(cobj.Args[40].Value));
755             l.assure(b41.Equals(cobj.Args[41].Value));
756             l.assure(b42.Equals(cobj.Args[42].Value));
757             l.assure(b43.Equals(cobj.Args[43].Value));
758             l.assure(b44.Equals(cobj.Args[44].Value));
759             l.assure(b45.Equals(cobj.Args[45].Value));
760             l.assure(b46.Equals(cobj.Args[46].Value));
761             l.assure(b47.Equals(cobj.Args[47].Value));
762             l.assure(b48.Equals(cobj.Args[48].Value));
763             l.assure(b49.Equals(cobj.Args[49].Value));
764             l.assure(b50.Equals(cobj.Args[50].Value));
765             l.assure(b51.Equals(cobj.Args[51].Value));
766             l.assure(b52.Equals(cobj.Args[52].Value));
767             l.assure(b53.Equals(cobj.Args[53].Value));
768             l.assure(b54.Equals(cobj.Args[54].Value));
769             l.assure(b55.Equals(cobj.Args[55].Value));
770             l.assure(b56.Equals(cobj.Args[56].Value));
771             l.assure(b57.Equals(cobj.Args[57].Value));
772             l.assure(b58.Equals(cobj.Args[58].Value));
773             l.assure(b59.Equals(cobj.Args[59].Value));
774             l.assure(b60.Equals(cobj.Args[60].Value));
775             l.assure(b61.Equals(cobj.Args[61].Value));
776             l.assure(b62.Equals(cobj.Args[62].Value));
777             l.assure(b63.Equals(cobj.Args[63].Value));
778             l.assure(b64.Equals(cobj.Args[64].Value));
779             l.assure(b65.Equals(cobj.Args[65].Value));
780             l.assure(b66.Equals(cobj.Args[66].Value));
781             l.assure(b67.Equals(cobj.Args[67].Value));
782             l.assure(b68.Equals(cobj.Args[68].Value));
783             l.assure(b69.Equals(cobj.Args[69].Value));
784             l.assure(b70.Equals(cobj.Args[70].Value));
785             l.assure(b71.Equals(cobj.Args[71].Value));
786             l.assure(b72.Equals(cobj.Args[72].Value));
787             l.assure(b73.Equals(cobj.Args[73].Value));
788             l.assure(b74.Equals(cobj.Args[74].Value));
789             l.assure(b75.Equals(cobj.Args[75].Value));
790             l.assure(b76.Equals(cobj.Args[76].Value));
791             l.assure(b77.Equals(cobj.Args[77].Value));
792             l.assure(b78.Equals(cobj.Args[78].Value));
793             l.assure(b79.Equals(cobj.Args[79].Value));
794             l.assure(b80.Equals(cobj.Args[80].Value));
795             l.assure(b81.Equals(cobj.Args[81].Value));
796             l.assure(b82.Equals(cobj.Args[82].Value));
797             l.assure(b83.Equals(cobj.Args[83].Value));
798             l.assure(b84.Equals(cobj.Args[84].Value));
799             l.assure(b85.Equals(cobj.Args[85].Value));
800             l.assure(b86.Equals(cobj.Args[86].Value));
801             l.assure(b87.Equals(cobj.Args[87].Value));
802             l.assure(b88.Equals(cobj.Args[88].Value));
803             l.assure(b89.Equals(cobj.Args[89].Value));
804             l.assure(b90.Equals(cobj.Args[90].Value));
805             l.assure(b91.Equals(cobj.Args[91].Value));
806             l.assure(b92.Equals(cobj.Args[92].Value));
807 
808         } catch (Exception) {
809             l.assure(false);
810         }
811 
812         //test
813         c = new Context(Context.test_kind.NORMAL);
814         try {
815 
816             PolyStruct2 arg1 = new PolyStruct2(typeof(PolyStruct2), 1);
817             PolyStruct2 arg2 = new PolyStruct2(new Any(true), 1);
818             PolyStruct2 arg3 = new PolyStruct2(true, 1);
819             PolyStruct2 arg4 = new PolyStruct2((Byte)8, 1);
820             PolyStruct2 arg5 = new PolyStruct2('c', 1);
821             PolyStruct2 arg6 = new PolyStruct2((Int16)10, 1);
822             PolyStruct2 arg7 = new PolyStruct2(11, 1);
823             PolyStruct2 arg8 = new PolyStruct2(12L, 1);
824             PolyStruct2 arg9 = new PolyStruct2("Hello", 1);
825             PolyStruct2 arg10 = new PolyStruct2(1.3, 1);
826             PolyStruct2 arg11 = new PolyStruct2(1.3d, 1);
827             PolyStruct2 arg12 = new PolyStruct2(new Object(), 1);
828             PolyStruct2 arg13 = new PolyStruct2(new uno.util.WeakComponentBase(), 1);
829             PolyStruct2 arg14 = new PolyStruct2(
830                 new PolyStruct('A', 1), 1);
831             PolyStruct2 arg15 = new PolyStruct2(
832                 new PolyStruct(new PolyStruct('A',1),1),1);
833             PolyStruct arg16 = new PolyStruct("Hallo", 1);
834             PolyStruct arg17 = new PolyStruct(
835                 new PolyStruct('A',1),1);
836 
837             Type[] arType = {typeof(PolyStruct), typeof(PolyStruct2)};
838             PolyStruct2 arg101 = new PolyStruct2(arType,1);
839             PolyStruct2 arg102 = new PolyStruct2(
840                 new Any[] {new Any(true)},1);
841             PolyStruct2 arg103 = new PolyStruct2(new bool[]{true}, 1);
842             PolyStruct2 arg104 = new PolyStruct2(new byte[] { (byte) 1}, 1);
843             PolyStruct2 arg105 = new PolyStruct2(new char[] {'\u1234', 'A'}, 1);
844             PolyStruct2 arg106 = new PolyStruct2(new short[] {(short)1}, 1);
845             PolyStruct2 arg107 = new PolyStruct2(new int[] {1}, 1);
846             PolyStruct2 arg108 = new PolyStruct2(new long[] {1}, 1);
847             PolyStruct2 arg109 = new PolyStruct2(new string[]{"Hallo"}, 1);
848             PolyStruct2 arg110 = new PolyStruct2(new float[]{1.3f}, 1);
849             PolyStruct2 arg111 = new PolyStruct2(new double[] {1.3d}, 1);
850             PolyStruct2 arg112 = new PolyStruct2(
851                 new Object[] { new Object()}, 1);
852             PolyStruct2 arg113 = new PolyStruct2(
853                 new uno.util.WeakComponentBase[] {
854                     new uno.util.WeakComponentBase()}, 1);
855             PolyStruct2 arg114 = new PolyStruct2(
856                 new PolyStruct[]{
857                 new PolyStruct('A',1)} ,1);
858             PolyStruct2 arg115 = new PolyStruct2(
859                 new PolyStruct[] {
860                 new PolyStruct( new PolyStruct2('A',1),1)}
861                 ,1);
862             PolyStruct2 arg201 = new PolyStruct2(new char[][] { new char[]{'A'},
863                                                             new char[]{'B'}}, 1);
864 
865 			PolyStruct2[] arg301 = new PolyStruct2[] {new PolyStruct2('A', 1)};
866 			PolyStruct2[] arg302 = new PolyStruct2[] {new PolyStruct2(
867 				new PolyStruct('A', 1), 1)};
868 			PolyStruct2[] arg303 = new PolyStruct2[] {new PolyStruct2(
869 				new PolyStruct(new PolyStruct('A',1),1),1)};
870 			PolyStruct[] arg304 = new PolyStruct[] {new PolyStruct("Hallo", 1)};
871 			PolyStruct[] arg305 = new PolyStruct[] {new PolyStruct(
872 				new PolyStruct('A',1),1)};
873 
874 			PolyStruct2[][] arg401 = new PolyStruct2[][] {new PolyStruct2[] {new PolyStruct2('A', 1)}};
875 			PolyStruct2[][] arg402 = new PolyStruct2[][] {new PolyStruct2[] {new PolyStruct2(
876 				new PolyStruct('A', 1), 1)}};
877 			PolyStruct2[][] arg403 = new PolyStruct2[][] {new PolyStruct2[] {new PolyStruct2(
878 				new PolyStruct(new PolyStruct('A',1),1),1)}};
879 			PolyStruct[][] arg404 = new PolyStruct[][] {new PolyStruct[] {new PolyStruct("Hallo", 1)}};
880 			PolyStruct[][] arg405 = new PolyStruct[][] {new PolyStruct[] {new PolyStruct(
881 				new PolyStruct('A',1),1)}};
882 
883 
884             XTest xTest = S1.create6(c,
885                  arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,
886                  arg11,arg12,arg13,arg14,arg15,arg16,arg17,
887                  arg101,arg102,arg103,arg104,arg105,arg106,arg107,arg108,arg109,arg110,
888                  arg111,arg112,arg113,arg114,arg115,
889                  arg201,
890 				arg301, arg302, arg303, arg304, arg305,
891 				arg401, arg402, arg403, arg404, arg405);
892             Component cobj = (Component) xTest;
893             l.assure(cobj.Args[0].Value == c);
894 			//arg1 - arg17
895             string sType = ((PolymorphicType) cobj.Args[1].Type).PolymorphicName;
896             l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Type>");
897             sType = ((PolymorphicType) cobj.Args[2].Type).PolymorphicName;
898             l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<uno.Any>");
899             sType = ((PolymorphicType) cobj.Args[3].Type).PolymorphicName;
900             l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Boolean>");
901             sType = ((PolymorphicType) cobj.Args[4].Type).PolymorphicName;
902             l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Byte>");
903             sType = ((PolymorphicType) cobj.Args[5].Type).PolymorphicName;
904             l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Char>");
905             sType = ((PolymorphicType) cobj.Args[6].Type).PolymorphicName;
906             l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Int16>");
907             sType = ((PolymorphicType) cobj.Args[7].Type).PolymorphicName;
908             l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Int32>");
909             sType = ((PolymorphicType) cobj.Args[8].Type).PolymorphicName;
910             l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Int64>");
911             sType = ((PolymorphicType) cobj.Args[9].Type).PolymorphicName;
912             l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.String>");
913             sType = ((PolymorphicType) cobj.Args[10].Type).PolymorphicName;
914             l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Single>");
915             sType = ((PolymorphicType) cobj.Args[11].Type).PolymorphicName;
916             l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Double>");
917             sType = ((PolymorphicType) cobj.Args[12].Type).PolymorphicName;
918             l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Object>");
919             sType = ((PolymorphicType) cobj.Args[13].Type).PolymorphicName;
920             l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<unoidl.com.sun.star.lang.XComponent>");
921             sType = ((PolymorphicType) cobj.Args[14].Type).PolymorphicName;
922             l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<unoidl.test.cliure.climaker.PolyStruct<System.Char,uno.Any>>");
923             sType = ((PolymorphicType) cobj.Args[15].Type).PolymorphicName;
924             l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<" +
925                       "unoidl.test.cliure.climaker.PolyStruct<" +
926                       "unoidl.test.cliure.climaker.PolyStruct<" +
927                       "System.Char,uno.Any>,System.String>>");
928             sType = ((PolymorphicType) cobj.Args[16].Type).PolymorphicName;
929             l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct<" +
930                       "System.String,unoidl.test.cliure.climaker.PolyStruct<" +
931                       "System.Char,unoidl.test.cliure.climaker.PolyStruct2<" +
932                       "uno.Any>>>");
933             sType = ((PolymorphicType) cobj.Args[17].Type).PolymorphicName;
934             l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct<" +
935                       "unoidl.test.cliure.climaker.PolyStruct<System.Char,uno.Any>," +
936                       "unoidl.test.cliure.climaker.PolyStruct2<System.Char>>");
937 			//arg101 - arg115
938             sType = ((PolymorphicType) cobj.Args[18].Type).PolymorphicName;
939             l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Type[]>");
940             sType = ((PolymorphicType) cobj.Args[19].Type).PolymorphicName;
941             l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<uno.Any[]>");
942             sType = ((PolymorphicType) cobj.Args[20].Type).PolymorphicName;
943             l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Boolean[]>");
944             sType = ((PolymorphicType) cobj.Args[21].Type).PolymorphicName;
945             l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Byte[]>");
946             sType = ((PolymorphicType) cobj.Args[22].Type).PolymorphicName;
947             l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Char[]>");
948             sType = ((PolymorphicType) cobj.Args[23].Type).PolymorphicName;
949             l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Int16[]>");
950             sType = ((PolymorphicType) cobj.Args[24].Type).PolymorphicName;
951             l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Int32[]>");
952             sType = ((PolymorphicType) cobj.Args[25].Type).PolymorphicName;
953             l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Int64[]>");
954             sType = ((PolymorphicType) cobj.Args[26].Type).PolymorphicName;
955             l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.String[]>");
956             sType = ((PolymorphicType) cobj.Args[27].Type).PolymorphicName;
957             l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Single[]>");
958             sType = ((PolymorphicType) cobj.Args[28].Type).PolymorphicName;
959             l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Double[]>");
960             sType = ((PolymorphicType) cobj.Args[29].Type).PolymorphicName;
961             l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Object[]>");
962             sType = ((PolymorphicType) cobj.Args[30].Type).PolymorphicName;
963             l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<unoidl.com.sun.star.lang.XComponent[]>");
964             sType = ((PolymorphicType) cobj.Args[31].Type).PolymorphicName;
965             l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<" +
966                       "unoidl.test.cliure.climaker.PolyStruct<System.Char,uno.Any[]>[]>");
967             sType = ((PolymorphicType) cobj.Args[32].Type).PolymorphicName;
968             l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<" +
969                                 "unoidl.test.cliure.climaker.PolyStruct<" +
970                                 "unoidl.test.cliure.climaker.PolyStruct2<" +
971                                 "System.Char>,uno.Any[]>[]>");
972 			//arg 201
973             sType = ((PolymorphicType) cobj.Args[33].Type).PolymorphicName;
974             l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<" +
975                                 "System.Char[][]>");
976 			//arg 301 - arg305
977 			sType = ((PolymorphicType) cobj.Args[34].Type).PolymorphicName;
978 			l.assure (sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Char>[]");
979 			sType = ((PolymorphicType) cobj.Args[35].Type).PolymorphicName;
980 			l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<unoidl.test.cliure.climaker.PolyStruct<System.Char,uno.Any>>[]");
981 			sType = ((PolymorphicType) cobj.Args[36].Type).PolymorphicName;
982 			l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<" +
983 				"unoidl.test.cliure.climaker.PolyStruct<" +
984 				"unoidl.test.cliure.climaker.PolyStruct<" +
985 				"System.Char,uno.Any>,System.String>>[]");
986 			sType = ((PolymorphicType) cobj.Args[37].Type).PolymorphicName;
987 			l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct<" +
988 				"System.String,unoidl.test.cliure.climaker.PolyStruct<" +
989 				"System.Char,unoidl.test.cliure.climaker.PolyStruct2<" +
990 				"uno.Any>>>[]");
991 			sType = ((PolymorphicType) cobj.Args[38].Type).PolymorphicName;
992 			l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct<" +
993 				"unoidl.test.cliure.climaker.PolyStruct<System.Char,uno.Any>," +
994 				"unoidl.test.cliure.climaker.PolyStruct2<System.Char>>[]");
995 			//arg 401 - arg405
996 			sType = ((PolymorphicType) cobj.Args[39].Type).PolymorphicName;
997 			l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Char>[][]");
998 			sType = ((PolymorphicType) cobj.Args[40].Type).PolymorphicName;
999 			l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<" +
1000 				"unoidl.test.cliure.climaker.PolyStruct<System.Char,uno.Any>>[][]");
1001 			sType = ((PolymorphicType) cobj.Args[41].Type).PolymorphicName;
1002 			l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<" +
1003 				"unoidl.test.cliure.climaker.PolyStruct<" +
1004 				"unoidl.test.cliure.climaker.PolyStruct<" +
1005 				"System.Char,uno.Any>,System.String>>[][]");
1006 			sType = ((PolymorphicType) cobj.Args[42].Type).PolymorphicName;
1007 			l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct<" +
1008 				"System.String,unoidl.test.cliure.climaker.PolyStruct<" +
1009 				"System.Char,unoidl.test.cliure.climaker.PolyStruct2<" +
1010 				"uno.Any>>>[][]");
1011 			sType = ((PolymorphicType) cobj.Args[43].Type).PolymorphicName;
1012 			l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct<" +
1013 				"unoidl.test.cliure.climaker.PolyStruct<System.Char,uno.Any>," +
1014 				"unoidl.test.cliure.climaker.PolyStruct2<System.Char>>[][]");
1015 
1016 
1017 
1018 
1019         }
1020 		catch (Exception)
1021 		{
1022             l.assure(false);
1023         }
1024     }
1025 
1026     void testSingletons(Logger l)
1027     {
1028         l.Function = "testSingletons";
1029         Context c = new Context(Context.test_kind.NORMAL);
1030         try {
1031 			XTest obj = S4.get(c);
1032 			l.assure(obj != null);
1033         } catch (Exception) {
1034             l.assure(false);
1035         }
1036 
1037         /** Case context fails to provide sigleton, a DeploymentException should be thrown.
1038          */
1039         c = new Context(Context.test_kind.CREATION_FAILED);
1040         try {
1041 			XTest obj = S4.get(c);
1042 			l.assure(obj != null);
1043         } catch (ucss.uno.DeploymentException e) {
1044             Type t = typeof(unoidl.test.cliure.climaker.S4);
1045             l.assure( e.Message.IndexOf(t.FullName) != -1);
1046         } catch (System.Exception) {
1047             l.assure(false);
1048         }
1049     }
1050 
1051     void testAttributes(Logger l)
1052     {
1053         l.Function = "testAttributes";
1054         //oneway attribute
1055         Type typeXTest = typeof(unoidl.test.cliure.climaker.XTest);
1056         object[] arAttr = typeXTest.GetMethod("testOneway").GetCustomAttributes(false);
1057         if (arAttr.Length == 1)
1058             l.assure(typeof(uno.OnewayAttribute).Equals(arAttr[0].GetType()));
1059         else
1060             l.assure(false);
1061 
1062         //test exceptions
1063         arAttr = typeXTest.GetMethod("testExceptions").GetCustomAttributes(false);
1064         if (arAttr.Length == 1 && arAttr[0].GetType() == typeof(uno.ExceptionAttribute))
1065         {
1066             uno.ExceptionAttribute attr = arAttr[0] as uno.ExceptionAttribute;
1067             if (attr != null && attr.Raises.Length == 2)
1068             {
1069                 l.assure(attr.Raises[0] == typeof(unoidl.com.sun.star.uno.Exception));
1070                 l.assure(attr.Raises[1] == typeof(unoidl.com.sun.star.lang.ClassNotFoundException));
1071             }
1072             else
1073                 l.assure(false);
1074         }
1075         else
1076             l.assure(false);
1077 
1078         //function test must not have the oneway attribute and Exception attribute
1079         arAttr = typeXTest.GetMethod("test").GetCustomAttributes(false);
1080         l.assure(arAttr.Length == 0);
1081 
1082         //test exceptions on service constructor methods
1083         Type typeS1 = typeof(unoidl.test.cliure.climaker.S1);
1084         arAttr = typeS1.GetMethod("create3").GetCustomAttributes(false);
1085         if (arAttr.Length == 1 && arAttr[0].GetType() == typeof(uno.ExceptionAttribute))
1086         {
1087             uno.ExceptionAttribute attr = arAttr[0] as uno.ExceptionAttribute;
1088             if (attr != null && attr.Raises.Length == 4)
1089             {
1090                 l.assure(attr.Raises[0] == typeof(unoidl.com.sun.star.uno.RuntimeException));
1091                 l.assure(attr.Raises[1] == typeof(unoidl.com.sun.star.lang.ClassNotFoundException));
1092                 l.assure(attr.Raises[2] == typeof(unoidl.com.sun.star.lang.IllegalAccessException));
1093                 l.assure(attr.Raises[3] == typeof(unoidl.com.sun.star.uno.DeploymentException));
1094             }
1095             else
1096                 l.assure(false);
1097         }
1098         else
1099             l.assure(false);
1100 
1101         //create1 does not have exceptions
1102         arAttr = typeS1.GetMethod("create1").GetCustomAttributes(false);
1103         l.assure(arAttr.Length == 0);
1104 
1105         //test exceptions of UNO interface attributes
1106         arAttr = typeXTest.GetProperty("A3").GetGetMethod().GetCustomAttributes(false);
1107         if (arAttr.Length == 1)
1108         {
1109             uno.ExceptionAttribute attr = arAttr[0] as uno.ExceptionAttribute;
1110             if (attr != null && attr.Raises.Length == 2)
1111             {
1112                 l.assure(attr.Raises[0] == typeof(unoidl.com.sun.star.uno.Exception));
1113                 l.assure(attr.Raises[1] == typeof(unoidl.com.sun.star.lang.ClassNotFoundException));
1114             }
1115             else
1116                 l.assure(false);
1117         }
1118         else
1119             l.assure(false);
1120 
1121         arAttr = typeXTest.GetProperty("A3").GetSetMethod().GetCustomAttributes(false);
1122         if (arAttr.Length == 1)
1123         {
1124             uno.ExceptionAttribute attr = arAttr[0] as uno.ExceptionAttribute;
1125             if (attr != null && attr.Raises.Length == 1)
1126                 l.assure(attr.Raises[0] == typeof(unoidl.com.sun.star.uno.RuntimeException));
1127             else
1128                 l.assure(false);
1129         }
1130         else
1131             l.assure(false);
1132 
1133         //attribute A1 must have the ExceptionAttribute
1134         l.assure(typeXTest.GetProperty("A1").GetGetMethod().GetCustomAttributes(false).Length == 0);
1135         l.assure(typeXTest.GetProperty("A1").GetSetMethod().GetCustomAttributes(false).Length == 0);
1136 
1137         //Test BoundAttribute
1138         BoundAttribute bound = (BoundAttribute) Attribute.GetCustomAttribute(
1139             typeXTest.GetProperty("A1"), typeof(BoundAttribute));
1140         l.assure(bound != null);
1141 
1142         bound = (BoundAttribute) Attribute.GetCustomAttribute(
1143             typeXTest.GetProperty("A3"), typeof(BoundAttribute));
1144         l.assure(bound == null);
1145     }
1146 
1147     void testPolyStructAttributes(Logger l)
1148     {
1149         l.Function = "testPolyStructAttributes";
1150         //Test polymorphic struct
1151         Type typeStruct = typeof(unoidl.test.cliure.climaker.PolyStruct);
1152         object[] arAttr = typeStruct.GetCustomAttributes(false);
1153         if (arAttr.Length == 1)
1154         {
1155             try {
1156             uno.TypeParametersAttribute attr = (uno.TypeParametersAttribute) arAttr[0];
1157             string[] arNames = new string[]{"if", "else"};
1158             l.assure(attr != null && attr.Parameters.ToString().Equals(arNames.ToString()));
1159             }catch(Exception ) {
1160                 l.assure(false);
1161             }
1162         }
1163         else
1164             l.assure(false);
1165         l.assure(typeof(unoidl.test.cliure.climaker.Struct1).GetCustomAttributes(false).Length == 0);
1166         //member of a polymorphic struct with a parameterized type have also an attribute
1167         arAttr = typeStruct.GetField("member1").GetCustomAttributes(false);
1168         if (arAttr.Length == 1)
1169         {
1170             uno.ParameterizedTypeAttribute attr = arAttr[0] as uno.ParameterizedTypeAttribute;
1171             l.assure(attr != null && attr.Type == "if");
1172         }
1173         else
1174             l.assure(false);
1175 
1176 
1177         //test instantiated polymorphic struct: return value
1178 //         Type typeXTest = typeof(XTest);
1179 //         arAttr = typeXTest.GetMethod("testPolyStruct").ReturnTypeCustomAttributes.GetCustomAttributes(false);
1180 //         if (arAttr.Length == 1)
1181 //         {
1182 //             uno.TypeArgumentsAttribute attr = arAttr[0] as uno.TypeArgumentsAttribute;
1183 //             l.assure(attr != null && attr.Arguments.Length == 2
1184 //                      &&attr.Arguments[0] == typeof(char)
1185 //                      && attr.Arguments[1] == typeof(int));
1186 //         }
1187 //         else
1188 //             l.assure(false);
1189 //         arAttr = typeXTest.GetMethod("testPolyStruct").GetCustomAttributes(false);
1190     }
1191 
1192 //     private XComponentContext context;
1193 
1194         void testPolymorphicType(Logger l)
1195         {
1196             l.Function = "testPolymorphicType";
1197             string name = "unoidl.test.cliure.climaker.PolyStruct<System.Int32,System.Int32>";
1198 
1199             uno.PolymorphicType t1 = PolymorphicType.GetType(
1200                 typeof(unoidl.test.cliure.climaker.PolyStruct), name);
1201 
1202             uno.PolymorphicType t2 = PolymorphicType.GetType(
1203                 typeof(unoidl.test.cliure.climaker.PolyStruct ), name);
1204 
1205             l.assure(t1 == t2);
1206             l.assure(t1.PolymorphicName == name);
1207             l.assure(t1.OriginalType == typeof(unoidl.test.cliure.climaker.PolyStruct));
1208 
1209         }
1210 
1211     void testInterface(Logger l)
1212     {
1213         l.Function = "testInterface";
1214         try {
1215             Context c = new Context(Context.test_kind.NORMAL);
1216             XTest obj = S1.create1(c);
1217             bool aBool = true;
1218             byte aByte = 0xff;
1219             short aShort =   0x7fff;
1220             ushort aUShort =   0xffff;
1221             int aInt  = 0x7fffffff;
1222             uint aUInt = 0xffffffff;
1223             long aLong = 0x7fffffffffffffff;
1224             ulong aULong = 0xffffffffffffffff;
1225             float aFloat = 0.314f;
1226             double aDouble = 0.314d;
1227             char aChar  = 'A';
1228             string aString = "Hello World";
1229             Type aType = typeof(XTest);
1230             Any aAny = new Any(typeof(XTest), obj);
1231             Enum2 aEnum2 = Enum2.VALUE2;
1232             Struct1 aStruct1 = new Struct1();
1233             object aXInterface = new object();
1234             ucss.lang.XComponent aXComponent = (ucss.lang.XComponent) obj;
1235             bool[] aSeqBool = {true, false, true};
1236 
1237             obj.inParameters(aBool, aByte, aShort, aUShort,
1238                              aInt, aUInt, aLong, aULong,
1239                              aFloat, aDouble, aChar, aString,
1240                              aType, aAny,aEnum2, aStruct1,
1241                              aXInterface, aXComponent, aSeqBool);
1242 
1243             bool outBool;
1244             byte outByte;
1245             short outShort;
1246             ushort outUShort;
1247             int outInt;
1248             uint outUInt;
1249             long outLong;
1250             ulong outULong;
1251             float outFloat;
1252             double outDouble;
1253             char outChar;
1254             string outString;
1255             Type outType;
1256             Any outAny;
1257             Enum2 outEnum2;
1258             Struct1 outStruct1;
1259             object outXInterface;
1260             ucss.lang.XComponent outXComponent;
1261             bool[] outSeqBool;
1262 
1263             obj.outParameters(out outBool, out outByte, out  outShort, out outUShort,
1264                               out outInt, out outUInt, out outLong, out outULong,
1265                               out outFloat, out outDouble, out outChar, out outString,
1266                               out outType, out outAny, out outEnum2, out outStruct1,
1267                               out outXInterface, out outXComponent, out outSeqBool);
1268 
1269             l.assure(aBool == outBool);
1270             l.assure(aByte == outByte);
1271             l.assure(aShort == outShort);
1272             l.assure(aUShort == outUShort);
1273             l.assure(aInt == outInt);
1274             l.assure(aUInt == outUInt);
1275             l.assure(aLong == outLong);
1276             l.assure(aULong == outULong);
1277             l.assure(aFloat == outFloat);
1278             l.assure(aDouble == outDouble);
1279             l.assure(aChar == outChar);
1280             l.assure(aString == outString);
1281             l.assure(aType == outType);
1282             l.assure(aAny.Equals(outAny));
1283             l.assure(aEnum2 == outEnum2);
1284             l.assure(aStruct1 == outStruct1);
1285             l.assure(aXInterface == outXInterface);
1286             l.assure(aXComponent == outXComponent);
1287             l.assure(aSeqBool == outSeqBool);
1288 
1289             bool inoutBool = false;;
1290             byte inoutByte = 10;
1291             short inoutShort = 11;
1292             ushort inoutUShort = 12;
1293             int inoutInt = 13;
1294             uint inoutUInt = 14;
1295             long inoutLong = 15;
1296             ulong inoutULong = 16;
1297             float inoutFloat = 4.134f;
1298             double inoutDouble = 5.135;
1299             char inoutChar = 'B';
1300             string inoutString =  "Hello Hamburg";
1301             Type inoutType = typeof(int);
1302             Any inoutAny = new Any(inoutInt);
1303             Enum2 inoutEnum2 = Enum2.VALUE4;
1304             Struct1 inoutStruct1 = new Struct1();
1305             object inoutXInterface = new object();
1306             ucss.lang.XComponent inoutXComponent = (ucss.lang.XComponent) S1.create1(c);
1307             bool[] inoutSeqBool = {false, true, false};
1308 
1309 
1310             obj.inoutParameters(ref inoutBool, ref inoutByte, ref inoutShort, ref inoutUShort,
1311                                 ref inoutInt, ref inoutUInt, ref inoutLong, ref inoutULong,
1312                                 ref inoutFloat, ref inoutDouble, ref inoutChar, ref inoutString,
1313                                 ref inoutType, ref inoutAny, ref inoutEnum2, ref inoutStruct1,
1314                                 ref inoutXInterface, ref inoutXComponent, ref inoutSeqBool);
1315 
1316             l.assure(aBool == inoutBool);
1317             l.assure(aByte == inoutByte);
1318             l.assure(aShort == inoutShort);
1319             l.assure(aUShort == inoutUShort);
1320             l.assure(aInt == inoutInt);
1321             l.assure(aUInt == inoutUInt);
1322             l.assure(aLong == inoutLong);
1323             l.assure(aULong == inoutULong);
1324             l.assure(aFloat == inoutFloat);
1325             l.assure(aDouble == inoutDouble);
1326             l.assure(aChar == inoutChar);
1327             l.assure(aString == inoutString);
1328             l.assure(aType == inoutType);
1329             l.assure(aAny.Equals(inoutAny));
1330             l.assure(aEnum2 == inoutEnum2);
1331             l.assure(aStruct1 == inoutStruct1);
1332             l.assure(aXInterface == inoutXInterface);
1333             l.assure(aXComponent == inoutXComponent);
1334             l.assure(aSeqBool == inoutSeqBool);
1335 
1336 
1337             //now check the return values
1338             obj.inParameters(aBool, aByte, aShort, aUShort,
1339                              aInt, aUInt, aLong, aULong,
1340                              aFloat, aDouble, aChar, aString,
1341                              aType, aAny,aEnum2, aStruct1,
1342                              aXInterface, aXComponent, aSeqBool);
1343 
1344             l.assure(obj.retBoolean() == aBool);
1345             l.assure(obj.retByte() == aByte);
1346             l.assure(obj.retShort() == aShort);
1347             l.assure(obj.retUShort() == aUShort);
1348             l.assure(obj.retLong() == aInt);
1349             l.assure(obj.retULong() == aUInt);
1350             l.assure(obj.retHyper() == aLong);
1351             l.assure(obj.retUHyper() == aULong);
1352             l.assure(obj.retFloat() == aFloat);
1353             l.assure(obj.retDouble() == aDouble);
1354             l.assure(obj.retChar() == aChar);
1355             l.assure(obj.retString() == aString);
1356             l.assure(obj.retType() == aType);
1357             l.assure(obj.retAny().Equals(aAny));
1358             l.assure(obj.retEnum() == aEnum2);
1359             l.assure(obj.retStruct1() == aStruct1);
1360             l.assure(obj.retXInterface() == aXInterface);
1361             l.assure(obj.retXComponent() == aXComponent);
1362             l.assure(obj.retSeqBool() == aSeqBool);
1363 
1364 
1365             obj = S1.create1(c);
1366             obj.attrBoolean = true;
1367             l.assure(obj.attrBoolean == true);
1368             obj.attrByte = aByte;
1369             l.assure(obj.attrByte == aByte);
1370             obj.attrShort = aShort;
1371             l.assure(obj.attrShort == aShort);
1372             obj.attrUShort = aUShort;
1373             l.assure(obj.attrUShort == aUShort);
1374             obj.attrLong = aInt;
1375             l.assure(obj.attrLong == aInt);
1376             obj.attrULong = aUInt;
1377             l.assure(obj.attrULong == aUInt);
1378             obj.attrHyper = aLong;
1379             l.assure(obj.attrHyper == aLong);
1380             obj.attrUHyper = aULong;
1381             l.assure(obj.attrUHyper == aULong);
1382             obj.attrFloat = aFloat;
1383             l.assure(obj.attrFloat == aFloat);
1384             obj.attrDouble = aDouble;
1385             l.assure(obj.attrDouble == aDouble);
1386             obj.attrChar = aChar;
1387             l.assure(obj.attrChar == aChar);
1388             obj.attrString = aString;
1389             l.assure(obj.attrString == aString);
1390             obj.attrType = aType;
1391             l.assure(obj.attrType == aType);
1392             obj.attrAny = aAny;
1393             l.assure(obj.attrAny.Equals(aAny));
1394             obj.attrEnum2 = aEnum2;
1395             l.assure(obj.attrEnum2 == aEnum2);
1396             obj.attrStruct1 = aStruct1;
1397             l.assure(obj.attrStruct1 == aStruct1);
1398             obj.attrXInterface = aXInterface;
1399             l.assure(obj.attrXInterface == aXInterface);
1400             obj.attrXComponent = aXComponent;
1401             l.assure(obj.attrXComponent == aXComponent);
1402             obj.attrSeqBoolean = aSeqBool;
1403             l.assure(obj.attrSeqBoolean == aSeqBool);
1404         } catch (Exception )
1405         {
1406             l.assure(false);
1407         }
1408     }
1409 
1410     public void testAny(Logger l)
1411     {
1412         l.Function = "testAny";
1413         //create any with valid and invalid arguments
1414         try
1415         {
1416             Any a = new Any(null, null);
1417             l.assure(false);
1418         }
1419         catch(System.Exception e)
1420         {
1421             l.assure(e.Message.IndexOf("Any") != -1);
1422         }
1423         try
1424         {
1425             Any a = new Any(typeof(int), null);
1426             l.assure(false);
1427         }
1428         catch(System.Exception e)
1429         {
1430             l.assure(e.Message.IndexOf("Any") != -1);
1431         }
1432 
1433 
1434         try
1435         {
1436             Any a = new Any(typeof(unoidl.com.sun.star.uno.XComponentContext), null);
1437             a = new Any('a');
1438             a = new Any((sbyte)1);
1439         }
1440         catch (System.Exception)
1441         {
1442             l.assure(false);
1443         }
1444 
1445         //test polymorphic struct
1446         try
1447         {
1448             Any a = new Any(typeof(unoidl.test.cliure.climaker.PolyStruct),
1449                             new PolyStruct());
1450             l.assure(false);
1451         }
1452         catch (System.Exception e)
1453         {
1454             l.assure(e.Message.IndexOf("Any") != -1);
1455         }
1456         try
1457         {
1458             Any a = new Any(uno.PolymorphicType.GetType(
1459                                 typeof(unoidl.test.cliure.climaker.PolyStruct),
1460                                 "unoidl.test.cliure.climaker.PolyStruct<System.Char>"),
1461                             new PolyStruct('A', 10));
1462         }
1463         catch (System.Exception )
1464         {
1465             l.assure(false);
1466         }
1467 
1468         //test Any.Equals
1469 
1470         Any aVoid = Any.VOID;
1471         l.assure(aVoid.Equals((object) Any.VOID));
1472         l.assure(aVoid.Equals(Any.VOID));
1473 
1474         l.assure(aVoid.Equals(new Any("")) == false);
1475 
1476         Any a1 = new Any(10);
1477         Any a2 = a1;
1478         l.assure(a1.Equals(a2));
1479 
1480         a1 = new Any(typeof(unoidl.com.sun.star.uno.XComponentContext), null);
1481         l.assure(a1.Equals(a2) == false);
1482         a2 = a1;
1483         l.assure(a1.Equals(a2));
1484         l.assure(a1.Equals(null) == false);
1485         l.assure(a1.Equals(new object()) == false);
1486     }
1487 }
1488