1 package org.objectweb.celtix.systest.type_test; 2 3 import java.io.Serializable ; 4 import java.math.BigInteger ; 5 import java.util.Arrays ; 6 import java.util.Iterator ; 7 import java.util.List ; 8 import java.util.Map ; 9 10 import javax.xml.namespace.QName ; 11 import javax.xml.soap.Name ; 12 import javax.xml.soap.SOAPElement ; 13 import javax.xml.soap.SOAPFactory ; 14 import javax.xml.ws.Holder; 15 16 import org.w3c.dom.Element ; 17 18 import org.objectweb.type_test.types1.DerivedChoiceBaseArray; 19 import org.objectweb.type_test.types1.DerivedChoiceBaseChoice; 20 import org.objectweb.type_test.types1.DerivedChoiceBaseStruct; 21 import org.objectweb.type_test.types1.DerivedEmptyBaseEmptyAll; 22 import org.objectweb.type_test.types1.DerivedEmptyBaseEmptyChoice; 23 import org.objectweb.type_test.types1.DerivedNoContent; 24 import org.objectweb.type_test.types1.DerivedStructBaseChoice; 25 import org.objectweb.type_test.types1.DerivedStructBaseEmpty; 26 import org.objectweb.type_test.types1.DerivedStructBaseStruct; 27 import org.objectweb.type_test.types1.RestrictedChoiceBaseChoice; 28 import org.objectweb.type_test.types1.SimpleChoice; 29 import org.objectweb.type_test.types1.SimpleStruct; 30 import org.objectweb.type_test.types1.UnboundedArray; 31 import org.objectweb.type_test.types2.ChoiceOfChoice; 32 import org.objectweb.type_test.types2.ChoiceOfSeq; 33 import org.objectweb.type_test.types2.ChoiceWithAnyAttribute; 34 import org.objectweb.type_test.types2.ChoiceWithBinary; 35 import org.objectweb.type_test.types2.ChoiceWithGroupChoice; 36 import org.objectweb.type_test.types2.ChoiceWithGroupSeq; 37 import org.objectweb.type_test.types2.ChoiceWithGroups; 38 import org.objectweb.type_test.types2.ComplexTypeWithAttributeGroup; 39 import org.objectweb.type_test.types2.ComplexTypeWithAttributeGroup1; 40 import org.objectweb.type_test.types2.ComplexTypeWithAttributes; 41 import org.objectweb.type_test.types2.ExtBase64Binary; 42 import org.objectweb.type_test.types2.GroupDirectlyInComplexType; 43 import org.objectweb.type_test.types2.IDTypeAttribute; 44 import org.objectweb.type_test.types2.MultipleOccursSequenceInSequence; 45 import org.objectweb.type_test.types2.SequenceWithGroupChoice; 46 import org.objectweb.type_test.types2.SequenceWithGroupSeq; 47 import org.objectweb.type_test.types2.SequenceWithGroups; 48 import org.objectweb.type_test.types2.SequenceWithOccuringGroup; 49 import org.objectweb.type_test.types2.StructWithAny; 50 import org.objectweb.type_test.types2.StructWithAnyArray; 51 import org.objectweb.type_test.types2.StructWithAnyAttribute; 52 import org.objectweb.type_test.types2.StructWithBinary; 53 import org.objectweb.type_test.types3.OccuringChoice; 54 import org.objectweb.type_test.types3.OccuringChoice1; 55 import org.objectweb.type_test.types3.OccuringChoice2; 56 import org.objectweb.type_test.types3.OccuringStruct; 57 import org.objectweb.type_test.types3.OccuringStruct1; 58 import org.objectweb.type_test.types3.OccuringStruct2; 59 60 public abstract class AbstractTypeTestClient3 extends AbstractTypeTestClient2 { 61 62 public AbstractTypeTestClient3(String name, QName theServicename, 63 QName thePort, String theWsdlPath) { 64 super(name, theServicename, thePort, theWsdlPath); 65 } 66 67 69 protected boolean equals(ChoiceOfChoice x, ChoiceOfChoice y) { 70 if (x.getVarInt() != null && y.getVarInt() != null) { 71 return x.getVarInt().equals(y.getVarInt()); 72 } 73 if (x.getVarFloat() != null && y.getVarFloat() != null) { 74 return x.getVarFloat().equals(y.getVarFloat()); 75 } 76 if (x.getVarOtherInt() != null && y.getVarOtherInt() != null) { 77 return x.getVarOtherInt().equals(y.getVarOtherInt()); 78 } 79 if (x.getVarString() != null && y.getVarString() != null) { 80 return x.getVarString().equals(y.getVarString()); 81 } 82 return false; 83 } 84 85 public void testChoiceOfChoice() throws Exception { 86 ChoiceOfChoice x = new ChoiceOfChoice(); 87 ChoiceOfChoice yOrig = new ChoiceOfChoice(); 88 x.setVarFloat(3.14f); 89 yOrig.setVarString("y456"); 90 91 Holder<ChoiceOfChoice> y = new Holder<ChoiceOfChoice>(yOrig); 92 Holder<ChoiceOfChoice> z = new Holder<ChoiceOfChoice>(); 93 94 ChoiceOfChoice ret; 95 if (testDocLiteral) { 96 ret = docClient.testChoiceOfChoice(x, y, z); 97 } else { 98 ret = rpcClient.testChoiceOfChoice(x, y, z); 99 } 100 if (!perfTestOnly) { 101 assertTrue("testChoiceOfChoice(): Incorrect value for inout param", 102 equals(x, y.value)); 103 assertTrue("testChoiceOfChoice(): Incorrect value for out param", 104 equals(yOrig, z.value)); 105 assertTrue("testChoiceOfChoice(): Incorrect return value", equals(x, ret)); 106 } 107 } 108 109 111 protected boolean equals(ChoiceOfSeq x, ChoiceOfSeq y) { 112 if (x.getVarFloat() != null && x.getVarInt() != null 113 && y.getVarFloat() != null && y.getVarInt() != null) { 114 return x.getVarInt().equals(y.getVarInt()) 115 && x.getVarFloat().compareTo(y.getVarFloat()) == 0; 116 } 117 if (x.getVarOtherInt() != null && y.getVarOtherInt() != null 118 && x.getVarString() != null && y.getVarString() != null) { 119 return x.getVarOtherInt().equals(y.getVarOtherInt()) 120 && x.getVarString().equals(y.getVarString()); 121 } 122 return false; 123 } 124 125 public void testChoiceOfSeq() throws Exception { 126 ChoiceOfSeq x = new ChoiceOfSeq(); 127 x.setVarInt(123); 128 x.setVarFloat(3.14f); 129 130 ChoiceOfSeq yOrig = new ChoiceOfSeq(); 131 yOrig.setVarOtherInt(456); 132 yOrig.setVarString("y456"); 133 134 Holder<ChoiceOfSeq> y = new Holder<ChoiceOfSeq>(yOrig); 135 Holder<ChoiceOfSeq> z = new Holder<ChoiceOfSeq>(); 136 137 ChoiceOfSeq ret; 138 if (testDocLiteral) { 139 ret = docClient.testChoiceOfSeq(x, y, z); 140 } else { 141 ret = rpcClient.testChoiceOfSeq(x, y, z); 142 } 143 if (!perfTestOnly) { 144 assertTrue("testChoiceOfSeq(): Incorrect value for inout param", 145 equals(x, y.value)); 146 assertTrue("testChoiceOfSeq(): Incorrect value for out param", 147 equals(yOrig, z.value)); 148 assertTrue("testChoiceOfSeq(): Incorrect return value", equals(x, ret)); 149 } 150 } 151 152 154 protected boolean equals(DerivedStructBaseStruct x, DerivedStructBaseStruct y) { 155 return equals((SimpleStruct)x, (SimpleStruct)y) 156 && (x.getVarFloatExt() == y.getVarFloatExt()) 157 && (x.getVarStringExt().equals(y.getVarStringExt())) 158 && (x.getAttrString1().equals(y.getAttrString1())) 159 && (x.getAttrString2().equals(y.getAttrString2())); 160 } 161 162 public void testDerivedStructBaseStruct() throws Exception { 163 DerivedStructBaseStruct x = new DerivedStructBaseStruct(); 164 x.setVarFloat(3.14f); 166 x.setVarInt(new BigInteger ("42")); 167 x.setVarString("BaseStruct-x"); 168 x.setVarAttrString("BaseStructAttr-x"); 169 x.setVarFloatExt(-3.14f); 171 x.setVarStringExt("DerivedStruct-x"); 172 x.setAttrString1("DerivedAttr1-x"); 173 x.setAttrString2("DerivedAttr2-x"); 174 175 DerivedStructBaseStruct yOrig = new DerivedStructBaseStruct(); 176 yOrig.setVarFloat(-9.14f); 178 yOrig.setVarInt(new BigInteger ("10")); 179 yOrig.setVarString("BaseStruct-y"); 180 yOrig.setVarAttrString("BaseStructAttr-y"); 181 yOrig.setVarFloatExt(1.414f); 183 yOrig.setVarStringExt("DerivedStruct-y"); 184 yOrig.setAttrString1("DerivedAttr1-y"); 185 yOrig.setAttrString2("DerivedAttr2-y"); 186 187 Holder<DerivedStructBaseStruct> y = new Holder<DerivedStructBaseStruct>(yOrig); 188 Holder<DerivedStructBaseStruct> z = new Holder<DerivedStructBaseStruct>(); 189 DerivedStructBaseStruct ret; 190 if (testDocLiteral) { 191 ret = docClient.testDerivedStructBaseStruct(x, y, z); 192 } else { 193 ret = rpcClient.testDerivedStructBaseStruct(x, y, z); 194 } 195 if (!perfTestOnly) { 196 assertTrue("testDerivedStructBaseStruct(): Incorrect value for inout param", 197 equals(x, y.value)); 198 assertTrue("testDerivedStructBaseStruct(): Incorrect value for out param", 199 equals(yOrig, z.value)); 200 assertTrue("testDerivedStructBaseStruct(): Incorrect return value", equals(x, ret)); 201 } 202 } 203 204 206 protected boolean equals(DerivedStructBaseChoice x, DerivedStructBaseChoice y) { 207 return equals((SimpleChoice)x, (SimpleChoice)y) 208 && (Float.compare(x.getVarFloatExt(), y.getVarFloatExt()) == 0) 209 && (x.getVarStringExt().equals(y.getVarStringExt())) 210 && (x.getAttrString().equals(y.getAttrString())); 211 } 212 213 public void testDerivedStructBaseChoice() throws Exception { 214 DerivedStructBaseChoice x = new DerivedStructBaseChoice(); 215 x.setVarString("BaseChoice-x"); 217 x.setVarFloatExt(-3.14f); 219 x.setVarStringExt("DerivedStruct-x"); 220 x.setAttrString("DerivedAttr-x"); 221 222 DerivedStructBaseChoice yOrig = new DerivedStructBaseChoice(); 223 yOrig.setVarFloat(-9.14f); 225 yOrig.setVarFloatExt(1.414f); 227 yOrig.setVarStringExt("DerivedStruct-y"); 228 yOrig.setAttrString("DerivedAttr-y"); 229 230 Holder<DerivedStructBaseChoice> y = new Holder<DerivedStructBaseChoice>(yOrig); 231 Holder<DerivedStructBaseChoice> z = new Holder<DerivedStructBaseChoice>(); 232 DerivedStructBaseChoice ret; 233 if (testDocLiteral) { 234 ret = docClient.testDerivedStructBaseChoice(x, y, z); 235 } else { 236 ret = rpcClient.testDerivedStructBaseChoice(x, y, z); 237 } 238 if (!perfTestOnly) { 239 assertTrue("testDerivedStructBaseChoice(): Incorrect value for inout param", 240 equals(x, y.value)); 241 assertTrue("testDerivedStructBaseChoice(): Incorrect value for out param", 242 equals(yOrig, z.value)); 243 assertTrue("testDerivedStructBaseChoice(): Incorrect return value", equals(x, ret)); 244 } 245 } 246 247 249 protected boolean equals(DerivedChoiceBaseStruct x, DerivedChoiceBaseStruct y) { 250 boolean isEquals = x.getAttrString().equals(y.getAttrString()); 251 if (x.getVarStringExt() != null && y.getVarStringExt() != null) { 252 isEquals &= x.getVarStringExt().equals(y.getVarStringExt()); 253 } else { 254 isEquals &= x.getVarFloatExt() != null && y.getVarFloatExt() != null 255 && x.getVarFloatExt().compareTo(y.getVarFloatExt()) == 0; 256 } 257 return isEquals && equals((SimpleStruct)x, (SimpleStruct)y); 258 } 259 260 public void testDerivedChoiceBaseStruct() throws Exception { 261 DerivedChoiceBaseStruct x = new DerivedChoiceBaseStruct(); 262 x.setVarFloat(3.14f); 264 x.setVarInt(new BigInteger ("42")); 265 x.setVarString("BaseStruct-x"); 266 x.setVarAttrString("BaseStructAttr-x"); 267 x.setVarStringExt("DerivedChoice-x"); 269 x.setAttrString("DerivedAttr-x"); 270 271 DerivedChoiceBaseStruct yOrig = new DerivedChoiceBaseStruct(); 272 yOrig.setVarFloat(-9.14f); 274 yOrig.setVarInt(new BigInteger ("10")); 275 yOrig.setVarString("BaseStruct-y"); 276 yOrig.setVarAttrString("BaseStructAttr-y"); 277 yOrig.setVarFloatExt(1.414f); 279 yOrig.setAttrString("DerivedAttr-y"); 280 281 Holder<DerivedChoiceBaseStruct> y = new Holder<DerivedChoiceBaseStruct>(yOrig); 282 Holder<DerivedChoiceBaseStruct> z = new Holder<DerivedChoiceBaseStruct>(); 283 DerivedChoiceBaseStruct ret; 284 if (testDocLiteral) { 285 ret = docClient.testDerivedChoiceBaseStruct(x, y, z); 286 } else { 287 ret = rpcClient.testDerivedChoiceBaseStruct(x, y, z); 288 } 289 if (!perfTestOnly) { 290 assertTrue("testDerivedChoiceBaseStruct(): Incorrect value for inout param", 291 equals(x, y.value)); 292 assertTrue("testDerivedChoiceBaseStruct(): Incorrect value for out param", 293 equals(yOrig, z.value)); 294 assertTrue("testDerivedChoiceBaseStruct(): Incorrect return value", equals(x, ret)); 295 } 296 } 297 298 300 protected boolean equals(DerivedChoiceBaseArray x, DerivedChoiceBaseArray y) { 301 boolean isEquals = x.getAttrStringExt().equals(y.getAttrStringExt()); 302 if (x.getVarFloatExt() != null && y.getVarFloatExt() != null) { 303 isEquals &= x.getVarFloatExt().compareTo(y.getVarFloatExt()) == 0; 304 } else { 305 isEquals &= x.getVarStringExt() != null && y.getVarStringExt() != null 306 && x.getVarStringExt().equals(y.getVarStringExt()); 307 } 308 return isEquals && equals((UnboundedArray)x, (UnboundedArray)y); 309 } 310 311 public void testDerivedChoiceBaseArray() throws Exception { 312 DerivedChoiceBaseArray x = new DerivedChoiceBaseArray(); 313 x.getItem().addAll(Arrays.asList("AAA", "BBB", "CCC")); 315 x.setVarStringExt("DerivedChoice-x"); 317 x.setAttrStringExt("DerivedAttr-x"); 318 319 DerivedChoiceBaseArray yOrig = new DerivedChoiceBaseArray(); 320 yOrig.getItem().addAll(Arrays.asList("XXX", "YYY", "ZZZ")); 322 yOrig.setVarFloatExt(1.414f); 324 yOrig.setAttrStringExt("DerivedAttr-y"); 325 326 Holder<DerivedChoiceBaseArray> y = new Holder<DerivedChoiceBaseArray>(yOrig); 327 Holder<DerivedChoiceBaseArray> z = new Holder<DerivedChoiceBaseArray>(); 328 DerivedChoiceBaseArray ret; 329 if (testDocLiteral) { 330 ret = docClient.testDerivedChoiceBaseArray(x, y, z); 331 } else { 332 ret = rpcClient.testDerivedChoiceBaseArray(x, y, z); 333 } 334 if (!perfTestOnly) { 335 assertTrue("testDerivedChoiceBaseArray(): Incorrect value for inout param", 336 equals(x, y.value)); 337 assertTrue("testDerivedChoiceBaseArray(): Incorrect value for out param", 338 equals(yOrig, z.value)); 339 assertTrue("testDerivedChoiceBaseArray(): Incorrect return value", 340 equals(ret, x)); 341 } 342 } 343 344 346 protected boolean equals(DerivedChoiceBaseChoice x, DerivedChoiceBaseChoice y) { 347 boolean isEquals = x.getAttrString().equals(y.getAttrString()); 348 if (x.getVarStringExt() != null && y.getVarStringExt() != null) { 349 isEquals &= x.getVarStringExt().equals(y.getVarStringExt()); 350 } else { 351 isEquals &= x.getVarFloatExt() != null && y.getVarFloatExt() != null 352 && x.getVarFloatExt().compareTo(y.getVarFloatExt()) == 0; 353 } 354 return isEquals && equals((SimpleChoice)x, (SimpleChoice)y); 355 } 356 357 public void testDerivedChoiceBaseChoice() throws Exception { 358 DerivedChoiceBaseChoice x = new DerivedChoiceBaseChoice(); 359 x.setVarString("BaseChoice-x"); 361 x.setVarStringExt("DerivedChoice-x"); 363 x.setAttrString("DerivedAttr-x"); 364 365 DerivedChoiceBaseChoice yOrig = new DerivedChoiceBaseChoice(); 366 yOrig.setVarFloat(-9.14f); 368 yOrig.setVarFloatExt(1.414f); 370 yOrig.setAttrString("DerivedAttr-y"); 371 372 Holder<DerivedChoiceBaseChoice> y = new Holder<DerivedChoiceBaseChoice>(yOrig); 373 Holder<DerivedChoiceBaseChoice> z = new Holder<DerivedChoiceBaseChoice>(); 374 DerivedChoiceBaseChoice ret; 375 if (testDocLiteral) { 376 ret = docClient.testDerivedChoiceBaseChoice(x, y, z); 377 } else { 378 ret = rpcClient.testDerivedChoiceBaseChoice(x, y, z); 379 } 380 if (!perfTestOnly) { 381 assertTrue("testDerivedChoiceBaseChoice(): Incorrect value for inout param", 382 equals(x, y.value)); 383 assertTrue("testDerivedChoiceBaseChoice(): Incorrect value for out param", 384 equals(yOrig, z.value)); 385 assertTrue("testDerivedChoiceBaseChoice(): Incorrect return value", equals(x, ret)); 386 } 387 } 388 389 391 protected boolean equals(DerivedNoContent x, DerivedNoContent y) { 392 return equals((SimpleStruct)x, (SimpleStruct)y) 393 && x.getVarAttrString().equals(y.getVarAttrString()); 394 } 395 396 public void testDerivedNoContent() throws Exception { 397 DerivedNoContent x = new DerivedNoContent(); 398 x.setVarFloat(3.14f); 399 x.setVarInt(new BigInteger ("42")); 400 x.setVarString("BaseStruct-x"); 401 x.setVarAttrString("BaseStructAttr-x"); 402 403 DerivedNoContent yOrig = new DerivedNoContent(); 404 yOrig.setVarFloat(1.414f); 405 yOrig.setVarInt(new BigInteger ("13")); 406 yOrig.setVarString("BaseStruct-y"); 407 yOrig.setVarAttrString("BaseStructAttr-y"); 408 409 Holder<DerivedNoContent> y = new Holder<DerivedNoContent>(yOrig); 410 Holder<DerivedNoContent> z = new Holder<DerivedNoContent>(); 411 DerivedNoContent ret; 412 if (testDocLiteral) { 413 ret = docClient.testDerivedNoContent(x, y, z); 414 } else { 415 ret = rpcClient.testDerivedNoContent(x, y, z); 416 } 417 if (!perfTestOnly) { 418 assertTrue("testDerivedNoContent(): Incorrect value for inout param", 419 equals(x, y.value)); 420 assertTrue("testDerivedNoContent(): Incorrect value for out param", 421 equals(yOrig, z.value)); 422 assertTrue("testDerivedNoContent(): Incorrect return value", equals(ret, x)); 423 } 424 } 425 426 428 protected boolean equals(DerivedStructBaseEmpty x, DerivedStructBaseEmpty y) { 429 return (x.getVarFloatExt() == y.getVarFloatExt()) 430 && (x.getVarStringExt().equals(y.getVarStringExt())) 431 && (x.getAttrString().equals(y.getAttrString())); 432 } 433 434 public void testDerivedStructBaseEmpty() throws Exception { 435 DerivedStructBaseEmpty x = new DerivedStructBaseEmpty(); 436 x.setVarFloatExt(-3.14f); 438 x.setVarStringExt("DerivedStruct-x"); 439 x.setAttrString("DerivedAttr-x"); 440 441 DerivedStructBaseEmpty yOrig = new DerivedStructBaseEmpty(); 442 yOrig.setVarFloatExt(1.414f); 444 yOrig.setVarStringExt("DerivedStruct-y"); 445 yOrig.setAttrString("DerivedAttr-y"); 446 447 Holder<DerivedStructBaseEmpty> y = new Holder<DerivedStructBaseEmpty>(yOrig); 448 Holder<DerivedStructBaseEmpty> z = new Holder<DerivedStructBaseEmpty>(); 449 DerivedStructBaseEmpty ret; 450 if (testDocLiteral) { 451 ret = docClient.testDerivedStructBaseEmpty(x, y, z); 452 } else { 453 ret = rpcClient.testDerivedStructBaseEmpty(x, y, z); 454 } 455 if (!perfTestOnly) { 456 assertTrue("testDerivedStructBaseEmpty(): Incorrect value for inout param", 457 equals(x, y.value)); 458 assertTrue("testDerivedStructBaseEmpty(): Incorrect value for out param", 459 equals(yOrig, z.value)); 460 assertTrue("testDerivedStructBaseEmpty(): Incorrect return value", equals(x, ret)); 461 } 462 } 463 464 466 public void testDerivedEmptyBaseEmptyAll() throws Exception { 467 DerivedEmptyBaseEmptyAll x = new DerivedEmptyBaseEmptyAll(); 468 DerivedEmptyBaseEmptyAll yOrig = new DerivedEmptyBaseEmptyAll(); 469 Holder<DerivedEmptyBaseEmptyAll> y = new Holder<DerivedEmptyBaseEmptyAll>(yOrig); 470 Holder<DerivedEmptyBaseEmptyAll> z = new Holder<DerivedEmptyBaseEmptyAll>(); 471 DerivedEmptyBaseEmptyAll ret; 472 if (testDocLiteral) { 473 ret = docClient.testDerivedEmptyBaseEmptyAll(x, y, z); 474 } else { 475 ret = rpcClient.testDerivedEmptyBaseEmptyAll(x, y, z); 476 } 477 assertNotNull(y.value); 479 assertNotNull(z.value); 480 assertNotNull(ret); 481 } 482 483 485 public void testDerivedEmptyBaseEmptyChoice() throws Exception { 486 DerivedEmptyBaseEmptyChoice x = new DerivedEmptyBaseEmptyChoice(); 487 DerivedEmptyBaseEmptyChoice yOrig = new DerivedEmptyBaseEmptyChoice(); 488 Holder<DerivedEmptyBaseEmptyChoice> y = new Holder<DerivedEmptyBaseEmptyChoice>(yOrig); 489 Holder<DerivedEmptyBaseEmptyChoice> z = new Holder<DerivedEmptyBaseEmptyChoice>(); 490 DerivedEmptyBaseEmptyChoice ret; 491 if (testDocLiteral) { 492 ret = docClient.testDerivedEmptyBaseEmptyChoice(x, y, z); 493 } else { 494 ret = rpcClient.testDerivedEmptyBaseEmptyChoice(x, y, z); 495 } 496 assertNotNull(y.value); 498 assertNotNull(z.value); 499 assertNotNull(ret); 500 } 501 502 504 protected boolean equals(RestrictedChoiceBaseChoice x, RestrictedChoiceBaseChoice y) { 505 if (x.getVarFloat() != null && y.getVarFloat() != null) { 506 return x.getVarFloat().compareTo(y.getVarFloat()) == 0; 507 } else { 508 return x.getVarInt() != null && y.getVarInt() != null 509 && x.getVarInt().compareTo(y.getVarInt()) == 0; 510 } 511 } 512 513 public void testRestrictedChoiceBaseChoice() throws Exception { 514 RestrictedChoiceBaseChoice x = new RestrictedChoiceBaseChoice(); 515 x.setVarInt(12); 516 517 RestrictedChoiceBaseChoice yOrig = new RestrictedChoiceBaseChoice(); 518 yOrig.setVarFloat(-9.14f); 519 520 Holder<RestrictedChoiceBaseChoice> y = new Holder<RestrictedChoiceBaseChoice>(yOrig); 521 Holder<RestrictedChoiceBaseChoice> z = new Holder<RestrictedChoiceBaseChoice>(); 522 523 RestrictedChoiceBaseChoice ret; 524 if (testDocLiteral) { 525 ret = docClient.testRestrictedChoiceBaseChoice(x, y, z); 526 } else { 527 ret = rpcClient.testRestrictedChoiceBaseChoice(x, y, z); 528 } 529 if (!perfTestOnly) { 530 assertTrue("testRestrictedChoiceBaseChoice(): Incorrect value for inout param", 531 equals(x, y.value)); 532 assertTrue("testRestrictedChoiceBaseChoice(): Incorrect value for out param", 533 equals(yOrig, z.value)); 534 assertTrue("testRestrictedChoiceBaseChoice(): Incorrect return value", 535 equals(x, ret)); 536 } 537 } 538 539 541 protected boolean equals(ComplexTypeWithAttributeGroup x, 542 ComplexTypeWithAttributeGroup y) { 543 return x.getAttrInt().compareTo(y.getAttrInt()) == 0 544 && x.getAttrString().equals(y.getAttrString()); 545 } 546 547 public void testComplexTypeWithAttributeGroup() throws Exception { 548 ComplexTypeWithAttributeGroup x = new ComplexTypeWithAttributeGroup(); 549 x.setAttrInt(new BigInteger ("123")); 550 x.setAttrString("x123"); 551 ComplexTypeWithAttributeGroup yOrig = new ComplexTypeWithAttributeGroup(); 552 yOrig.setAttrInt(new BigInteger ("456")); 553 yOrig.setAttrString("x456"); 554 555 Holder<ComplexTypeWithAttributeGroup> y = new Holder<ComplexTypeWithAttributeGroup>(yOrig); 556 Holder<ComplexTypeWithAttributeGroup> z = new Holder<ComplexTypeWithAttributeGroup>(); 557 ComplexTypeWithAttributeGroup ret; 558 if (testDocLiteral) { 559 ret = docClient.testComplexTypeWithAttributeGroup(x, y, z); 560 } else { 561 ret = rpcClient.testComplexTypeWithAttributeGroup(x, y, z); 562 } 563 if (!perfTestOnly) { 564 assertTrue("testComplexTypeWithAttributeGroup(): Incorrect value for inout param", 565 equals(x, y.value)); 566 assertTrue("testComplexTypeWithAttributeGroup(): Incorrect value for out param", 567 equals(yOrig, z.value)); 568 assertTrue("testComplexTypeWithAttributeGroup(): Incorrect return value", equals(x, ret)); 569 } 570 } 571 572 574 protected boolean equals(ComplexTypeWithAttributeGroup1 x, 575 ComplexTypeWithAttributeGroup1 y) { 576 return x.getAttrInt().compareTo(y.getAttrInt()) == 0 577 && x.getAttrFloat().compareTo(y.getAttrFloat()) == 0 578 && x.getAttrString().equals(y.getAttrString()); 579 } 580 581 public void testComplexTypeWithAttributeGroup1() throws Exception { 582 ComplexTypeWithAttributeGroup1 x = new ComplexTypeWithAttributeGroup1(); 583 x.setAttrInt(new BigInteger ("123")); 584 x.setAttrString("x123"); 585 x.setAttrFloat(new Float (3.14f)); 586 ComplexTypeWithAttributeGroup1 yOrig = new ComplexTypeWithAttributeGroup1(); 587 yOrig.setAttrInt(new BigInteger ("456")); 588 yOrig.setAttrString("x456"); 589 yOrig.setAttrFloat(new Float (6.28f)); 590 591 Holder<ComplexTypeWithAttributeGroup1> y = new Holder<ComplexTypeWithAttributeGroup1>(yOrig); 592 Holder<ComplexTypeWithAttributeGroup1> z = new Holder<ComplexTypeWithAttributeGroup1>(); 593 ComplexTypeWithAttributeGroup1 ret; 594 if (testDocLiteral) { 595 ret = docClient.testComplexTypeWithAttributeGroup1(x, y, z); 596 } else { 597 ret = rpcClient.testComplexTypeWithAttributeGroup1(x, y, z); 598 } 599 if (!perfTestOnly) { 600 assertTrue("testComplexTypeWithAttributeGroup1(): Incorrect value for inout param", 601 equals(x, y.value)); 602 assertTrue("testComplexTypeWithAttributeGroup1(): Incorrect value for out param", 603 equals(yOrig, z.value)); 604 assertTrue("testComplexTypeWithAttributeGroup1(): Incorrect return value", equals(x, ret)); 605 } 606 } 607 608 protected boolean equals(SequenceWithGroupSeq x, SequenceWithGroupSeq y) { 610 return x.getVarInt() == y.getVarInt() 611 && Float.compare(x.getVarFloat(), y.getVarFloat()) == 0 612 && x.getVarString().equals(y.getVarString()) 613 && x.getVarOtherInt() == y.getVarOtherInt() 614 && Float.compare(x.getVarOtherFloat(), y.getVarOtherFloat()) == 0 615 && x.getVarOtherString().equals(y.getVarOtherString()); 616 } 617 618 public void testSequenceWithGroupSeq() throws Exception { 619 SequenceWithGroupSeq x = new SequenceWithGroupSeq(); 620 x.setVarInt(100); 621 x.setVarString("hello"); 622 x.setVarFloat(1.1f); 623 x.setVarOtherInt(11); 624 x.setVarOtherString("world"); 625 x.setVarOtherFloat(10.1f); 626 SequenceWithGroupSeq yOrig = new SequenceWithGroupSeq(); 627 yOrig.setVarInt(11); 628 yOrig.setVarString("world"); 629 yOrig.setVarFloat(10.1f); 630 yOrig.setVarOtherInt(100); 631 yOrig.setVarOtherString("hello"); 632 yOrig.setVarOtherFloat(1.1f); 633 634 Holder<SequenceWithGroupSeq> y = new Holder<SequenceWithGroupSeq>(yOrig); 635 Holder<SequenceWithGroupSeq> z = new Holder<SequenceWithGroupSeq>(); 636 637 SequenceWithGroupSeq ret; 638 if (testDocLiteral) { 639 ret = docClient.testSequenceWithGroupSeq(x, y, z); 640 } else { 641 ret = rpcClient.testSequenceWithGroupSeq(x, y, z); 642 } 643 if (!perfTestOnly) { 644 assertTrue("testSequenceWithGroupSeq(): Incorrect value for inout param", 645 equals(x, y.value)); 646 assertTrue("testSequenceWithGroupSeq(): Incorrect value for out param", 647 equals(yOrig, z.value)); 648 assertTrue("testSequenceWithGroupSeq(): Incorrect return value", equals(x, ret)); 649 } 650 } 651 652 654 protected boolean equals(SequenceWithGroupChoice x, SequenceWithGroupChoice y) { 655 if (x.getVarInt() != null && y.getVarInt() != null) { 656 if (x.getVarInt().compareTo(y.getVarInt()) != 0) { 657 return false; 658 } 659 } else if (x.getVarFloat() != null && y.getVarFloat() != null) { 660 if (x.getVarFloat().compareTo(y.getVarFloat()) != 0) { 661 return false; 662 } 663 } else if (x.getVarString() != null && y.getVarString() != null) { 664 if (!x.getVarString().equals(y.getVarString())) { 665 return false; 666 } 667 } else { 668 return false; 669 } 670 if (x.getVarOtherInt() != null && y.getVarOtherInt() != null) { 671 if (x.getVarOtherInt().compareTo(y.getVarOtherInt()) != 0) { 672 return false; 673 } 674 } else if (x.getVarOtherFloat() != null && y.getVarOtherFloat() != null) { 675 if (x.getVarOtherFloat().compareTo(y.getVarOtherFloat()) != 0) { 676 return false; 677 } 678 } else if (x.getVarOtherString() != null && y.getVarOtherString() != null) { 679 return x.getVarOtherString().equals(y.getVarOtherString()); 680 } else { 681 return false; 682 } 683 return true; 684 } 685 686 public void testSequenceWithGroupChoice() throws Exception { 687 SequenceWithGroupChoice x = new SequenceWithGroupChoice(); 688 x.setVarFloat(1.1f); 689 x.setVarOtherString("world"); 690 SequenceWithGroupChoice yOrig = new SequenceWithGroupChoice(); 691 yOrig.setVarOtherFloat(2.2f); 692 yOrig.setVarString("world"); 693 694 Holder<SequenceWithGroupChoice> y = new Holder<SequenceWithGroupChoice>(yOrig); 695 Holder<SequenceWithGroupChoice> z = new Holder<SequenceWithGroupChoice>(); 696 697 SequenceWithGroupChoice ret; 698 if (testDocLiteral) { 699 ret = docClient.testSequenceWithGroupChoice(x, y, z); 700 } else { 701 ret = rpcClient.testSequenceWithGroupChoice(x, y, z); 702 } 703 if (!perfTestOnly) { 704 assertTrue("testSequenceWithGroupChoice(): Incorrect value for inout param", 705 equals(x, y.value)); 706 assertTrue("testSequenceWithGroupChoice(): Incorrect value for out param", 707 equals(yOrig, z.value)); 708 assertTrue("testSequenceWithGroupChoice(): Incorrect return value", equals(x, ret)); 709 } 710 } 711 712 714 protected boolean equals(SequenceWithGroups x, SequenceWithGroups y) { 715 if (x.getVarOtherInt() != null && y.getVarOtherInt() != null) { 716 if (x.getVarOtherInt().compareTo(y.getVarOtherInt()) != 0) { 717 return false; 718 } 719 } else if (x.getVarOtherFloat() != null && y.getVarOtherFloat() != null) { 720 if (x.getVarOtherFloat().compareTo(y.getVarOtherFloat()) != 0) { 721 return false; 722 } 723 } else if (x.getVarOtherString() != null && y.getVarOtherString() != null) { 724 if (!x.getVarOtherString().equals(y.getVarOtherString())) { 725 return false; 726 } 727 } else { 728 return false; 729 } 730 return x.getVarInt() == y.getVarInt() 731 && Float.compare(x.getVarFloat(), y.getVarFloat()) == 0 732 && x.getVarString().equals(y.getVarString()); 733 } 734 735 public void testSequenceWithGroups() throws Exception { 736 SequenceWithGroups x = new SequenceWithGroups(); 737 x.setVarInt(100); 738 x.setVarString("hello"); 739 x.setVarFloat(1.1f); 740 x.setVarOtherFloat(1.1f); 741 742 SequenceWithGroups yOrig = new SequenceWithGroups(); 743 yOrig.setVarInt(11); 744 yOrig.setVarString("world"); 745 yOrig.setVarFloat(10.1f); 746 yOrig.setVarOtherString("world"); 747 748 Holder<SequenceWithGroups> y = new Holder<SequenceWithGroups>(yOrig); 749 Holder<SequenceWithGroups> z = new Holder<SequenceWithGroups>(); 750 751 SequenceWithGroups ret; 752 if (testDocLiteral) { 753 ret = docClient.testSequenceWithGroups(x, y, z); 754 } else { 755 ret = rpcClient.testSequenceWithGroups(x, y, z); 756 } 757 if (!perfTestOnly) { 758 assertTrue("testSequenceWithGroups(): Incorrect value for inout param", 759 equals(x, y.value)); 760 assertTrue("testSequenceWithGroups(): Incorrect value for out param", 761 equals(yOrig, z.value)); 762 assertTrue("testSequenceWithGroups(): Incorrect return value", equals(x, ret)); 763 } 764 } 765 766 768 protected boolean equals(SequenceWithOccuringGroup x, SequenceWithOccuringGroup y) { 769 return equalsFloatIntStringList(x.getBatchElementsSeq(), y.getBatchElementsSeq()); 770 } 771 772 public void testSequenceWithOccuringGroup() throws Exception { 773 SequenceWithOccuringGroup x = new SequenceWithOccuringGroup(); 774 x.getBatchElementsSeq().add(1.1f); 775 x.getBatchElementsSeq().add(100); 776 x.getBatchElementsSeq().add("hello"); 777 778 SequenceWithOccuringGroup yOrig = new SequenceWithOccuringGroup(); 779 yOrig.getBatchElementsSeq().add(2.2f); 780 yOrig.getBatchElementsSeq().add(200); 781 yOrig.getBatchElementsSeq().add("world"); 782 783 Holder<SequenceWithOccuringGroup> y = new Holder<SequenceWithOccuringGroup>(yOrig); 784 Holder<SequenceWithOccuringGroup> z = new Holder<SequenceWithOccuringGroup>(); 785 786 SequenceWithOccuringGroup ret; 787 if (testDocLiteral) { 788 ret = docClient.testSequenceWithOccuringGroup(x, y, z); 789 } else { 790 ret = rpcClient.testSequenceWithOccuringGroup(x, y, z); 791 } 792 if (!perfTestOnly) { 793 assertTrue("testGroupDirectlyInComplexType(): Incorrect value for inout param", 794 equals(x, y.value)); 795 assertTrue("testGroupDirectlyInComplexType(): Incorrect value for out param", 796 equals(yOrig, z.value)); 797 assertTrue("testGroupDirectlyInComplexType(): Incorrect return value", equals(x, ret)); 798 } 799 } 800 801 803 protected boolean equals(GroupDirectlyInComplexType x, GroupDirectlyInComplexType y) { 804 return x.getVarInt() == y.getVarInt() 805 && x.getVarString().equals(y.getVarString()) 806 && Float.compare(x.getVarFloat(), y.getVarFloat()) == 0 807 && x.getAttr1().equals(y.getAttr1()); 808 } 809 810 public void testGroupDirectlyInComplexType() throws Exception { 811 GroupDirectlyInComplexType x = new GroupDirectlyInComplexType(); 812 x.setVarInt(100); 813 x.setVarString("hello"); 814 x.setVarFloat(1.1f); 815 x.setAttr1(new Integer (1)); 816 GroupDirectlyInComplexType yOrig = new GroupDirectlyInComplexType(); 817 yOrig.setVarInt(11); 818 yOrig.setVarString("world"); 819 yOrig.setVarFloat(10.1f); 820 yOrig.setAttr1(new Integer (2)); 821 822 Holder<GroupDirectlyInComplexType> y = new Holder<GroupDirectlyInComplexType>(yOrig); 823 Holder<GroupDirectlyInComplexType> z = new Holder<GroupDirectlyInComplexType>(); 824 825 GroupDirectlyInComplexType ret; 826 if (testDocLiteral) { 827 ret = docClient.testGroupDirectlyInComplexType(x, y, z); 828 } else { 829 ret = rpcClient.testGroupDirectlyInComplexType(x, y, z); 830 } 831 if (!perfTestOnly) { 832 assertTrue("testGroupDirectlyInComplexType(): Incorrect value for inout param", 833 equals(x, y.value)); 834 assertTrue("testGroupDirectlyInComplexType(): Incorrect value for out param", 835 equals(yOrig, z.value)); 836 assertTrue("testGroupDirectlyInComplexType(): Incorrect return value", equals(x, ret)); 837 } 838 } 839 840 842 protected boolean equals(ComplexTypeWithAttributes x, ComplexTypeWithAttributes y) { 843 return x.getAttrInt().equals(y.getAttrInt()) 844 && x.getAttrString().equals(y.getAttrString()); 845 } 846 847 public void testComplexTypeWithAttributes() throws Exception { 848 ComplexTypeWithAttributes x = new ComplexTypeWithAttributes(); 849 x.setAttrInt(new BigInteger ("123")); 850 x.setAttrString("x123"); 851 ComplexTypeWithAttributes yOrig = new ComplexTypeWithAttributes(); 852 yOrig.setAttrInt(new BigInteger ("456")); 853 yOrig.setAttrString("x456"); 854 855 Holder<ComplexTypeWithAttributes> y = new Holder<ComplexTypeWithAttributes>(yOrig); 856 Holder<ComplexTypeWithAttributes> z = new Holder<ComplexTypeWithAttributes>(); 857 ComplexTypeWithAttributes ret; 858 if (testDocLiteral) { 859 ret = docClient.testComplexTypeWithAttributes(x, y, z); 860 } else { 861 ret = rpcClient.testComplexTypeWithAttributes(x, y, z); 862 } 863 864 if (!perfTestOnly) { 865 assertTrue("testComplexTypeWithAttributes(): Incorrect value for inout param", 866 equals(x, y.value)); 867 assertTrue("testComplexTypeWithAttributes(): Incorrect value for out param", 868 equals(yOrig, z.value)); 869 assertTrue("testComplexTypeWithAttributes(): Incorrect return value", equals(x, ret)); 870 } 871 } 872 873 875 public void assertEqualsStructWithAny(StructWithAny a, StructWithAny b) throws Exception { 876 assertEquals("StructWithAny names don't match", a.getName(), b.getName()); 877 assertEquals("StructWithAny addresses don't match", a.getAddress(), b.getAddress()); 878 assertEquals(a.getAny(), b.getAny()); 879 } 880 881 public void assertEquals(Element elA, Element elB) throws Exception { 882 if (elA instanceof SOAPElement && elB instanceof SOAPElement ) { 883 SOAPElement soapA = (SOAPElement )elA; 884 SOAPElement soapB = (SOAPElement )elB; 885 assertEquals("StructWithAny soap element names don't match", 886 soapA.getElementName(), soapB.getElementName()); 887 assertEquals("StructWithAny soap element text nodes don't match", 888 soapA.getValue(), soapB.getValue()); 889 890 Iterator itExp = soapA.getChildElements(); 891 Iterator itGen = soapB.getChildElements(); 892 while (itExp.hasNext()) { 893 if (!itGen.hasNext()) { 894 fail("Incorrect number of child elements inside any"); 895 } 896 Object objA = itExp.next(); 897 Object objB = itGen.next(); 898 if (objA instanceof SOAPElement ) { 899 if (objB instanceof SOAPElement ) { 900 assertEquals((SOAPElement )objA, (SOAPElement )objB); 901 } else { 902 fail("No matching soap element."); 903 } 904 } 905 } 906 } 907 } 908 909 public void testStructWithAny() throws Exception { 910 StructWithAny swa = new StructWithAny(); 911 swa.setName("Name"); 912 swa.setAddress("Some Address"); 913 914 StructWithAny yOrig = new StructWithAny(); 915 yOrig.setName("Name2"); 916 yOrig.setAddress("Some Other Address"); 917 918 SOAPFactory factory = SOAPFactory.newInstance(); 919 SOAPElement x = factory.createElement("hello", "foo", "http://some.url.com"); 920 x.addNamespaceDeclaration("foo", "http://some.url.com"); 921 x.addTextNode("This is the text of the node"); 922 923 SOAPElement x2 = factory.createElement("hello2", "foo", "http://some.url.com"); 924 x2.addNamespaceDeclaration("foo", "http://some.url.com"); 925 x2.addTextNode("This is the text of the node for the second struct"); 926 927 swa.setAny(x); 928 yOrig.setAny(x2); 929 930 Holder<StructWithAny> y = new Holder<StructWithAny>(yOrig); 931 Holder<StructWithAny> z = new Holder<StructWithAny>(); 932 933 StructWithAny ret; 934 if (testDocLiteral) { 935 ret = docClient.testStructWithAny(swa, y, z); 936 } else { 937 ret = rpcClient.testStructWithAny(swa, y, z); 938 } 939 if (!perfTestOnly) { 940 assertEqualsStructWithAny(swa, y.value); 941 assertEqualsStructWithAny(yOrig, z.value); 942 assertEqualsStructWithAny(swa, ret); 943 } 944 } 945 946 public void testStructWithAnyXsi() throws Exception { 947 StructWithAny swa = new StructWithAny(); 948 swa.setName("Name"); 949 swa.setAddress("Some Address"); 950 StructWithAny yOrig = new StructWithAny(); 951 yOrig.setName("Name2"); 952 yOrig.setAddress("Some Other Address"); 953 954 SOAPFactory sf = SOAPFactory.newInstance(); 955 Name elementName = sf.createName("UKAddress", "", "http://objectweb.org/type_test"); 956 Name xsiAttrName = sf.createName("type", "xsi", "http://www.w3.org/2001/XMLSchema-instance"); 957 SOAPElement x = sf.createElement(elementName); 958 x.addNamespaceDeclaration("tns", "http://objectweb.org/type_test"); 959 x.addNamespaceDeclaration("xsi", "http://www.w3.org/2001/XMLSchema-instance"); 960 x.addAttribute(xsiAttrName, "tns:UKAddressType11"); 961 x.addTextNode("This is the text of the node for the first struct"); 962 963 Name elementName2 = sf.createName("UKAddress", "", "http://objectweb.org/type_test"); 964 Name xsiAttrName2 = sf.createName("type", "xsi", "http://www.w3.org/2001/XMLSchema-instance"); 965 SOAPElement x2 = sf.createElement(elementName2); 966 x2.addNamespaceDeclaration("tns", "http://objectweb.org/type_test"); 967 x2.addNamespaceDeclaration("xsi", "http://www.w3.org/2001/XMLSchema-instance"); 968 x2.addAttribute(xsiAttrName2, "tns:UKAddressType22"); 969 x2.addTextNode("This is the text of the node for the second struct"); 970 971 swa.setAny(x); 972 yOrig.setAny(x2); 973 974 Holder<StructWithAny> y = new Holder<StructWithAny>(yOrig); 975 Holder<StructWithAny> z = new Holder<StructWithAny>(); 976 StructWithAny ret; 977 if (testDocLiteral) { 978 ret = docClient.testStructWithAny(swa, y, z); 979 } else { 980 ret = rpcClient.testStructWithAny(swa, y, z); 981 } 982 if (!perfTestOnly) { 983 assertEqualsStructWithAny(swa, y.value); 984 assertEqualsStructWithAny(yOrig, z.value); 985 assertEqualsStructWithAny(swa, ret); 986 } 987 } 988 989 public void testStructWithInvalidAny() throws Exception { 992 StructWithAny swa = new StructWithAny(); 993 swa.setName("Name"); 994 swa.setAddress("Some Address"); 995 996 StructWithAny yOrig = new StructWithAny(); 997 yOrig.setName("Name2"); 998 yOrig.setAddress("Some Other Address"); 999 1000 SOAPFactory factory = SOAPFactory.newInstance(); 1001 SOAPElement x = factory.createElement("hello", "foo", "http://some.url.com"); 1002 x.addTextNode("This is the text of the node"); 1003 1004 SOAPElement x2 = factory.createElement("hello2", "foo", "http://some.url.com"); 1005 x2.addTextNode("This is the text of the node for the second struct"); 1006 1007 swa.setAny(x); 1008 yOrig.setAny(x2); 1009 1010 Holder<StructWithAny> y = new Holder<StructWithAny>(yOrig); 1011 Holder<StructWithAny> z = new Holder<StructWithAny>(); 1012 1013 try { 1014 if (testDocLiteral) { 1015 docClient.testStructWithAny(swa, y, z); 1016 } else { 1017 rpcClient.testStructWithAny(swa, y, z); 1018 } 1019 } catch (Exception ex) { 1021 fail("testStructWithInvalidAny(): caught expected exception - woot."); 1022 } 1023 } 1024 1025 1027 public void assertEqualsStructWithAnyArray(StructWithAnyArray a, StructWithAnyArray b) throws Exception { 1028 assertEquals("StructWithAny names don't match", a.getName(), b.getName()); 1029 assertEquals("StructWithAny addresses don't match", a.getAddress(), b.getAddress()); 1030 1031 List <Element > ae = a.getAny(); 1032 List <Element > be = b.getAny(); 1033 1034 assertEquals("StructWithAny soap element lengths don't match", ae.size(), be.size()); 1035 for (int i = 0; i < ae.size(); i++) { 1036 assertEquals(ae.get(i), be.get(i)); 1037 } 1038 } 1039 1040 public void testStructWithAnyArray() throws Exception { 1041 StructWithAnyArray swa = new StructWithAnyArray(); 1042 swa.setName("Name"); 1043 swa.setAddress("Some Address"); 1044 1045 StructWithAnyArray yOrig = new StructWithAnyArray(); 1046 yOrig.setName("Name2"); 1047 yOrig.setAddress("Some Other Address"); 1048 1049 SOAPFactory factory = SOAPFactory.newInstance(); 1050 SOAPElement x = factory.createElement("hello", "foo", "http://some.url.com"); 1051 x.addNamespaceDeclaration("foo", "http://some.url.com"); 1052 x.addTextNode("This is the text of the node"); 1053 1054 SOAPElement x2 = factory.createElement("hello2", "foo", "http://some.url.com"); 1055 x2.addNamespaceDeclaration("foo", "http://some.url.com"); 1056 x2.addTextNode("This is the text of the node for the second struct"); 1057 1058 swa.getAny().add(x); 1059 yOrig.getAny().add(x2); 1060 1061 Holder<StructWithAnyArray> y = new Holder<StructWithAnyArray>(yOrig); 1062 Holder<StructWithAnyArray> z = new Holder<StructWithAnyArray>(); 1063 1064 StructWithAnyArray ret; 1065 if (testDocLiteral) { 1066 ret = docClient.testStructWithAnyArray(swa, y, z); 1067 } else { 1068 ret = rpcClient.testStructWithAnyArray(swa, y, z); 1069 } 1070 if (!perfTestOnly) { 1071 assertEqualsStructWithAnyArray(swa, y.value); 1072 assertEqualsStructWithAnyArray(yOrig, z.value); 1073 assertEqualsStructWithAnyArray(swa, ret); 1074 } 1075 } 1076 1077 public void testStructWithInvalidAnyArray() throws Exception { 1080 StructWithAnyArray swa = new StructWithAnyArray(); 1081 swa.setName("Name"); 1082 swa.setAddress("Some Address"); 1083 1084 StructWithAnyArray yOrig = new StructWithAnyArray(); 1085 yOrig.setName("Name2"); 1086 yOrig.setAddress("Some Other Address"); 1087 1088 SOAPFactory factory = SOAPFactory.newInstance(); 1089 SOAPElement x = factory.createElement("hello", "foo", "http://some.url.com"); 1090 x.addTextNode("This is the text of the node"); 1091 1092 SOAPElement x2 = factory.createElement("hello2", "foo", "http://some.url.com"); 1093 x2.addTextNode("This is the text of the node for the second struct"); 1094 1095 swa.getAny().add(x); 1096 yOrig.getAny().add(x2); 1097 1098 Holder<StructWithAnyArray> y = new Holder<StructWithAnyArray>(yOrig); 1099 Holder<StructWithAnyArray> z = new Holder<StructWithAnyArray>(); 1100 1101 try { 1102 if (testDocLiteral) { 1103 docClient.testStructWithAnyArray(swa, y, z); 1104 } else { 1105 rpcClient.testStructWithAnyArray(swa, y, z); 1106 } 1107 } catch (Exception ex) { 1109 fail("testStructWithInvalidAnyArray(): caught expected exception - woot."); 1111 } 1112 } 1113 1114 public void testStructWithAnyStrict() throws Exception { 1115 } 1117 1118 public void testStructWithAnyArrayLax() throws Exception { 1119 } 1121 1122 1124 protected boolean equalsIDTypeAttribute(IDTypeAttribute x, IDTypeAttribute y) { 1125 return equalsNilable(x.getId(), y.getId()); 1126 } 1127 1128 public void testIDTypeAttribute() throws Exception { 1129 IDTypeAttribute x = new IDTypeAttribute(); 1133 x.setId("x123"); 1134 IDTypeAttribute yOrig = new IDTypeAttribute(); 1135 yOrig.setId("x456"); 1136 1137 Holder<IDTypeAttribute> y = new Holder<IDTypeAttribute>(yOrig); 1138 Holder<IDTypeAttribute> z = new Holder<IDTypeAttribute>(); 1139 if (testDocLiteral) { 1141 docClient.testIDTypeAttribute(x, y, z); 1142 } else { 1143 rpcClient.testIDTypeAttribute(x, y, z); 1144 } 1145 1146 if (!perfTestOnly) { 1147 assertTrue("testIDTypeAttribute(): Incorrect value for inout param", 1148 equalsIDTypeAttribute(x, y.value)); 1149 assertTrue("testIDTypeAttribute(): Incorrect value for out param", 1150 equalsIDTypeAttribute(yOrig, z.value)); 1151 } 1152 } 1153 1154 protected boolean equals(MultipleOccursSequenceInSequence x, MultipleOccursSequenceInSequence y) { 1156 int size = x.getValue().size(); 1157 if (size != y.getValue().size()) { 1158 return false; 1159 } 1160 for (int i = 0; i < size; i++) { 1161 if (x.getValue().get(i).compareTo(y.getValue().get(i)) != 0) { 1162 return false; 1163 } 1164 } 1165 return true; 1166 } 1167 1168 public void testMultipleOccursSequenceInSequence() throws Exception { 1169 MultipleOccursSequenceInSequence x = new MultipleOccursSequenceInSequence(); 1170 x.getValue().add(new BigInteger ("32")); 1171 MultipleOccursSequenceInSequence yOriginal = new MultipleOccursSequenceInSequence(); 1172 yOriginal.getValue().add(new BigInteger ("3200")); 1173 1174 Holder<MultipleOccursSequenceInSequence> y = 1175 new Holder<MultipleOccursSequenceInSequence>(yOriginal); 1176 Holder<MultipleOccursSequenceInSequence> z = 1177 new Holder<MultipleOccursSequenceInSequence>(); 1178 1179 MultipleOccursSequenceInSequence ret; 1180 if (testDocLiteral) { 1181 ret = docClient.testMultipleOccursSequenceInSequence(x, y, z); 1182 } else { 1183 ret = rpcClient.testMultipleOccursSequenceInSequence(x, y, z); 1184 } 1185 if (!perfTestOnly) { 1186 assertTrue("testMultipleOccursSequenceInSequence(): Incorrect value for inout param", 1187 equals(x, y.value)); 1188 assertTrue("testMultipleOccursSequenceInSequence(): Incorrect value for out param", 1189 equals(yOriginal, z.value)); 1190 assertTrue("testMultipleOccursSequenceInSequence(): Incorrect return value", 1191 equals(x, ret)); 1192 } 1193 } 1194 1195 1197 protected boolean equals(StructWithBinary x, StructWithBinary y) { 1198 return Arrays.equals(x.getBase64(), y.getBase64()) 1199 && Arrays.equals(x.getHex(), y.getHex()); 1200 } 1201 1202 public void testStructWithBinary() throws Exception { 1203 StructWithBinary x = new StructWithBinary(); 1204 x.setBase64("base64Binary_x".getBytes()); 1205 x.setHex("hexBinary_x".getBytes()); 1206 1207 StructWithBinary yOriginal = new StructWithBinary(); 1208 yOriginal.setBase64("base64Binary_y".getBytes()); 1209 yOriginal.setHex("hexBinary_y".getBytes()); 1210 1211 Holder<StructWithBinary> y = new Holder<StructWithBinary>(yOriginal); 1212 Holder<StructWithBinary> z = new Holder<StructWithBinary>(); 1213 1214 StructWithBinary ret; 1215 if (testDocLiteral) { 1216 ret = docClient.testStructWithBinary(x, y, z); 1217 } else { 1218 ret = rpcClient.testStructWithBinary(x, y, z); 1219 } 1220 if (!perfTestOnly) { 1221 assertTrue("testStructWithBinary(): Incorrect value for inout param", 1222 equals(x, y.value)); 1223 assertTrue("testStructWithBinary(): Incorrect value for out param", 1224 equals(yOriginal, z.value)); 1225 assertTrue("testStructWithBinary(): Incorrect return value", 1226 equals(x, ret)); 1227 } 1228 } 1229 1230 1232 protected boolean equals(ChoiceWithBinary x, ChoiceWithBinary y) { 1233 if (x.getBase64() != null && y.getBase64() != null) { 1234 return Arrays.equals(x.getBase64(), y.getBase64()); 1235 } else { 1236 return x.getHex() != null && y.getHex() != null 1237 && Arrays.equals(x.getHex(), y.getHex()); 1238 } 1239 } 1240 1241 public void testChoiceWithBinary() throws Exception { 1242 ChoiceWithBinary x = new ChoiceWithBinary(); 1243 x.setBase64("base64Binary_x".getBytes()); 1244 1245 ChoiceWithBinary yOriginal = new ChoiceWithBinary(); 1246 yOriginal.setHex("hexBinary_y".getBytes()); 1247 1248 Holder<ChoiceWithBinary> y = new Holder<ChoiceWithBinary>(yOriginal); 1249 Holder<ChoiceWithBinary> z = new Holder<ChoiceWithBinary>(); 1250 1251 ChoiceWithBinary ret; 1252 if (testDocLiteral) { 1253 ret = docClient.testChoiceWithBinary(x, y, z); 1254 } else { 1255 ret = rpcClient.testChoiceWithBinary(x, y, z); 1256 } 1257 if (!perfTestOnly) { 1258 assertTrue("testChoiceWithBinary(): Incorrect value for inout param", 1259 equals(x, y.value)); 1260 assertTrue("testChoiceWithBinary(): Incorrect value for out param", 1261 equals(yOriginal, z.value)); 1262 assertTrue("testChoiceWithBinary(): Incorrect return value", 1263 equals(x, ret)); 1264 } 1265 } 1266 1267 1269 protected boolean equals(ChoiceWithGroupChoice x, ChoiceWithGroupChoice y) { 1270 if (x.getVarFloat() != null && y.getVarFloat() != null) { 1271 return x.getVarFloat().compareTo(y.getVarFloat()) == 0; 1272 } 1273 if (x.getVarInt() != null && y.getVarInt() != null) { 1274 return x.getVarInt().compareTo(y.getVarInt()) == 0; 1275 } 1276 if (x.getVarString() != null && y.getVarString() != null) { 1277 return x.getVarString().equals(y.getVarString()); 1278 } 1279 if (x.getVarOtherFloat() != null && y.getVarOtherFloat() != null) { 1280 return x.getVarOtherFloat().compareTo(y.getVarOtherFloat()) == 0; 1281 } 1282 if (x.getVarOtherInt() != null && y.getVarOtherInt() != null) { 1283 return x.getVarOtherInt().compareTo(y.getVarOtherInt()) == 0; 1284 } 1285 if (x.getVarOtherString() != null && y.getVarOtherString() != null) { 1286 return x.getVarOtherString().equals(y.getVarOtherString()); 1287 } 1288 return false; 1289 } 1290 1291 public void testChoiceWithGroupChoice() throws Exception { 1293 ChoiceWithGroupChoice x = new ChoiceWithGroupChoice(); 1294 x.setVarFloat(1.1f); 1295 ChoiceWithGroupChoice yOrig = new ChoiceWithGroupChoice(); 1296 yOrig.setVarOtherString("world"); 1297 1298 Holder<ChoiceWithGroupChoice> y = new Holder<ChoiceWithGroupChoice>(yOrig); 1299 Holder<ChoiceWithGroupChoice> z = new Holder<ChoiceWithGroupChoice>(); 1300 1301 ChoiceWithGroupChoice ret; 1302 if (testDocLiteral) { 1303 ret = docClient.testChoiceWithGroupChoice(x, y, z); 1304 } else { 1305 ret = rpcClient.testChoiceWithGroupChoice(x, y, z); 1306 } 1307 if (!perfTestOnly) { 1308 assertTrue("testChoiceWithGroupChoice(): Incorrect value for inout param", 1309 equals(x, y.value)); 1310 assertTrue("testChoiceWithGroupChoice(): Incorrect value for out param", 1311 equals(yOrig, z.value)); 1312 assertTrue("testChoiceWithGroupChoice(): Incorrect return value", 1313 equals(x, ret)); 1314 } 1315 } 1316 1317 1319 protected boolean equals(ChoiceWithGroupSeq x, ChoiceWithGroupSeq y) { 1320 if (x.getVarInt() != null && x.getVarFloat() != null 1321 && x.getVarString() != null) { 1322 if (x.getVarInt().compareTo(y.getVarInt()) != 0) { 1323 return false; 1324 } 1325 if (x.getVarFloat().compareTo(y.getVarFloat()) != 0) { 1326 return false; 1327 } 1328 return x.getVarString().equals(y.getVarString()); 1329 } 1330 if (x.getVarOtherInt() != null && x.getVarOtherFloat() != null 1331 && x.getVarOtherString() != null) { 1332 if (x.getVarOtherInt().compareTo(y.getVarOtherInt()) != 0) { 1333 return false; 1334 } 1335 if (x.getVarOtherFloat().compareTo(y.getVarOtherFloat()) != 0) { 1336 return false; 1337 } 1338 return x.getVarOtherString().equals(y.getVarOtherString()); 1339 } 1340 return false; 1341 } 1342 1343 public void testChoiceWithGroupSeq() throws Exception { 1345 ChoiceWithGroupSeq x = new ChoiceWithGroupSeq(); 1346 x.setVarInt(100); 1347 x.setVarString("hello"); 1348 x.setVarFloat(1.1f); 1349 ChoiceWithGroupSeq yOrig = new ChoiceWithGroupSeq(); 1350 yOrig.setVarOtherInt(11); 1351 yOrig.setVarOtherString("world"); 1352 yOrig.setVarOtherFloat(10.1f); 1353 1354 Holder<ChoiceWithGroupSeq> y = new Holder<ChoiceWithGroupSeq>(yOrig); 1355 Holder<ChoiceWithGroupSeq> z = new Holder<ChoiceWithGroupSeq>(); 1356 1357 ChoiceWithGroupSeq ret; 1358 if (testDocLiteral) { 1359 ret = docClient.testChoiceWithGroupSeq(x, y, z); 1360 } else { 1361 ret = rpcClient.testChoiceWithGroupSeq(x, y, z); 1362 } 1363 if (!perfTestOnly) { 1364 assertTrue("testChoiceWithGroupSeq(): Incorrect value for inout param", 1365 equals(x, y.value)); 1366 assertTrue("testChoiceWithGroupSeq(): Incorrect value for out param", 1367 equals(yOrig, z.value)); 1368 assertTrue("testChoiceWithGroupSeq(): Incorrect return value", 1369 equals(x, ret)); 1370 } 1371 } 1372 1373 1375 protected boolean equals(ChoiceWithGroups x, ChoiceWithGroups y) { 1376 if (x.getVarInt() != null && x.getVarString() != null 1377 && x.getVarFloat() != null) { 1378 if (x.getVarInt().compareTo(y.getVarInt()) == 0 1379 && x.getVarString().equals(y.getVarString()) 1380 && x.getVarFloat().compareTo(y.getVarFloat()) == 0) { 1381 return true; 1382 } 1383 return false; 1384 } else { 1385 if (x.getVarOtherFloat() != null && y.getVarOtherFloat() != null) { 1386 return x.getVarOtherFloat().compareTo(y.getVarOtherFloat()) == 0; 1387 } 1388 if (x.getVarOtherInt() != null && y.getVarOtherInt() != null) { 1389 return x.getVarOtherInt().compareTo(y.getVarOtherInt()) == 0; 1390 } 1391 if (x.getVarOtherString() != null && y.getVarOtherString() != null) { 1392 return x.getVarOtherString().equals(y.getVarOtherString()); 1393 } 1394 return false; 1395 } 1396 } 1397 1398 public void testChoiceWithGroups() throws Exception { 1400 ChoiceWithGroups x = new ChoiceWithGroups(); 1401 x.setVarInt(100); 1402 x.setVarString("hello"); 1403 x.setVarFloat(1.1f); 1404 ChoiceWithGroups yOrig = new ChoiceWithGroups(); 1405 yOrig.setVarOtherString("world"); 1406 1407 Holder<ChoiceWithGroups> y = new Holder<ChoiceWithGroups>(yOrig); 1408 Holder<ChoiceWithGroups> z = new Holder<ChoiceWithGroups>(); 1409 1410 ChoiceWithGroups ret; 1411 if (testDocLiteral) { 1412 ret = docClient.testChoiceWithGroups(x, y, z); 1413 } else { 1414 ret = rpcClient.testChoiceWithGroups(x, y, z); 1415 } 1416 if (!perfTestOnly) { 1417 assertTrue("testChoiceWithGroups(): Incorrect value for inout param", 1418 equals(x, y.value)); 1419 assertTrue("testChoiceWithGroups(): Incorrect value for out param", 1420 equals(yOrig, z.value)); 1421 assertTrue("testChoiceWithGroups(): Incorrect return value", 1422 equals(x, ret)); 1423 } 1424 } 1425 1426 1428 protected boolean equals(ExtBase64Binary x, ExtBase64Binary y) { 1429 return x.getId() == y.getId() && Arrays.equals(x.getValue(), y.getValue()); 1430 } 1431 1432 public void testExtBase64Binary() throws Exception { 1433 ExtBase64Binary x1 = new ExtBase64Binary(); 1434 x1.setValue("base64a".getBytes()); 1435 x1.setId(1); 1436 1437 ExtBase64Binary y1 = new ExtBase64Binary(); 1438 y1.setValue("base64b".getBytes()); 1439 y1.setId(2); 1440 1441 Holder<ExtBase64Binary> y1Holder = new Holder<ExtBase64Binary>(y1); 1442 Holder<ExtBase64Binary> z1 = new Holder<ExtBase64Binary>(); 1443 ExtBase64Binary ret; 1444 if (testDocLiteral) { 1445 ret = docClient.testExtBase64Binary(x1, y1Holder, z1); 1446 } else { 1447 ret = rpcClient.testExtBase64Binary(x1, y1Holder, z1); 1448 } 1449 1450 if (!perfTestOnly) { 1451 assertTrue("testExtBase64Binary(): Incorrect value for inout param", 1452 equals(x1, y1Holder.value)); 1453 assertTrue("testExtBase64Binary(): Incorrect value for out param", 1454 equals(y1, z1.value)); 1455 assertTrue("testExtBase64Binary(): Incorrect return value", equals(x1, ret)); 1456 } 1457 } 1458 1459 1461 protected boolean equals(StructWithAnyAttribute x, StructWithAnyAttribute y) { 1462 if (!(x.getVarString().equals(y.getVarString())) 1463 || (x.getVarInt() != y.getVarInt())) { 1464 return false; 1465 } 1466 if (!equalsNilable(x.getAtString(), y.getAtString()) 1467 || !equalsNilable(x.getAtInt(), y.getAtInt())) { 1468 return false; 1469 } 1470 return equalsQNameStringPairs(x.getOtherAttributes(), y.getOtherAttributes()); 1471 } 1472 1473 protected boolean equalsQNameStringPairs(Map <QName , String > x, Map <QName , String > y) { 1474 if ((x == null && y != null) 1475 || (x != null && y == null)) { 1476 return false; 1477 } 1478 if (x.isEmpty() && y.isEmpty()) { 1479 return true; 1480 } 1481 if (x.size() != y.size()) { 1482 return false; 1483 } 1484 1485 Iterator <QName > itx = x.keySet().iterator(); 1486 while (itx.hasNext()) { 1487 QName attName = itx.next(); 1488 if (attName == null) { 1489 return false; 1490 } 1491 1492 String attValue = y.get(attName); 1493 if (attValue == null || !attValue.equals(x.get(attName))) { 1494 return false; 1495 } 1496 } 1497 return true; 1498 } 1499 1500 public void testStructWithAnyAttribute() throws Exception { 1501 QName xAt1Name = new QName ("http://schemas.iona.com/type_test", "at_one"); 1502 QName xAt2Name = new QName ("http://schemas.iona.com/type_test", "at_two"); 1503 QName yAt3Name = new QName ("http://objectweb.org/type_test", "at_thr"); 1504 QName yAt4Name = new QName ("http://objectweb.org/type_test", "at_fou"); 1505 1506 StructWithAnyAttribute x = new StructWithAnyAttribute(); 1507 StructWithAnyAttribute y = new StructWithAnyAttribute(); 1508 1509 x.setVarString("hello"); 1510 x.setVarInt(1000); 1511 x.setAtString("hello attribute"); 1512 x.setAtInt(new Integer (2000)); 1513 1514 y.setVarString("there"); 1515 y.setVarInt(1001); 1516 y.setAtString("there attribute"); 1517 y.setAtInt(new Integer (2002)); 1518 1519 Map <QName , String > xAttrMap = x.getOtherAttributes(); 1520 xAttrMap.put(xAt1Name, "one"); 1521 xAttrMap.put(xAt2Name, "two"); 1522 1523 Map <QName , String > yAttrMap = y.getOtherAttributes(); 1524 yAttrMap.put(yAt3Name, "three"); 1525 yAttrMap.put(yAt4Name, "four"); 1526 1527 Holder<StructWithAnyAttribute> yh = new Holder<StructWithAnyAttribute>(y); 1528 Holder<StructWithAnyAttribute> zh = new Holder<StructWithAnyAttribute>(); 1529 StructWithAnyAttribute ret; 1530 if (testDocLiteral) { 1531 ret = docClient.testStructWithAnyAttribute(x, yh, zh); 1532 } else { 1533 ret = rpcClient.testStructWithAnyAttribute(x, yh, zh); 1534 } 1535 1536 if (!perfTestOnly) { 1537 assertTrue("testStructWithAnyAttribute(): Incorrect value for inout param", 1538 equals(x, yh.value)); 1539 assertTrue("testStructWithAnyAttribute(): Incorrect value for out param", 1540 equals(y, zh.value)); 1541 assertTrue("testStructWithAnyAttribute(): Incorrect return value", 1542 equals(ret, x)); 1543 } 1544 } 1545 1546 1548 protected boolean equals(ChoiceWithAnyAttribute x, ChoiceWithAnyAttribute y) { 1549 String xString = x.getVarString(); 1550 String yString = y.getVarString(); 1551 Integer xInt = x.getVarInt(); 1552 Integer yInt = y.getVarInt(); 1553 if (xString != null) { 1554 if (yString == null || !xString.equals(yString)) { 1555 fail(xString + " != " + yString); 1556 return false; 1557 } 1558 } else if (xInt != null) { 1559 if (yInt == null || !(xInt.equals(yInt))) { 1560 fail(xInt + " != " + yInt); 1561 return false; 1562 } 1563 } else { 1564 fail("null choice"); 1565 return false; 1566 } 1567 1568 if (!equalsNilable(x.getAtString(), y.getAtString()) 1569 || !equalsNilable(x.getAtInt(), y.getAtInt())) { 1570 fail("grrr"); 1571 return false; 1572 } 1573 return equalsQNameStringPairs(x.getOtherAttributes(), y.getOtherAttributes()); 1574 } 1575 1576 public void testChoiceWithAnyAttribute() throws Exception { 1577 QName xAt1Name = new QName ("http://schemas.iona.com/type_test", "at_one"); 1578 QName xAt2Name = new QName ("http://schemas.iona.com/type_test", "at_two"); 1579 QName yAt3Name = new QName ("http://objectweb.org/type_test", "at_thr"); 1580 QName yAt4Name = new QName ("http://objectweb.org/type_test", "at_fou"); 1581 1582 ChoiceWithAnyAttribute x = new ChoiceWithAnyAttribute(); 1583 ChoiceWithAnyAttribute y = new ChoiceWithAnyAttribute(); 1584 1585 x.setVarString("hello"); 1586 x.setAtString("hello attribute"); 1587 x.setAtInt(new Integer (2000)); 1588 1589 y.setVarInt(1001); 1590 y.setAtString("there attribute"); 1591 y.setAtInt(new Integer (2002)); 1592 1593 Map <QName , String > xAttrMap = x.getOtherAttributes(); 1594 xAttrMap.put(xAt1Name, "one"); 1595 xAttrMap.put(xAt2Name, "two"); 1596 1597 Map <QName , String > yAttrMap = y.getOtherAttributes(); 1598 yAttrMap.put(yAt3Name, "three"); 1599 yAttrMap.put(yAt4Name, "four"); 1600 1601 Holder<ChoiceWithAnyAttribute> yh = new Holder<ChoiceWithAnyAttribute>(y); 1602 Holder<ChoiceWithAnyAttribute> zh = new Holder<ChoiceWithAnyAttribute>(); 1603 ChoiceWithAnyAttribute ret; 1604 if (testDocLiteral) { 1605 ret = docClient.testChoiceWithAnyAttribute(x, yh, zh); 1606 } else { 1607 ret = rpcClient.testChoiceWithAnyAttribute(x, yh, zh); 1608 } 1609 1610 if (!perfTestOnly) { 1611 assertTrue("testChoiceWithAnyAttribute(): Incorrect value for inout param", 1612 equals(x, yh.value)); 1613 assertTrue("testChoiceWithAnyAttribute(): Incorrect value for out param", 1614 equals(y, zh.value)); 1615 assertTrue("testChoiceWithAnyAttribute(): Incorrect return value", 1616 equals(ret, x)); 1617 } 1618 } 1619 1620 1622 protected boolean equals(OccuringStruct x, OccuringStruct y) { 1623 if (!equalsNilable(x.getVarAttrib(), y.getVarAttrib())) { 1624 return false; 1625 } 1626 return equalsFloatIntStringList(x.getVarFloatAndVarIntAndVarString(), 1627 y.getVarFloatAndVarIntAndVarString()); 1628 } 1629 1630 protected boolean equalsFloatIntStringList(List <Serializable > xList, 1631 List <Serializable > yList) { 1632 int size = xList.size(); 1633 if (size != yList.size()) { 1634 return false; 1635 } 1636 for (int i = 0; i < size; i++) { 1637 if (xList.get(i) instanceof Float && yList.get(i) instanceof Float ) { 1638 Float fx = (Float )xList.get(i); 1639 Float fy = (Float )yList.get(i); 1640 if (fx.compareTo(fy) != 0) { 1641 return false; 1642 } 1643 } else if (xList.get(i) instanceof Integer && yList.get(i) instanceof Integer ) { 1644 Integer ix = (Integer )xList.get(i); 1645 Integer iy = (Integer )yList.get(i); 1646 if (iy.compareTo(ix) != 0) { 1647 return false; 1648 } 1649 } else if (xList.get(i) instanceof String && yList.get(i) instanceof String ) { 1650 String sx = (String )xList.get(i); 1651 String sy = (String )yList.get(i); 1652 if (!sx.equals(sy)) { 1653 return false; 1654 } 1655 } else { 1656 return false; 1657 } 1658 } 1659 return true; 1660 } 1661 1662 public void testOccuringStruct() throws Exception { 1663 OccuringStruct x = new OccuringStruct(); 1664 List <Serializable > theList = x.getVarFloatAndVarIntAndVarString(); 1665 theList.add(1.14f); 1666 theList.add(new Integer (0)); 1667 theList.add("x1"); 1668 theList.add(11.14f); 1669 theList.add(new Integer (1)); 1670 theList.add("x2"); 1671 x.setVarAttrib("x_attr"); 1672 1673 OccuringStruct yOriginal = new OccuringStruct(); 1674 theList = yOriginal.getVarFloatAndVarIntAndVarString(); 1675 theList.add(3.14f); 1676 theList.add(new Integer (42)); 1677 theList.add("y"); 1678 yOriginal.setVarAttrib("y_attr"); 1679 1680 Holder<OccuringStruct> y = new Holder<OccuringStruct>(yOriginal); 1681 Holder<OccuringStruct> z = new Holder<OccuringStruct>(); 1682 1683 OccuringStruct ret; 1684 if (testDocLiteral) { 1685 ret = docClient.testOccuringStruct(x, y, z); 1686 } else { 1687 ret = rpcClient.testOccuringStruct(x, y, z); 1688 } 1689 if (!perfTestOnly) { 1690 assertTrue("testOccuringStruct(): Incorrect value for inout param", 1691 equals(x, y.value)); 1692 assertTrue("testOccuringStruct(): Incorrect value for out param", 1693 equals(yOriginal, z.value)); 1694 assertTrue("testOccuringStruct(): Incorrect return value", 1695 equals(x, ret)); 1696 } 1697 } 1698 1699 1701 protected boolean equals(OccuringStruct1 x, OccuringStruct1 y) { 1702 return equalsFloatIntStringList(x.getVarFloatAndVarIntAndVarString(), 1703 y.getVarFloatAndVarIntAndVarString()); 1704 } 1705 1706 public void testOccuringStruct1() throws Exception { 1707 OccuringStruct1 x = new OccuringStruct1(); 1708 List <Serializable > theList = x.getVarFloatAndVarIntAndVarString(); 1709 theList.add(1.1f); 1710 theList.add(2); 1711 theList.add("xX"); 1712 1713 OccuringStruct1 yOriginal = new OccuringStruct1(); 1714 theList = yOriginal.getVarFloatAndVarIntAndVarString(); 1715 theList.add(11.11f); 1716 theList.add(22); 1717 theList.add("yY"); 1718 1719 Holder<OccuringStruct1> y = new Holder<OccuringStruct1>(yOriginal); 1720 Holder<OccuringStruct1> z = new Holder<OccuringStruct1>(); 1721 1722 OccuringStruct1 ret; 1723 if (testDocLiteral) { 1724 ret = docClient.testOccuringStruct1(x, y, z); 1725 } else { 1726 ret = rpcClient.testOccuringStruct1(x, y, z); 1727 } 1728 if (!perfTestOnly) { 1729 assertTrue("testOccuringStruct1(): Incorrect value for inout param", 1730 equals(x, y.value)); 1731 assertTrue("testOccuringStruct1(): Incorrect value for out param", 1732 equals(yOriginal, z.value)); 1733 assertTrue("testOccuringStruct1(): Incorrect return value", 1734 equals(x, ret)); 1735 } 1736 } 1737 1738 1740 protected boolean equals(OccuringStruct2 x, OccuringStruct2 y) { 1741 if (Float.compare(x.getVarFloat(), y.getVarFloat()) != 0) { 1742 return false; 1743 } 1744 List <Serializable > xList = x.getVarIntAndVarString(); 1745 List <Serializable > yList = y.getVarIntAndVarString(); 1746 int size = xList.size(); 1747 if (size != yList.size()) { 1748 return false; 1749 } 1750 for (int i = 0; i < size; i++) { 1751 if (xList.get(i) instanceof Integer && yList.get(i) instanceof Integer ) { 1752 Integer ix = (Integer )xList.get(i); 1753 Integer iy = (Integer )yList.get(i); 1754 if (iy.compareTo(ix) != 0) { 1755 return false; 1756 } 1757 } else if (xList.get(i) instanceof String && yList.get(i) instanceof String ) { 1758 String sx = (String )xList.get(i); 1759 String sy = (String )yList.get(i); 1760 if (!sx.equals(sy)) { 1761 return false; 1762 } 1763 } else { 1764 return false; 1765 } 1766 } 1767 return true; 1768 } 1769 1770 public void testOccuringStruct2() throws Exception { 1771 OccuringStruct2 x = new OccuringStruct2(); 1772 x.setVarFloat(1.14f); 1773 List <Serializable > theList = x.getVarIntAndVarString(); 1774 theList.add(0); 1775 theList.add("x1"); 1776 theList.add(1); 1777 theList.add("x2"); 1778 1779 OccuringStruct2 yOriginal = new OccuringStruct2(); 1780 yOriginal.setVarFloat(3.14f); 1781 theList = yOriginal.getVarIntAndVarString(); 1782 theList.add(42); 1783 theList.add("the answer"); 1784 theList.add(6); 1785 theList.add("hammer"); 1786 theList.add(2); 1787 theList.add("anvil"); 1788 1789 Holder<OccuringStruct2> y = new Holder<OccuringStruct2>(yOriginal); 1790 Holder<OccuringStruct2> z = new Holder<OccuringStruct2>(); 1791 1792 OccuringStruct2 ret; 1793 if (testDocLiteral) { 1794 ret = docClient.testOccuringStruct2(x, y, z); 1795 } else { 1796 ret = rpcClient.testOccuringStruct2(x, y, z); 1797 } 1798 if (!perfTestOnly) { 1799 assertTrue("testOccuringStruct2(): Incorrect value for inout param", 1800 equals(x, y.value)); 1801 assertTrue("testOccuringStruct2(): Incorrect value for out param", 1802 equals(yOriginal, z.value)); 1803 assertTrue("testOccuringStruct2(): Incorrect return value", 1804 equals(x, ret)); 1805 } 1806 } 1807 1808 1810 protected boolean equals(OccuringChoice x, OccuringChoice y) { 1811 if (!equalsNilable(x.getVarAttrib(), y.getVarAttrib())) { 1812 return false; 1813 } 1814 return equalsFloatIntStringList(x.getVarFloatOrVarIntOrVarString(), 1815 y.getVarFloatOrVarIntOrVarString()); 1816 } 1817 1818 public void testOccuringChoice() throws Exception { 1819 OccuringChoice x = new OccuringChoice(); 1820 List <Serializable > theList = x.getVarFloatOrVarIntOrVarString(); 1821 theList.add(0); 1822 theList.add(1.14f); 1823 theList.add("x1"); 1824 theList.add(1); 1825 theList.add(11.14f); 1826 x.setVarAttrib("x_attr"); 1827 1828 OccuringChoice yOriginal = new OccuringChoice(); 1829 theList = yOriginal.getVarFloatOrVarIntOrVarString(); 1830 theList.add(3.14f); 1831 theList.add("y"); 1832 theList.add(42); 1833 yOriginal.setVarAttrib("y_attr"); 1834 1835 Holder<OccuringChoice> y = new Holder<OccuringChoice>(yOriginal); 1836 Holder<OccuringChoice> z = new Holder<OccuringChoice>(); 1837 1838 OccuringChoice ret; 1839 if (testDocLiteral) { 1840 ret = docClient.testOccuringChoice(x, y, z); 1841 } else { 1842 ret = rpcClient.testOccuringChoice(x, y, z); 1843 } 1844 if (!perfTestOnly) { 1845 assertTrue("testOccuringChoice(): Incorrect value for inout param", 1846 equals(x, y.value)); 1847 assertTrue("testOccuringChoice(): Incorrect value for out param", 1848 equals(yOriginal, z.value)); 1849 assertTrue("testOccuringChoice(): Incorrect return value", 1850 equals(x, ret)); 1851 } 1852 1853 theList.add(52); 1854 theList.add(4.14f); 1855 1856 y = new Holder<OccuringChoice>(yOriginal); 1857 z = new Holder<OccuringChoice>(); 1858 1859 if (testDocLiteral) { 1860 ret = docClient.testOccuringChoice(x, y, z); 1861 } else { 1862 ret = rpcClient.testOccuringChoice(x, y, z); 1863 } 1864 if (!perfTestOnly) { 1865 assertTrue("testOccuringChoice(): Incorrect value for inout param", 1866 equals(x, y.value)); 1867 assertTrue("testOccuringChoice(): Incorrect value for out param", 1868 equals(yOriginal, z.value)); 1869 assertTrue("testOccuringChoice(): Incorrect return value", 1870 equals(x, ret)); 1871 } 1872 } 1873 1874 1876 protected boolean equals(OccuringChoice1 x, OccuringChoice1 y) { 1877 List <Comparable > xList = x.getVarFloatOrVarInt(); 1878 List <Comparable > yList = y.getVarFloatOrVarInt(); 1879 int size = xList.size(); 1880 if (size != yList.size()) { 1881 return false; 1882 } 1883 for (int i = 0; i < size; i++) { 1884 if (xList.get(i) instanceof Integer && yList.get(i) instanceof Integer ) { 1885 Integer xi = (Integer )xList.get(i); 1886 Integer yi = (Integer )yList.get(i); 1887 if (xi.compareTo(yi) != 0) { 1888 return false; 1889 } 1890 } 1891 if (xList.get(i) instanceof Float && yList.get(i) instanceof Float ) { 1892 Float xf = (Float )xList.get(i); 1893 Float yf = (Float )yList.get(i); 1894 if (xf.compareTo(yf) != 0) { 1895 return false; 1896 } 1897 } 1898 } 1899 return true; 1900 } 1901 1902 public void testOccuringChoice1() throws Exception { 1903 OccuringChoice1 x = new OccuringChoice1(); 1904 List <Comparable > theList = x.getVarFloatOrVarInt(); 1905 theList.add(0); 1906 theList.add(new Float (1.14f)); 1907 theList.add(1); 1908 theList.add(new Float (11.14f)); 1909 OccuringChoice1 yOriginal = new OccuringChoice1(); 1911 1912 Holder<OccuringChoice1> y = new Holder<OccuringChoice1>(yOriginal); 1913 Holder<OccuringChoice1> z = new Holder<OccuringChoice1>(); 1914 1915 OccuringChoice1 ret; 1916 if (testDocLiteral) { 1917 ret = docClient.testOccuringChoice1(x, y, z); 1918 } else { 1919 ret = rpcClient.testOccuringChoice1(x, y, z); 1920 } 1921 if (!perfTestOnly) { 1922 assertTrue("testOccuringChoice1(): Incorrect value for inout param", 1923 equals(x, y.value)); 1924 assertTrue("testOccuringChoice1(): Incorrect value for out param", 1925 equals(yOriginal, z.value)); 1926 assertTrue("testOccuringChoice1(): Incorrect return value", 1927 equals(x, ret)); 1928 } 1929 } 1930 1931 1933 protected boolean equals(OccuringChoice2 x, OccuringChoice2 y) { 1934 if (x.getVarString() != null && !x.getVarString().equals(y.getVarString())) { 1935 return false; 1936 } 1937 if (x.getVarInt() != null && x.getVarInt() != y.getVarInt()) { 1938 return false; 1939 } 1940 return true; 1941 } 1942 1943 public void testOccuringChoice2() throws Exception { 1944 OccuringChoice2 x = new OccuringChoice2(); 1945 x.setVarString("x1"); 1946 OccuringChoice2 yOriginal = new OccuringChoice2(); 1947 yOriginal.setVarString("y1"); 1948 Holder<OccuringChoice2> y = new Holder<OccuringChoice2>(yOriginal); 1949 Holder<OccuringChoice2> z = new Holder<OccuringChoice2>(); 1950 OccuringChoice2 ret; 1951 if (testDocLiteral) { 1952 ret = docClient.testOccuringChoice2(x, y, z); 1953 } else { 1954 ret = rpcClient.testOccuringChoice2(x, y, z); 1955 } 1956 1957 if (!perfTestOnly) { 1958 assertTrue("testOccuringChoice2(): Incorrect value for inout param", 1959 equals(x, y.value)); 1960 assertTrue("testOccuringChoice2(): Incorrect value for out param", 1961 equals(yOriginal, z.value)); 1962 assertTrue("testOccuringChoice2(): Incorrect return value", 1963 equals(x, ret)); 1964 } 1965 1966 x = new OccuringChoice2(); 1967 yOriginal = new OccuringChoice2(); 1968 yOriginal.setVarString("y1"); 1969 y = new Holder<OccuringChoice2>(yOriginal); 1970 z = new Holder<OccuringChoice2>(); 1971 if (testDocLiteral) { 1972 ret = docClient.testOccuringChoice2(x, y, z); 1973 } else { 1974 ret = rpcClient.testOccuringChoice2(x, y, z); 1975 } 1976 1977 if (!perfTestOnly) { 1978 assertTrue("testOccuringChoice2(): Incorrect value for inout param", 1979 equals(x, y.value)); 1980 assertTrue("testOccuringChoice2(): Incorrect value for out param", 1981 equals(yOriginal, z.value)); 1982 assertTrue("testOccuringChoice2(): Incorrect return value", 1983 equals(x, ret)); 1984 } 1985 } 1986} 1987 | Popular Tags |