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