KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > celtix > systest > type_test > AbstractTypeTestClient4


1 package org.objectweb.celtix.systest.type_test;
2
3 import java.io.Serializable JavaDoc;
4 import java.math.BigDecimal JavaDoc;
5 import java.math.BigInteger JavaDoc;
6 import java.util.Arrays JavaDoc;
7 import java.util.List JavaDoc;
8 import java.util.Map JavaDoc;
9
10 import javax.xml.namespace.QName JavaDoc;
11 import javax.xml.ws.Holder;
12
13 import org.objectweb.type_test.types1.AnonymousType;
14 //import org.objectweb.type_test.types1.ComplexArray;
15
//import org.objectweb.type_test.types1.ComplexChoice;
16
//import org.objectweb.type_test.types1.ComplexStruct;
17
//import org.objectweb.type_test.types1.DerivedAllBaseAll;
18
//import org.objectweb.type_test.types1.DerivedAllBaseChoice;
19
//import org.objectweb.type_test.types1.DerivedAllBaseStruct;
20
//import org.objectweb.type_test.types1.DerivedChoiceBaseAll;
21
import org.objectweb.type_test.types1.DerivedChoiceBaseArray;
22 //import org.objectweb.type_test.types1.DerivedChoiceBaseComplex;
23
import org.objectweb.type_test.types1.DerivedEmptyBaseEmptyAll;
24 //import org.objectweb.type_test.types1.DerivedStructBaseAll;
25
import org.objectweb.type_test.types1.DerivedStructBaseChoice;
26 import org.objectweb.type_test.types1.DerivedStructBaseStruct;
27 import org.objectweb.type_test.types1.EmptyAll;
28 import org.objectweb.type_test.types1.EmptyStruct;
29 import org.objectweb.type_test.types1.NestedStruct;
30 import org.objectweb.type_test.types1.OccuringAll;
31 import org.objectweb.type_test.types1.RecSeqB6918;
32 import org.objectweb.type_test.types1.RestrictedAllBaseAll;
33 import org.objectweb.type_test.types1.RestrictedStructBaseStruct;
34 //import org.objectweb.type_test.types1.SimpleAll;
35
import org.objectweb.type_test.types1.SimpleChoice;
36 import org.objectweb.type_test.types1.SimpleStruct;
37 import org.objectweb.type_test.types1.UnboundedArray;
38 import org.objectweb.type_test.types2.OccuringChoiceWithAnyAttribute;
39 import org.objectweb.type_test.types2.OccuringStructWithAnyAttribute;
40 import org.objectweb.type_test.types2.SimpleContentExtWithAnyAttribute;
41 import org.objectweb.type_test.types3.ArrayOfMRecSeqD;
42 import org.objectweb.type_test.types3.MRecSeqA;
43 import org.objectweb.type_test.types3.MRecSeqB;
44 import org.objectweb.type_test.types3.MRecSeqC;
45 import org.objectweb.type_test.types3.MRecSeqD;
46 import org.objectweb.type_test.types3.StructWithNillableChoice;
47 import org.objectweb.type_test.types3.StructWithNillableStruct;
48 import org.objectweb.type_test.types3.StructWithOccuringChoice;
49 import org.objectweb.type_test.types3.StructWithOccuringStruct;
50
51 public abstract class AbstractTypeTestClient4 extends AbstractTypeTestClient3 {
52
53     public AbstractTypeTestClient4(String JavaDoc name, QName JavaDoc theServicename,
54             QName JavaDoc thePort, String JavaDoc theWsdlPath) {
55         super(name, theServicename, thePort, theWsdlPath);
56     }
57
58     // org.objectweb.type_test.types2.SimpleContentExtWithAnyAttribute;
59

60     protected boolean equals(SimpleContentExtWithAnyAttribute x,
61                              SimpleContentExtWithAnyAttribute y) {
62         if (!x.getValue().equals(y.getValue())) {
63             return false;
64         }
65         if (!equalsNilable(x.getAttrib(), y.getAttrib())) {
66             return false;
67         }
68         return equalsQNameStringPairs(x.getOtherAttributes(), y.getOtherAttributes());
69     }
70
71     public void testSimpleContentExtWithAnyAttribute() throws Exception JavaDoc {
72         QName JavaDoc xAt1Name = new QName JavaDoc("http://objectweb.org/type_test", "at_one");
73         QName JavaDoc xAt2Name = new QName JavaDoc("http://objectweb.org/type_test", "at_two");
74         QName JavaDoc yAt3Name = new QName JavaDoc("http://objectweb.org/type_test", "at_thr");
75         QName JavaDoc yAt4Name = new QName JavaDoc("http://objectweb.org/type_test", "at_fou");
76
77         SimpleContentExtWithAnyAttribute x = new SimpleContentExtWithAnyAttribute();
78         x.setValue("foo");
79         x.setAttrib(new Integer JavaDoc(2000));
80
81         SimpleContentExtWithAnyAttribute y = new SimpleContentExtWithAnyAttribute();
82         y.setValue("bar");
83         y.setAttrib(new Integer JavaDoc(2001));
84
85         Map JavaDoc<QName JavaDoc, String JavaDoc> xAttrMap = x.getOtherAttributes();
86         xAttrMap.put(xAt1Name, "one");
87         xAttrMap.put(xAt2Name, "two");
88
89         Map JavaDoc<QName JavaDoc, String JavaDoc> yAttrMap = y.getOtherAttributes();
90         yAttrMap.put(yAt3Name, "three");
91         yAttrMap.put(yAt4Name, "four");
92
93         Holder<SimpleContentExtWithAnyAttribute> yh = new Holder<SimpleContentExtWithAnyAttribute>(y);
94         Holder<SimpleContentExtWithAnyAttribute> zh = new Holder<SimpleContentExtWithAnyAttribute>();
95         SimpleContentExtWithAnyAttribute ret;
96         if (testDocLiteral) {
97             ret = docClient.testSimpleContentExtWithAnyAttribute(x, yh, zh);
98         } else {
99             ret = rpcClient.testSimpleContentExtWithAnyAttribute(x, yh, zh);
100         }
101
102         if (!perfTestOnly) {
103             assertTrue("testSimpleContentExtWithAnyAttribute(): Incorrect value for inout param",
104                 equals(x, yh.value));
105             assertTrue("testSimpleContentExtWithAnyAttribute(): Incorrect value for out param",
106                 equals(y, zh.value));
107             assertTrue("testSimpleContentExtWithAnyAttribute(): Incorrect return value",
108                 equals(ret, x));
109         }
110     }
111
112     // org.objectweb.type_test.types3.OccuringAll;
113

114     protected boolean equals(OccuringAll x, OccuringAll y) {
115         if (x.getVarAttrString() == null && y.getVarAttrString() == null) {
116             return x.getVarInt() == null && y.getVarInt() == null;
117         } else if (!equalsNilable(x.getVarAttrString(), y.getVarAttrString())) {
118             return false;
119         }
120         return x.getVarInt().compareTo(y.getVarInt()) == 0;
121     }
122
123     public void testOccuringAll() throws Exception JavaDoc {
124         OccuringAll x = new OccuringAll();
125         x.setVarInt(new Integer JavaDoc(42));
126         x.setVarAttrString("x_attr");
127         OccuringAll yOrig = new OccuringAll();
128         Holder<OccuringAll> y = new Holder<OccuringAll>(yOrig);
129         Holder<OccuringAll> z = new Holder<OccuringAll>();
130         OccuringAll ret;
131         if (testDocLiteral) {
132             ret = docClient.testOccuringAll(x, y, z);
133         } else {
134             ret = rpcClient.testOccuringAll(x, y, z);
135         }
136         if (!perfTestOnly) {
137             assertTrue("testOccuringAll(): Incorrect value for inout param", equals(x, y.value));
138             assertTrue("testOccuringAll(): Incorrect value for out param", equals(yOrig, z.value));
139             assertTrue("testOccuringAll(): Incorrect return value", equals(x, ret));
140         }
141     }
142
143     // org.objectweb.type_test.types2.OccuringStructWithAnyAttribute;
144

145     protected boolean equals(OccuringStructWithAnyAttribute x,
146                              OccuringStructWithAnyAttribute y) {
147         if (!equalsNilable(x.getAtString(), y.getAtString())
148             || !equalsNilable(x.getAtInt(), y.getAtInt())) {
149             return false;
150         }
151         List JavaDoc<Serializable JavaDoc> xList = x.getVarStringAndVarInt();
152         List JavaDoc<Serializable JavaDoc> yList = y.getVarStringAndVarInt();
153         if (!equalsStringIntList(xList, yList)) {
154             return false;
155         }
156         return equalsQNameStringPairs(x.getOtherAttributes(), y.getOtherAttributes());
157     }
158
159     private boolean equalsStringIntList(List JavaDoc<Serializable JavaDoc> xList, List JavaDoc<Serializable JavaDoc> yList) {
160         int size = xList.size();
161         if (size != yList.size()) {
162             return false;
163         }
164         for (int i = 0; i < size; i++) {
165             if (xList.get(i) instanceof String JavaDoc && yList.get(i) instanceof String JavaDoc) {
166                 if (!xList.get(i).equals(yList.get(i))) {
167                     return false;
168                 }
169             } else if (xList.get(i) instanceof Integer JavaDoc && yList.get(i) instanceof Integer JavaDoc) {
170                 Integer JavaDoc ix = (Integer JavaDoc)xList.get(i);
171                 Integer JavaDoc iy = (Integer JavaDoc)yList.get(i);
172                 if (iy.compareTo(ix) != 0) {
173                     return false;
174                 }
175             } else {
176                 return false;
177             }
178         }
179         return true;
180     }
181
182     public void testOccuringStructWithAnyAttribute() throws Exception JavaDoc {
183         QName JavaDoc xAt1Name = new QName JavaDoc("http://objectweb.org/type_test", "at_one");
184         QName JavaDoc xAt2Name = new QName JavaDoc("http://objectweb.org/type_test", "at_two");
185         QName JavaDoc yAt3Name = new QName JavaDoc("http://objectweb.org/type_test", "at_thr");
186         QName JavaDoc yAt4Name = new QName JavaDoc("http://objectweb.org/type_test", "at_fou");
187
188         OccuringStructWithAnyAttribute x = new OccuringStructWithAnyAttribute();
189         OccuringStructWithAnyAttribute y = new OccuringStructWithAnyAttribute();
190         List JavaDoc<Serializable JavaDoc> xVarStringAndVarInt = x.getVarStringAndVarInt();
191         xVarStringAndVarInt.add("x1");
192         xVarStringAndVarInt.add(0);
193         xVarStringAndVarInt.add("x2");
194         xVarStringAndVarInt.add(1);
195         x.setAtString("attribute");
196         x.setAtInt(new Integer JavaDoc(2000));
197
198         List JavaDoc<Serializable JavaDoc> yVarStringAndVarInt = y.getVarStringAndVarInt();
199         yVarStringAndVarInt.add("there");
200         yVarStringAndVarInt.add(1001);
201         y.setAtString("another attribute");
202         y.setAtInt(new Integer JavaDoc(2002));
203
204         Map JavaDoc<QName JavaDoc, String JavaDoc> xAttrMap = x.getOtherAttributes();
205         xAttrMap.put(xAt1Name, "one");
206         xAttrMap.put(xAt2Name, "two");
207
208         Map JavaDoc<QName JavaDoc, String JavaDoc> yAttrMap = y.getOtherAttributes();
209         yAttrMap.put(yAt3Name, "three");
210         yAttrMap.put(yAt4Name, "four");
211
212         Holder<OccuringStructWithAnyAttribute> yh = new Holder<OccuringStructWithAnyAttribute>(y);
213         Holder<OccuringStructWithAnyAttribute> zh = new Holder<OccuringStructWithAnyAttribute>();
214         OccuringStructWithAnyAttribute ret;
215         if (testDocLiteral) {
216             ret = docClient.testOccuringStructWithAnyAttribute(x, yh, zh);
217         } else {
218             ret = rpcClient.testOccuringStructWithAnyAttribute(x, yh, zh);
219         }
220
221         if (!perfTestOnly) {
222             assertTrue("testOccuringStructWithAnyAttribute(): Incorrect value for inout param",
223                 equals(x, yh.value));
224             assertTrue("testOccuringStructWithAnyAttribute(): Incorrect value for inout param",
225                 equals(y, zh.value));
226             assertTrue("testOccuringStructWithAnyAttribute(): Incorrect value for inout param",
227                 equals(ret, x));
228         }
229     }
230
231     // org.objectweb.type_test.types2.OccuringChoiceWithAnyAttribute;
232

233     protected boolean equals(OccuringChoiceWithAnyAttribute x,
234                              OccuringChoiceWithAnyAttribute y) {
235         if (!equalsNilable(x.getAtString(), y.getAtString())
236             || !equalsNilable(x.getAtInt(), y.getAtInt())) {
237             return false;
238         }
239         List JavaDoc<Serializable JavaDoc> xList = x.getVarStringOrVarInt();
240         List JavaDoc<Serializable JavaDoc> yList = y.getVarStringOrVarInt();
241         if (!equalsStringIntList(xList, yList)) {
242             return false;
243         }
244         return equalsQNameStringPairs(x.getOtherAttributes(), y.getOtherAttributes());
245     }
246
247     public void testOccuringChoiceWithAnyAttribute() throws Exception JavaDoc {
248         QName JavaDoc xAt1Name = new QName JavaDoc("http://schemas.iona.com/type_test", "at_one");
249         QName JavaDoc xAt2Name = new QName JavaDoc("http://schemas.iona.com/type_test", "at_two");
250         QName JavaDoc yAt3Name = new QName JavaDoc("http://objectweb.org/type_test", "at_thr");
251         QName JavaDoc yAt4Name = new QName JavaDoc("http://objectweb.org/type_test", "at_fou");
252
253         OccuringChoiceWithAnyAttribute x = new OccuringChoiceWithAnyAttribute();
254         OccuringChoiceWithAnyAttribute y = new OccuringChoiceWithAnyAttribute();
255
256         List JavaDoc<Serializable JavaDoc> xVarStringOrVarInt = x.getVarStringOrVarInt();
257         xVarStringOrVarInt.add("hello");
258         xVarStringOrVarInt.add(1);
259         x.setAtString("attribute");
260         x.setAtInt(new Integer JavaDoc(2000));
261
262         List JavaDoc<Serializable JavaDoc> yVarStringOrVarInt = y.getVarStringOrVarInt();
263         yVarStringOrVarInt.add(1001);
264         y.setAtString("the attribute");
265         y.setAtInt(new Integer JavaDoc(2002));
266
267         Map JavaDoc<QName JavaDoc, String JavaDoc> xAttrMap = x.getOtherAttributes();
268         xAttrMap.put(xAt1Name, "one");
269         xAttrMap.put(xAt2Name, "two");
270
271         Map JavaDoc<QName JavaDoc, String JavaDoc> yAttrMap = y.getOtherAttributes();
272         yAttrMap.put(yAt3Name, "three");
273         yAttrMap.put(yAt4Name, "four");
274
275         Holder<OccuringChoiceWithAnyAttribute> yh = new Holder<OccuringChoiceWithAnyAttribute>(y);
276         Holder<OccuringChoiceWithAnyAttribute> zh = new Holder<OccuringChoiceWithAnyAttribute>();
277         OccuringChoiceWithAnyAttribute ret;
278         if (testDocLiteral) {
279             ret = docClient.testOccuringChoiceWithAnyAttribute(x, yh, zh);
280         } else {
281             ret = rpcClient.testOccuringChoiceWithAnyAttribute(x, yh, zh);
282         }
283
284         if (!perfTestOnly) {
285             assertTrue("testOccuringChoiceWithAnyAttribute(): Incorrect value for inout param",
286                 equals(x, yh.value));
287             assertTrue("testOccuringChoiceWithAnyAttribute(): Incorrect value for out param",
288                 equals(y, zh.value));
289             assertTrue("testOccuringChoiceWithAnyAttribute(): Incorrect return value",
290                 equals(ret, x));
291         }
292     }
293
294     // org.objectweb.type_test.types3.MRecSeqA;
295

296     protected boolean equals(MRecSeqA x, MRecSeqA y) {
297         List JavaDoc<MRecSeqB> xList = x.getSeqB();
298         List JavaDoc<MRecSeqB> yList = y.getSeqB();
299         int size = xList.size();
300         if (size != yList.size()) {
301             return false;
302         }
303         for (int i = 0; i < size; i++) {
304             if (!equals(xList.get(i), yList.get(i))) {
305                 return false;
306             }
307         }
308         return x.getVarIntA() == y.getVarIntA();
309     }
310
311     protected boolean equals(MRecSeqB x, MRecSeqB y) {
312         return x.getVarIntB() == y.getVarIntB()
313             && equals(x.getSeqA(), y.getSeqA());
314     }
315
316     public void testMRecSeqA() throws Exception JavaDoc {
317         MRecSeqA xA = new MRecSeqA();
318         MRecSeqA yA = new MRecSeqA();
319         MRecSeqA zA = new MRecSeqA();
320         MRecSeqB xB = new MRecSeqB();
321         MRecSeqB yB = new MRecSeqB();
322         xA.setVarIntA(11);
323         yA.setVarIntA(12);
324         zA.setVarIntA(13);
325         xB.setVarIntB(21);
326         yB.setVarIntB(22);
327         xB.setSeqA(yA);
328         yB.setSeqA(zA);
329         xA.getSeqB().add(xB);
330         yA.getSeqB().add(yB);
331         Holder<MRecSeqA> yh = new Holder<MRecSeqA>(yA);
332         Holder<MRecSeqA> zh = new Holder<MRecSeqA>();
333         MRecSeqA ret;
334         if (testDocLiteral) {
335             ret = docClient.testMRecSeqA(xA, yh, zh);
336         } else {
337             ret = rpcClient.testMRecSeqA(xA, yh, zh);
338         }
339         if (!perfTestOnly) {
340             assertTrue("test_MRecSeqA(): Incorrect value for inout param",
341                 equals(xA, yh.value));
342             assertTrue("test_MRecSeqA(): Incorrect value for out param",
343                 equals(yA, zh.value));
344             assertTrue("test_MRecSeqA(): Incorrect return value",
345                 equals(ret, xA));
346         }
347     }
348
349     // org.objectweb.type_test.types3.MRecSeqC;
350

351     protected boolean equals(MRecSeqC x, MRecSeqC y) {
352         return x.getVarIntC() == y.getVarIntC()
353             && equals(x.getSeqDs(), y.getSeqDs());
354     }
355
356     protected boolean equals(ArrayOfMRecSeqD x, ArrayOfMRecSeqD y) {
357         List JavaDoc<MRecSeqD> xList = x.getSeqD();
358         List JavaDoc<MRecSeqD> yList = y.getSeqD();
359         int size = xList.size();
360         if (size != yList.size()) {
361             return false;
362         }
363         for (int i = 0; i < size; i++) {
364             if (!equals(xList.get(i), yList.get(i))) {
365                 return false;
366             }
367         }
368         return true;
369     }
370
371     protected boolean equals(MRecSeqD x, MRecSeqD y) {
372         return x.getVarIntD() == y.getVarIntD()
373             && equals(x.getSeqC(), y.getSeqC());
374     }
375
376     public void testMRecSeqC() throws Exception JavaDoc {
377         MRecSeqC xC = new MRecSeqC();
378         MRecSeqC yC = new MRecSeqC();
379         MRecSeqC zC = new MRecSeqC();
380         ArrayOfMRecSeqD xDs = new ArrayOfMRecSeqD();
381         ArrayOfMRecSeqD yDs = new ArrayOfMRecSeqD();
382         ArrayOfMRecSeqD zDs = new ArrayOfMRecSeqD();
383         MRecSeqD xD = new MRecSeqD();
384         MRecSeqD yD = new MRecSeqD();
385         xC.setVarIntC(11);
386         yC.setVarIntC(12);
387         zC.setVarIntC(13);
388         xD.setVarIntD(21);
389         yD.setVarIntD(22);
390         xDs.getSeqD().add(xD);
391         yDs.getSeqD().add(yD);
392         xC.setSeqDs(xDs);
393         yC.setSeqDs(yDs);
394         zC.setSeqDs(zDs);
395         xD.setSeqC(yC);
396         yD.setSeqC(zC);
397         Holder<MRecSeqC> yh = new Holder<MRecSeqC>(yC);
398         Holder<MRecSeqC> zh = new Holder<MRecSeqC>();
399         MRecSeqC ret;
400         if (testDocLiteral) {
401             ret = docClient.testMRecSeqC(xC, yh, zh);
402         } else {
403             ret = rpcClient.testMRecSeqC(xC, yh, zh);
404         }
405         if (!perfTestOnly) {
406             assertTrue("test_MRecSeqC(): Incorrect value for inout param",
407                 equals(xC, yh.value));
408             assertTrue("test_MRecSeqC(): Incorrect value for out param",
409                 equals(yC, zh.value));
410             assertTrue("test_MRecSeqC(): Incorrect return value",
411                 equals(ret, xC));
412         }
413     }
414
415     // org.objectweb.type_test.types3.StructWithNillableChoice;
416

417     protected boolean equals(StructWithNillableChoice x, StructWithNillableChoice y) {
418         if (x.getVarInteger() != y.getVarInteger()) {
419             return false;
420         }
421
422         if (x.getVarString() != null) {
423             return x.getVarString().equals(y.getVarString());
424         } else if (x.getVarInt() != null) {
425             return x.getVarInt() == y.getVarInt();
426         }
427         return y.getVarInt() == null && y.getVarString() == null;
428     }
429
430     protected boolean isNormalized(StructWithNillableChoice x) {
431         return x == null || x.getVarInt() == null && x.getVarString() == null;
432     }
433
434     public void testStructWithNillableChoice() throws Exception JavaDoc {
435         // Test 1
436
//
437
// x: non-nil choice
438
// y: nil choice
439
//
440
StructWithNillableChoice x = new StructWithNillableChoice();
441         x.setVarInteger(2);
442         x.setVarInt(3);
443
444         StructWithNillableChoice yOriginal = new StructWithNillableChoice();
445         yOriginal.setVarInteger(1);
446
447         Holder<StructWithNillableChoice> y = new Holder<StructWithNillableChoice>(yOriginal);
448         Holder<StructWithNillableChoice> z = new Holder<StructWithNillableChoice>();
449         StructWithNillableChoice ret;
450         if (testDocLiteral) {
451             ret = docClient.testStructWithNillableChoice(x, y, z);
452         } else {
453             ret = rpcClient.testStructWithNillableChoice(x, y, z);
454         }
455
456         if (!perfTestOnly) {
457             assertTrue("testStructWithNillableChoice(): Incorrect value for inout param",
458                        equals(x, y.value));
459             assertTrue("testStructWithNillableChoice(): Incorrect value for out param",
460                        equals(yOriginal, z.value));
461             assertTrue("testStructWithNillableChoice(): Incorrect return value",
462                        equals(x, ret));
463             assertTrue("testStructWithNillableChoice(): Incorrect form for out param",
464                        isNormalized(z.value));
465         }
466
467         // Test 2
468
//
469
// x: nil choice
470
// y: non-nil choice
471
//
472
y = new Holder<StructWithNillableChoice>(x);
473         x = yOriginal;
474         yOriginal = y.value;
475         z = new Holder<StructWithNillableChoice>();
476         if (testDocLiteral) {
477             ret = docClient.testStructWithNillableChoice(x, y, z);
478         } else {
479             ret = rpcClient.testStructWithNillableChoice(x, y, z);
480         }
481
482         if (!perfTestOnly) {
483             assertTrue("testStructWithNillableChoice(): Incorrect value for inout param",
484                        equals(x, y.value));
485             assertTrue("testStructWithNillableChoice(): Incorrect value for out param",
486                        equals(yOriginal, z.value));
487             assertTrue("testStructWithNillableChoice(): Incorrect return value",
488                        equals(x, ret));
489             assertTrue("testStructWithNillableChoice(): Incorrect form for inout param",
490                        isNormalized(y.value));
491             assertTrue("testStructWithNillableChoice(): Incorrect return form",
492                        isNormalized(ret));
493         }
494     }
495
496     // org.objectweb.type_test.types3.StructWithOccuringChoice;
497

498     protected boolean equals(StructWithOccuringChoice x, StructWithOccuringChoice y) {
499         if (x.getVarInteger() != y.getVarInteger()) {
500             fail(x.getVarInteger() + " != " + y.getVarInteger());
501             return false;
502         }
503
504         List JavaDoc<Serializable JavaDoc> xList = x.getVarIntOrVarString();
505         List JavaDoc<Serializable JavaDoc> yList = y.getVarIntOrVarString();
506         int size = xList.size();
507         if (size != yList.size()) {
508             return false;
509         }
510         for (int i = 0; i < size; i++) {
511             if (xList.get(i) instanceof Integer JavaDoc && yList.get(i) instanceof Integer JavaDoc) {
512                 Integer JavaDoc ix = (Integer JavaDoc)xList.get(i);
513                 Integer JavaDoc iy = (Integer JavaDoc)yList.get(i);
514                 if (iy.compareTo(ix) != 0) {
515                     return false;
516                 }
517             } else if (xList.get(i) instanceof String JavaDoc && yList.get(i) instanceof String JavaDoc) {
518                 String JavaDoc sx = (String JavaDoc)xList.get(i);
519                 String JavaDoc sy = (String JavaDoc)yList.get(i);
520                 if (!sx.equals(sy)) {
521                     return false;
522                 }
523             } else {
524                 return false;
525             }
526         }
527
528         return true;
529     }
530
531     protected boolean isNormalized(StructWithOccuringChoice x) {
532         return x == null || x.getVarIntOrVarString().size() == 0;
533     }
534
535     public void testStructWithOccuringChoice() throws Exception JavaDoc {
536         // Test 1
537
//
538
// x: choice occurs twice
539
// y: choice doesn't occur
540
//
541
StructWithOccuringChoice x = new StructWithOccuringChoice();
542         x.setVarInteger(2);
543         x.getVarIntOrVarString().add(3);
544         x.getVarIntOrVarString().add("hello");
545
546         StructWithOccuringChoice yOriginal = new StructWithOccuringChoice();
547         yOriginal.setVarInteger(1);
548
549         Holder<StructWithOccuringChoice> y = new Holder<StructWithOccuringChoice>(yOriginal);
550         Holder<StructWithOccuringChoice> z = new Holder<StructWithOccuringChoice>();
551         StructWithOccuringChoice ret;
552         if (testDocLiteral) {
553             ret = docClient.testStructWithOccuringChoice(x, y, z);
554         } else {
555             ret = rpcClient.testStructWithOccuringChoice(x, y, z);
556         }
557
558         if (!perfTestOnly) {
559             assertTrue("testStructWithOccuringChoice(): Incorrect value for inout param",
560                        equals(x, y.value));
561             assertTrue("testStructWithOccuringChoice(): Incorrect value for out param",
562                        equals(yOriginal, z.value));
563             assertTrue("testStructWithOccuringChoice(): Incorrect return value",
564                        equals(x, ret));
565             assertTrue("testStructWithOccuringChoice(): Incorrect form for out param",
566                        isNormalized(z.value));
567         }
568
569         // Test 2
570
//
571
// x: choice occurs twice
572
// y: choice occurs once
573
//
574
yOriginal.getVarIntOrVarString().add("world");
575
576         y = new Holder<StructWithOccuringChoice>(yOriginal);
577         z = new Holder<StructWithOccuringChoice>();
578         if (testDocLiteral) {
579             ret = docClient.testStructWithOccuringChoice(x, y, z);
580         } else {
581             ret = rpcClient.testStructWithOccuringChoice(x, y, z);
582         }
583         if (!perfTestOnly) {
584             assertTrue("testStructWithOccuringChoice(): Incorrect value for inout param",
585                        equals(x, y.value));
586             assertTrue("testStructWithOccuringChoice(): Incorrect value for out param",
587                        equals(yOriginal, z.value));
588             assertTrue("testStructWithOccuringChoice(): Incorrect return value",
589                        equals(x, ret));
590         }
591
592         // Test 3
593
//
594
// x: choice occurs once
595
// y: choice occurs twice
596
//
597
y = new Holder<StructWithOccuringChoice>(x);
598         x = yOriginal;
599         yOriginal = y.value;
600         z = new Holder<StructWithOccuringChoice>();
601         if (testDocLiteral) {
602             ret = docClient.testStructWithOccuringChoice(x, y, z);
603         } else {
604             ret = rpcClient.testStructWithOccuringChoice(x, y, z);
605         }
606
607         if (!perfTestOnly) {
608             assertTrue("testStructWithOccuringChoice(): Incorrect value for inout param",
609                        equals(x, y.value));
610             assertTrue("testStructWithOccuringChoice(): Incorrect value for out param",
611                        equals(yOriginal, z.value));
612             assertTrue("testStructWithOccuringChoice(): Incorrect return value",
613                        equals(x, ret));
614         }
615
616         // Test 4
617
//
618
// x: choice doesn't occur
619
// y: choice occurs twice
620
//
621
x.getVarIntOrVarString().clear();
622
623         y = new Holder<StructWithOccuringChoice>(yOriginal);
624         z = new Holder<StructWithOccuringChoice>();
625         if (testDocLiteral) {
626             ret = docClient.testStructWithOccuringChoice(x, y, z);
627         } else {
628             ret = rpcClient.testStructWithOccuringChoice(x, y, z);
629         }
630
631         if (!perfTestOnly) {
632             assertTrue("testStructWithOccuringChoice(): Incorrect value for inout param",
633                        equals(x, y.value));
634             assertTrue("testStructWithOccuringChoice(): Incorrect value for out param",
635                        equals(yOriginal, z.value));
636             assertTrue("testStructWithOccuringChoice(): Incorrect return value",
637                        equals(x, ret));
638             assertTrue("testStructWithOccuringChoice(): Incorrect form for inout param",
639                        isNormalized(y.value));
640             assertTrue("testStructWithOccuringChoice(): Incorrect return form",
641                        isNormalized(ret));
642         }
643     }
644
645     // org.objectweb.type_test.types3.StructWithNillableStruct;
646

647     protected boolean equals(StructWithNillableStruct x, StructWithNillableStruct y) {
648         if (x.getVarInteger() != y.getVarInteger()) {
649             fail(x.getVarInteger() + " != " + y.getVarInteger());
650             return false;
651         }
652
653         if (x.getVarInt() == null) {
654             if (x.getVarFloat() == null) {
655                 return y.getVarInt() == null && y.getVarFloat() == null;
656             } else {
657                 return false;
658             }
659         } else {
660             if (x.getVarFloat() == null || y.getVarInt() == null || y.getVarFloat() == null) {
661                 return false;
662             }
663         }
664         return x.getVarFloat().compareTo(y.getVarFloat()) == 0
665             && x.getVarInt() == y.getVarInt();
666     }
667
668     protected boolean isNormalized(StructWithNillableStruct x) {
669         return x.getVarInt() == null && x.getVarFloat() == null;
670     }
671
672     public void testStructWithNillableStruct() throws Exception JavaDoc {
673         // Test 1
674
//
675
// x: non-nil sequence
676
// y: nil sequence (non-null holder object)
677
//
678
StructWithNillableStruct x = new StructWithNillableStruct();
679         x.setVarInteger(100);
680         x.setVarInt(101);
681         x.setVarFloat(101.5f);
682         StructWithNillableStruct yOriginal = new StructWithNillableStruct();
683         yOriginal.setVarInteger(200);
684
685         Holder<StructWithNillableStruct> y =
686             new Holder<StructWithNillableStruct>(yOriginal);
687         Holder<StructWithNillableStruct> z = new Holder<StructWithNillableStruct>();
688         StructWithNillableStruct ret;
689         if (testDocLiteral) {
690             ret = docClient.testStructWithNillableStruct(x, y, z);
691         } else {
692             ret = rpcClient.testStructWithNillableStruct(x, y, z);
693         }
694
695         if (!perfTestOnly) {
696             assertTrue("testStructWithNillableStruct(): Incorrect value for inout param",
697                        equals(x, y.value));
698             assertTrue("testStructWithNillableStruct(): Incorrect value for out param",
699                        equals(yOriginal, z.value));
700             assertTrue("testStructWithNillableStruct(): Incorrect return value",
701                        equals(x, ret));
702             assertTrue("testStructWithNillableStruct(): Incorrect form for out param",
703                        isNormalized(z.value));
704         }
705
706         // Test 2
707
//
708
// x: non-nil sequence
709
// y: nil sequence (null holder object)
710
//
711
yOriginal.setVarInt(null);
712         yOriginal.setVarFloat(null);
713
714         y = new Holder<StructWithNillableStruct>(yOriginal);
715         z = new Holder<StructWithNillableStruct>();
716         if (testDocLiteral) {
717             ret = docClient.testStructWithNillableStruct(x, y, z);
718         } else {
719             ret = rpcClient.testStructWithNillableStruct(x, y, z);
720         }
721         if (!perfTestOnly) {
722             assertTrue("testStructWithNillableStruct(): Incorrect value for inout param",
723                        equals(x, y.value));
724             assertTrue("testStructWithNillableStruct(): Incorrect value for out param",
725                        equals(yOriginal, z.value));
726             assertTrue("testStructWithNillableStruct(): Incorrect return value",
727                        equals(x, ret));
728             assertTrue("testStructWithNillableStruct(): Incorrect form for out param",
729                        isNormalized(z.value));
730         }
731
732         // Test 3
733
//
734
// x: nil sequence (null holder object)
735
// y: non-nil sequence
736
//
737
y = new Holder<StructWithNillableStruct>(x);
738         x = yOriginal;
739         yOriginal = y.value;
740         z = new Holder<StructWithNillableStruct>();
741         if (testDocLiteral) {
742             ret = docClient.testStructWithNillableStruct(x, y, z);
743         } else {
744             ret = rpcClient.testStructWithNillableStruct(x, y, z);
745         }
746
747         if (!perfTestOnly) {
748             assertTrue("testStructWithNillableStruct(): Incorrect value for inout param",
749                        equals(x, y.value));
750             assertTrue("testStructWithNillableStruct(): Incorrect value for out param",
751                        equals(yOriginal, z.value));
752             assertTrue("testStructWithNillableStruct(): Incorrect return value",
753                        equals(x, ret));
754             assertTrue("testStructWithNillableStruct(): Incorrect form for inout param",
755                        isNormalized(y.value));
756             assertTrue("testStructWithNillableStruct(): Incorrect return form",
757                        isNormalized(ret));
758         }
759     }
760
761     // org.objectweb.type_test.types3.StructWithOccuringStruct;
762

763     protected boolean equals(StructWithOccuringStruct x, StructWithOccuringStruct y) {
764         if (x.getVarInteger() != y.getVarInteger()) {
765             return false;
766         }
767
768         List JavaDoc<Comparable JavaDoc> xList = x.getVarIntAndVarFloat();
769         List JavaDoc<Comparable JavaDoc> yList = y.getVarIntAndVarFloat();
770         int xSize = (xList == null) ? 0 : xList.size();
771         int ySize = (yList == null) ? 0 : yList.size();
772         if (xSize != ySize) {
773             return false;
774         }
775         for (int i = 0; i < xSize; ++i) {
776             if (xList.get(i) instanceof Integer JavaDoc && yList.get(i) instanceof Integer JavaDoc) {
777                 if (((Integer JavaDoc)xList.get(i)).compareTo((Integer JavaDoc)yList.get(i)) != 0) {
778                     return false;
779                 }
780             } else if (xList.get(i) instanceof Float JavaDoc && yList.get(i) instanceof Float JavaDoc) {
781                 if (((Float JavaDoc)xList.get(i)).compareTo((Float JavaDoc)yList.get(i)) != 0) {
782                     return false;
783                 }
784             } else {
785                 return false;
786             }
787         }
788
789         return true;
790     }
791
792     protected boolean isNormalized(StructWithOccuringStruct x) {
793         return x.getVarIntAndVarFloat() != null;
794     }
795
796     public void testStructWithOccuringStruct() throws Exception JavaDoc {
797         // Test 1
798
//
799
// x: sequence occurs twice
800
// y: sequence doesn't occur (null holder object)
801
//
802
StructWithOccuringStruct x = new StructWithOccuringStruct();
803         x.setVarInteger(100);
804         x.getVarIntAndVarFloat().add(101);
805         x.getVarIntAndVarFloat().add(101.5f);
806         x.getVarIntAndVarFloat().add(102);
807         x.getVarIntAndVarFloat().add(102.5f);
808
809         StructWithOccuringStruct yOriginal = new StructWithOccuringStruct();
810         yOriginal.setVarInteger(200);
811
812         Holder<StructWithOccuringStruct> y = new Holder<StructWithOccuringStruct>(yOriginal);
813         Holder<StructWithOccuringStruct> z = new Holder<StructWithOccuringStruct>();
814         StructWithOccuringStruct ret;
815         if (testDocLiteral) {
816             ret = docClient.testStructWithOccuringStruct(x, y, z);
817         } else {
818             ret = rpcClient.testStructWithOccuringStruct(x, y, z);
819         }
820
821         if (!perfTestOnly) {
822             assertTrue("testStructWithOccuringStruct(): Incorrect value for inout param",
823                        equals(x, y.value));
824             assertTrue("testStructWithOccuringStruct(): Incorrect value for out param",
825                        equals(yOriginal, z.value));
826             assertTrue("testStructWithOccuringStruct(): Incorrect return value",
827                        equals(x, ret));
828             assertTrue("testStructWithOccuringStruct(): Incorrect form for out param",
829                        isNormalized(z.value));
830         }
831
832         // Test 2
833
//
834
// x: sequence occurs twice
835
// y: sequence occurs once
836
//
837
yOriginal.getVarIntAndVarFloat().add(201);
838         yOriginal.getVarIntAndVarFloat().add(202.5f);
839
840         y = new Holder<StructWithOccuringStruct>(yOriginal);
841         z = new Holder<StructWithOccuringStruct>();
842         if (testDocLiteral) {
843             ret = docClient.testStructWithOccuringStruct(x, y, z);
844         } else {
845             ret = rpcClient.testStructWithOccuringStruct(x, y, z);
846         }
847         if (!perfTestOnly) {
848             assertTrue("testStructWithOccuringStruct(): Incorrect value for inout param",
849                        equals(x, y.value));
850             assertTrue("testStructWithOccuringStruct(): Incorrect value for out param",
851                        equals(yOriginal, z.value));
852             assertTrue("testStructWithOccuringStruct(): Incorrect return value",
853                        equals(x, ret));
854         }
855
856         // Test 3
857
//
858
// x: sequence occurs once
859
// y: sequence occurs twice
860
//
861
y = new Holder<StructWithOccuringStruct>(x);
862         x = yOriginal;
863         yOriginal = y.value;
864         z = new Holder<StructWithOccuringStruct>();
865         if (testDocLiteral) {
866             ret = docClient.testStructWithOccuringStruct(x, y, z);
867         } else {
868             ret = rpcClient.testStructWithOccuringStruct(x, y, z);
869         }
870
871         if (!perfTestOnly) {
872             assertTrue("testStructWithOccuringStruct(): Incorrect value for inout param",
873                        equals(x, y.value));
874             assertTrue("testStructWithOccuringStruct(): Incorrect value for out param",
875                        equals(yOriginal, z.value));
876             assertTrue("testStructWithOccuringStruct(): Incorrect return value",
877                        equals(x, ret));
878         }
879
880         // Test 4
881
//
882
// x: sequence doesn't occur (array of size 0)
883
// y: sequence occurs twice
884
//
885
x.getVarIntAndVarFloat().clear();
886
887         y = new Holder<StructWithOccuringStruct>(yOriginal);
888         z = new Holder<StructWithOccuringStruct>();
889         if (testDocLiteral) {
890             ret = docClient.testStructWithOccuringStruct(x, y, z);
891         } else {
892             ret = rpcClient.testStructWithOccuringStruct(x, y, z);
893         }
894
895         if (!perfTestOnly) {
896             assertTrue("testStructWithOccuringStruct(): Incorrect value for inout param",
897                        equals(x, y.value));
898             assertTrue("testStructWithOccuringStruct(): Incorrect value for out param",
899                        equals(yOriginal, z.value));
900             assertTrue("testStructWithOccuringStruct(): Incorrect return value",
901                        equals(x, ret));
902             assertTrue("testStructWithOccuringStruct(): Incorrect form for inout param",
903                        isNormalized(y.value));
904             assertTrue("testStructWithOccuringStruct(): Incorrect return form",
905                        isNormalized(ret));
906         }
907     }
908
909     // org.objectweb.type_test.types1.AnonymousType;
910

911     protected boolean equals(AnonymousType x, AnonymousType y) {
912         return x.getFoo().getFoo().equals(y.getFoo().getFoo())
913             && x.getFoo().getBar().equals(y.getFoo().getBar());
914     }
915
916     public void testAnonymousType() throws Exception JavaDoc {
917         AnonymousType x = new AnonymousType();
918         AnonymousType.Foo fx = new AnonymousType.Foo();
919         fx.setFoo("hello");
920         fx.setBar("there");
921         x.setFoo(fx);
922
923         AnonymousType yOrig = new AnonymousType();
924         AnonymousType.Foo fy = new AnonymousType.Foo();
925         fy.setFoo("good");
926         fy.setBar("bye");
927         yOrig.setFoo(fy);
928
929         Holder<AnonymousType> y = new Holder<AnonymousType>(yOrig);
930         Holder<AnonymousType> z = new Holder<AnonymousType>();
931
932         AnonymousType ret;
933         if (testDocLiteral) {
934             ret = docClient.testAnonymousType(x, y, z);
935         } else {
936             ret = rpcClient.testAnonymousType(x, y, z);
937         }
938         if (!perfTestOnly) {
939             assertTrue("testAnonymousType(): Incorrect value for inout param",
940                        equals(x, y.value));
941             assertTrue("testAnonymousType(): Incorrect value for out param",
942                        equals(yOrig, z.value));
943             assertTrue("testAnonymousType(): Incorrect return value", equals(x, ret));
944         }
945     }
946
947     // org.objectweb.type_test.types1.RecSeqB6918;
948

949     protected boolean equals(RecSeqB6918 x, RecSeqB6918 y) {
950         List JavaDoc<Object JavaDoc> xList = x.getNextSeqAndVarInt();
951         List JavaDoc<Object JavaDoc> yList = y.getNextSeqAndVarInt();
952         int size = xList.size();
953         if (size != yList.size()) {
954             return false;
955         }
956         for (int i = 0; i < size; i++) {
957             Object JavaDoc xo = xList.get(i);
958             Object JavaDoc yo = yList.get(i);
959             if (xo instanceof Integer JavaDoc) {
960                 if (yo instanceof Integer JavaDoc) {
961                     if (((Integer JavaDoc)xo).compareTo((Integer JavaDoc)yo) != 0) {
962                         return false;
963                     }
964                 } else {
965                     return false;
966                 }
967             } else if (xo instanceof RecSeqB6918) {
968                 if (yo instanceof RecSeqB6918) {
969                     return equals((RecSeqB6918)xo, (RecSeqB6918)yo);
970                 } else {
971                     return false;
972                 }
973             }
974         }
975         return true;
976     }
977
978     public void testRecSeqB6918() throws Exception JavaDoc {
979         RecSeqB6918 x = new RecSeqB6918();
980         List JavaDoc<Object JavaDoc> theList = x.getNextSeqAndVarInt();
981         theList.add(new Integer JavaDoc(6));
982         theList.add(new RecSeqB6918());
983         theList.add(new Integer JavaDoc(42));
984         RecSeqB6918 yOrig = new RecSeqB6918();
985         theList = yOrig.getNextSeqAndVarInt();
986         theList.add(x);
987         theList.add(new Integer JavaDoc(2));
988         Holder<RecSeqB6918> y = new Holder<RecSeqB6918>(yOrig);
989         Holder<RecSeqB6918> z = new Holder<RecSeqB6918>();
990
991         RecSeqB6918 ret;
992         if (testDocLiteral) {
993             ret = docClient.testRecSeqB6918(x, y, z);
994         } else {
995             ret = rpcClient.testRecSeqB6918(x, y, z);
996         }
997         if (!perfTestOnly) {
998             assertTrue("testRecSeqB6918(): Incorrect value for inout param",
999                        equals(x, y.value));
1000            assertTrue("testRecSeqB6918(): Incorrect value for out param",
1001                       equals(yOrig, z.value));
1002            assertTrue("testRecSeqB6918(): Incorrect return value", equals(x, ret));
1003        }
1004    }
1005
1006    /* XXX - The DerivedChoiceBaseAll, DerivedStructBaseAll, DerivedAll* types
1007     * result in an error creating the Schema object:
1008     * cos-all-limited.1.2: An 'all' model group must appear in a particle with
1009     * {min occurs} = {max occurs} = 1, and that particle must be part of a
1010     * pair which constitutes the {content type} of a complex type definition.
1011     
1012    // org.objectweb.type_test.types1.ComplexArray
1013     
1014    protected boolean equals(ComplexArray x, ComplexArray y) {
1015        List<DerivedAllBaseStruct> xx = x.getVarDerivedItem();
1016        List<DerivedAllBaseStruct> yy = y.getVarDerivedItem();
1017        if (xx.size() != yy.size()) {
1018            return false;
1019        }
1020        for (int i = 0; i < xx.size(); i++) {
1021            if (!equals(xx.get(i), yy.get(i))) {
1022                return false;
1023            }
1024        }
1025        return true;
1026    }
1027
1028    public void testComplexArray() throws Exception {
1029        DerivedAllBaseStruct xx = new DerivedAllBaseStruct();
1030        //Base
1031        xx.setVarFloat(3.14f);
1032        xx.setVarInt(new BigInteger("42"));
1033        xx.setVarString("BaseStruct-x");
1034        xx.setVarAttrString("BaseStructAttr-x");
1035        //Derived
1036        xx.setVarFloatExt(-3.14f);
1037        xx.setVarStringExt("DerivedAll-x");
1038        xx.setAttrString("DerivedAttr-x");
1039
1040        DerivedAllBaseStruct yy = new DerivedAllBaseStruct();
1041        //Base
1042        yy.setVarFloat(-9.14f);
1043        yy.setVarInt(new BigInteger("10"));
1044        yy.setVarString("BaseStruct-y");
1045        yy.setVarAttrString("BaseStructAttr-y");
1046        //Derived
1047        yy.setVarFloatExt(1.414f);
1048        yy.setVarStringExt("DerivedAll-y");
1049        yy.setAttrString("DerivedAttr-y");
1050
1051        ComplexArray x = new ComplexArray();
1052        x.getVarDerivedItem().add(xx);
1053        x.getVarDerivedItem().add(yy);
1054
1055        ComplexArray yOrig = new ComplexArray();
1056        yOrig.getVarDerivedItem().add(yy);
1057
1058        Holder<ComplexArray> y = new Holder<ComplexArray>(yOrig);
1059        Holder<ComplexArray> z = new Holder<ComplexArray>();
1060        ComplexArray ret;
1061        if (testDocLiteral) {
1062            ret = docClient.testComplexArray(x, y, z);
1063        } else {
1064            ret = rpcClient.testComplexArray(x, y, z);
1065        }
1066
1067        if (!perfTestOnly) {
1068            assertTrue("testComplexArray(): Incorrect value for inout param",
1069                       equals(x, y.value));
1070            assertTrue("testComplexArray(): Incorrect value for out param",
1071                       equals(yOrig, z.value));
1072            assertTrue("testComplexArray(): Incorrect return value", equals(ret, x));
1073        }
1074    }
1075    
1076    // org.objectweb.type_test.types1.ComplexChoice
1077
1078    protected boolean equals(ComplexChoice x, ComplexChoice y) {
1079        DerivedChoiceBaseComplex xx = x.getVarDerivedStruct();
1080        DerivedChoiceBaseComplex yy = y.getVarDerivedStruct();
1081        return (xx != null && yy != null && equals(xx, yy))
1082            || (x.getVarFloat() != null && y.getVarFloat() != null
1083                && x.getVarFloat().compareTo(y.getVarFloat()) == 0);
1084    }
1085
1086    public void testComplexChoice() throws Exception {
1087        DerivedChoiceBaseComplex xx = new DerivedChoiceBaseComplex();
1088        //Base (Sequence)
1089        xx.setVarFloat(3.14f);
1090        xx.setVarInt(new BigInteger("42"));
1091        xx.setVarString("BaseSequence-x");
1092        xx.setVarAttrString("BaseStructAttr-x");
1093        //Derived (All)
1094        xx.setVarFloatExt(-3.14f);
1095        xx.setVarStringExt("DerivedAll-x");
1096        xx.setAttrString("DerivedAttr-x");
1097        //Most Derived (Choice)
1098        xx.setVarStringExtExt("MostDerivedChoice-x");
1099        xx.setAttrStringExtExt("MostDerivedAttr-x");
1100
1101        ComplexChoice x = new ComplexChoice();
1102        x.setVarDerivedStruct(xx);
1103
1104        ComplexChoice yOrig = new ComplexChoice();
1105        yOrig.setVarFloat(10.14f);
1106
1107        Holder<ComplexChoice> y = new Holder<ComplexChoice>(yOrig);
1108        Holder<ComplexChoice> z = new Holder<ComplexChoice>();
1109        ComplexChoice ret;
1110        if (testDocLiteral) {
1111            ret = docClient.testComplexChoice(x, y, z);
1112        } else {
1113            ret = rpcClient.testComplexChoice(x, y, z);
1114        }
1115
1116        if (!perfTestOnly) {
1117            assertTrue("testComplexChoice(): Incorrect value for inout param",
1118                       equals(x, y.value));
1119            assertTrue("testComplexChoice(): Incorrect value for out param",
1120                       equals(yOrig, z.value));
1121            assertTrue("testComplexChoice(): Incorrect return value", equals(ret, x));
1122        }
1123    }
1124
1125    // org.objectweb.type_test.types1.ComplexStruct
1126
1127    protected boolean equals(ComplexStruct x, ComplexStruct y) {
1128        return equals(x.getVarDerivedStruct(), y.getVarDerivedStruct())
1129            && Float.compare(x.getVarFloat(), y.getVarFloat()) == 0;
1130    }
1131
1132    public void testComplexStruct() throws Exception {
1133        DerivedChoiceBaseComplex xx = new DerivedChoiceBaseComplex();
1134        //Base (Sequence)
1135        xx.setVarFloat(3.14f);
1136        xx.setVarInt(new BigInteger("42"));
1137        xx.setVarString("BaseSequence-x");
1138        xx.setVarAttrString("BaseStructAttr-x");
1139        //Derived (All)
1140        xx.setVarFloatExt(-3.14f);
1141        xx.setVarStringExt("DerivedAll-x");
1142        xx.setAttrString("DerivedAttr-x");
1143        //Most Derived (Choice)
1144        xx.setVarStringExtExt("MostDerivedChoice-x");
1145        xx.setAttrStringExtExt("MostDerivedAttr-x");
1146
1147        ComplexStruct x = new ComplexStruct();
1148        x.setVarFloat(30.14f);
1149        x.setVarDerivedStruct(xx);
1150
1151        DerivedChoiceBaseComplex yy = new DerivedChoiceBaseComplex();
1152        //Base
1153        yy.setVarFloat(-9.14f);
1154        yy.setVarInt(new BigInteger("10"));
1155        yy.setVarString("BaseSequence-y");
1156        yy.setVarAttrString("BaseStructAttr-y");
1157        //Derived
1158        yy.setVarFloatExt(1.414f);
1159        yy.setVarStringExt("DerivedAll-y");
1160        yy.setAttrString("DerivedAttr-y");
1161        //Most Derived
1162        yy.setVarFloatExtExt(19.144f);
1163        yy.setAttrStringExtExt("MostDerivedAttr-y");
1164
1165        ComplexStruct yOrig = new ComplexStruct();
1166        yOrig.setVarFloat(10.14f);
1167        yOrig.setVarDerivedStruct(yy);
1168
1169        Holder<ComplexStruct> y = new Holder<ComplexStruct>(yOrig);
1170        Holder<ComplexStruct> z = new Holder<ComplexStruct>();
1171        ComplexStruct ret;
1172        if (testDocLiteral) {
1173            ret = docClient.testComplexStruct(x, y, z);
1174        } else {
1175            ret = rpcClient.testComplexStruct(x, y, z);
1176        }
1177
1178        if (!perfTestOnly) {
1179            assertTrue("testComplexStruct(): Incorrect value for inout param",
1180                       equals(x, y.value));
1181            assertTrue("testComplexStruct(): Incorrect value for out param",
1182                       equals(yOrig, z.value));
1183            assertTrue("testComplexStruct(): Incorrect return value", equals(ret, x));
1184        }
1185    }
1186    
1187    // org.objectweb.type_test.types1.DerivedChoiceBaseComplex
1188
1189    protected boolean equals(DerivedChoiceBaseComplex x, DerivedChoiceBaseComplex y) {
1190        return equals((DerivedAllBaseStruct)x, (DerivedAllBaseStruct)y)
1191            && ((x.getVarStringExtExt() != null && y.getVarStringExtExt() != null
1192                 && x.getVarStringExtExt().equals(y.getVarStringExtExt()))
1193            || (x.getVarFloatExtExt() != null && y.getVarFloatExtExt() != null
1194                 && x.getVarFloatExtExt().compareTo(y.getVarFloatExtExt()) == 0));
1195    }
1196
1197    public void testDerivedChoiceBaseComplex() throws Exception {
1198        DerivedChoiceBaseComplex x = new DerivedChoiceBaseComplex();
1199        //Base (Sequence)
1200        x.setVarFloat(3.14f);
1201        x.setVarInt(new BigInteger("42"));
1202        x.setVarString("BaseSequence-x");
1203        x.setVarAttrString("BaseStructAttr-x");
1204        //Derived (All)
1205        x.setVarFloatExt(-3.14f);
1206        x.setVarStringExt("DerivedAll-x");
1207        x.setAttrString("DerivedAttr-x");
1208        //Most Derived (Choice)
1209        x.setVarStringExtExt("MostDerivedChoice-x");
1210        x.setAttrStringExtExt("MostDerivedAttr-x");
1211
1212        DerivedChoiceBaseComplex yOrig = new DerivedChoiceBaseComplex();
1213        //Base
1214        yOrig.setVarFloat(-9.14f);
1215        yOrig.setVarInt(new BigInteger("10"));
1216        yOrig.setVarString("BaseSequence-y");
1217        yOrig.setVarAttrString("BaseStructAttr-y");
1218        //Derived
1219        yOrig.setVarFloatExt(1.414f);
1220        yOrig.setVarStringExt("DerivedAll-y");
1221        yOrig.setAttrString("DerivedAttr-y");
1222        //Most Derived
1223        yOrig.setVarFloatExtExt(19.144f);
1224        yOrig.setAttrStringExtExt("MostDerivedAttr-y");
1225
1226        Holder<DerivedChoiceBaseComplex> y = new Holder<DerivedChoiceBaseComplex>(yOrig);
1227        Holder<DerivedChoiceBaseComplex> z = new Holder<DerivedChoiceBaseComplex>();
1228        DerivedChoiceBaseComplex ret;
1229        if (testDocLiteral) {
1230            ret = docClient.testDerivedChoiceBaseComplex(x, y, z);
1231        } else {
1232            ret = rpcClient.testDerivedChoiceBaseComplex(x, y, z);
1233        }
1234
1235        if (!perfTestOnly) {
1236            assertTrue("testDerivedChoiceBaseComplex(): Incorrect value for inout param",
1237                       equals(x, y.value));
1238            assertTrue("testDerivedChoiceBaseComplex(): Incorrect value for out param",
1239                       equals(yOrig, z.value));
1240            assertTrue("testDerivedChoiceBaseComplex(): Incorrect return value", equals(x, ret));
1241        }
1242    }
1243    
1244    // org.objectweb.type_test.types1.DerivedAllBaseAll
1245
1246    protected boolean equals(DerivedAllBaseAll x, DerivedAllBaseAll y) {
1247        return equals((SimpleAll)x, (SimpleAll)y)
1248            && (Float.compare(x.getVarFloatExt(), y.getVarFloatExt()) == 0)
1249            && (x.getVarStringExt().equals(y.getVarStringExt()))
1250            && (x.getAttrString().equals(y.getAttrString()));
1251    }
1252
1253    public void testDerivedAllBaseAll() throws Exception {
1254        DerivedAllBaseAll x = new DerivedAllBaseAll();
1255        //Base
1256        x.setVarFloat(3.14f);
1257        x.setVarInt(42);
1258        x.setVarString("BaseAll-x");
1259        x.setVarAttrString("BaseAllAttr-x");
1260        //Derived
1261        x.setVarFloatExt(-3.14f);
1262        x.setVarStringExt("DerivedAll-x");
1263        x.setAttrString("DerivedAttr-x");
1264
1265        DerivedAllBaseAll yOrig = new DerivedAllBaseAll();
1266        //Base
1267        yOrig.setVarFloat(-9.14f);
1268        yOrig.setVarInt(10);
1269        yOrig.setVarString("BaseAll-y");
1270        yOrig.setVarAttrString("BaseAllAttr-y");
1271        //Derived
1272        yOrig.setVarFloatExt(1.414f);
1273        yOrig.setVarStringExt("DerivedAll-y");
1274        yOrig.setAttrString("DerivedAttr-y");
1275
1276        Holder<DerivedAllBaseAll> y = new Holder<DerivedAllBaseAll>(yOrig);
1277        Holder<DerivedAllBaseAll> z = new Holder<DerivedAllBaseAll>();
1278
1279        DerivedAllBaseAll ret;
1280        if (testDocLiteral) {
1281            ret = docClient.testDerivedAllBaseAll(x, y, z);
1282        } else {
1283            ret = rpcClient.testDerivedAllBaseAll(x, y, z);
1284        }
1285        if (!perfTestOnly) {
1286            assertTrue("testDerivedAllBaseAll(): Incorrect value for inout param",
1287                       equals(x, y.value));
1288            assertTrue("testDerivedAllBaseAll(): Incorrect value for out param",
1289                       equals(yOrig, z.value));
1290            assertTrue("testDerivedAllBaseAll(): Incorrect return value", equals(x, ret));
1291        }
1292    }
1293    
1294    // org.objectweb.type_test.types1.DerivedAllBaseChoice
1295
1296    protected boolean equals(DerivedAllBaseChoice x, DerivedAllBaseChoice y) {
1297        return equals((SimpleChoice)x, (SimpleChoice)y)
1298            && Float.compare(x.getVarFloatExt(), y.getVarFloatExt()) == 0
1299            && x.getVarStringExt().equals(y.getVarStringExt())
1300            && x.getAttrString().equals(y.getAttrString());
1301    }
1302
1303    public void testDerivedAllBaseChoice() throws Exception {
1304        DerivedAllBaseChoice x = new DerivedAllBaseChoice();
1305        //Base
1306        x.setVarString("BaseChoice-x");
1307        //Derived
1308        x.setVarFloatExt(-3.14f);
1309        x.setVarStringExt("DerivedAll-x");
1310        x.setAttrString("DerivedAttr-x");
1311
1312        DerivedAllBaseChoice yOrig = new DerivedAllBaseChoice();
1313        //Base
1314        yOrig.setVarFloat(-9.14f);
1315        //Derived
1316        yOrig.setVarFloatExt(1.414f);
1317        yOrig.setVarStringExt("DerivedAll-y");
1318        yOrig.setAttrString("DerivedAttr-y");
1319
1320        Holder<DerivedAllBaseChoice> y = new Holder<DerivedAllBaseChoice>(yOrig);
1321        Holder<DerivedAllBaseChoice> z = new Holder<DerivedAllBaseChoice>();
1322
1323        DerivedAllBaseChoice ret;
1324        if (testDocLiteral) {
1325            ret = docClient.testDerivedAllBaseChoice(x, y, z);
1326        } else {
1327            ret = rpcClient.testDerivedAllBaseChoice(x, y, z);
1328        }
1329        if (!perfTestOnly) {
1330            assertTrue("testDerivedAllBaseChoice(): Incorrect value for inout param",
1331                       equals(x, y.value));
1332            assertTrue("testDerivedAllBaseChoice(): Incorrect value for out param",
1333                       equals(yOrig, z.value));
1334            assertTrue("testDerivedAllBaseChoice(): Incorrect return value", equals(x, ret));
1335        }
1336    }
1337    
1338    // org.objectweb.type_test.types1.DerivedAllBaseStruct
1339
1340    protected boolean equals(DerivedAllBaseStruct x, DerivedAllBaseStruct y) {
1341        return equals((SimpleStruct)x, (SimpleStruct)y)
1342            && (x.getVarFloatExt() == y.getVarFloatExt())
1343            && (x.getVarStringExt().equals(y.getVarStringExt()))
1344            && (x.getAttrString().equals(y.getAttrString()));
1345    }
1346
1347    public void testDerivedAllBaseStruct() throws Exception {
1348        DerivedAllBaseStruct x = new DerivedAllBaseStruct();
1349        //Base
1350        x.setVarFloat(3.14f);
1351        x.setVarInt(new BigInteger("42"));
1352        x.setVarString("BaseStruct-x");
1353        x.setVarAttrString("BaseStructAttr-x");
1354        //Derived
1355        x.setVarFloatExt(-3.14f);
1356        x.setVarStringExt("DerivedAll-x");
1357        x.setAttrString("DerivedAttr-x");
1358
1359        DerivedAllBaseStruct yOrig = new DerivedAllBaseStruct();
1360        //Base
1361        yOrig.setVarFloat(-9.14f);
1362        yOrig.setVarInt(new BigInteger("10"));
1363        yOrig.setVarString("BaseStruct-y");
1364        yOrig.setVarAttrString("BaseStructAttr-y");
1365        //Derived
1366        yOrig.setVarFloatExt(1.414f);
1367        yOrig.setVarStringExt("DerivedAll-y");
1368        yOrig.setAttrString("DerivedAttr-y");
1369
1370        Holder<DerivedAllBaseStruct> y = new Holder<DerivedAllBaseStruct>(yOrig);
1371        Holder<DerivedAllBaseStruct> z = new Holder<DerivedAllBaseStruct>();
1372
1373        DerivedAllBaseStruct ret;
1374        if (testDocLiteral) {
1375            ret = docClient.testDerivedAllBaseStruct(x, y, z);
1376        } else {
1377            ret = rpcClient.testDerivedAllBaseStruct(x, y, z);
1378        }
1379        if (!perfTestOnly) {
1380            assertTrue("testDerivedAllBaseStruct(): Incorrect value for inout param",
1381                       equals(x, y.value));
1382            assertTrue("testDerivedAllBaseStruct(): Incorrect value for out param",
1383                       equals(yOrig, z.value));
1384            assertTrue("testDerivedAllBaseStruct(): Incorrect return value",
1385                       equals(x, ret));
1386        }
1387    }
1388     
1389    // org.objectweb.type_test.types1.DerivedChoiceBaseAll
1390
1391    protected boolean equals(DerivedChoiceBaseAll x, DerivedChoiceBaseAll y) {
1392        if (x.getVarStringExt() != null && y.getVarStringExt() != null
1393            && !x.getVarStringExt().equals(y.getVarStringExt())) {
1394            return false;
1395        } else if (x.getVarFloatExt() != null && y.getVarFloatExt() != null
1396            && x.getVarFloatExt().compareTo(y.getVarFloatExt()) != 0) {
1397            return false;
1398        }
1399        return equals((SimpleAll)x, (SimpleAll)y)
1400            && x.getAttrString().equals(y.getAttrString());
1401    }
1402
1403    public void testDerivedChoiceBaseAll() throws Exception {
1404        DerivedChoiceBaseAll x = new DerivedChoiceBaseAll();
1405        //Base
1406        x.setVarFloat(3.14f);
1407        x.setVarInt(42);
1408        x.setVarString("BaseAll-x");
1409        x.setVarAttrString("BaseAllAttr-x");
1410        //Derived
1411        x.setVarStringExt("DerivedChoice-x");
1412        x.setAttrString("DerivedAttr-x");
1413
1414        DerivedChoiceBaseAll yOrig = new DerivedChoiceBaseAll();
1415        //Base
1416        yOrig.setVarFloat(-9.14f);
1417        yOrig.setVarInt(10);
1418        yOrig.setVarString("BaseAll-y");
1419        yOrig.setVarAttrString("BaseAllAttr-y");
1420        //Derived
1421        yOrig.setVarFloatExt(1.414f);
1422        yOrig.setAttrString("DerivedAttr-y");
1423
1424        Holder<DerivedChoiceBaseAll> y = new Holder<DerivedChoiceBaseAll>(yOrig);
1425        Holder<DerivedChoiceBaseAll> z = new Holder<DerivedChoiceBaseAll>();
1426
1427        DerivedChoiceBaseAll ret;
1428        if (testDocLiteral) {
1429            ret = docClient.testDerivedChoiceBaseAll(x, y, z);
1430        } else {
1431            ret = rpcClient.testDerivedChoiceBaseAll(x, y, z);
1432        }
1433        if (!perfTestOnly) {
1434            assertTrue("testDerivedChoiceBaseAll(): Incorrect value for inout param",
1435                       equals(x, y.value));
1436            assertTrue("testDerivedChoiceBaseAll(): Incorrect value for out param",
1437                       equals(yOrig, z.value));
1438            assertTrue("testDerivedChoiceBaseAll(): Incorrect return value", equals(x, ret));
1439        }
1440    }
1441    
1442    // org.objectweb.type_test.types1.DerivedStructBaseAll
1443
1444    protected boolean equals(DerivedStructBaseAll x, DerivedStructBaseAll y) {
1445        return equals((SimpleAll)x, (SimpleAll)y)
1446            && (Float.compare(x.getVarFloatExt(), y.getVarFloatExt()) == 0)
1447            && (x.getVarStringExt().equals(y.getVarStringExt()))
1448            && (x.getAttrString().equals(y.getAttrString()));
1449    }
1450
1451    public void testDerivedStructBaseAll() throws Exception {
1452        DerivedStructBaseAll x = new DerivedStructBaseAll();
1453        //Base
1454        x.setVarFloat(3.14f);
1455        x.setVarInt(42);
1456        x.setVarString("BaseAll-x");
1457        x.setVarAttrString("BaseAllAttr-x");
1458        //Derived
1459        x.setVarFloatExt(-3.14f);
1460        x.setVarStringExt("DerivedStruct-x");
1461        x.setAttrString("DerivedAttr-x");
1462
1463        DerivedStructBaseAll yOrig = new DerivedStructBaseAll();
1464        //Base
1465        yOrig.setVarFloat(-9.14f);
1466        yOrig.setVarInt(10);
1467        yOrig.setVarString("BaseAll-y");
1468        yOrig.setVarAttrString("BaseAllAttr-y");
1469        //Derived
1470        yOrig.setVarFloatExt(1.414f);
1471        yOrig.setVarStringExt("DerivedStruct-y");
1472        yOrig.setAttrString("DerivedAttr-y");
1473
1474        Holder<DerivedStructBaseAll> y = new Holder<DerivedStructBaseAll>(yOrig);
1475        Holder<DerivedStructBaseAll> z = new Holder<DerivedStructBaseAll>();
1476
1477        DerivedStructBaseAll ret;
1478        if (testDocLiteral) {
1479            ret = docClient.testDerivedStructBaseAll(x, y, z);
1480        } else {
1481            ret = rpcClient.testDerivedStructBaseAll(x, y, z);
1482        }
1483        if (!perfTestOnly) {
1484            assertTrue("testDerivedStructBaseAll(): Incorrect value for inout param",
1485                       equals(x, y.value));
1486            assertTrue("testDerivedStructBaseAll(): Incorrect value for out param",
1487                       equals(yOrig, z.value));
1488            assertTrue("testDerivedStructBaseAll(): Incorrect return value", equals(x, ret));
1489        }
1490    }
1491
1492    // org.objectweb.type_test.types1.DerivedChoiceBaseSimpleContent
1493
1494    protected void equals(String msg, DerivedChoiceBaseSimpleContent x,
1495            DerivedChoiceBaseSimpleContent y) throws Exception {
1496        equals(msg, (Document)x, (Document)y);
1497        assertEquals(msg, x.getAttrStringExt(), y.getAttrStringExt());
1498        if (x.getVarStringExt() != null) {
1499            assertNotNull(msg, y.getVarStringExt());
1500            assertEquals(msg, x.getVarStringExt(), y.getVarStringExt());
1501            assertTrue(msg, x.getVarFloatExt() == y.getVarFloatExt());
1502        }
1503    }
1504
1505    public void testDerivedChoiceBaseSimpleContent() throws Exception {
1506        DerivedChoiceBaseSimpleContent x = new DerivedChoiceBaseSimpleContent();
1507        //Base
1508        x.setID("Base-x");
1509        x.setValue("BART");
1510        //Derived
1511        x.setVarStringExt("DerivedChoice-x");
1512        x.setAttrStringExt("DerivedAttr-x");
1513
1514        DerivedChoiceBaseSimpleContent yOrig = new DerivedChoiceBaseSimpleContent();
1515        //Base
1516        yOrig.setID("Base-y");
1517        yOrig.setValue("LISA");
1518        //Derived
1519        yOrig.setVarFloatExt(1.414f);
1520        yOrig.setAttrStringExt("DerivedAttr-y");
1521
1522        Holder<DerivedChoiceBaseSimpleContent> y = new Holder<DerivedChoiceBaseSimpleContent>(yOrig);
1523        Holder<DerivedChoiceBaseSimpleContent> z = new Holder<DerivedChoiceBaseSimpleContent>();
1524
1525        DerivedChoiceBaseSimpleContent ret;
1526        if (testDocLiteral) {
1527            ret = docClient.testDerivedChoiceBaseSimpleContent(x, y, z);
1528        } else {
1529            ret = rpcClient.testDerivedChoiceBaseSimpleContent(x, y, z);
1530        }
1531        if (!perfTestOnly) {
1532            equals("testDerivedChoiceBaseSimpleContent(): Incorrect value for inout param", x, y.value);
1533            equals("testDerivedChoiceBaseSimpleContent(): Incorrect value for out param", yOrig, z.value);
1534            equals("testDerivedChoiceBaseSimpleContent(): Incorrect return value", x, ret);
1535        }
1536    }
1537    */

1538
1539    // org.objectweb.type_test.types1.RestrictedStructBaseStruct;
1540

1541    protected boolean equals(RestrictedStructBaseStruct x, RestrictedStructBaseStruct y) {
1542        return (x.getVarFloat() == y.getVarFloat())
1543            && (x.getVarInt().equals(y.getVarInt()))
1544            && (x.getVarAttrString().equals(y.getVarAttrString()));
1545    }
1546
1547    public void testRestrictedStructBaseStruct() throws Exception JavaDoc {
1548        RestrictedStructBaseStruct x = new RestrictedStructBaseStruct();
1549        x.setVarFloat(3.14f);
1550        x.setVarInt(new BigInteger JavaDoc("42"));
1551        x.setVarAttrString("BaseStructAttr-x");
1552        RestrictedStructBaseStruct yOrig = new RestrictedStructBaseStruct();
1553        yOrig.setVarFloat(-9.14f);
1554        yOrig.setVarInt(new BigInteger JavaDoc("10"));
1555        yOrig.setVarAttrString("BaseStructAttr-y");
1556
1557        Holder<RestrictedStructBaseStruct> y = new Holder<RestrictedStructBaseStruct>(yOrig);
1558        Holder<RestrictedStructBaseStruct> z = new Holder<RestrictedStructBaseStruct>();
1559
1560        RestrictedStructBaseStruct ret;
1561        if (testDocLiteral) {
1562            ret = docClient.testRestrictedStructBaseStruct(x, y, z);
1563        } else {
1564            ret = rpcClient.testRestrictedStructBaseStruct(x, y, z);
1565        }
1566        if (!perfTestOnly) {
1567            assertTrue("testRestrictedStructBaseStruct(): Incorrect value for inout param",
1568                       equals(x, y.value));
1569            assertTrue("testRestrictedStructBaseStruct(): Incorrect value for out param",
1570                       equals(yOrig, z.value));
1571            assertTrue("testRestrictedStructBaseStruct(): Incorrect return value", equals(x, ret));
1572        }
1573    }
1574    
1575    // org.objectweb.type_test.types1.RestrictedAllBaseAll;
1576

1577    protected boolean equals(RestrictedAllBaseAll x, RestrictedAllBaseAll y) {
1578        return (x.getVarFloat() == y.getVarFloat())
1579            && (x.getVarInt() == y.getVarInt())
1580            && (x.getVarAttrString().equals(y.getVarAttrString()));
1581    }
1582
1583    public void testRestrictedAllBaseAll() throws Exception JavaDoc {
1584        RestrictedAllBaseAll x = new RestrictedAllBaseAll();
1585        x.setVarFloat(3.14f);
1586        x.setVarInt(42);
1587        x.setVarAttrString("BaseAllAttr-x");
1588        RestrictedAllBaseAll yOrig = new RestrictedAllBaseAll();
1589        yOrig.setVarFloat(-9.14f);
1590        yOrig.setVarInt(10);
1591        yOrig.setVarAttrString("BaseAllAttr-y");
1592
1593        Holder<RestrictedAllBaseAll> y = new Holder<RestrictedAllBaseAll>(yOrig);
1594        Holder<RestrictedAllBaseAll> z = new Holder<RestrictedAllBaseAll>();
1595
1596        RestrictedAllBaseAll ret;
1597        if (testDocLiteral) {
1598            ret = docClient.testRestrictedAllBaseAll(x, y, z);
1599        } else {
1600            ret = rpcClient.testRestrictedAllBaseAll(x, y, z);
1601        }
1602        if (!perfTestOnly) {
1603            assertTrue("testRestrictedAllBaseAll(): Incorrect value for inout param",
1604                       equals(x, y.value));
1605            assertTrue("testRestrictedAllBaseAll(): Incorrect value for out param",
1606                       equals(yOrig, z.value));
1607            assertTrue("testRestrictedAllBaseAll(): Incorrect return value", equals(x, ret));
1608        }
1609    }
1610
1611    // org.objectweb.type_test.types1.UnionWithStringList;
1612

1613    public void testUnionWithStringList() throws Exception JavaDoc {
1614        if (testDocLiteral) {
1615            List JavaDoc<String JavaDoc> x = Arrays.asList("5");
1616            List JavaDoc<String JavaDoc> yOrig = Arrays.asList("I", "am", "SimpleList");
1617
1618            // Invoke testUnionWithStringList
1619
Holder<List JavaDoc<String JavaDoc>> y = new Holder<List JavaDoc<String JavaDoc>>(yOrig);
1620            Holder<List JavaDoc<String JavaDoc>> z = new Holder<List JavaDoc<String JavaDoc>>();
1621            List JavaDoc<String JavaDoc> ret = docClient.testUnionWithStringList(x, y, z);
1622            if (!perfTestOnly) {
1623                assertEquals("testUnionWithStringList(): Incorrect value for inout param",
1624                             x, y.value);
1625                assertEquals("testUnionWithStringList(): Incorrect value for out param",
1626                             yOrig, z.value);
1627                assertEquals("testUnionWithStringList(): Incorrect return value", x, ret);
1628            }
1629        } else {
1630            String JavaDoc[] x = {"5"};
1631            String JavaDoc[] yOrig = {"I", "am", "SimpleList"};
1632
1633            Holder<String JavaDoc[]> y = new Holder<String JavaDoc[]>(yOrig);
1634            Holder<String JavaDoc[]> z = new Holder<String JavaDoc[]>();
1635
1636            String JavaDoc[] ret = rpcClient.testUnionWithStringList(x, y, z);
1637            if (!perfTestOnly) {
1638                assertTrue("testUnionWithStringList(): Incorrect value for inout param",
1639                           Arrays.equals(x, y.value));
1640                assertTrue("testUnionWithStringList(): Incorrect value for out param",
1641                           Arrays.equals(yOrig, z.value));
1642                assertTrue("testUnionWithStringList(): Incorrect return value",
1643                           Arrays.equals(x, ret));
1644            }
1645        }
1646    }
1647
1648    // org.objectweb.type_test.types1.UnionWithStringListRestriction;
1649

1650    public void testUnionWithStringListRestriction() throws Exception JavaDoc {
1651        if (testDocLiteral) {
1652            List JavaDoc<String JavaDoc> x = Arrays.asList("5");
1653            List JavaDoc<String JavaDoc> yOrig = Arrays.asList("I", "am", "SimpleList");
1654
1655            // Invoke testUnionWithStringListRestriction
1656
Holder<List JavaDoc<String JavaDoc>> y = new Holder<List JavaDoc<String JavaDoc>>(yOrig);
1657            Holder<List JavaDoc<String JavaDoc>> z = new Holder<List JavaDoc<String JavaDoc>>();
1658            List JavaDoc<String JavaDoc> ret = docClient.testUnionWithStringListRestriction(x, y, z);
1659            if (!perfTestOnly) {
1660                assertEquals("testUnionWithStringListRestriction(): Incorrect value for inout param",
1661                             x, y.value);
1662                assertEquals("testUnionWithStringListRestriction(): Incorrect value for out param",
1663                             yOrig, z.value);
1664                assertEquals("testUnionWithStringListRestriction(): Incorrect return value", x, ret);
1665            }
1666        } else {
1667            String JavaDoc[] x = {"5"};
1668            String JavaDoc[] yOrig = {"I", "am", "SimpleList"};
1669
1670            Holder<String JavaDoc[]> y = new Holder<String JavaDoc[]>(yOrig);
1671            Holder<String JavaDoc[]> z = new Holder<String JavaDoc[]>();
1672
1673            String JavaDoc[] ret = rpcClient.testUnionWithStringListRestriction(x, y, z);
1674            if (!perfTestOnly) {
1675                assertTrue("testUnionWithStringListRestriction(): Incorrect value for inout param",
1676                           Arrays.equals(x, y.value));
1677                assertTrue("testUnionWithStringListRestriction(): Incorrect value for out param",
1678                           Arrays.equals(yOrig, z.value));
1679                assertTrue("testUnionWithStringListRestriction(): Incorrect return value",
1680                           Arrays.equals(x, ret));
1681            }
1682        }
1683    }
1684
1685    // org.objectweb.type_test.types1.UnionWithAnonList;
1686

1687    public void testUnionWithAnonList() throws Exception JavaDoc {
1688        if (testDocLiteral) {
1689            List JavaDoc<String JavaDoc> x = Arrays.asList("5");
1690            List JavaDoc<String JavaDoc> yOrig = Arrays.asList("0.5f", "1.5f", "2.5f");
1691
1692            // Invoke testUnionWithAnonList
1693
Holder<List JavaDoc<String JavaDoc>> y = new Holder<List JavaDoc<String JavaDoc>>(yOrig);
1694            Holder<List JavaDoc<String JavaDoc>> z = new Holder<List JavaDoc<String JavaDoc>>();
1695            List JavaDoc<String JavaDoc> ret = docClient.testUnionWithAnonList(x, y, z);
1696            if (!perfTestOnly) {
1697                assertEquals("testUnionWithAnonList(): Incorrect value for inout param", x, y.value);
1698                assertEquals("testUnionWithAnonList(): Incorrect value for out param", yOrig, z.value);
1699                assertEquals("testUnionWithAnonList(): Incorrect return value", x, ret);
1700            }
1701        } else {
1702            String JavaDoc[] x = {"5"};
1703            String JavaDoc[] yOrig = {"0.5f", "1.5f", "2.5f"};
1704
1705            Holder<String JavaDoc[]> y = new Holder<String JavaDoc[]>(yOrig);
1706            Holder<String JavaDoc[]> z = new Holder<String JavaDoc[]>();
1707
1708            String JavaDoc[] ret = rpcClient.testUnionWithStringListRestriction(x, y, z);
1709            if (!perfTestOnly) {
1710                assertTrue("testUnionWithAnonList(): Incorrect value for inout param",
1711                           Arrays.equals(x, y.value));
1712                assertTrue("testUnionWithAnonList(): Incorrect value for out param",
1713                           Arrays.equals(yOrig, z.value));
1714                assertTrue("testUnionWithAnonList(): Incorrect return value",
1715                           Arrays.equals(x, ret));
1716            }
1717        }
1718    }
1719
1720    public void testAnyURIRestriction() throws Exception JavaDoc {
1721        // normal case, maxLength = 50 for anyURI
1722
String JavaDoc x = new String JavaDoc("http://celtix.objectweb.org/");
1723        String JavaDoc yOrig = new String JavaDoc("http://www.iona.com/info/services/oss/");
1724        Holder<String JavaDoc> y = new Holder<String JavaDoc>(yOrig);
1725        Holder<String JavaDoc> z = new Holder<String JavaDoc>();
1726
1727        String JavaDoc ret;
1728        if (testDocLiteral) {
1729            ret = docClient.testAnyURIRestriction(x, y, z);
1730        } else {
1731            ret = rpcClient.testAnyURIRestriction(x, y, z);
1732        }
1733        if (!perfTestOnly) {
1734            assertEquals("testString(): Incorrect value for inout param", x, y.value);
1735            assertEquals("testString(): Incorrect value for out param", yOrig, z.value);
1736            assertEquals("testString(): Incorrect return value", x, ret);
1737        }
1738
1739        if (testDocLiteral) {
1740            // abnormal case
1741
yOrig = new String JavaDoc("http://www.iona.com/info/services/oss/info_services_oss_train.html");
1742            y = new Holder<String JavaDoc>(yOrig);
1743            z = new Holder<String JavaDoc>();
1744            try {
1745                ret = docClient.testAnyURIRestriction(x, y, z);
1746                fail("maxLength=50 restriction is violated.");
1747            } catch (Exception JavaDoc ex) {
1748                //ex.printStackTrace();
1749
}
1750        }
1751    }
1752
1753    // Test Inheritance
1754

1755    // test internal inheritance
1756
public void testInheritanceNestedStruct() throws Exception JavaDoc {
1757        DerivedStructBaseStruct xs = new DerivedStructBaseStruct();
1758        //Base
1759
xs.setVarFloat(3.14f);
1760        xs.setVarInt(new BigInteger JavaDoc("42"));
1761        xs.setVarString("BaseStruct-x");
1762        xs.setVarAttrString("BaseStructAttr-x");
1763        //Derived
1764
xs.setVarFloatExt(-3.14f);
1765        xs.setVarStringExt("DerivedStruct-x");
1766        xs.setAttrString1("DerivedAttr1-x");
1767        xs.setAttrString2("DerivedAttr2-x");
1768
1769        DerivedStructBaseStruct ys = new DerivedStructBaseStruct();
1770        //Base
1771
ys.setVarFloat(-9.14f);
1772        ys.setVarInt(new BigInteger JavaDoc("10"));
1773        ys.setVarString("BaseStruct-y");
1774        ys.setVarAttrString("BaseStructAttr-y");
1775        //Derived
1776
ys.setVarFloatExt(1.414f);
1777        ys.setVarStringExt("DerivedStruct-y");
1778        ys.setAttrString1("DerivedAttr1-y");
1779        ys.setAttrString2("DerivedAttr2-y");
1780
1781        NestedStruct x = new NestedStruct();
1782        x.setVarFloat(new BigDecimal JavaDoc("3.14"));
1783        x.setVarInt(42);
1784        x.setVarString("Hello There");
1785        x.setVarEmptyStruct(new EmptyStruct());
1786        x.setVarStruct(xs);
1787
1788        NestedStruct yOrig = new NestedStruct();
1789        yOrig.setVarFloat(new BigDecimal JavaDoc("1.414"));
1790        yOrig.setVarInt(13);
1791        yOrig.setVarString("Cheerio");
1792        yOrig.setVarEmptyStruct(new EmptyStruct());
1793        yOrig.setVarStruct(ys);
1794        Holder<NestedStruct> y = new Holder<NestedStruct>(yOrig);
1795        Holder<NestedStruct> z = new Holder<NestedStruct>();
1796
1797        NestedStruct ret;
1798        if (testDocLiteral) {
1799            ret = docClient.testNestedStruct(x, y, z);
1800        } else {
1801            ret = rpcClient.testNestedStruct(x, y, z);
1802        }
1803        if (!perfTestOnly) {
1804            assertTrue("testNestedStruct(): Incorrect value for inout param",
1805                       equals(x, y.value));
1806            assertTrue("testNestedStruct(): Incorrect value for out param",
1807                       equals(yOrig, z.value));
1808            assertTrue("testNestedStruct(): Incorrect return value", equals(x, ret));
1809        }
1810    }
1811
1812    // test first level inheritance (parameters)
1813
public void testInheritanceSimpleStructDerivedStruct() throws Exception JavaDoc {
1814        DerivedStructBaseStruct x = new DerivedStructBaseStruct();
1815        //Base
1816
x.setVarFloat(3.14f);
1817        x.setVarInt(new BigInteger JavaDoc("42"));
1818        x.setVarString("BaseStruct-x");
1819        x.setVarAttrString("BaseStructAttr-x");
1820        //Derived
1821
x.setVarFloatExt(-3.14f);
1822        x.setVarStringExt("DerivedStruct-x");
1823        x.setAttrString1("DerivedAttr1-x");
1824        x.setAttrString2("DerivedAttr2-x");
1825
1826        DerivedStructBaseStruct yOrig = new DerivedStructBaseStruct();
1827        //Base
1828
yOrig.setVarFloat(-9.14f);
1829        yOrig.setVarInt(new BigInteger JavaDoc("10"));
1830        yOrig.setVarString("BaseStruct-y");
1831        yOrig.setVarAttrString("BaseStructAttr-y");
1832        //Derived
1833
yOrig.setVarFloatExt(1.414f);
1834        yOrig.setVarStringExt("DerivedStruct-y");
1835        yOrig.setAttrString1("DerivedAttr1-y");
1836        yOrig.setAttrString2("DerivedAttr2-y");
1837
1838        Holder<SimpleStruct> y = new Holder<SimpleStruct>(yOrig);
1839        Holder<SimpleStruct> z = new Holder<SimpleStruct>();
1840
1841        SimpleStruct ret;
1842        if (testDocLiteral) {
1843            ret = docClient.testSimpleStruct(x, y, z);
1844            // XXX - rpc-literal returns an object of type SimpleStruct,
1845
// doc-literal returns an object of type
1846
// DerivedStructBaseStruct
1847
//System.out.println("ret: " + ret.getClass().getName());
1848
if (!perfTestOnly) {
1849                assertTrue("testSimpleStruct(): Incorrect value for inout param",
1850                           equals(x, (DerivedStructBaseStruct)y.value));
1851                assertTrue("testSimpleStruct(): Incorrect value for out param",
1852                           equals(yOrig, (DerivedStructBaseStruct)z.value));
1853                assertTrue("testSimpleStruct(): Incorrect return value",
1854                           equals(x, (DerivedStructBaseStruct)ret));
1855            }
1856        } else {
1857            ret = rpcClient.testSimpleStruct(x, y, z);
1858            // XXX - rpc-literal returns an object of type SimpleStruct,
1859
// doc-literal returns an object of type
1860
// DerivedStructBaseStruct
1861
//System.out.println("ret: " + ret.getClass().getName());
1862
if (!perfTestOnly) {
1863                assertTrue("testSimpleStruct(): Incorrect value for inout param",
1864                           equals(x, y.value));
1865                assertTrue("testSimpleStruct(): Incorrect value for out param",
1866                           equals(yOrig, z.value));
1867                assertTrue("testSimpleStruct(): Incorrect return value",
1868                           equals(x, ret));
1869            }
1870        }
1871    }
1872
1873    public void testInheritanceSimpleChoiceDerivedStruct() throws Exception JavaDoc {
1874        DerivedStructBaseChoice x = new DerivedStructBaseChoice();
1875        //Base
1876
x.setVarString("BaseChoice-x");
1877        //Derived
1878
x.setVarFloatExt(-3.14f);
1879        x.setVarStringExt("DerivedStruct-x");
1880        x.setAttrString("DerivedAttr-x");
1881
1882        DerivedStructBaseChoice yOrig = new DerivedStructBaseChoice();
1883        //Base
1884
yOrig.setVarFloat(-9.14f);
1885        //Derived
1886
yOrig.setVarFloatExt(1.414f);
1887        yOrig.setVarStringExt("DerivedStruct-y");
1888        yOrig.setAttrString("DerivedAttr-y");
1889
1890        Holder<SimpleChoice> y = new Holder<SimpleChoice>(yOrig);
1891        Holder<SimpleChoice> z = new Holder<SimpleChoice>();
1892
1893        SimpleChoice ret;
1894        if (testDocLiteral) {
1895            ret = docClient.testSimpleChoice(x, y, z);
1896            // XXX - rpc-literal returns an object of type SimpleChoice,
1897
// doc-literal returns an object of type
1898
// DerivedStructBaseChoice
1899
//System.out.println("ret: " + ret.getClass().getName());
1900
if (!perfTestOnly) {
1901                assertTrue("testInheritanceSimpleChoiceDerivedStruct(): Incorrect value for inout param",
1902                           equals(x, (DerivedStructBaseChoice)y.value));
1903                assertTrue("testInheritanceSimpleChoiceDerivedStruct(): Incorrect value for out param",
1904                           equals(yOrig, (DerivedStructBaseChoice)z.value));
1905                assertTrue("testInheritanceSimpleChoiceDerivedStruct(): Incorrect return value",
1906                           equals(x, (DerivedStructBaseChoice)ret));
1907            }
1908        } else {
1909            ret = rpcClient.testSimpleChoice(x, y, z);
1910            // XXX - rpc-literal returns an object of type SimpleChoice,
1911
// doc-literal returns an object of type
1912
// DerivedStructBaseChoice
1913
//System.out.println("ret: " + ret.getClass().getName());
1914
if (!perfTestOnly) {
1915                assertTrue("testInheritanceSimpleChoiceDerivedStruct(): Incorrect value for inout param",
1916                           equals(x, y.value));
1917                assertTrue("testInheritanceSimpleChoiceDerivedStruct(): Incorrect value for out param",
1918                           equals(yOrig, z.value));
1919                assertTrue("testInheritanceSimpleChoiceDerivedStruct(): Incorrect return value",
1920                           equals(x, ret));
1921            }
1922        }
1923    }
1924
1925    public void testInheritanceUnboundedArrayDerivedChoice() throws Exception JavaDoc {
1926        DerivedChoiceBaseArray x = new DerivedChoiceBaseArray();
1927        //Base
1928
x.getItem().addAll(Arrays.asList("AAA", "BBB", "CCC"));
1929        //Derived
1930
x.setVarStringExt("DerivedChoice-x");
1931        x.setAttrStringExt("DerivedAttr-x");
1932
1933        DerivedChoiceBaseArray yOrig = new DerivedChoiceBaseArray();
1934        //Base
1935
yOrig.getItem().addAll(Arrays.asList("XXX", "YYY", "ZZZ"));
1936        //Derived
1937
yOrig.setVarFloatExt(1.414f);
1938        yOrig.setAttrStringExt("DerivedAttr-y");
1939
1940        Holder<UnboundedArray> y = new Holder<UnboundedArray>(yOrig);
1941        Holder<UnboundedArray> z = new Holder<UnboundedArray>();
1942        UnboundedArray ret;
1943        if (testDocLiteral) {
1944            ret = docClient.testUnboundedArray(x, y, z);
1945            // XXX - rpc-literal returns an object of type SimpleChoice,
1946
// doc-literal returns an object of type
1947
// DerivedStructBaseChoice
1948
//System.out.println("ret: " + ret.getClass().getName());
1949
if (!perfTestOnly) {
1950                assertTrue("testInheritanceUnboundedArrayDerivedChoice(): Incorrect value for inout param",
1951                           equals(x, (DerivedChoiceBaseArray)y.value));
1952                assertTrue("testInheritanceUnboundedArrayDerivedChoice(): Incorrect value for out param",
1953                           equals(yOrig, (DerivedChoiceBaseArray)z.value));
1954                assertTrue("testInheritanceUnboundedArrayDerivedChoice(): Incorrect return value",
1955                           equals(x, (DerivedChoiceBaseArray)ret));
1956            }
1957        } else {
1958            ret = rpcClient.testUnboundedArray(x, y, z);
1959            // XXX - rpc-literal returns an object of type SimpleChoice,
1960
// doc-literal returns an object of type
1961
// DerivedStructBaseChoice
1962
//System.out.println("ret: " + ret.getClass().getName());
1963
if (!perfTestOnly) {
1964                assertTrue("testInheritanceUnboundedArrayDerivedChoice(): Incorrect value for inout param",
1965                           equals(x, y.value));
1966                assertTrue("testInheritanceUnboundedArrayDerivedChoice(): Incorrect value for out param",
1967                           equals(yOrig, z.value));
1968                assertTrue("testInheritanceUnboundedArrayDerivedChoice(): Incorrect return value",
1969                           equals(x, ret));
1970            }
1971        }
1972    }
1973
1974    public void testInheritanceEmptyAllDerivedEmpty() throws Exception JavaDoc {
1975        DerivedEmptyBaseEmptyAll x = new DerivedEmptyBaseEmptyAll();
1976        DerivedEmptyBaseEmptyAll yOrig = new DerivedEmptyBaseEmptyAll();
1977        Holder<EmptyAll> y = new Holder<EmptyAll>(yOrig);
1978        Holder<EmptyAll> z = new Holder<EmptyAll>();
1979
1980        EmptyAll ret;
1981        if (testDocLiteral) {
1982            ret = docClient.testEmptyAll(x, y, z);
1983        } else {
1984            ret = rpcClient.testEmptyAll(x, y, z);
1985        }
1986        // not much to check
1987
assertNotNull("testInheritanceEmptyAllDerivedEmpty()", y.value);
1988        assertNotNull("testInheritanceEmptyAllDerivedEmpty()", z.value);
1989        assertNotNull("testInheritanceEmptyAllDerivedEmpty()", ret);
1990    }
1991}
1992
Popular Tags