1 package org.objectweb.celtix.systest.type_test; 2 3 import java.io.Serializable ; 4 import java.math.BigDecimal ; 5 import java.math.BigInteger ; 6 import java.util.Arrays ; 7 import java.util.List ; 8 import java.util.Map ; 9 10 import javax.xml.namespace.QName ; 11 import javax.xml.ws.Holder; 12 13 import org.objectweb.type_test.types1.AnonymousType; 14 import org.objectweb.type_test.types1.DerivedChoiceBaseArray; 22 import org.objectweb.type_test.types1.DerivedEmptyBaseEmptyAll; 24 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.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 name, QName theServicename, 54 QName thePort, String theWsdlPath) { 55 super(name, theServicename, thePort, theWsdlPath); 56 } 57 58 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 { 72 QName xAt1Name = new QName ("http://objectweb.org/type_test", "at_one"); 73 QName xAt2Name = new QName ("http://objectweb.org/type_test", "at_two"); 74 QName yAt3Name = new QName ("http://objectweb.org/type_test", "at_thr"); 75 QName yAt4Name = new QName ("http://objectweb.org/type_test", "at_fou"); 76 77 SimpleContentExtWithAnyAttribute x = new SimpleContentExtWithAnyAttribute(); 78 x.setValue("foo"); 79 x.setAttrib(new Integer (2000)); 80 81 SimpleContentExtWithAnyAttribute y = new SimpleContentExtWithAnyAttribute(); 82 y.setValue("bar"); 83 y.setAttrib(new Integer (2001)); 84 85 Map <QName , String > xAttrMap = x.getOtherAttributes(); 86 xAttrMap.put(xAt1Name, "one"); 87 xAttrMap.put(xAt2Name, "two"); 88 89 Map <QName , String > 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 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 { 124 OccuringAll x = new OccuringAll(); 125 x.setVarInt(new Integer (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 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 <Serializable > xList = x.getVarStringAndVarInt(); 152 List <Serializable > 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 <Serializable > xList, List <Serializable > 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 && yList.get(i) instanceof String ) { 166 if (!xList.get(i).equals(yList.get(i))) { 167 return false; 168 } 169 } else if (xList.get(i) instanceof Integer && yList.get(i) instanceof Integer ) { 170 Integer ix = (Integer )xList.get(i); 171 Integer iy = (Integer )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 { 183 QName xAt1Name = new QName ("http://objectweb.org/type_test", "at_one"); 184 QName xAt2Name = new QName ("http://objectweb.org/type_test", "at_two"); 185 QName yAt3Name = new QName ("http://objectweb.org/type_test", "at_thr"); 186 QName yAt4Name = new QName ("http://objectweb.org/type_test", "at_fou"); 187 188 OccuringStructWithAnyAttribute x = new OccuringStructWithAnyAttribute(); 189 OccuringStructWithAnyAttribute y = new OccuringStructWithAnyAttribute(); 190 List <Serializable > 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 (2000)); 197 198 List <Serializable > yVarStringAndVarInt = y.getVarStringAndVarInt(); 199 yVarStringAndVarInt.add("there"); 200 yVarStringAndVarInt.add(1001); 201 y.setAtString("another attribute"); 202 y.setAtInt(new Integer (2002)); 203 204 Map <QName , String > xAttrMap = x.getOtherAttributes(); 205 xAttrMap.put(xAt1Name, "one"); 206 xAttrMap.put(xAt2Name, "two"); 207 208 Map <QName , String > 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 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 <Serializable > xList = x.getVarStringOrVarInt(); 240 List <Serializable > 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 { 248 QName xAt1Name = new QName ("http://schemas.iona.com/type_test", "at_one"); 249 QName xAt2Name = new QName ("http://schemas.iona.com/type_test", "at_two"); 250 QName yAt3Name = new QName ("http://objectweb.org/type_test", "at_thr"); 251 QName yAt4Name = new QName ("http://objectweb.org/type_test", "at_fou"); 252 253 OccuringChoiceWithAnyAttribute x = new OccuringChoiceWithAnyAttribute(); 254 OccuringChoiceWithAnyAttribute y = new OccuringChoiceWithAnyAttribute(); 255 256 List <Serializable > xVarStringOrVarInt = x.getVarStringOrVarInt(); 257 xVarStringOrVarInt.add("hello"); 258 xVarStringOrVarInt.add(1); 259 x.setAtString("attribute"); 260 x.setAtInt(new Integer (2000)); 261 262 List <Serializable > yVarStringOrVarInt = y.getVarStringOrVarInt(); 263 yVarStringOrVarInt.add(1001); 264 y.setAtString("the attribute"); 265 y.setAtInt(new Integer (2002)); 266 267 Map <QName , String > xAttrMap = x.getOtherAttributes(); 268 xAttrMap.put(xAt1Name, "one"); 269 xAttrMap.put(xAt2Name, "two"); 270 271 Map <QName , String > 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 296 protected boolean equals(MRecSeqA x, MRecSeqA y) { 297 List <MRecSeqB> xList = x.getSeqB(); 298 List <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 { 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 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 <MRecSeqD> xList = x.getSeqD(); 358 List <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 { 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 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 { 435 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 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 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 <Serializable > xList = x.getVarIntOrVarString(); 505 List <Serializable > 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 && yList.get(i) instanceof Integer ) { 512 Integer ix = (Integer )xList.get(i); 513 Integer iy = (Integer )yList.get(i); 514 if (iy.compareTo(ix) != 0) { 515 return false; 516 } 517 } else if (xList.get(i) instanceof String && yList.get(i) instanceof String ) { 518 String sx = (String )xList.get(i); 519 String sy = (String )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 { 536 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 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 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 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 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 { 673 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 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 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 763 protected boolean equals(StructWithOccuringStruct x, StructWithOccuringStruct y) { 764 if (x.getVarInteger() != y.getVarInteger()) { 765 return false; 766 } 767 768 List <Comparable > xList = x.getVarIntAndVarFloat(); 769 List <Comparable > 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 && yList.get(i) instanceof Integer ) { 777 if (((Integer )xList.get(i)).compareTo((Integer )yList.get(i)) != 0) { 778 return false; 779 } 780 } else if (xList.get(i) instanceof Float && yList.get(i) instanceof Float ) { 781 if (((Float )xList.get(i)).compareTo((Float )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 { 797 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 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 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 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 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 { 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 949 protected boolean equals(RecSeqB6918 x, RecSeqB6918 y) { 950 List <Object > xList = x.getNextSeqAndVarInt(); 951 List <Object > 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 xo = xList.get(i); 958 Object yo = yList.get(i); 959 if (xo instanceof Integer ) { 960 if (yo instanceof Integer ) { 961 if (((Integer )xo).compareTo((Integer )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 { 979 RecSeqB6918 x = new RecSeqB6918(); 980 List <Object > theList = x.getNextSeqAndVarInt(); 981 theList.add(new Integer (6)); 982 theList.add(new RecSeqB6918()); 983 theList.add(new Integer (42)); 984 RecSeqB6918 yOrig = new RecSeqB6918(); 985 theList = yOrig.getNextSeqAndVarInt(); 986 theList.add(x); 987 theList.add(new Integer (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 1538 1539 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 { 1548 RestrictedStructBaseStruct x = new RestrictedStructBaseStruct(); 1549 x.setVarFloat(3.14f); 1550 x.setVarInt(new BigInteger ("42")); 1551 x.setVarAttrString("BaseStructAttr-x"); 1552 RestrictedStructBaseStruct yOrig = new RestrictedStructBaseStruct(); 1553 yOrig.setVarFloat(-9.14f); 1554 yOrig.setVarInt(new BigInteger ("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 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 { 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 1613 public void testUnionWithStringList() throws Exception { 1614 if (testDocLiteral) { 1615 List <String > x = Arrays.asList("5"); 1616 List <String > yOrig = Arrays.asList("I", "am", "SimpleList"); 1617 1618 Holder<List <String >> y = new Holder<List <String >>(yOrig); 1620 Holder<List <String >> z = new Holder<List <String >>(); 1621 List <String > 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 [] x = {"5"}; 1631 String [] yOrig = {"I", "am", "SimpleList"}; 1632 1633 Holder<String []> y = new Holder<String []>(yOrig); 1634 Holder<String []> z = new Holder<String []>(); 1635 1636 String [] 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 1650 public void testUnionWithStringListRestriction() throws Exception { 1651 if (testDocLiteral) { 1652 List <String > x = Arrays.asList("5"); 1653 List <String > yOrig = Arrays.asList("I", "am", "SimpleList"); 1654 1655 Holder<List <String >> y = new Holder<List <String >>(yOrig); 1657 Holder<List <String >> z = new Holder<List <String >>(); 1658 List <String > 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 [] x = {"5"}; 1668 String [] yOrig = {"I", "am", "SimpleList"}; 1669 1670 Holder<String []> y = new Holder<String []>(yOrig); 1671 Holder<String []> z = new Holder<String []>(); 1672 1673 String [] 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 1687 public void testUnionWithAnonList() throws Exception { 1688 if (testDocLiteral) { 1689 List <String > x = Arrays.asList("5"); 1690 List <String > yOrig = Arrays.asList("0.5f", "1.5f", "2.5f"); 1691 1692 Holder<List <String >> y = new Holder<List <String >>(yOrig); 1694 Holder<List <String >> z = new Holder<List <String >>(); 1695 List <String > 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 [] x = {"5"}; 1703 String [] yOrig = {"0.5f", "1.5f", "2.5f"}; 1704 1705 Holder<String []> y = new Holder<String []>(yOrig); 1706 Holder<String []> z = new Holder<String []>(); 1707 1708 String [] 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 { 1721 String x = new String ("http://celtix.objectweb.org/"); 1723 String yOrig = new String ("http://www.iona.com/info/services/oss/"); 1724 Holder<String > y = new Holder<String >(yOrig); 1725 Holder<String > z = new Holder<String >(); 1726 1727 String 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 yOrig = new String ("http://www.iona.com/info/services/oss/info_services_oss_train.html"); 1742 y = new Holder<String >(yOrig); 1743 z = new Holder<String >(); 1744 try { 1745 ret = docClient.testAnyURIRestriction(x, y, z); 1746 fail("maxLength=50 restriction is violated."); 1747 } catch (Exception ex) { 1748 } 1750 } 1751 } 1752 1753 1755 public void testInheritanceNestedStruct() throws Exception { 1757 DerivedStructBaseStruct xs = new DerivedStructBaseStruct(); 1758 xs.setVarFloat(3.14f); 1760 xs.setVarInt(new BigInteger ("42")); 1761 xs.setVarString("BaseStruct-x"); 1762 xs.setVarAttrString("BaseStructAttr-x"); 1763 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 ys.setVarFloat(-9.14f); 1772 ys.setVarInt(new BigInteger ("10")); 1773 ys.setVarString("BaseStruct-y"); 1774 ys.setVarAttrString("BaseStructAttr-y"); 1775 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 ("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 ("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 public void testInheritanceSimpleStructDerivedStruct() throws Exception { 1814 DerivedStructBaseStruct x = new DerivedStructBaseStruct(); 1815 x.setVarFloat(3.14f); 1817 x.setVarInt(new BigInteger ("42")); 1818 x.setVarString("BaseStruct-x"); 1819 x.setVarAttrString("BaseStructAttr-x"); 1820 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 yOrig.setVarFloat(-9.14f); 1829 yOrig.setVarInt(new BigInteger ("10")); 1830 yOrig.setVarString("BaseStruct-y"); 1831 yOrig.setVarAttrString("BaseStructAttr-y"); 1832 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 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 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 { 1874 DerivedStructBaseChoice x = new DerivedStructBaseChoice(); 1875 x.setVarString("BaseChoice-x"); 1877 x.setVarFloatExt(-3.14f); 1879 x.setVarStringExt("DerivedStruct-x"); 1880 x.setAttrString("DerivedAttr-x"); 1881 1882 DerivedStructBaseChoice yOrig = new DerivedStructBaseChoice(); 1883 yOrig.setVarFloat(-9.14f); 1885 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 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 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 { 1926 DerivedChoiceBaseArray x = new DerivedChoiceBaseArray(); 1927 x.getItem().addAll(Arrays.asList("AAA", "BBB", "CCC")); 1929 x.setVarStringExt("DerivedChoice-x"); 1931 x.setAttrStringExt("DerivedAttr-x"); 1932 1933 DerivedChoiceBaseArray yOrig = new DerivedChoiceBaseArray(); 1934 yOrig.getItem().addAll(Arrays.asList("XXX", "YYY", "ZZZ")); 1936 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 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 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 { 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 assertNotNull("testInheritanceEmptyAllDerivedEmpty()", y.value); 1988 assertNotNull("testInheritanceEmptyAllDerivedEmpty()", z.value); 1989 assertNotNull("testInheritanceEmptyAllDerivedEmpty()", ret); 1990 } 1991} 1992 | Popular Tags |