merge the formfield patch from ooo-build
[ooovba.git] / bridges / test / java_uno / any / TestAny.java
blob365424444e7f7950ea42cc78082be6b4b6263dfc
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: TestAny.java,v $
10 * $Revision: 1.5.20.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 package test.java_uno.anytest;
33 import com.sun.star.uno.Any;
34 import com.sun.star.uno.Enum;
35 import com.sun.star.uno.Type;
36 import com.sun.star.uno.TypeClass;
37 import com.sun.star.uno.XInterface;
38 import java.lang.reflect.Array;
40 final class TestAny {
41 public static boolean test(XTransport transport, boolean createTypes) {
42 boolean success = true;
44 // Sanity check for com.sun.star.uno.Type:
45 success &= testType(void.class, TypeClass.VOID, "void");
46 success &= testType(boolean.class, TypeClass.BOOLEAN, "boolean");
47 success &= testType(byte.class, TypeClass.BYTE, "byte");
48 success &= testType(short.class, TypeClass.SHORT, "short");
49 success &= testType(int.class, TypeClass.LONG, "long");
50 success &= testType(long.class, TypeClass.HYPER, "hyper");
51 success &= testType(float.class, TypeClass.FLOAT, "float");
52 success &= testType(double.class, TypeClass.DOUBLE, "double");
53 success &= testType(char.class, TypeClass.CHAR, "char");
54 success &= testType(String.class, TypeClass.STRING, "string");
55 success &= testType(Type.class, TypeClass.TYPE, "type");
56 success &= testType(Any.class, TypeClass.ANY, "any");
57 success &= testType(boolean[].class, TypeClass.SEQUENCE, "[]boolean");
58 success &= testType(byte[].class, TypeClass.SEQUENCE, "[]byte");
59 success &= testType(short[].class, TypeClass.SEQUENCE, "[]short");
60 success &= testType(int[].class, TypeClass.SEQUENCE, "[]long");
61 success &= testType(long[].class, TypeClass.SEQUENCE, "[]hyper");
62 success &= testType(float[].class, TypeClass.SEQUENCE, "[]float");
63 success &= testType(double[].class, TypeClass.SEQUENCE, "[]double");
64 success &= testType(char[].class, TypeClass.SEQUENCE, "[]char");
65 success &= testType(String[].class, TypeClass.SEQUENCE, "[]string");
66 success &= testType(Type[].class, TypeClass.SEQUENCE, "[]type");
67 success &= testType(Any[].class, TypeClass.SEQUENCE, "[]any");
68 success &= testType(Enum1[].class, TypeClass.SEQUENCE,
69 "[]" + Enum1.class.getName());
70 success &= testType(BaseStruct[].class, TypeClass.SEQUENCE,
71 "[]" + BaseStruct.class.getName());
72 success &= testType(DerivedStruct[].class, TypeClass.SEQUENCE,
73 "[]" + DerivedStruct.class.getName());
74 success &= testType(XInterface[].class, TypeClass.SEQUENCE,
75 "[]" + XInterface.class.getName());
76 success &= testType(BaseInterface[].class, TypeClass.SEQUENCE,
77 "[]" + BaseInterface.class.getName());
78 success &= testType(DerivedInterface[].class, TypeClass.SEQUENCE,
79 "[]" + DerivedInterface.class.getName());
80 success &= testType(boolean[][].class, TypeClass.SEQUENCE,
81 "[][]boolean");
82 success &= testType(byte[][].class, TypeClass.SEQUENCE, "[][]byte");
83 success &= testType(short[][].class, TypeClass.SEQUENCE, "[][]short");
84 success &= testType(int[][].class, TypeClass.SEQUENCE, "[][]long");
85 success &= testType(long[][].class, TypeClass.SEQUENCE, "[][]hyper");
86 success &= testType(float[][].class, TypeClass.SEQUENCE, "[][]float");
87 success &= testType(double[][].class, TypeClass.SEQUENCE, "[][]double");
88 success &= testType(char[][].class, TypeClass.SEQUENCE, "[][]char");
89 success &= testType(String[][].class, TypeClass.SEQUENCE, "[][]string");
90 success &= testType(Type[][].class, TypeClass.SEQUENCE, "[][]type");
91 success &= testType(Any[][].class, TypeClass.SEQUENCE, "[][]any");
92 success &= testType(Enum1[][].class, TypeClass.SEQUENCE,
93 "[][]" + Enum1.class.getName());
94 success &= testType(BaseStruct[][].class, TypeClass.SEQUENCE,
95 "[][]" + BaseStruct.class.getName());
96 success &= testType(DerivedStruct[][].class, TypeClass.SEQUENCE,
97 "[][]" + DerivedStruct.class.getName());
98 success &= testType(XInterface[][].class, TypeClass.SEQUENCE,
99 "[][]" + XInterface.class.getName());
100 success &= testType(BaseInterface[][].class, TypeClass.SEQUENCE,
101 "[][]" + BaseInterface.class.getName());
102 success &= testType(DerivedInterface[][].class, TypeClass.SEQUENCE,
103 "[][]" + DerivedInterface.class.getName());
104 success &= testType(Enum1.class, TypeClass.ENUM, Enum1.class.getName());
105 success &= testType(BaseStruct.class, TypeClass.STRUCT,
106 BaseStruct.class.getName());
107 success &= testType(DerivedStruct.class, TypeClass.STRUCT,
108 DerivedStruct.class.getName());
109 success &= testType(com.sun.star.uno.Exception.class,
110 TypeClass.EXCEPTION,
111 com.sun.star.uno.Exception.class.getName());
112 success &= testType(com.sun.star.uno.RuntimeException.class,
113 TypeClass.EXCEPTION,
114 com.sun.star.uno.RuntimeException.class.getName());
115 success &= testType(XInterface.class, TypeClass.INTERFACE,
116 XInterface.class.getName());
117 success &= testType(BaseInterface.class, TypeClass.INTERFACE,
118 BaseInterface.class.getName());
119 success &= testType(DerivedInterface.class, TypeClass.INTERFACE,
120 DerivedInterface.class.getName());
122 // VOID:
123 success &= testMapAny(transport, Any.VOID, new CompareBoxed());
125 // BOOLEAN:
126 success &= testMapAny(transport, Boolean.FALSE, new CompareBoxed());
127 success &= testMapAny(transport, Boolean.TRUE, new CompareBoxed());
128 success &= testMapAny(transport,
129 new Any(Type.BOOLEAN, Boolean.FALSE),
130 new CompareUnboxed());
131 success &= testMapAny(transport,
132 new Any(Type.BOOLEAN, Boolean.TRUE),
133 new CompareUnboxed());
135 // BYTE:
136 success &= testMapAny(transport, new Byte((byte) -128),
137 new CompareBoxed());
138 success &= testMapAny(transport, new Byte((byte) 0),
139 new CompareBoxed());
140 success &= testMapAny(transport, new Byte((byte) 127),
141 new CompareBoxed());
142 success &= testMapAny(transport,
143 new Any(Type.BYTE, new Byte((byte) -128)),
144 new CompareUnboxed());
145 success &= testMapAny(transport,
146 new Any(Type.BYTE, new Byte((byte) 0)),
147 new CompareUnboxed());
148 success &= testMapAny(transport,
149 new Any(Type.BYTE, new Byte((byte) 127)),
150 new CompareUnboxed());
152 // SHORT:
153 success &= testMapAny(transport, new Short((short) -32768),
154 new CompareBoxed());
155 success &= testMapAny(transport, new Short((short) 0),
156 new CompareBoxed());
157 success &= testMapAny(transport, new Short((short) 32767),
158 new CompareBoxed());
159 success &= testMapAny(transport,
160 new Any(Type.SHORT,
161 new Short((short) -32768)),
162 new CompareUnboxed());
163 success &= testMapAny(transport,
164 new Any(Type.SHORT, new Short((short) 0)),
165 new CompareUnboxed());
166 success &= testMapAny(transport,
167 new Any(Type.SHORT, new Short((short) 32767)),
168 new CompareUnboxed());
170 // UNSIGNED SHORT:
171 success &= testMapAny(transport,
172 new Any(Type.UNSIGNED_SHORT,
173 new Short((short) 0)),
174 new CompareBoxed());
175 success &= testMapAny(transport,
176 new Any(Type.UNSIGNED_SHORT,
177 new Short((short) -32768)),
178 new CompareBoxed());
180 // LONG:
181 success &= testMapAny(transport, new Integer(-2147483648),
182 new CompareBoxed());
183 success &= testMapAny(transport, new Integer(0),
184 new CompareBoxed());
185 success &= testMapAny(transport, new Integer(2147483647),
186 new CompareBoxed());
187 success &= testMapAny(transport,
188 new Any(Type.LONG, new Integer(-2147483648)),
189 new CompareUnboxed());
190 success &= testMapAny(transport,
191 new Any(Type.LONG, new Integer(0)),
192 new CompareUnboxed());
193 success &= testMapAny(transport,
194 new Any(Type.LONG, new Integer(2147483647)),
195 new CompareUnboxed());
197 // UNSIGNED LONG:
198 success &= testMapAny(transport,
199 new Any(Type.UNSIGNED_LONG, new Integer(0)),
200 new CompareBoxed());
201 success &= testMapAny(transport,
202 new Any(Type.UNSIGNED_LONG,
203 new Integer(-2147483648)),
204 new CompareBoxed());
206 // HYPER:
207 success &= testMapAny(transport, new Long(-9223372036854775808L),
208 new CompareBoxed());
209 success &= testMapAny(transport, new Long(0L), new CompareBoxed());
210 success &= testMapAny(transport, new Long(9223372036854775807L),
211 new CompareBoxed());
212 success &= testMapAny(transport,
213 new Any(Type.HYPER,
214 new Long(-9223372036854775808L)),
215 new CompareUnboxed());
216 success &= testMapAny(transport, new Any(Type.HYPER, new Long(0L)),
217 new CompareUnboxed());
218 success &= testMapAny(transport,
219 new Any(Type.HYPER,
220 new Long(9223372036854775807L)),
221 new CompareUnboxed());
223 // UNSIGNED HYPER:
224 success &= testMapAny(transport,
225 new Any(Type.UNSIGNED_HYPER, new Long(0L)),
226 new CompareBoxed());
227 success &= testMapAny(transport,
228 new Any(Type.UNSIGNED_HYPER,
229 new Long(-9223372036854775808L)),
230 new CompareBoxed());
232 // FLOAT:
233 success &= testMapAny(transport, new Float(Float.NEGATIVE_INFINITY),
234 new CompareBoxed());
235 success &= testMapAny(transport, new Float(Float.MIN_VALUE),
236 new CompareBoxed());
237 success &= testMapAny(transport, new Float(-0.0f),
238 new CompareBoxed());
239 success &= testMapAny(transport, new Float(0.0f),
240 new CompareBoxed());
241 success &= testMapAny(transport, new Float(Float.MAX_VALUE),
242 new CompareBoxed());
243 success &= testMapAny(transport, new Float(Float.POSITIVE_INFINITY),
244 new CompareBoxed());
245 success &= testMapAny(transport, new Float(Float.NaN),
246 new CompareBoxed());
247 success &= testMapAny(transport,
248 new Any(Type.FLOAT,
249 new Float(Float.NEGATIVE_INFINITY)),
250 new CompareUnboxed());
251 success &= testMapAny(transport,
252 new Any(Type.FLOAT,
253 new Float(Float.MIN_VALUE)),
254 new CompareUnboxed());
255 success &= testMapAny(transport,
256 new Any(Type.FLOAT, new Float(-0.0f)),
257 new CompareUnboxed());
258 success &= testMapAny(transport,
259 new Any(Type.FLOAT, new Float(0.0f)),
260 new CompareUnboxed());
261 success &= testMapAny(transport,
262 new Any(Type.FLOAT,
263 new Float(Float.MAX_VALUE)),
264 new CompareUnboxed());
265 success &= testMapAny(transport,
266 new Any(Type.FLOAT,
267 new Float(Float.POSITIVE_INFINITY)),
268 new CompareUnboxed());
269 success &= testMapAny(transport,
270 new Any(Type.FLOAT, new Float(Float.NaN)),
271 new CompareUnboxed());
273 // DOUBLE:
274 success &= testMapAny(transport,
275 new Double(Double.NEGATIVE_INFINITY),
276 new CompareBoxed());
277 success &= testMapAny(transport, new Double(Double.MIN_VALUE),
278 new CompareBoxed());
279 success &= testMapAny(transport, new Double(-0.0f),
280 new CompareBoxed());
281 success &= testMapAny(transport, new Double(0.0f),
282 new CompareBoxed());
283 success &= testMapAny(transport, new Double(Double.MAX_VALUE),
284 new CompareBoxed());
285 success &= testMapAny(transport,
286 new Double(Double.POSITIVE_INFINITY),
287 new CompareBoxed());
288 success &= testMapAny(transport, new Double(Double.NaN),
289 new CompareBoxed());
290 success &= testMapAny(transport,
291 new Any(Type.DOUBLE,
292 new Double(Double.NEGATIVE_INFINITY)),
293 new CompareUnboxed());
294 success &= testMapAny(transport,
295 new Any(Type.DOUBLE,
296 new Double(Double.MIN_VALUE)),
297 new CompareUnboxed());
298 success &= testMapAny(transport,
299 new Any(Type.DOUBLE, new Double(-0.0)),
300 new CompareUnboxed());
301 success &= testMapAny(transport,
302 new Any(Type.DOUBLE, new Double(0.0)),
303 new CompareUnboxed());
304 success &= testMapAny(transport,
305 new Any(Type.DOUBLE,
306 new Double(Double.MAX_VALUE)),
307 new CompareUnboxed());
308 success &= testMapAny(transport,
309 new Any(Type.DOUBLE,
310 new Double(Double.POSITIVE_INFINITY)),
311 new CompareUnboxed());
312 success &= testMapAny(transport,
313 new Any(Type.DOUBLE, new Double(Double.NaN)),
314 new CompareUnboxed());
316 // CHAR:
317 success &= testMapAny(transport, new Character('\u0000'),
318 new CompareBoxed());
319 success &= testMapAny(transport, new Character('\uDBFF'),
320 new CompareBoxed());
321 success &= testMapAny(transport, new Character('\uFFFD'),
322 new CompareBoxed());
323 success &= testMapAny(transport,
324 new Any(Type.CHAR, new Character('\u0000')),
325 new CompareUnboxed());
326 success &= testMapAny(transport,
327 new Any(Type.CHAR, new Character('\uDBFF')),
328 new CompareUnboxed());
329 success &= testMapAny(transport,
330 new Any(Type.CHAR, new Character('\uFFFD')),
331 new CompareUnboxed());
333 // STRING:
334 success &= testMapAny(transport, "", new CompareBoxed());
335 success &= testMapAny(transport, "\uD800\uDC00",
336 new CompareBoxed());
337 success &= testMapAny(transport, "Test", new CompareBoxed());
338 success &= testMapAny(transport, new Any(Type.STRING, ""),
339 new CompareUnboxed());
340 success &= testMapAny(transport,
341 new Any(Type.STRING, "\uD800\uDC00"),
342 new CompareUnboxed());
343 success &= testMapAny(transport, new Any(Type.STRING, "Test"),
344 new CompareUnboxed());
346 // TYPE:
347 success &= testMapAny(transport, Type.VOID, new CompareBoxed());
348 success &= testMapAny(transport, Type.BOOLEAN, new CompareBoxed());
349 success &= testMapAny(transport, Type.BYTE, new CompareBoxed());
350 success &= testMapAny(transport, Type.SHORT, new CompareBoxed());
351 success &= testMapAny(transport, Type.UNSIGNED_SHORT,
352 new CompareBoxed());
353 success &= testMapAny(transport, Type.LONG, new CompareBoxed());
354 success &= testMapAny(transport, Type.UNSIGNED_LONG,
355 new CompareBoxed());
356 success &= testMapAny(transport, Type.HYPER, new CompareBoxed());
357 success &= testMapAny(transport, Type.UNSIGNED_HYPER,
358 new CompareBoxed());
359 success &= testMapAny(transport, Type.FLOAT, new CompareBoxed());
360 success &= testMapAny(transport, Type.DOUBLE, new CompareBoxed());
361 success &= testMapAny(transport, Type.CHAR, new CompareBoxed());
362 success &= testMapAny(transport, Type.STRING, new CompareBoxed());
363 success &= testMapAny(transport, Type.TYPE, new CompareBoxed());
364 success &= testMapAny(transport, Type.ANY, new CompareBoxed());
365 success &= testMapAny(transport,
366 new Type("[]boolean", TypeClass.SEQUENCE),
367 new CompareBoxed());
368 success &= testMapAny(transport,
369 new Type("[]byte", TypeClass.SEQUENCE),
370 new CompareBoxed());
371 success &= testMapAny(transport,
372 new Type("[]short", TypeClass.SEQUENCE),
373 new CompareBoxed());
374 success &= testMapAny(transport,
375 new Type("[]unsigned short",
376 TypeClass.SEQUENCE),
377 new CompareBoxed());
378 success &= testMapAny(transport,
379 new Type("[]long", TypeClass.SEQUENCE),
380 new CompareBoxed());
381 success &= testMapAny(transport,
382 new Type("[]unsigned long",
383 TypeClass.SEQUENCE),
384 new CompareBoxed());
385 success &= testMapAny(transport,
386 new Type("[]hyper", TypeClass.SEQUENCE),
387 new CompareBoxed());
388 success &= testMapAny(transport,
389 new Type("[]unsigned hyper",
390 TypeClass.SEQUENCE),
391 new CompareBoxed());
392 success &= testMapAny(transport,
393 new Type("[]float", TypeClass.SEQUENCE),
394 new CompareBoxed());
395 success &= testMapAny(transport,
396 new Type("[]double", TypeClass.SEQUENCE),
397 new CompareBoxed());
398 success &= testMapAny(transport,
399 new Type("[]char", TypeClass.SEQUENCE),
400 new CompareBoxed());
401 success &= testMapAny(transport,
402 new Type("[]string", TypeClass.SEQUENCE),
403 new CompareBoxed());
404 success &= testMapAny(transport,
405 new Type("[]type", TypeClass.SEQUENCE),
406 new CompareBoxed());
407 success &= testMapAny(transport,
408 new Type("[]any", TypeClass.SEQUENCE),
409 new CompareBoxed());
410 if (createTypes) {
411 success &= testMapAny(transport,
412 new Type("[]" + Enum1.class.getName(),
413 TypeClass.SEQUENCE),
414 new CompareBoxed());
415 success &= testMapAny(transport,
416 new Type("[]" + BaseStruct.class.getName(),
417 TypeClass.SEQUENCE),
418 new CompareBoxed());
419 success &= testMapAny(transport,
420 new Type("[]" + DerivedStruct.class.getName(),
421 TypeClass.SEQUENCE),
422 new CompareBoxed());
424 success &= testMapAny(transport,
425 new Type("[]" + XInterface.class.getName(),
426 TypeClass.SEQUENCE),
427 new CompareBoxed());
428 success &= testMapAny(transport,
429 new Type("[]" + BaseInterface.class.getName(),
430 TypeClass.SEQUENCE),
431 new CompareBoxed());
432 success &= testMapAny(transport,
433 new Type("[]"
434 + DerivedInterface.class.getName(),
435 TypeClass.SEQUENCE),
436 new CompareBoxed());
437 success &= testMapAny(transport,
438 new Type("[][]boolean", TypeClass.SEQUENCE),
439 new CompareBoxed());
440 success &= testMapAny(transport,
441 new Type("[][]byte", TypeClass.SEQUENCE),
442 new CompareBoxed());
443 success &= testMapAny(transport,
444 new Type("[][]short", TypeClass.SEQUENCE),
445 new CompareBoxed());
446 success &= testMapAny(transport,
447 new Type("[][]unsigned short",
448 TypeClass.SEQUENCE),
449 new CompareBoxed());
450 success &= testMapAny(transport,
451 new Type("[][]long", TypeClass.SEQUENCE),
452 new CompareBoxed());
453 success &= testMapAny(transport,
454 new Type("[][]unsigned long",
455 TypeClass.SEQUENCE),
456 new CompareBoxed());
457 success &= testMapAny(transport,
458 new Type("[][]hyper", TypeClass.SEQUENCE),
459 new CompareBoxed());
460 success &= testMapAny(transport,
461 new Type("[][]unsigned hyper",
462 TypeClass.SEQUENCE),
463 new CompareBoxed());
464 success &= testMapAny(transport,
465 new Type("[][]float", TypeClass.SEQUENCE),
466 new CompareBoxed());
467 success &= testMapAny(transport,
468 new Type("[][]double", TypeClass.SEQUENCE),
469 new CompareBoxed());
470 success &= testMapAny(transport,
471 new Type("[][]char", TypeClass.SEQUENCE),
472 new CompareBoxed());
473 success &= testMapAny(transport,
474 new Type("[][]string", TypeClass.SEQUENCE),
475 new CompareBoxed());
476 success &= testMapAny(transport,
477 new Type("[][]type", TypeClass.SEQUENCE),
478 new CompareBoxed());
479 success &= testMapAny(transport,
480 new Type("[][]any", TypeClass.SEQUENCE),
481 new CompareBoxed());
482 if (createTypes) {
483 success &= testMapAny(transport,
484 new Type("[][]" + Enum1.class.getName(),
485 TypeClass.SEQUENCE),
486 new CompareBoxed());
487 success &= testMapAny(transport,
488 new Type("[][]" + BaseStruct.class.getName(),
489 TypeClass.SEQUENCE),
490 new CompareBoxed());
491 success &= testMapAny(transport,
492 new Type("[][]"
493 + DerivedStruct.class.getName(),
494 TypeClass.SEQUENCE),
495 new CompareBoxed());
497 success &= testMapAny(transport,
498 new Type("[][]" + XInterface.class.getName(),
499 TypeClass.SEQUENCE),
500 new CompareBoxed());
501 success &= testMapAny(transport,
502 new Type("[][]"
503 + BaseInterface.class.getName(),
504 TypeClass.SEQUENCE),
505 new CompareBoxed());
506 success &= testMapAny(transport,
507 new Type("[][]"
508 + DerivedInterface.class.getName(),
509 TypeClass.SEQUENCE),
510 new CompareBoxed());
511 if (createTypes) {
512 success &= testMapAny(transport, new Type(Enum1.class.getName(),
513 TypeClass.ENUM),
514 new CompareBoxed());
515 success &= testMapAny(transport,
516 new Type(BaseStruct.class.getName(),
517 TypeClass.STRUCT),
518 new CompareBoxed());
519 success &= testMapAny(transport,
520 new Type(DerivedStruct.class.getName(),
521 TypeClass.STRUCT),
522 new CompareBoxed());
524 success &= testMapAny(transport,
525 new Type(
526 com.sun.star.uno.Exception.class.
527 getName(),
528 TypeClass.EXCEPTION),
529 new CompareBoxed());
530 if (createTypes) {
531 success &= testMapAny(transport,
532 new Type(BaseException.class.getName(),
533 TypeClass.EXCEPTION),
534 new CompareBoxed());
535 success &= testMapAny(transport,
536 new Type(DerivedException.class.getName(),
537 TypeClass.EXCEPTION),
538 new CompareBoxed());
540 success &= testMapAny(transport,
541 new Type(
542 com.sun.star.uno.RuntimeException.class.
543 getName(),
544 TypeClass.EXCEPTION),
545 new CompareBoxed());
546 if (createTypes) {
547 success &= testMapAny(transport,
548 new Type(
549 BaseRuntimeException.class.getName(),
550 TypeClass.EXCEPTION),
551 new CompareBoxed());
552 success &= testMapAny(transport,
553 new Type(
554 DerivedRuntimeException.class.
555 getName(),
556 TypeClass.EXCEPTION),
557 new CompareBoxed());
559 success &= testMapAny(transport,
560 new Type(XInterface.class.getName(),
561 TypeClass.INTERFACE),
562 new CompareBoxed());
563 success &= testMapAny(transport,
564 new Type(BaseInterface.class.getName(),
565 TypeClass.INTERFACE),
566 new CompareBoxed());
567 success &= testMapAny(transport,
568 new Type(DerivedInterface.class.getName(),
569 TypeClass.INTERFACE),
570 new CompareBoxed());
571 success &= testMapAny(transport, new Any(Type.TYPE, Type.VOID),
572 new CompareUnboxed());
573 success &= testMapAny(transport, new Any(Type.TYPE, Type.BOOLEAN),
574 new CompareUnboxed());
575 success &= testMapAny(transport, new Any(Type.TYPE, Type.BYTE),
576 new CompareUnboxed());
577 success &= testMapAny(transport, new Any(Type.TYPE, Type.SHORT),
578 new CompareUnboxed());
579 success &= testMapAny(transport,
580 new Any(Type.TYPE, Type.UNSIGNED_SHORT),
581 new CompareUnboxed());
582 success &= testMapAny(transport, new Any(Type.TYPE, Type.LONG),
583 new CompareUnboxed());
584 success &= testMapAny(transport,
585 new Any(Type.TYPE, Type.UNSIGNED_LONG),
586 new CompareUnboxed());
587 success &= testMapAny(transport, new Any(Type.TYPE, Type.HYPER),
588 new CompareUnboxed());
589 success &= testMapAny(transport,
590 new Any(Type.TYPE, Type.UNSIGNED_HYPER),
591 new CompareUnboxed());
592 success &= testMapAny(transport, new Any(Type.TYPE, Type.FLOAT),
593 new CompareUnboxed());
594 success &= testMapAny(transport, new Any(Type.TYPE, Type.DOUBLE),
595 new CompareUnboxed());
596 success &= testMapAny(transport, new Any(Type.TYPE, Type.CHAR),
597 new CompareUnboxed());
598 success &= testMapAny(transport, new Any(Type.TYPE, Type.STRING),
599 new CompareUnboxed());
600 success &= testMapAny(transport, new Any(Type.TYPE, Type.TYPE),
601 new CompareUnboxed());
602 success &= testMapAny(transport, new Any(Type.TYPE, Type.ANY),
603 new CompareUnboxed());
604 success &= testMapAny(transport,
605 new Any(Type.TYPE,
606 new Type("[]boolean",
607 TypeClass.SEQUENCE)),
608 new CompareUnboxed());
609 success &= testMapAny(transport,
610 new Any(Type.TYPE,
611 new Type("[]byte",
612 TypeClass.SEQUENCE)),
613 new CompareUnboxed());
614 success &= testMapAny(transport,
615 new Any(Type.TYPE,
616 new Type("[]short",
617 TypeClass.SEQUENCE)),
618 new CompareUnboxed());
619 success &= testMapAny(transport,
620 new Any(Type.TYPE,
621 new Type("[]unsigned short",
622 TypeClass.SEQUENCE)),
623 new CompareUnboxed());
624 success &= testMapAny(transport,
625 new Any(Type.TYPE,
626 new Type("[]long",
627 TypeClass.SEQUENCE)),
628 new CompareUnboxed());
629 success &= testMapAny(transport,
630 new Any(Type.TYPE,
631 new Type("[]unsigned long",
632 TypeClass.SEQUENCE)),
633 new CompareUnboxed());
634 success &= testMapAny(transport,
635 new Any(Type.TYPE,
636 new Type("[]hyper",
637 TypeClass.SEQUENCE)),
638 new CompareUnboxed());
639 success &= testMapAny(transport,
640 new Any(Type.TYPE,
641 new Type("[]unsigned hyper",
642 TypeClass.SEQUENCE)),
643 new CompareUnboxed());
644 success &= testMapAny(transport,
645 new Any(Type.TYPE,
646 new Type("[]float",
647 TypeClass.SEQUENCE)),
648 new CompareUnboxed());
649 success &= testMapAny(transport,
650 new Any(Type.TYPE,
651 new Type("[]double",
652 TypeClass.SEQUENCE)),
653 new CompareUnboxed());
654 success &= testMapAny(transport,
655 new Any(Type.TYPE,
656 new Type("[]char",
657 TypeClass.SEQUENCE)),
658 new CompareUnboxed());
659 success &= testMapAny(transport,
660 new Any(Type.TYPE,
661 new Type("[]string",
662 TypeClass.SEQUENCE)),
663 new CompareUnboxed());
664 success &= testMapAny(transport,
665 new Any(Type.TYPE,
666 new Type("[]type",
667 TypeClass.SEQUENCE)),
668 new CompareUnboxed());
669 success &= testMapAny(transport,
670 new Any(Type.TYPE,
671 new Type("[]any",
672 TypeClass.SEQUENCE)),
673 new CompareUnboxed());
674 if (createTypes) {
675 success &= testMapAny(transport,
676 new Any(Type.TYPE,
677 new Type("[]" + Enum1.class.getName(),
678 TypeClass.SEQUENCE)),
679 new CompareUnboxed());
680 success &= testMapAny(transport,
681 new Any(Type.TYPE,
682 new Type("[]"
683 + BaseStruct.class.getName(),
684 TypeClass.SEQUENCE)),
685 new CompareUnboxed());
686 success &= testMapAny(transport,
687 new Any(Type.TYPE,
688 new Type(
689 "[]"
690 + DerivedStruct.class.getName(),
691 TypeClass.SEQUENCE)),
692 new CompareUnboxed());
694 success &= testMapAny(transport,
695 new Any(Type.TYPE,
696 new Type("[]"
697 + XInterface.class.getName(),
698 TypeClass.SEQUENCE)),
699 new CompareUnboxed());
700 success &= testMapAny(transport,
701 new Any(Type.TYPE,
702 new Type(
703 "[]"
704 + BaseInterface.class.getName(),
705 TypeClass.SEQUENCE)),
706 new CompareUnboxed());
707 success &= testMapAny(transport,
708 new Any(
709 Type.TYPE,
710 new Type(
711 "[]"
712 + DerivedInterface.class.getName(),
713 TypeClass.SEQUENCE)),
714 new CompareUnboxed());
715 success &= testMapAny(transport,
716 new Any(Type.TYPE,
717 new Type("[][]boolean",
718 TypeClass.SEQUENCE)),
719 new CompareUnboxed());
720 success &= testMapAny(transport,
721 new Any(Type.TYPE,
722 new Type("[][]byte",
723 TypeClass.SEQUENCE)),
724 new CompareUnboxed());
725 success &= testMapAny(transport,
726 new Any(Type.TYPE,
727 new Type("[][]short",
728 TypeClass.SEQUENCE)),
729 new CompareUnboxed());
730 success &= testMapAny(transport,
731 new Any(Type.TYPE,
732 new Type("[][]unsigned short",
733 TypeClass.SEQUENCE)),
734 new CompareUnboxed());
735 success &= testMapAny(transport,
736 new Any(Type.TYPE,
737 new Type("[][]long",
738 TypeClass.SEQUENCE)),
739 new CompareUnboxed());
740 success &= testMapAny(transport,
741 new Any(Type.TYPE,
742 new Type("[][]unsigned long",
743 TypeClass.SEQUENCE)),
744 new CompareUnboxed());
745 success &= testMapAny(transport,
746 new Any(Type.TYPE,
747 new Type("[][]hyper",
748 TypeClass.SEQUENCE)),
749 new CompareUnboxed());
750 success &= testMapAny(transport,
751 new Any(Type.TYPE,
752 new Type("[][]unsigned hyper",
753 TypeClass.SEQUENCE)),
754 new CompareUnboxed());
755 success &= testMapAny(transport,
756 new Any(Type.TYPE,
757 new Type("[][]float",
758 TypeClass.SEQUENCE)),
759 new CompareUnboxed());
760 success &= testMapAny(transport,
761 new Any(Type.TYPE,
762 new Type("[][]double",
763 TypeClass.SEQUENCE)),
764 new CompareUnboxed());
765 success &= testMapAny(transport,
766 new Any(Type.TYPE,
767 new Type("[][]char",
768 TypeClass.SEQUENCE)),
769 new CompareUnboxed());
770 success &= testMapAny(transport,
771 new Any(Type.TYPE,
772 new Type("[][]string",
773 TypeClass.SEQUENCE)),
774 new CompareUnboxed());
775 success &= testMapAny(transport,
776 new Any(Type.TYPE,
777 new Type("[][]type",
778 TypeClass.SEQUENCE)),
779 new CompareUnboxed());
780 success &= testMapAny(transport,
781 new Any(Type.TYPE,
782 new Type("[][]any",
783 TypeClass.SEQUENCE)),
784 new CompareUnboxed());
785 if (createTypes) {
786 success &= testMapAny(transport,
787 new Any(Type.TYPE,
788 new Type("[][]"
789 + Enum1.class.getName(),
790 TypeClass.SEQUENCE)),
791 new CompareUnboxed());
792 success &= testMapAny(transport,
793 new Any(Type.TYPE,
794 new Type("[][]"
795 + BaseStruct.class.getName(),
796 TypeClass.SEQUENCE)),
797 new CompareUnboxed());
798 success &= testMapAny(transport,
799 new Any(Type.TYPE,
800 new Type(
801 "[][]"
802 + DerivedStruct.class.getName(),
803 TypeClass.SEQUENCE)),
804 new CompareUnboxed());
806 success &= testMapAny(transport,
807 new Any(Type.TYPE,
808 new Type("[][]"
809 + XInterface.class.getName(),
810 TypeClass.SEQUENCE)),
811 new CompareUnboxed());
812 success &= testMapAny(transport,
813 new Any(Type.TYPE,
814 new Type(
815 "[][]"
816 + BaseInterface.class.getName(),
817 TypeClass.SEQUENCE)),
818 new CompareUnboxed());
819 success &= testMapAny(transport,
820 new Any(
821 Type.TYPE,
822 new Type(
823 "[][]"
824 + DerivedInterface.class.getName(),
825 TypeClass.SEQUENCE)),
826 new CompareUnboxed());
827 if (createTypes) {
828 success &= testMapAny(transport,
829 new Any(Type.TYPE,
830 new Type(Enum1.class.getName(),
831 TypeClass.ENUM)),
832 new CompareUnboxed());
833 success &= testMapAny(transport,
834 new Any(Type.TYPE,
835 new Type(BaseStruct.class.getName(),
836 TypeClass.STRUCT)),
837 new CompareUnboxed());
838 success &= testMapAny(transport,
839 new Any(Type.TYPE,
840 new Type(
841 DerivedStruct.class.getName(),
842 TypeClass.STRUCT)),
843 new CompareUnboxed());
845 success &= testMapAny(transport,
846 new Any(
847 Type.TYPE,
848 new Type(
849 com.sun.star.uno.Exception.class.
850 getName(),
851 TypeClass.EXCEPTION)),
852 new CompareUnboxed());
853 if (createTypes) {
854 success &= testMapAny(transport,
855 new Any(Type.TYPE,
856 new Type(
857 BaseException.class.getName(),
858 TypeClass.EXCEPTION)),
859 new CompareUnboxed());
860 success &= testMapAny(transport,
861 new Any(
862 Type.TYPE,
863 new Type(
864 DerivedException.class.getName(),
865 TypeClass.EXCEPTION)),
866 new CompareUnboxed());
868 success &= testMapAny(transport,
869 new Any(
870 Type.TYPE,
871 new Type(
872 com.sun.star.uno.RuntimeException.
873 class.getName(),
874 TypeClass.EXCEPTION)),
875 new CompareUnboxed());
876 if (createTypes) {
877 success &= testMapAny(transport,
878 new Any(
879 Type.TYPE,
880 new Type(
881 BaseRuntimeException.class.
882 getName(),
883 TypeClass.EXCEPTION)),
884 new CompareUnboxed());
885 success &= testMapAny(transport,
886 new Any(
887 Type.TYPE,
888 new Type(
889 DerivedRuntimeException.class.
890 getName(),
891 TypeClass.EXCEPTION)),
892 new CompareUnboxed());
894 success &= testMapAny(transport,
895 new Any(Type.TYPE,
896 new Type(XInterface.class.getName(),
897 TypeClass.INTERFACE)),
898 new CompareUnboxed());
899 success &= testMapAny(transport,
900 new Any(Type.TYPE,
901 new Type(
902 BaseInterface.class.getName(),
903 TypeClass.INTERFACE)),
904 new CompareUnboxed());
905 success &= testMapAny(transport,
906 new Any(Type.TYPE,
907 new Type(
908 DerivedInterface.class.getName(),
909 TypeClass.INTERFACE)),
910 new CompareUnboxed());
912 // Sequence Types:
913 success &= testMapAny(transport, new boolean[] {},
914 new CompareBoxed());
915 success &= testMapAny(transport, new boolean[] { false, true },
916 new CompareBoxed());
917 success &= testMapAny(transport,
918 new Any(new Type(boolean[].class),
919 new boolean[] {}),
920 new CompareUnboxed());
921 success &= testMapAny(transport,
922 new Any(new Type(boolean[].class),
923 new boolean[] { false, true }),
924 new CompareUnboxed());
925 success &= testMapAny(transport, new byte[] {},
926 new CompareBoxed());
927 success &= testMapAny(transport, new byte[] { -128, 0, 127 },
928 new CompareBoxed());
929 success &= testMapAny(transport,
930 new Any(new Type(byte[].class),
931 new byte[] {}),
932 new CompareUnboxed());
933 success &= testMapAny(transport,
934 new Any(new Type(byte[].class),
935 new byte[] { -128, 0, 127 }),
936 new CompareUnboxed());
937 success &= testMapAny(transport, new short[] {},
938 new CompareBoxed());
939 success &= testMapAny(transport, new short[] { -32768, 0, 32767 },
940 new CompareBoxed());
941 success &= testMapAny(transport,
942 new Any(new Type(short[].class),
943 new short[] {}),
944 new CompareUnboxed());
945 success &= testMapAny(transport,
946 new Any(new Type(short[].class),
947 new short[] { -32768, 0, 32767 }),
948 new CompareUnboxed());
949 success &= testMapAny(transport,
950 new Any(new Type("[]unsigned short",
951 TypeClass.SEQUENCE),
952 new short[] {}),
953 new CompareBoxed());
954 success &= testMapAny(transport,
955 new Any(new Type("[]unsigned short",
956 TypeClass.SEQUENCE),
957 new short[] { 0, -32768 }),
958 new CompareBoxed());
959 success &= testMapAny(transport, new int[] {},
960 new CompareBoxed());
961 success &= testMapAny(transport,
962 new int[] { -2147483648, 0, 2147483647 },
963 new CompareBoxed());
964 success &= testMapAny(transport,
965 new Any(new Type(int[].class),
966 new int[] {}),
967 new CompareUnboxed());
968 success &= testMapAny(transport,
969 new Any(new Type(int[].class),
970 new int[] { -2147483648, 0,
971 2147483647 }),
972 new CompareUnboxed());
973 success &= testMapAny(transport,
974 new Any(new Type("[]unsigned long",
975 TypeClass.SEQUENCE),
976 new int[] {}),
977 new CompareBoxed());
978 success &= testMapAny(transport,
979 new Any(new Type("[]unsigned long",
980 TypeClass.SEQUENCE),
981 new int[] { 0, -2147483648 }),
982 new CompareBoxed());
983 success &= testMapAny(transport, new long[] {},
984 new CompareBoxed());
985 success &= testMapAny(transport,
986 new long[] { -9223372036854775808L, 0L,
987 9223372036854775807L },
988 new CompareBoxed());
989 success &= testMapAny(transport,
990 new Any(new Type(long[].class),
991 new long[] {}),
992 new CompareUnboxed());
993 success &= testMapAny(transport,
994 new Any(new Type(long[].class),
995 new long[] { -9223372036854775808L,
997 9223372036854775807L }),
998 new CompareUnboxed());
999 success &= testMapAny(transport,
1000 new Any(new Type("[]unsigned hyper",
1001 TypeClass.SEQUENCE),
1002 new long[] {}),
1003 new CompareBoxed());
1004 success &= testMapAny(transport,
1005 new Any(new Type("[]unsigned hyper",
1006 TypeClass.SEQUENCE),
1007 new long[] { 0L,
1008 -9223372036854775808L }),
1009 new CompareBoxed());
1010 success &= testMapAny(transport, new float[] {},
1011 new CompareBoxed());
1012 success &= testMapAny(transport,
1013 new float[] { Float.NEGATIVE_INFINITY,
1014 Float.MIN_VALUE, -0.0f, 0.0f,
1015 Float.MAX_VALUE,
1016 Float.POSITIVE_INFINITY,
1017 Float.NaN },
1018 new CompareBoxed());
1019 success &= testMapAny(transport,
1020 new Any(new Type(float[].class),
1021 new float[] {}),
1022 new CompareUnboxed());
1023 success &= testMapAny(transport,
1024 new Any(new Type(float[].class),
1025 new float[] { Float.NEGATIVE_INFINITY,
1026 Float.MIN_VALUE, -0.0f,
1027 0.0f, Float.MAX_VALUE,
1028 Float.POSITIVE_INFINITY,
1029 Float.NaN }),
1030 new CompareUnboxed());
1031 success &= testMapAny(transport, new double[] {},
1032 new CompareBoxed());
1033 success &= testMapAny(transport,
1034 new double[] { Double.NEGATIVE_INFINITY,
1035 Double.MIN_VALUE, -0.0, 0.0,
1036 Double.MAX_VALUE,
1037 Double.POSITIVE_INFINITY,
1038 Double.NaN },
1039 new CompareBoxed());
1040 success &= testMapAny(transport,
1041 new Any(new Type(double[].class),
1042 new double[] {}),
1043 new CompareUnboxed());
1044 success &= testMapAny(transport,
1045 new Any(new Type(double[].class),
1046 new double[] {
1047 Double.NEGATIVE_INFINITY,
1048 Double.MIN_VALUE, -0.0, 0.0,
1049 Double.MAX_VALUE,
1050 Double.POSITIVE_INFINITY,
1051 Double.NaN }),
1052 new CompareUnboxed());
1053 success &= testMapAny(transport, new char[] {},
1054 new CompareBoxed());
1055 success &= testMapAny(transport,
1056 new char[] { '\u0000', '\uDBFF', '\uFFFD' },
1057 new CompareBoxed());
1058 success &= testMapAny(transport,
1059 new Any(new Type(char[].class),
1060 new char[] {}),
1061 new CompareUnboxed());
1062 success &= testMapAny(transport,
1063 new Any(
1064 new Type(char[].class),
1065 new char[] { '\u0000', '\uDBFF',
1066 '\uFFFD' }),
1067 new CompareUnboxed());
1068 success &= testMapAny(transport, new String[] {},
1069 new CompareBoxed());
1070 success &= testMapAny(transport,
1071 new String[] { "", "\uD800\uDC00", "Test" },
1072 new CompareBoxed());
1073 success &= testMapAny(transport,
1074 new Any(new Type(String[].class),
1075 new String[] {}),
1076 new CompareUnboxed());
1077 success &= testMapAny(transport,
1078 new Any(new Type(String[].class),
1079 new String[] { "", "\uD800\uDC00",
1080 "Test" }),
1081 new CompareUnboxed());
1082 success &= testMapAny(transport, new Type[] {}, new CompareBoxed());
1083 success &= testMapAny(transport,
1084 new Type[] {
1085 Type.VOID,
1086 new Type(DerivedInterface.class.getName(),
1087 TypeClass.INTERFACE) },
1088 new CompareBoxed());
1089 success &= testMapAny(transport,
1090 new Any(new Type(Type[].class),
1091 new Type[] {}),
1092 new CompareUnboxed());
1093 success &= testMapAny(transport,
1094 new Any(
1095 new Type(Type[].class),
1096 new Type[] {
1097 Type.VOID,
1098 new Type(
1099 DerivedInterface.class.getName(),
1100 TypeClass.INTERFACE) }),
1101 new CompareUnboxed());
1102 success &= testMapAny(transport, new Object[] {},
1103 new CompareBoxed());
1104 success &= testMapAny(transport,
1105 new Object[] { Any.VOID, Boolean.FALSE },
1106 new CompareBoxed());
1107 success &= testMapAny(transport,
1108 new Object[] {
1109 Boolean.FALSE,
1110 new Any(Type.BOOLEAN, Boolean.TRUE) },
1111 new CompareBoxed(true));
1112 success &= testMapAny(transport,
1113 new Any(new Type(Any[].class),
1114 new Object[] {}),
1115 new CompareUnboxed());
1116 success &= testMapAny(transport,
1117 new Any(new Type(Any[].class),
1118 new Object[] { Any.VOID,
1119 Boolean.FALSE }),
1120 new CompareUnboxed());
1121 success &= testMapAny(transport,
1122 new Any(new Type(Any[].class),
1123 new Object[] {
1124 Boolean.FALSE,
1125 new Any(Type.BOOLEAN,
1126 Boolean.TRUE) }),
1127 new CompareUnboxed(true));
1128 success &= testMapAny(transport, new Any[] {},
1129 new CompareSpecific(new Object[] {}));
1130 success &= testMapAny(transport,
1131 new Any[] { Any.VOID,
1132 new Any(Type.BOOLEAN,
1133 Boolean.TRUE) },
1134 new CompareSpecific(
1135 new Object[] { Any.VOID, Boolean.TRUE }));
1136 success &= testMapAny(transport,
1137 new Any(new Type(Any[].class), new Any[] {}),
1138 new CompareSpecific(new Object[] {}));
1139 success &= testMapAny(transport,
1140 new Any(new Type(Any[].class),
1141 new Any[] { Any.VOID,
1142 new Any(Type.BOOLEAN,
1143 Boolean.TRUE) }),
1144 new CompareSpecific(
1145 new Object[] { Any.VOID, Boolean.TRUE }));
1146 success &= testMapAny(transport,
1147 new Any(new Type(Any[].class),
1148 new Boolean[] {}),
1149 new CompareSpecific(new Object[] {}));
1150 success &= testMapAny(transport,
1151 new Any(new Type(Any[].class),
1152 new Boolean[] { Boolean.FALSE }),
1153 new CompareSpecific(
1154 new Object[] { Boolean.FALSE }));
1155 if (createTypes) {
1156 success &= testMapAny(transport, new Enum1[] {},
1157 new CompareBoxed());
1158 success &= testMapAny(transport, new Enum1[] { new Enum1(),
1159 new Enum2() },
1160 new CompareSpecific(
1161 new Enum1[] { new Enum1(),
1162 new Enum1() }));
1163 success &= testMapAny(transport,
1164 new Any(new Type(Enum1[].class),
1165 new Enum1[] {}),
1166 new CompareUnboxed());
1167 success &= testMapAny(transport,
1168 new Any(new Type(Enum1[].class),
1169 new Enum1[] { new Enum1(),
1170 new Enum2() }),
1171 new CompareSpecific(
1172 new Enum1[] { new Enum1(),
1173 new Enum1() }));
1174 success &= testMapAny(transport,
1175 new Any(new Type(Enum1[].class),
1176 new Enum2[] {}),
1177 new CompareSpecific(new Enum1[] {}));
1178 success &= testMapAny(transport,
1179 new Any(new Type(Enum1[].class),
1180 new Enum2[] { new Enum2() }),
1181 new CompareSpecific(
1182 new Enum1[] { new Enum1() }));
1183 success &= testMapAny(transport, new BaseStruct[] {},
1184 new CompareBoxed());
1185 success &= testMapAny(transport,
1186 new BaseStruct[] { new BaseStruct(),
1187 new DerivedStruct() },
1188 new CompareSpecific(
1189 new BaseStruct[] { new BaseStruct(),
1190 new BaseStruct() }));
1191 success &= testMapAny(transport,
1192 new Any(new Type(BaseStruct[].class),
1193 new BaseStruct[] {}),
1194 new CompareUnboxed());
1195 success &= testMapAny(transport,
1196 new Any(new Type(BaseStruct[].class),
1197 new BaseStruct[] {
1198 new BaseStruct(),
1199 new DerivedStruct() }),
1200 new CompareSpecific(
1201 new BaseStruct[] { new BaseStruct(),
1202 new BaseStruct() }));
1203 success &= testMapAny(transport,
1204 new Any(new Type(BaseStruct[].class),
1205 new DerivedStruct[] {}),
1206 new CompareSpecific(new BaseStruct[] {}));
1207 success &= testMapAny(transport,
1208 new Any(new Type(BaseStruct[].class),
1209 new DerivedStruct[] {
1210 new DerivedStruct() }),
1211 new CompareSpecific(
1212 new BaseStruct[] { new BaseStruct() }));
1213 success &= testMapAny(transport, new DerivedStruct[] {},
1214 new CompareBoxed());
1215 success &= testMapAny(transport,
1216 new DerivedStruct[] { new DerivedStruct() },
1217 new CompareBoxed());
1218 success &= testMapAny(transport,
1219 new Any(new Type(DerivedStruct[].class),
1220 new DerivedStruct[] {}),
1221 new CompareUnboxed());
1222 success &= testMapAny(transport,
1223 new Any(new Type(DerivedStruct[].class),
1224 new DerivedStruct[] {
1225 new DerivedStruct() }),
1226 new CompareUnboxed());
1228 success &= testMapAny(transport, new XInterface[] {},
1229 new CompareBoxed());
1230 success &= testMapAny(transport,
1231 new XInterface[] {
1232 null, new XInterface() {},
1233 new BaseInterface() {},
1234 new DerivedInterface() {} },
1235 new CompareBoxed());
1236 success &= testMapAny(transport,
1237 new Any(new Type(XInterface[].class),
1238 new XInterface[] {}),
1239 new CompareUnboxed());
1240 success &= testMapAny(transport,
1241 new Any(new Type(XInterface[].class),
1242 new XInterface[] {
1243 null, new XInterface() {},
1244 new BaseInterface() {},
1245 new DerivedInterface() {} }),
1246 new CompareUnboxed());
1247 success &= testMapAny(transport,
1248 new Any(new Type(XInterface[].class),
1249 new Object[] {}),
1250 new CompareSpecific(new XInterface[] {}));
1252 XInterface if1 = new XInterface() {};
1253 XInterface if2 = new BaseInterface() {};
1254 XInterface if3 = new DerivedInterface() {};
1255 success &= testMapAny(transport,
1256 new Any(new Type(XInterface[].class),
1257 new Object[] { null, if1, if2,
1258 if3 }),
1259 new CompareSpecific(
1260 new XInterface[] { null, if1, if2,
1261 if3 }));
1263 success &= testMapAny(transport,
1264 new Any(new Type(XInterface[].class),
1265 new BaseInterface[] {}),
1266 new CompareSpecific(new XInterface[] {}));
1268 BaseInterface if1 = new BaseInterface() {};
1269 BaseInterface if2 = new DerivedInterface() {};
1270 success &= testMapAny(transport,
1271 new Any(new Type(XInterface[].class),
1272 new BaseInterface[] { null, if1,
1273 if2 }),
1274 new CompareSpecific(
1275 new XInterface[] { null, if1, if2 }));
1277 success &= testMapAny(transport,
1278 new Any(new Type(XInterface[].class),
1279 new DerivedInterface[] {}),
1280 new CompareSpecific(new XInterface[] {}));
1282 DerivedInterface if1 = new DerivedInterface() {};
1283 success &= testMapAny(transport,
1284 new Any(new Type(XInterface[].class),
1285 new DerivedInterface[] { null,
1286 if1 }),
1287 new CompareSpecific(
1288 new XInterface[] { null, if1 }));
1290 success &= testMapAny(transport, new BaseInterface[] {},
1291 new CompareBoxed());
1292 success &= testMapAny(transport,
1293 new BaseInterface[] {
1294 null, new BaseInterface() {},
1295 new DerivedInterface() {} },
1296 new CompareBoxed());
1297 success &= testMapAny(transport,
1298 new Any(new Type(BaseInterface[].class),
1299 new BaseInterface[] {}),
1300 new CompareUnboxed());
1301 success &= testMapAny(transport,
1302 new Any(new Type(BaseInterface[].class),
1303 new BaseInterface[] {
1304 null, new BaseInterface() {},
1305 new DerivedInterface() {} }),
1306 new CompareUnboxed());
1307 success &= testMapAny(transport,
1308 new Any(new Type(BaseInterface[].class),
1309 new DerivedInterface[] {}),
1310 new CompareSpecific(new BaseInterface[] {}));
1312 DerivedInterface if1 = new DerivedInterface() {};
1313 success &= testMapAny(transport,
1314 new Any(new Type(BaseInterface[].class),
1315 new DerivedInterface[] { null,
1316 if1 }),
1317 new CompareSpecific(
1318 new BaseInterface[] { null, if1 }));
1320 success &= testMapAny(transport, new DerivedInterface[] {},
1321 new CompareBoxed());
1322 success &= testMapAny(transport,
1323 new DerivedInterface[] {
1324 null, new DerivedInterface() {} },
1325 new CompareBoxed());
1326 success &= testMapAny(transport,
1327 new Any(new Type(DerivedInterface[].class),
1328 new DerivedInterface[] {}),
1329 new CompareUnboxed());
1330 success &= testMapAny(transport,
1331 new Any(new Type(DerivedInterface[].class),
1332 new DerivedInterface[] {
1333 null,
1334 new DerivedInterface() {} }),
1335 new CompareUnboxed());
1336 success &= testMapAny(transport,
1337 new boolean[][] { new boolean[] {} },
1338 new CompareBoxed());
1339 success &= testMapAny(transport,
1340 new boolean[][] {
1341 new boolean[] { false, true } },
1342 new CompareBoxed());
1343 success &= testMapAny(transport,
1344 new Any(new Type(boolean[][].class),
1345 new boolean[][] { new boolean[] {} }),
1346 new CompareUnboxed());
1347 success &= testMapAny(transport,
1348 new Any(new Type(boolean[][].class),
1349 new boolean[][] {
1350 new boolean[] { false, true } }),
1351 new CompareUnboxed());
1352 success &= testMapAny(transport, new byte[][] { new byte[] {} },
1353 new CompareBoxed());
1354 success &= testMapAny(transport,
1355 new byte[][] { new byte[] { -128, 0, 127 } },
1356 new CompareBoxed());
1357 success &= testMapAny(transport,
1358 new Any(new Type(byte[][].class),
1359 new byte[][] { new byte[] {} }),
1360 new CompareUnboxed());
1361 success &= testMapAny(transport,
1362 new Any(new Type(byte[][].class),
1363 new byte[][] {
1364 new byte[] { -128, 0, 127 } }),
1365 new CompareUnboxed());
1366 success &= testMapAny(transport, new short[][] { new short[] {} },
1367 new CompareBoxed());
1368 success &= testMapAny(transport,
1369 new short[][] {
1370 new short[] { -32768, 0, 32767 } },
1371 new CompareBoxed());
1372 success &= testMapAny(transport,
1373 new Any(new Type(short[][].class),
1374 new short[][] { new short[] {} }),
1375 new CompareUnboxed());
1376 success &= testMapAny(transport,
1377 new Any(new Type(short[][].class),
1378 new short[][] {
1379 new short[] { -32768, 0,
1380 32767 } }),
1381 new CompareUnboxed());
1382 success &= testMapAny(transport,
1383 new Any(new Type("[][]unsigned short",
1384 TypeClass.SEQUENCE),
1385 new short[][] { new short[] {} }),
1386 new CompareBoxed());
1387 success &= testMapAny(transport,
1388 new Any(new Type("[][]unsigned short",
1389 TypeClass.SEQUENCE),
1390 new short[][] {
1391 new short[] { 0, -32768 } }),
1392 new CompareBoxed());
1393 success &= testMapAny(transport, new int[][] { new int[] {} },
1394 new CompareBoxed());
1395 success &= testMapAny(transport,
1396 new int[][] { new int[] { -2147483648, 0,
1397 2147483647 } },
1398 new CompareBoxed());
1399 success &= testMapAny(transport,
1400 new Any(new Type(int[][].class),
1401 new int[][] { new int[] {} }),
1402 new CompareUnboxed());
1403 success &= testMapAny(transport,
1404 new Any(new Type(int[][].class),
1405 new int[][] {
1406 new int[] { -2147483648, 0,
1407 2147483647 } }),
1408 new CompareUnboxed());
1409 success &= testMapAny(transport,
1410 new Any(new Type("[][]unsigned long",
1411 TypeClass.SEQUENCE),
1412 new int[][] { new int[] {} }),
1413 new CompareBoxed());
1414 success &= testMapAny(transport,
1415 new Any(new Type("[][]unsigned long",
1416 TypeClass.SEQUENCE),
1417 new int[][] {
1418 new int[] { 0, -2147483648 } }),
1419 new CompareBoxed());
1420 success &= testMapAny(transport, new long[][] { new long[] {} },
1421 new CompareBoxed());
1422 success &= testMapAny(transport,
1423 new long[][] {
1424 new long[] { -9223372036854775808L, 0L,
1425 9223372036854775807L } },
1426 new CompareBoxed());
1427 success &= testMapAny(transport,
1428 new Any(new Type(long[][].class),
1429 new long[][] { new long[] {} }),
1430 new CompareUnboxed());
1431 success &= testMapAny(transport,
1432 new Any(new Type(long[][].class),
1433 new long[][] {
1434 new long[] {
1435 -9223372036854775808L, 0L,
1436 9223372036854775807L } }),
1437 new CompareUnboxed());
1438 success &= testMapAny(transport,
1439 new Any(new Type("[][]unsigned hyper",
1440 TypeClass.SEQUENCE),
1441 new long[][] { new long[] {} }),
1442 new CompareBoxed());
1443 success &= testMapAny(transport,
1444 new Any(new Type("[][]unsigned hyper",
1445 TypeClass.SEQUENCE),
1446 new long[][] {
1447 new long[] {
1449 -9223372036854775808L } }),
1450 new CompareBoxed());
1451 success &= testMapAny(transport, new float[][] { new float[] {} },
1452 new CompareBoxed());
1453 success &= testMapAny(transport,
1454 new float[][] {
1455 new float[] { Float.NEGATIVE_INFINITY,
1456 Float.MIN_VALUE, -0.0f,
1457 0.0f, Float.MAX_VALUE,
1458 Float.POSITIVE_INFINITY,
1459 Float.NaN } },
1460 new CompareBoxed());
1461 success &= testMapAny(transport,
1462 new Any(new Type(float[][].class),
1463 new float[][] { new float[] {} }),
1464 new CompareUnboxed());
1465 success &= testMapAny(transport,
1466 new Any(new Type(float[][].class),
1467 new float[][] {
1468 new float[] {
1469 Float.NEGATIVE_INFINITY,
1470 Float.MIN_VALUE, -0.0f, 0.0f,
1471 Float.MAX_VALUE,
1472 Float.POSITIVE_INFINITY,
1473 Float.NaN } }),
1474 new CompareUnboxed());
1475 success &= testMapAny(transport, new double[][] { new double[] {} },
1476 new CompareBoxed());
1477 success &= testMapAny(transport,
1478 new double[][] {
1479 new double[] { Double.NEGATIVE_INFINITY,
1480 Double.MIN_VALUE, -0.0,
1481 0.0, Double.MAX_VALUE,
1482 Double.POSITIVE_INFINITY,
1483 Double.NaN } },
1484 new CompareBoxed());
1485 success &= testMapAny(transport,
1486 new Any(new Type(double[][].class),
1487 new double[][] { new double[] {} }),
1488 new CompareUnboxed());
1489 success &= testMapAny(transport,
1490 new Any(new Type(double[][].class),
1491 new double[][] {
1492 new double[] {
1493 Double.NEGATIVE_INFINITY,
1494 Double.MIN_VALUE, -0.0, 0.0,
1495 Double.MAX_VALUE,
1496 Double.POSITIVE_INFINITY,
1497 Double.NaN } }),
1498 new CompareUnboxed());
1499 success &= testMapAny(transport, new char[][] { new char[] {} },
1500 new CompareBoxed());
1501 success &= testMapAny(transport,
1502 new char[][] {
1503 new char[] { '\u0000', '\uDBFF',
1504 '\uFFFD' } },
1505 new CompareBoxed());
1506 success &= testMapAny(transport,
1507 new Any(new Type(char[][].class),
1508 new char[][] { new char[] {} }),
1509 new CompareUnboxed());
1510 success &= testMapAny(transport,
1511 new Any(
1512 new Type(char[][].class),
1513 new char[][] {
1514 new char[] { '\u0000', '\uDBFF',
1515 '\uFFFD' } }),
1516 new CompareUnboxed());
1517 success &= testMapAny(transport, new String[][] { new String[] {} },
1518 new CompareBoxed());
1519 success &= testMapAny(transport,
1520 new String[][] {
1521 new String[] { "", "\uD800\uDC00",
1522 "Test" } },
1523 new CompareBoxed());
1524 success &= testMapAny(transport,
1525 new Any(new Type(String[][].class),
1526 new String[][] { new String[] {} }),
1527 new CompareUnboxed());
1528 success &= testMapAny(transport,
1529 new Any(new Type(String[][].class),
1530 new String[][] {
1531 new String[] { "", "\uD800\uDC00",
1532 "Test" } }),
1533 new CompareUnboxed());
1534 success &= testMapAny(transport, new Type[][] { new Type[] {} },
1535 new CompareBoxed());
1536 success &= testMapAny(transport,
1537 new Type[][] {
1538 new Type[] {
1539 Type.VOID,
1540 new Type(
1541 DerivedInterface.class.getName(),
1542 TypeClass.INTERFACE) } },
1543 new CompareBoxed());
1544 success &= testMapAny(transport,
1545 new Any(new Type(Type[][].class),
1546 new Type[][] { new Type[] {} }),
1547 new CompareUnboxed());
1548 success &= testMapAny(transport,
1549 new Any(
1550 new Type(Type[][].class),
1551 new Type[][] {
1552 new Type[] {
1553 Type.VOID,
1554 new Type(
1555 DerivedInterface.class.
1556 getName(),
1557 TypeClass.INTERFACE) } }),
1558 new CompareUnboxed());
1559 success &= testMapAny(transport, new Object[][] { new Object[] {} },
1560 new CompareBoxed());
1561 success &= testMapAny(transport,
1562 new Object[][] {
1563 new Object[] { Any.VOID,
1564 Boolean.FALSE } },
1565 new CompareBoxed());
1566 success &= testMapAny(transport,
1567 new Object[][] {
1568 new Object[] {
1569 Boolean.FALSE,
1570 new Any(Type.BOOLEAN,
1571 Boolean.TRUE) } },
1572 new CompareBoxed(true));
1573 success &= testMapAny(transport,
1574 new Any(new Type(Any[][].class),
1575 new Object[][] { new Object[] {} }),
1576 new CompareUnboxed());
1577 success &= testMapAny(transport,
1578 new Any(new Type(Any[][].class),
1579 new Object[][] {
1580 new Object[] { Any.VOID,
1581 Boolean.FALSE } }),
1582 new CompareUnboxed());
1583 success &= testMapAny(transport,
1584 new Any(new Type(Any[][].class),
1585 new Object[][] {
1586 new Object[] {
1587 Boolean.FALSE,
1588 new Any(Type.BOOLEAN,
1589 Boolean.TRUE) } }),
1590 new CompareUnboxed(true));
1591 success &= testMapAny(transport, new Any[][] { new Any[] {} },
1592 new CompareSpecific(
1593 new Object[][] { new Object[] {} }));
1594 success &= testMapAny(transport,
1595 new Any[][] {
1596 new Any[] { Any.VOID,
1597 new Any(Type.BOOLEAN,
1598 Boolean.TRUE) } },
1599 new CompareSpecific(
1600 new Object[][] {
1601 new Object[] { Any.VOID,
1602 Boolean.TRUE } }));
1603 success &= testMapAny(transport,
1604 new Any(new Type(Any[][].class),
1605 new Any[][] { new Any[] {} }),
1606 new CompareSpecific(
1607 new Object[][] { new Object[] {} }));
1608 success &= testMapAny(transport,
1609 new Any(new Type(Any[][].class),
1610 new Any[][] {
1611 new Any[] {
1612 Any.VOID,
1613 new Any(Type.BOOLEAN,
1614 Boolean.TRUE) } }),
1615 new CompareSpecific(
1616 new Object[][] {
1617 new Object[] { Any.VOID,
1618 Boolean.TRUE } }));
1619 success &= testMapAny(transport,
1620 new Any(new Type(Any[][].class),
1621 new Boolean[][] { new Boolean[] {} }),
1622 new CompareSpecific(
1623 new Object[][] { new Object[] {} }));
1624 success &= testMapAny(transport,
1625 new Any(new Type(Any[][].class),
1626 new Boolean[][] {
1627 new Boolean[] {
1628 Boolean.FALSE } }),
1629 new CompareSpecific(
1630 new Object[][] {
1631 new Object[] { Boolean.FALSE } }));
1632 if (createTypes) {
1633 success &= testMapAny(transport, new Enum1[][] { new Enum1[] {} },
1634 new CompareBoxed());
1635 success &= testMapAny(transport,
1636 new Enum1[][] {
1637 new Enum1[] { new Enum1(),
1638 new Enum2() } },
1639 new CompareSpecific(
1640 new Enum1[][] {
1641 new Enum1[] { new Enum1(),
1642 new Enum1() } }));
1643 success &= testMapAny(transport,
1644 new Any(new Type(Enum1[][].class),
1645 new Enum1[][] { new Enum1[] {} }),
1646 new CompareUnboxed());
1647 success &= testMapAny(transport,
1648 new Any(new Type(Enum1[][].class),
1649 new Enum1[][] {
1650 new Enum1[] { new Enum1(),
1651 new Enum2() } }),
1652 new CompareSpecific(
1653 new Enum1[][] {
1654 new Enum1[] { new Enum1(),
1655 new Enum1() } }));
1656 success &= testMapAny(transport,
1657 new Any(new Type(Enum1[][].class),
1658 new Enum2[][] { new Enum2[] {} }),
1659 new CompareSpecific(
1660 new Enum1[][] { new Enum1[] {} }));
1661 success &= testMapAny(transport,
1662 new Any(new Type(Enum1[][].class),
1663 new Enum2[][] {
1664 new Enum2[] { new Enum2() } }),
1665 new CompareSpecific(
1666 new Enum1[][] {
1667 new Enum1[] { new Enum1() } }));
1668 success &= testMapAny(transport,
1669 new BaseStruct[][] { new BaseStruct[] {} },
1670 new CompareBoxed());
1671 success &= testMapAny(transport,
1672 new BaseStruct[][] {
1673 new BaseStruct[] {
1674 new BaseStruct(),
1675 new DerivedStruct() } },
1676 new CompareSpecific(
1677 new BaseStruct[][] {
1678 new BaseStruct[] {
1679 new BaseStruct(),
1680 new BaseStruct() } }));
1681 success &= testMapAny(transport,
1682 new Any(new Type(BaseStruct[][].class),
1683 new BaseStruct[][] {
1684 new BaseStruct[] {} }),
1685 new CompareUnboxed());
1686 success &= testMapAny(transport,
1687 new Any(new Type(BaseStruct[][].class),
1688 new BaseStruct[][] {
1689 new BaseStruct[] {
1690 new BaseStruct(),
1691 new DerivedStruct() } }),
1692 new CompareSpecific(
1693 new BaseStruct[][] {
1694 new BaseStruct[] {
1695 new BaseStruct(),
1696 new BaseStruct() } }));
1697 success &= testMapAny(transport,
1698 new Any(new Type(BaseStruct[][].class),
1699 new DerivedStruct[][] {
1700 new DerivedStruct[] {} }),
1701 new CompareSpecific(
1702 new BaseStruct[][] {
1703 new BaseStruct[] {} }));
1704 success &= testMapAny(transport,
1705 new Any(new Type(BaseStruct[][].class),
1706 new DerivedStruct[][] {
1707 new DerivedStruct[] {
1708 new DerivedStruct() } }),
1709 new CompareSpecific(
1710 new BaseStruct[][] {
1711 new BaseStruct[] {
1712 new BaseStruct() } }));
1713 success &= testMapAny(transport,
1714 new DerivedStruct[][] {
1715 new DerivedStruct[] {} },
1716 new CompareBoxed());
1717 success &= testMapAny(transport,
1718 new DerivedStruct[][] {
1719 new DerivedStruct[] {
1720 new DerivedStruct() } },
1721 new CompareBoxed());
1722 success &= testMapAny(transport,
1723 new Any(new Type(DerivedStruct[][].class),
1724 new DerivedStruct[][] {
1725 new DerivedStruct[] {} }),
1726 new CompareUnboxed());
1727 success &= testMapAny(transport,
1728 new Any(new Type(DerivedStruct[][].class),
1729 new DerivedStruct[][] {
1730 new DerivedStruct[] {
1731 new DerivedStruct() } }),
1732 new CompareUnboxed());
1734 success &= testMapAny(transport,
1735 new XInterface[][] { new XInterface[] {} },
1736 new CompareBoxed());
1737 success &= testMapAny(transport,
1738 new XInterface[][] {
1739 new XInterface[] {
1740 null, new XInterface() {},
1741 new BaseInterface() {},
1742 new DerivedInterface() {} } },
1743 new CompareBoxed());
1744 success &= testMapAny(transport,
1745 new Any(new Type(XInterface[][].class),
1746 new XInterface[][] {
1747 new XInterface[] {} }),
1748 new CompareUnboxed());
1749 success &= testMapAny(transport,
1750 new Any(
1751 new Type(XInterface[][].class),
1752 new XInterface[][] {
1753 new XInterface[] {
1754 null, new XInterface() {},
1755 new BaseInterface() {},
1756 new DerivedInterface() {} } }),
1757 new CompareUnboxed());
1758 success &= testMapAny(transport,
1759 new Any(new Type(XInterface[][].class),
1760 new Object[][] { new Object[] {} }),
1761 new CompareSpecific(
1762 new XInterface[][] {
1763 new XInterface[] {} }));
1765 XInterface if1 = new XInterface() {};
1766 XInterface if2 = new BaseInterface() {};
1767 XInterface if3 = new DerivedInterface() {};
1768 success &= testMapAny(transport,
1769 new Any(new Type(XInterface[][].class),
1770 new Object[][] {
1771 new Object[] { null, if1, if2,
1772 if3 } }),
1773 new CompareSpecific(
1774 new XInterface[][] {
1775 new XInterface[] { null, if1, if2,
1776 if3 } }));
1778 success &= testMapAny(transport,
1779 new Any(new Type(XInterface[][].class),
1780 new BaseInterface[][] {
1781 new BaseInterface[] {} }),
1782 new CompareSpecific(
1783 new XInterface[][] {
1784 new XInterface[] {} }));
1786 BaseInterface if1 = new BaseInterface() {};
1787 BaseInterface if2 = new DerivedInterface() {};
1788 success &= testMapAny(transport,
1789 new Any(new Type(XInterface[][].class),
1790 new BaseInterface[][] {
1791 new BaseInterface[] {
1792 null, if1, if2 } }),
1793 new CompareSpecific(
1794 new XInterface[][] {
1795 new XInterface[] {
1796 null, if1, if2 } }));
1798 success &= testMapAny(transport,
1799 new Any(new Type(XInterface[][].class),
1800 new DerivedInterface[][] {
1801 new DerivedInterface[] {} }),
1802 new CompareSpecific(
1803 new XInterface[][] {
1804 new XInterface[] {} }));
1806 DerivedInterface if1 = new DerivedInterface() {};
1807 success &= testMapAny(transport,
1808 new Any(new Type(XInterface[][].class),
1809 new DerivedInterface[][] {
1810 new DerivedInterface[] {
1811 null, if1 } }),
1812 new CompareSpecific(
1813 new XInterface[][] {
1814 new XInterface[] {
1815 null, if1 } }));
1817 success &= testMapAny(transport,
1818 new BaseInterface[][] {
1819 new BaseInterface[] {} },
1820 new CompareBoxed());
1821 success &= testMapAny(transport,
1822 new BaseInterface[][] {
1823 new BaseInterface[] {
1824 null, new BaseInterface() {},
1825 new DerivedInterface() {} } },
1826 new CompareBoxed());
1827 success &= testMapAny(transport,
1828 new Any(new Type(BaseInterface[][].class),
1829 new BaseInterface[][] {
1830 new BaseInterface[] {} }),
1831 new CompareUnboxed());
1832 success &= testMapAny(transport,
1833 new Any(
1834 new Type(BaseInterface[][].class),
1835 new BaseInterface[][] {
1836 new BaseInterface[] {
1837 null, new BaseInterface() {},
1838 new DerivedInterface() {} } }),
1839 new CompareUnboxed());
1840 success &= testMapAny(transport,
1841 new Any(new Type(BaseInterface[][].class),
1842 new DerivedInterface[][] {
1843 new DerivedInterface[] {} }),
1844 new CompareSpecific(
1845 new BaseInterface[][] {
1846 new BaseInterface[] {} }));
1848 DerivedInterface if1 = new DerivedInterface() {};
1849 success &= testMapAny(transport,
1850 new Any(new Type(BaseInterface[][].class),
1851 new DerivedInterface[][] {
1852 new DerivedInterface[] {
1853 null, if1 } }),
1854 new CompareSpecific(
1855 new BaseInterface[][] {
1856 new BaseInterface[] {
1857 null, if1 } }));
1859 success &= testMapAny(transport,
1860 new DerivedInterface[][] {
1861 new DerivedInterface[] {} },
1862 new CompareBoxed());
1863 success &= testMapAny(transport,
1864 new DerivedInterface[][] {
1865 new DerivedInterface[] {
1866 null, new DerivedInterface() {} } },
1867 new CompareBoxed());
1868 success &= testMapAny(transport,
1869 new Any(new Type(DerivedInterface[][].class),
1870 new DerivedInterface[][] {
1871 new DerivedInterface[] {} }),
1872 new CompareUnboxed());
1873 success &= testMapAny(transport,
1874 new Any(
1875 new Type(DerivedInterface[][].class),
1876 new DerivedInterface[][] {
1877 new DerivedInterface[] {
1878 null,
1879 new DerivedInterface() {} } }),
1880 new CompareUnboxed());
1882 // Enum Types:
1883 if (createTypes) {
1884 success &= testMapAny(transport, new Enum1(), new CompareBoxed());
1885 success &= testMapAny(transport, new Any(new Type(Enum1.class),
1886 new Enum1()),
1887 new CompareUnboxed());
1888 success &= testMapAny(transport, new Any(new Type(Enum1.class),
1889 new Enum2()),
1890 new CompareSpecific(new Enum1()));
1893 // Struct Types:
1894 if (createTypes) {
1895 success &= testMapAny(transport, new BaseStruct(),
1896 new CompareBoxed());
1897 success &= testMapAny(transport,
1898 new Any(new Type(BaseStruct.class),
1899 new BaseStruct()),
1900 new CompareUnboxed());
1901 success &= testMapAny(transport,
1902 new Any(new Type(BaseStruct.class),
1903 new DerivedStruct()),
1904 new CompareSpecific(new BaseStruct()));
1905 success &= testMapAny(transport, new DerivedStruct(),
1906 new CompareBoxed());
1907 success &= testMapAny(transport,
1908 new Any(new Type(DerivedStruct.class),
1909 new DerivedStruct()),
1910 new CompareUnboxed());
1913 // Exception Types:
1914 success &= testMapAny(transport, new com.sun.star.uno.Exception(),
1915 new CompareClass(
1916 com.sun.star.uno.Exception.class));
1917 success &= testMapAny(transport,
1918 new Any(new Type(
1919 com.sun.star.uno.Exception.class),
1920 new com.sun.star.uno.Exception()),
1921 new CompareClass(
1922 com.sun.star.uno.Exception.class));
1923 success &= testMapAny(transport,
1924 new Any(new Type(
1925 com.sun.star.uno.Exception.class),
1926 new BaseException()),
1927 new CompareClass(
1928 com.sun.star.uno.Exception.class));
1929 success &= testMapAny(transport,
1930 new Any(new Type(
1931 com.sun.star.uno.Exception.class),
1932 new DerivedException()),
1933 new CompareClass(
1934 com.sun.star.uno.Exception.class));
1935 if (createTypes) {
1936 success &= testMapAny(transport, new BaseException(),
1937 new CompareBoxed());
1938 success &= testMapAny(transport,
1939 new Any(new Type(BaseException.class),
1940 new BaseException()),
1941 new CompareUnboxed());
1942 success &= testMapAny(transport,
1943 new Any(new Type(BaseException.class),
1944 new DerivedException()),
1945 new CompareSpecific(new BaseException()));
1946 success &= testMapAny(transport, new DerivedException(),
1947 new CompareBoxed());
1948 success &= testMapAny(transport,
1949 new Any(new Type(DerivedException.class),
1950 new DerivedException()),
1951 new CompareUnboxed());
1953 success &= testMapAny(transport,
1954 new com.sun.star.uno.RuntimeException(),
1955 new CompareClass(
1956 com.sun.star.uno.RuntimeException.class));
1957 success &= testMapAny(transport,
1958 new Any(
1959 new Type(
1960 com.sun.star.uno.RuntimeException.
1961 class),
1962 new com.sun.star.uno.RuntimeException()),
1963 new CompareClass(
1964 com.sun.star.uno.RuntimeException.class));
1965 success &= testMapAny(transport,
1966 new Any(
1967 new Type(
1968 com.sun.star.uno.RuntimeException.
1969 class),
1970 new BaseRuntimeException()),
1971 new CompareClass(
1972 com.sun.star.uno.RuntimeException.class));
1973 success &= testMapAny(transport,
1974 new Any(
1975 new Type(
1976 com.sun.star.uno.RuntimeException.
1977 class),
1978 new DerivedRuntimeException()),
1979 new CompareClass(
1980 com.sun.star.uno.RuntimeException.class));
1981 if (createTypes) {
1982 success &= testMapAny(transport, new BaseRuntimeException(),
1983 new CompareBoxed());
1984 success &= testMapAny(transport,
1985 new Any(new Type(
1986 BaseRuntimeException.class),
1987 new BaseRuntimeException()),
1988 new CompareUnboxed());
1989 success &= testMapAny(transport,
1990 new Any(new Type(
1991 BaseRuntimeException.class),
1992 new DerivedRuntimeException()),
1993 new CompareSpecific(
1994 new BaseRuntimeException()));
1995 success &= testMapAny(transport, new DerivedRuntimeException(),
1996 new CompareBoxed());
1997 success &= testMapAny(transport,
1998 new Any(new Type(
1999 DerivedRuntimeException.class),
2000 new DerivedRuntimeException()),
2001 new CompareUnboxed());
2004 // Interface Types:
2005 success &= testMapAny(transport, null, new CompareBoxed());
2006 success &= testMapAny(transport, new XInterface() {},
2007 new CompareBoxed());
2008 success &= testMapAny(transport, new BaseInterface() {},
2009 new CompareBoxed());
2010 success &= testMapAny(transport, new DerivedInterface() {},
2011 new CompareBoxed());
2012 success &= testMapAny(transport,
2013 new Any(new Type(XInterface.class), null),
2014 new CompareUnboxed());
2015 success &= testMapAny(transport,
2016 new Any(new Type(XInterface.class),
2017 new XInterface() {}),
2018 new CompareUnboxed());
2019 success &= testMapAny(transport,
2020 new Any(new Type(XInterface.class),
2021 new BaseInterface() {}),
2022 new CompareUnboxed());
2023 success &= testMapAny(transport,
2024 new Any(new Type(XInterface.class),
2025 new DerivedInterface() {}),
2026 new CompareUnboxed());
2027 success &= testMapAny(transport,
2028 new Any(new Type(BaseInterface.class), null),
2029 new CompareBoxed());
2030 success &= testMapAny(transport,
2031 new Any(new Type(BaseInterface.class),
2032 new BaseInterface() {}),
2033 new CompareBoxed());
2034 success &= testMapAny(transport,
2035 new Any(new Type(BaseInterface.class),
2036 new DerivedInterface() {}),
2037 new CompareBoxed());
2038 success &= testMapAny(transport,
2039 new Any(new Type(DerivedInterface.class),
2040 null),
2041 new CompareBoxed());
2042 success &= testMapAny(transport,
2043 new Any(new Type(DerivedInterface.class),
2044 new DerivedInterface() {}),
2045 new CompareBoxed());
2047 // Misc:
2048 try {
2049 transport.mapAny(new Object());
2050 System.out.println("BAD mapAny(Object), no exception");
2051 success = false;
2052 } catch (StackOverflowError e) {
2053 System.out.println("BAD mapAny(Object): " + e);
2054 success = false;
2055 } catch (RuntimeException e) {}
2057 return success;
2060 private TestAny() {} // do not instantiate
2062 private static boolean testType(Class zclass, TypeClass tclass,
2063 String tname) {
2064 Type t1 = new Type(zclass);
2065 Type t2 = new Type(tname, tclass);
2066 boolean ok = true;
2067 if (t1.getTypeClass() != tclass) {
2068 ok = false;
2069 System.out.println("BAD Type(" + zclass + ").getTypeClass() = "
2070 + t1.getTypeClass() + " != " + tclass);
2072 if (!t1.getTypeName().equals(tname)) {
2073 ok = false;
2074 System.out.println("BAD Type(" + zclass + ").getTypeName() = "
2075 + t1.getTypeName() + " != " + tname);
2077 if (!t1.equals(t2)) {
2078 ok = false;
2079 System.out.println("BAD Type(" + zclass + ") != Type(" + tname
2080 + ", " + tclass + ")");
2082 return ok;
2085 private static boolean testMapAny(XTransport transport, Object any,
2086 Compare compare) {
2087 Object any2 = transport.mapAny(any);
2088 boolean eq = compare.equal(any, any2);
2089 if (!eq) {
2090 System.out.println("BAD mapAny(" + any + ") -> " + any2);
2092 return eq;
2095 private static abstract class Compare {
2096 public abstract boolean equal(Object o1, Object o2);
2099 private static final class CompareBoxed extends Compare {
2100 public CompareBoxed() {
2101 this(false);
2104 public CompareBoxed(boolean unboxInner) {
2105 this.unboxInner = unboxInner;
2108 public boolean equal(Object o1, Object o2) {
2109 if (o1 instanceof Any) {
2110 return o2 instanceof Any
2111 && ((Any) o1).getType().equals(((Any) o2).getType())
2112 && equalValues(((Any) o1).getObject(),
2113 ((Any) o2).getObject());
2114 } else {
2115 return equalValues(o1, o2);
2119 private boolean equalValues(Object o1, Object o2) {
2120 if (o1 == null) {
2121 return o2 == null;
2122 } else if (o1.getClass().isArray()) {
2123 if (!(o2 != null && o1.getClass() == o2.getClass()
2124 && Array.getLength(o1) == Array.getLength(o2))) {
2125 return false;
2127 for (int i = 0; i < Array.getLength(o1); ++i) {
2128 Object oo1 = Array.get(o1, i);
2129 if (unboxInner && oo1 instanceof Any) {
2130 oo1 = ((Any) oo1).getObject();
2132 if (!equal(oo1, Array.get(o2, i))) {
2133 return false;
2136 return true;
2137 } else {
2138 return o1.equals(o2);
2142 private final boolean unboxInner;
2145 private static final class CompareUnboxed extends Compare {
2146 public CompareUnboxed() {
2147 this(false);
2150 public CompareUnboxed(boolean unboxInner) {
2151 this.unboxInner = unboxInner;
2154 public boolean equal(Object o1, Object o2) {
2155 return new CompareBoxed(unboxInner).equal(((Any) o1).getObject(),
2156 o2);
2159 private final boolean unboxInner;
2162 private static final class CompareSpecific extends Compare {
2163 public CompareSpecific(Object specific) {
2164 this.specific = specific;
2167 public boolean equal(Object o1, Object o2) {
2168 return new CompareBoxed().equal(specific, o2);
2171 private final Object specific;
2174 private static final class CompareClass extends Compare {
2175 public CompareClass(Class clazz) {
2176 this.clazz = clazz;
2179 public boolean equal(Object o1, Object o2) {
2180 return o2 != null && o2.getClass() == clazz;
2183 private final Class clazz;
2186 public static class Enum1 extends Enum {
2187 public Enum1() {
2188 super(0);
2191 public static Enum1 fromInt(int value) {
2192 return new Enum1();
2195 public boolean equals(Object obj) {
2196 return obj != null && obj.getClass() == Enum1.class;
2200 public static class Enum2 extends Enum1 {
2201 public boolean equals(Object obj) {
2202 return obj != null && obj.getClass() == Enum2.class;
2206 public static class BaseStruct {
2207 public boolean equals(Object obj) {
2208 return obj != null && obj.getClass() == BaseStruct.class;
2212 public static class DerivedStruct extends BaseStruct {
2213 public boolean equals(Object obj) {
2214 return obj != null && obj.getClass() == DerivedStruct.class;
2218 public static class BaseException extends com.sun.star.uno.Exception {
2219 public BaseException() {}
2221 public BaseException(String message) {
2222 super(message);
2225 public boolean equals(Object obj) {
2226 return obj != null && obj.getClass() == BaseException.class;
2230 public static class DerivedException extends BaseException {
2231 public DerivedException() {}
2233 public DerivedException(String message) {
2234 super(message);
2237 public boolean equals(Object obj) {
2238 return obj != null && obj.getClass() == DerivedException.class;
2242 public static class BaseRuntimeException
2243 extends com.sun.star.uno.RuntimeException
2245 public BaseRuntimeException() {}
2247 public BaseRuntimeException(String message) {
2248 super(message);
2251 public boolean equals(Object obj) {
2252 return obj != null
2253 && obj.getClass() == BaseRuntimeException.class;
2257 public static class DerivedRuntimeException extends BaseRuntimeException
2259 public DerivedRuntimeException() {}
2261 public DerivedRuntimeException(String message) {
2262 super(message);
2265 public boolean equals(Object obj) {
2266 return obj != null
2267 && obj.getClass() == DerivedRuntimeException.class;