0001: package org.objectweb.celtix.systest.type_test;
0002:
0003: import java.io.Serializable;
0004: import java.math.BigInteger;
0005: import java.util.Arrays;
0006: import java.util.Iterator;
0007: import java.util.List;
0008: import java.util.Map;
0009:
0010: import javax.xml.namespace.QName;
0011: import javax.xml.soap.Name;
0012: import javax.xml.soap.SOAPElement;
0013: import javax.xml.soap.SOAPFactory;
0014: import javax.xml.ws.Holder;
0015:
0016: import org.w3c.dom.Element;
0017:
0018: import org.objectweb.type_test.types1.DerivedChoiceBaseArray;
0019: import org.objectweb.type_test.types1.DerivedChoiceBaseChoice;
0020: import org.objectweb.type_test.types1.DerivedChoiceBaseStruct;
0021: import org.objectweb.type_test.types1.DerivedEmptyBaseEmptyAll;
0022: import org.objectweb.type_test.types1.DerivedEmptyBaseEmptyChoice;
0023: import org.objectweb.type_test.types1.DerivedNoContent;
0024: import org.objectweb.type_test.types1.DerivedStructBaseChoice;
0025: import org.objectweb.type_test.types1.DerivedStructBaseEmpty;
0026: import org.objectweb.type_test.types1.DerivedStructBaseStruct;
0027: import org.objectweb.type_test.types1.RestrictedChoiceBaseChoice;
0028: import org.objectweb.type_test.types1.SimpleChoice;
0029: import org.objectweb.type_test.types1.SimpleStruct;
0030: import org.objectweb.type_test.types1.UnboundedArray;
0031: import org.objectweb.type_test.types2.ChoiceOfChoice;
0032: import org.objectweb.type_test.types2.ChoiceOfSeq;
0033: import org.objectweb.type_test.types2.ChoiceWithAnyAttribute;
0034: import org.objectweb.type_test.types2.ChoiceWithBinary;
0035: import org.objectweb.type_test.types2.ChoiceWithGroupChoice;
0036: import org.objectweb.type_test.types2.ChoiceWithGroupSeq;
0037: import org.objectweb.type_test.types2.ChoiceWithGroups;
0038: import org.objectweb.type_test.types2.ComplexTypeWithAttributeGroup;
0039: import org.objectweb.type_test.types2.ComplexTypeWithAttributeGroup1;
0040: import org.objectweb.type_test.types2.ComplexTypeWithAttributes;
0041: import org.objectweb.type_test.types2.ExtBase64Binary;
0042: import org.objectweb.type_test.types2.GroupDirectlyInComplexType;
0043: import org.objectweb.type_test.types2.IDTypeAttribute;
0044: import org.objectweb.type_test.types2.MultipleOccursSequenceInSequence;
0045: import org.objectweb.type_test.types2.SequenceWithGroupChoice;
0046: import org.objectweb.type_test.types2.SequenceWithGroupSeq;
0047: import org.objectweb.type_test.types2.SequenceWithGroups;
0048: import org.objectweb.type_test.types2.SequenceWithOccuringGroup;
0049: import org.objectweb.type_test.types2.StructWithAny;
0050: import org.objectweb.type_test.types2.StructWithAnyArray;
0051: import org.objectweb.type_test.types2.StructWithAnyAttribute;
0052: import org.objectweb.type_test.types2.StructWithBinary;
0053: import org.objectweb.type_test.types3.OccuringChoice;
0054: import org.objectweb.type_test.types3.OccuringChoice1;
0055: import org.objectweb.type_test.types3.OccuringChoice2;
0056: import org.objectweb.type_test.types3.OccuringStruct;
0057: import org.objectweb.type_test.types3.OccuringStruct1;
0058: import org.objectweb.type_test.types3.OccuringStruct2;
0059:
0060: public abstract class AbstractTypeTestClient3 extends
0061: AbstractTypeTestClient2 {
0062:
0063: public AbstractTypeTestClient3(String name, QName theServicename,
0064: QName thePort, String theWsdlPath) {
0065: super (name, theServicename, thePort, theWsdlPath);
0066: }
0067:
0068: // org.objectweb.type_test.types2.ChoiceOfChoice
0069:
0070: protected boolean equals(ChoiceOfChoice x, ChoiceOfChoice y) {
0071: if (x.getVarInt() != null && y.getVarInt() != null) {
0072: return x.getVarInt().equals(y.getVarInt());
0073: }
0074: if (x.getVarFloat() != null && y.getVarFloat() != null) {
0075: return x.getVarFloat().equals(y.getVarFloat());
0076: }
0077: if (x.getVarOtherInt() != null && y.getVarOtherInt() != null) {
0078: return x.getVarOtherInt().equals(y.getVarOtherInt());
0079: }
0080: if (x.getVarString() != null && y.getVarString() != null) {
0081: return x.getVarString().equals(y.getVarString());
0082: }
0083: return false;
0084: }
0085:
0086: public void testChoiceOfChoice() throws Exception {
0087: ChoiceOfChoice x = new ChoiceOfChoice();
0088: ChoiceOfChoice yOrig = new ChoiceOfChoice();
0089: x.setVarFloat(3.14f);
0090: yOrig.setVarString("y456");
0091:
0092: Holder<ChoiceOfChoice> y = new Holder<ChoiceOfChoice>(yOrig);
0093: Holder<ChoiceOfChoice> z = new Holder<ChoiceOfChoice>();
0094:
0095: ChoiceOfChoice ret;
0096: if (testDocLiteral) {
0097: ret = docClient.testChoiceOfChoice(x, y, z);
0098: } else {
0099: ret = rpcClient.testChoiceOfChoice(x, y, z);
0100: }
0101: if (!perfTestOnly) {
0102: assertTrue(
0103: "testChoiceOfChoice(): Incorrect value for inout param",
0104: equals(x, y.value));
0105: assertTrue(
0106: "testChoiceOfChoice(): Incorrect value for out param",
0107: equals(yOrig, z.value));
0108: assertTrue("testChoiceOfChoice(): Incorrect return value",
0109: equals(x, ret));
0110: }
0111: }
0112:
0113: // org.objectweb.type_test.types2.ChoiceOfSeq
0114:
0115: protected boolean equals(ChoiceOfSeq x, ChoiceOfSeq y) {
0116: if (x.getVarFloat() != null && x.getVarInt() != null
0117: && y.getVarFloat() != null && y.getVarInt() != null) {
0118: return x.getVarInt().equals(y.getVarInt())
0119: && x.getVarFloat().compareTo(y.getVarFloat()) == 0;
0120: }
0121: if (x.getVarOtherInt() != null && y.getVarOtherInt() != null
0122: && x.getVarString() != null && y.getVarString() != null) {
0123: return x.getVarOtherInt().equals(y.getVarOtherInt())
0124: && x.getVarString().equals(y.getVarString());
0125: }
0126: return false;
0127: }
0128:
0129: public void testChoiceOfSeq() throws Exception {
0130: ChoiceOfSeq x = new ChoiceOfSeq();
0131: x.setVarInt(123);
0132: x.setVarFloat(3.14f);
0133:
0134: ChoiceOfSeq yOrig = new ChoiceOfSeq();
0135: yOrig.setVarOtherInt(456);
0136: yOrig.setVarString("y456");
0137:
0138: Holder<ChoiceOfSeq> y = new Holder<ChoiceOfSeq>(yOrig);
0139: Holder<ChoiceOfSeq> z = new Holder<ChoiceOfSeq>();
0140:
0141: ChoiceOfSeq ret;
0142: if (testDocLiteral) {
0143: ret = docClient.testChoiceOfSeq(x, y, z);
0144: } else {
0145: ret = rpcClient.testChoiceOfSeq(x, y, z);
0146: }
0147: if (!perfTestOnly) {
0148: assertTrue(
0149: "testChoiceOfSeq(): Incorrect value for inout param",
0150: equals(x, y.value));
0151: assertTrue(
0152: "testChoiceOfSeq(): Incorrect value for out param",
0153: equals(yOrig, z.value));
0154: assertTrue("testChoiceOfSeq(): Incorrect return value",
0155: equals(x, ret));
0156: }
0157: }
0158:
0159: // org.objectweb.type_test.types1.DerivedStructBaseStruct
0160:
0161: protected boolean equals(DerivedStructBaseStruct x,
0162: DerivedStructBaseStruct y) {
0163: return equals((SimpleStruct) x, (SimpleStruct) y)
0164: && (x.getVarFloatExt() == y.getVarFloatExt())
0165: && (x.getVarStringExt().equals(y.getVarStringExt()))
0166: && (x.getAttrString1().equals(y.getAttrString1()))
0167: && (x.getAttrString2().equals(y.getAttrString2()));
0168: }
0169:
0170: public void testDerivedStructBaseStruct() throws Exception {
0171: DerivedStructBaseStruct x = new DerivedStructBaseStruct();
0172: //Base
0173: x.setVarFloat(3.14f);
0174: x.setVarInt(new BigInteger("42"));
0175: x.setVarString("BaseStruct-x");
0176: x.setVarAttrString("BaseStructAttr-x");
0177: //Derived
0178: x.setVarFloatExt(-3.14f);
0179: x.setVarStringExt("DerivedStruct-x");
0180: x.setAttrString1("DerivedAttr1-x");
0181: x.setAttrString2("DerivedAttr2-x");
0182:
0183: DerivedStructBaseStruct yOrig = new DerivedStructBaseStruct();
0184: //Base
0185: yOrig.setVarFloat(-9.14f);
0186: yOrig.setVarInt(new BigInteger("10"));
0187: yOrig.setVarString("BaseStruct-y");
0188: yOrig.setVarAttrString("BaseStructAttr-y");
0189: //Derived
0190: yOrig.setVarFloatExt(1.414f);
0191: yOrig.setVarStringExt("DerivedStruct-y");
0192: yOrig.setAttrString1("DerivedAttr1-y");
0193: yOrig.setAttrString2("DerivedAttr2-y");
0194:
0195: Holder<DerivedStructBaseStruct> y = new Holder<DerivedStructBaseStruct>(
0196: yOrig);
0197: Holder<DerivedStructBaseStruct> z = new Holder<DerivedStructBaseStruct>();
0198: DerivedStructBaseStruct ret;
0199: if (testDocLiteral) {
0200: ret = docClient.testDerivedStructBaseStruct(x, y, z);
0201: } else {
0202: ret = rpcClient.testDerivedStructBaseStruct(x, y, z);
0203: }
0204: if (!perfTestOnly) {
0205: assertTrue(
0206: "testDerivedStructBaseStruct(): Incorrect value for inout param",
0207: equals(x, y.value));
0208: assertTrue(
0209: "testDerivedStructBaseStruct(): Incorrect value for out param",
0210: equals(yOrig, z.value));
0211: assertTrue(
0212: "testDerivedStructBaseStruct(): Incorrect return value",
0213: equals(x, ret));
0214: }
0215: }
0216:
0217: // org.objectweb.type_test.types1.DerivedStructBaseChoice
0218:
0219: protected boolean equals(DerivedStructBaseChoice x,
0220: DerivedStructBaseChoice y) {
0221: return equals((SimpleChoice) x, (SimpleChoice) y)
0222: && (Float.compare(x.getVarFloatExt(), y
0223: .getVarFloatExt()) == 0)
0224: && (x.getVarStringExt().equals(y.getVarStringExt()))
0225: && (x.getAttrString().equals(y.getAttrString()));
0226: }
0227:
0228: public void testDerivedStructBaseChoice() throws Exception {
0229: DerivedStructBaseChoice x = new DerivedStructBaseChoice();
0230: //Base
0231: x.setVarString("BaseChoice-x");
0232: //Derived
0233: x.setVarFloatExt(-3.14f);
0234: x.setVarStringExt("DerivedStruct-x");
0235: x.setAttrString("DerivedAttr-x");
0236:
0237: DerivedStructBaseChoice yOrig = new DerivedStructBaseChoice();
0238: //Base
0239: yOrig.setVarFloat(-9.14f);
0240: //Derived
0241: yOrig.setVarFloatExt(1.414f);
0242: yOrig.setVarStringExt("DerivedStruct-y");
0243: yOrig.setAttrString("DerivedAttr-y");
0244:
0245: Holder<DerivedStructBaseChoice> y = new Holder<DerivedStructBaseChoice>(
0246: yOrig);
0247: Holder<DerivedStructBaseChoice> z = new Holder<DerivedStructBaseChoice>();
0248: DerivedStructBaseChoice ret;
0249: if (testDocLiteral) {
0250: ret = docClient.testDerivedStructBaseChoice(x, y, z);
0251: } else {
0252: ret = rpcClient.testDerivedStructBaseChoice(x, y, z);
0253: }
0254: if (!perfTestOnly) {
0255: assertTrue(
0256: "testDerivedStructBaseChoice(): Incorrect value for inout param",
0257: equals(x, y.value));
0258: assertTrue(
0259: "testDerivedStructBaseChoice(): Incorrect value for out param",
0260: equals(yOrig, z.value));
0261: assertTrue(
0262: "testDerivedStructBaseChoice(): Incorrect return value",
0263: equals(x, ret));
0264: }
0265: }
0266:
0267: // org.objectweb.type_test.types1.DerivedChoiceBaseStruct
0268:
0269: protected boolean equals(DerivedChoiceBaseStruct x,
0270: DerivedChoiceBaseStruct y) {
0271: boolean isEquals = x.getAttrString().equals(y.getAttrString());
0272: if (x.getVarStringExt() != null && y.getVarStringExt() != null) {
0273: isEquals &= x.getVarStringExt().equals(y.getVarStringExt());
0274: } else {
0275: isEquals &= x.getVarFloatExt() != null
0276: && y.getVarFloatExt() != null
0277: && x.getVarFloatExt().compareTo(y.getVarFloatExt()) == 0;
0278: }
0279: return isEquals && equals((SimpleStruct) x, (SimpleStruct) y);
0280: }
0281:
0282: public void testDerivedChoiceBaseStruct() throws Exception {
0283: DerivedChoiceBaseStruct x = new DerivedChoiceBaseStruct();
0284: //Base
0285: x.setVarFloat(3.14f);
0286: x.setVarInt(new BigInteger("42"));
0287: x.setVarString("BaseStruct-x");
0288: x.setVarAttrString("BaseStructAttr-x");
0289: //Derived
0290: x.setVarStringExt("DerivedChoice-x");
0291: x.setAttrString("DerivedAttr-x");
0292:
0293: DerivedChoiceBaseStruct yOrig = new DerivedChoiceBaseStruct();
0294: // Base
0295: yOrig.setVarFloat(-9.14f);
0296: yOrig.setVarInt(new BigInteger("10"));
0297: yOrig.setVarString("BaseStruct-y");
0298: yOrig.setVarAttrString("BaseStructAttr-y");
0299: // Derived
0300: yOrig.setVarFloatExt(1.414f);
0301: yOrig.setAttrString("DerivedAttr-y");
0302:
0303: Holder<DerivedChoiceBaseStruct> y = new Holder<DerivedChoiceBaseStruct>(
0304: yOrig);
0305: Holder<DerivedChoiceBaseStruct> z = new Holder<DerivedChoiceBaseStruct>();
0306: DerivedChoiceBaseStruct ret;
0307: if (testDocLiteral) {
0308: ret = docClient.testDerivedChoiceBaseStruct(x, y, z);
0309: } else {
0310: ret = rpcClient.testDerivedChoiceBaseStruct(x, y, z);
0311: }
0312: if (!perfTestOnly) {
0313: assertTrue(
0314: "testDerivedChoiceBaseStruct(): Incorrect value for inout param",
0315: equals(x, y.value));
0316: assertTrue(
0317: "testDerivedChoiceBaseStruct(): Incorrect value for out param",
0318: equals(yOrig, z.value));
0319: assertTrue(
0320: "testDerivedChoiceBaseStruct(): Incorrect return value",
0321: equals(x, ret));
0322: }
0323: }
0324:
0325: // org.objectweb.type_test.types1.DerivedChoiceBaseArray
0326:
0327: protected boolean equals(DerivedChoiceBaseArray x,
0328: DerivedChoiceBaseArray y) {
0329: boolean isEquals = x.getAttrStringExt().equals(
0330: y.getAttrStringExt());
0331: if (x.getVarFloatExt() != null && y.getVarFloatExt() != null) {
0332: isEquals &= x.getVarFloatExt()
0333: .compareTo(y.getVarFloatExt()) == 0;
0334: } else {
0335: isEquals &= x.getVarStringExt() != null
0336: && y.getVarStringExt() != null
0337: && x.getVarStringExt().equals(y.getVarStringExt());
0338: }
0339: return isEquals
0340: && equals((UnboundedArray) x, (UnboundedArray) y);
0341: }
0342:
0343: public void testDerivedChoiceBaseArray() throws Exception {
0344: DerivedChoiceBaseArray x = new DerivedChoiceBaseArray();
0345: //Base
0346: x.getItem().addAll(Arrays.asList("AAA", "BBB", "CCC"));
0347: //Derived
0348: x.setVarStringExt("DerivedChoice-x");
0349: x.setAttrStringExt("DerivedAttr-x");
0350:
0351: DerivedChoiceBaseArray yOrig = new DerivedChoiceBaseArray();
0352: //Base
0353: yOrig.getItem().addAll(Arrays.asList("XXX", "YYY", "ZZZ"));
0354: //Derived
0355: yOrig.setVarFloatExt(1.414f);
0356: yOrig.setAttrStringExt("DerivedAttr-y");
0357:
0358: Holder<DerivedChoiceBaseArray> y = new Holder<DerivedChoiceBaseArray>(
0359: yOrig);
0360: Holder<DerivedChoiceBaseArray> z = new Holder<DerivedChoiceBaseArray>();
0361: DerivedChoiceBaseArray ret;
0362: if (testDocLiteral) {
0363: ret = docClient.testDerivedChoiceBaseArray(x, y, z);
0364: } else {
0365: ret = rpcClient.testDerivedChoiceBaseArray(x, y, z);
0366: }
0367: if (!perfTestOnly) {
0368: assertTrue(
0369: "testDerivedChoiceBaseArray(): Incorrect value for inout param",
0370: equals(x, y.value));
0371: assertTrue(
0372: "testDerivedChoiceBaseArray(): Incorrect value for out param",
0373: equals(yOrig, z.value));
0374: assertTrue(
0375: "testDerivedChoiceBaseArray(): Incorrect return value",
0376: equals(ret, x));
0377: }
0378: }
0379:
0380: // org.objectweb.type_test.types1.DerivedChoiceBaseChoice
0381:
0382: protected boolean equals(DerivedChoiceBaseChoice x,
0383: DerivedChoiceBaseChoice y) {
0384: boolean isEquals = x.getAttrString().equals(y.getAttrString());
0385: if (x.getVarStringExt() != null && y.getVarStringExt() != null) {
0386: isEquals &= x.getVarStringExt().equals(y.getVarStringExt());
0387: } else {
0388: isEquals &= x.getVarFloatExt() != null
0389: && y.getVarFloatExt() != null
0390: && x.getVarFloatExt().compareTo(y.getVarFloatExt()) == 0;
0391: }
0392: return isEquals && equals((SimpleChoice) x, (SimpleChoice) y);
0393: }
0394:
0395: public void testDerivedChoiceBaseChoice() throws Exception {
0396: DerivedChoiceBaseChoice x = new DerivedChoiceBaseChoice();
0397: //Base
0398: x.setVarString("BaseChoice-x");
0399: //Derived
0400: x.setVarStringExt("DerivedChoice-x");
0401: x.setAttrString("DerivedAttr-x");
0402:
0403: DerivedChoiceBaseChoice yOrig = new DerivedChoiceBaseChoice();
0404: //Base
0405: yOrig.setVarFloat(-9.14f);
0406: //Derived
0407: yOrig.setVarFloatExt(1.414f);
0408: yOrig.setAttrString("DerivedAttr-y");
0409:
0410: Holder<DerivedChoiceBaseChoice> y = new Holder<DerivedChoiceBaseChoice>(
0411: yOrig);
0412: Holder<DerivedChoiceBaseChoice> z = new Holder<DerivedChoiceBaseChoice>();
0413: DerivedChoiceBaseChoice ret;
0414: if (testDocLiteral) {
0415: ret = docClient.testDerivedChoiceBaseChoice(x, y, z);
0416: } else {
0417: ret = rpcClient.testDerivedChoiceBaseChoice(x, y, z);
0418: }
0419: if (!perfTestOnly) {
0420: assertTrue(
0421: "testDerivedChoiceBaseChoice(): Incorrect value for inout param",
0422: equals(x, y.value));
0423: assertTrue(
0424: "testDerivedChoiceBaseChoice(): Incorrect value for out param",
0425: equals(yOrig, z.value));
0426: assertTrue(
0427: "testDerivedChoiceBaseChoice(): Incorrect return value",
0428: equals(x, ret));
0429: }
0430: }
0431:
0432: // org.objectweb.type_test.types1.DerivedNoContent
0433:
0434: protected boolean equals(DerivedNoContent x, DerivedNoContent y) {
0435: return equals((SimpleStruct) x, (SimpleStruct) y)
0436: && x.getVarAttrString().equals(y.getVarAttrString());
0437: }
0438:
0439: public void testDerivedNoContent() throws Exception {
0440: DerivedNoContent x = new DerivedNoContent();
0441: x.setVarFloat(3.14f);
0442: x.setVarInt(new BigInteger("42"));
0443: x.setVarString("BaseStruct-x");
0444: x.setVarAttrString("BaseStructAttr-x");
0445:
0446: DerivedNoContent yOrig = new DerivedNoContent();
0447: yOrig.setVarFloat(1.414f);
0448: yOrig.setVarInt(new BigInteger("13"));
0449: yOrig.setVarString("BaseStruct-y");
0450: yOrig.setVarAttrString("BaseStructAttr-y");
0451:
0452: Holder<DerivedNoContent> y = new Holder<DerivedNoContent>(yOrig);
0453: Holder<DerivedNoContent> z = new Holder<DerivedNoContent>();
0454: DerivedNoContent ret;
0455: if (testDocLiteral) {
0456: ret = docClient.testDerivedNoContent(x, y, z);
0457: } else {
0458: ret = rpcClient.testDerivedNoContent(x, y, z);
0459: }
0460: if (!perfTestOnly) {
0461: assertTrue(
0462: "testDerivedNoContent(): Incorrect value for inout param",
0463: equals(x, y.value));
0464: assertTrue(
0465: "testDerivedNoContent(): Incorrect value for out param",
0466: equals(yOrig, z.value));
0467: assertTrue(
0468: "testDerivedNoContent(): Incorrect return value",
0469: equals(ret, x));
0470: }
0471: }
0472:
0473: // org.objectweb.type_test.types1.DerivedStructBaseEmpty
0474:
0475: protected boolean equals(DerivedStructBaseEmpty x,
0476: DerivedStructBaseEmpty y) {
0477: return (x.getVarFloatExt() == y.getVarFloatExt())
0478: && (x.getVarStringExt().equals(y.getVarStringExt()))
0479: && (x.getAttrString().equals(y.getAttrString()));
0480: }
0481:
0482: public void testDerivedStructBaseEmpty() throws Exception {
0483: DerivedStructBaseEmpty x = new DerivedStructBaseEmpty();
0484: //Derived
0485: x.setVarFloatExt(-3.14f);
0486: x.setVarStringExt("DerivedStruct-x");
0487: x.setAttrString("DerivedAttr-x");
0488:
0489: DerivedStructBaseEmpty yOrig = new DerivedStructBaseEmpty();
0490: //Derived
0491: yOrig.setVarFloatExt(1.414f);
0492: yOrig.setVarStringExt("DerivedStruct-y");
0493: yOrig.setAttrString("DerivedAttr-y");
0494:
0495: Holder<DerivedStructBaseEmpty> y = new Holder<DerivedStructBaseEmpty>(
0496: yOrig);
0497: Holder<DerivedStructBaseEmpty> z = new Holder<DerivedStructBaseEmpty>();
0498: DerivedStructBaseEmpty ret;
0499: if (testDocLiteral) {
0500: ret = docClient.testDerivedStructBaseEmpty(x, y, z);
0501: } else {
0502: ret = rpcClient.testDerivedStructBaseEmpty(x, y, z);
0503: }
0504: if (!perfTestOnly) {
0505: assertTrue(
0506: "testDerivedStructBaseEmpty(): Incorrect value for inout param",
0507: equals(x, y.value));
0508: assertTrue(
0509: "testDerivedStructBaseEmpty(): Incorrect value for out param",
0510: equals(yOrig, z.value));
0511: assertTrue(
0512: "testDerivedStructBaseEmpty(): Incorrect return value",
0513: equals(x, ret));
0514: }
0515: }
0516:
0517: // org.objectweb.type_test.types1.DerivedEmptyBaseEmptyAll
0518:
0519: public void testDerivedEmptyBaseEmptyAll() throws Exception {
0520: DerivedEmptyBaseEmptyAll x = new DerivedEmptyBaseEmptyAll();
0521: DerivedEmptyBaseEmptyAll yOrig = new DerivedEmptyBaseEmptyAll();
0522: Holder<DerivedEmptyBaseEmptyAll> y = new Holder<DerivedEmptyBaseEmptyAll>(
0523: yOrig);
0524: Holder<DerivedEmptyBaseEmptyAll> z = new Holder<DerivedEmptyBaseEmptyAll>();
0525: DerivedEmptyBaseEmptyAll ret;
0526: if (testDocLiteral) {
0527: ret = docClient.testDerivedEmptyBaseEmptyAll(x, y, z);
0528: } else {
0529: ret = rpcClient.testDerivedEmptyBaseEmptyAll(x, y, z);
0530: }
0531: // not much to check
0532: assertNotNull(y.value);
0533: assertNotNull(z.value);
0534: assertNotNull(ret);
0535: }
0536:
0537: // org.objectweb.type_test.types1.DerivedEmptyBaseEmptyChoice
0538:
0539: public void testDerivedEmptyBaseEmptyChoice() throws Exception {
0540: DerivedEmptyBaseEmptyChoice x = new DerivedEmptyBaseEmptyChoice();
0541: DerivedEmptyBaseEmptyChoice yOrig = new DerivedEmptyBaseEmptyChoice();
0542: Holder<DerivedEmptyBaseEmptyChoice> y = new Holder<DerivedEmptyBaseEmptyChoice>(
0543: yOrig);
0544: Holder<DerivedEmptyBaseEmptyChoice> z = new Holder<DerivedEmptyBaseEmptyChoice>();
0545: DerivedEmptyBaseEmptyChoice ret;
0546: if (testDocLiteral) {
0547: ret = docClient.testDerivedEmptyBaseEmptyChoice(x, y, z);
0548: } else {
0549: ret = rpcClient.testDerivedEmptyBaseEmptyChoice(x, y, z);
0550: }
0551: // not much to check
0552: assertNotNull(y.value);
0553: assertNotNull(z.value);
0554: assertNotNull(ret);
0555: }
0556:
0557: // org.objectweb.type_test.types1.RestrictedChoiceBaseChoice
0558:
0559: protected boolean equals(RestrictedChoiceBaseChoice x,
0560: RestrictedChoiceBaseChoice y) {
0561: if (x.getVarFloat() != null && y.getVarFloat() != null) {
0562: return x.getVarFloat().compareTo(y.getVarFloat()) == 0;
0563: } else {
0564: return x.getVarInt() != null && y.getVarInt() != null
0565: && x.getVarInt().compareTo(y.getVarInt()) == 0;
0566: }
0567: }
0568:
0569: public void testRestrictedChoiceBaseChoice() throws Exception {
0570: RestrictedChoiceBaseChoice x = new RestrictedChoiceBaseChoice();
0571: x.setVarInt(12);
0572:
0573: RestrictedChoiceBaseChoice yOrig = new RestrictedChoiceBaseChoice();
0574: yOrig.setVarFloat(-9.14f);
0575:
0576: Holder<RestrictedChoiceBaseChoice> y = new Holder<RestrictedChoiceBaseChoice>(
0577: yOrig);
0578: Holder<RestrictedChoiceBaseChoice> z = new Holder<RestrictedChoiceBaseChoice>();
0579:
0580: RestrictedChoiceBaseChoice ret;
0581: if (testDocLiteral) {
0582: ret = docClient.testRestrictedChoiceBaseChoice(x, y, z);
0583: } else {
0584: ret = rpcClient.testRestrictedChoiceBaseChoice(x, y, z);
0585: }
0586: if (!perfTestOnly) {
0587: assertTrue(
0588: "testRestrictedChoiceBaseChoice(): Incorrect value for inout param",
0589: equals(x, y.value));
0590: assertTrue(
0591: "testRestrictedChoiceBaseChoice(): Incorrect value for out param",
0592: equals(yOrig, z.value));
0593: assertTrue(
0594: "testRestrictedChoiceBaseChoice(): Incorrect return value",
0595: equals(x, ret));
0596: }
0597: }
0598:
0599: // org.objectweb.type_test.types2.ComplexTypeWithAttributeGroup
0600:
0601: protected boolean equals(ComplexTypeWithAttributeGroup x,
0602: ComplexTypeWithAttributeGroup y) {
0603: return x.getAttrInt().compareTo(y.getAttrInt()) == 0
0604: && x.getAttrString().equals(y.getAttrString());
0605: }
0606:
0607: public void testComplexTypeWithAttributeGroup() throws Exception {
0608: ComplexTypeWithAttributeGroup x = new ComplexTypeWithAttributeGroup();
0609: x.setAttrInt(new BigInteger("123"));
0610: x.setAttrString("x123");
0611: ComplexTypeWithAttributeGroup yOrig = new ComplexTypeWithAttributeGroup();
0612: yOrig.setAttrInt(new BigInteger("456"));
0613: yOrig.setAttrString("x456");
0614:
0615: Holder<ComplexTypeWithAttributeGroup> y = new Holder<ComplexTypeWithAttributeGroup>(
0616: yOrig);
0617: Holder<ComplexTypeWithAttributeGroup> z = new Holder<ComplexTypeWithAttributeGroup>();
0618: ComplexTypeWithAttributeGroup ret;
0619: if (testDocLiteral) {
0620: ret = docClient.testComplexTypeWithAttributeGroup(x, y, z);
0621: } else {
0622: ret = rpcClient.testComplexTypeWithAttributeGroup(x, y, z);
0623: }
0624: if (!perfTestOnly) {
0625: assertTrue(
0626: "testComplexTypeWithAttributeGroup(): Incorrect value for inout param",
0627: equals(x, y.value));
0628: assertTrue(
0629: "testComplexTypeWithAttributeGroup(): Incorrect value for out param",
0630: equals(yOrig, z.value));
0631: assertTrue(
0632: "testComplexTypeWithAttributeGroup(): Incorrect return value",
0633: equals(x, ret));
0634: }
0635: }
0636:
0637: // org.objectweb.type_test.types2.ComplexTypeWithAttributeGroup1
0638:
0639: protected boolean equals(ComplexTypeWithAttributeGroup1 x,
0640: ComplexTypeWithAttributeGroup1 y) {
0641: return x.getAttrInt().compareTo(y.getAttrInt()) == 0
0642: && x.getAttrFloat().compareTo(y.getAttrFloat()) == 0
0643: && x.getAttrString().equals(y.getAttrString());
0644: }
0645:
0646: public void testComplexTypeWithAttributeGroup1() throws Exception {
0647: ComplexTypeWithAttributeGroup1 x = new ComplexTypeWithAttributeGroup1();
0648: x.setAttrInt(new BigInteger("123"));
0649: x.setAttrString("x123");
0650: x.setAttrFloat(new Float(3.14f));
0651: ComplexTypeWithAttributeGroup1 yOrig = new ComplexTypeWithAttributeGroup1();
0652: yOrig.setAttrInt(new BigInteger("456"));
0653: yOrig.setAttrString("x456");
0654: yOrig.setAttrFloat(new Float(6.28f));
0655:
0656: Holder<ComplexTypeWithAttributeGroup1> y = new Holder<ComplexTypeWithAttributeGroup1>(
0657: yOrig);
0658: Holder<ComplexTypeWithAttributeGroup1> z = new Holder<ComplexTypeWithAttributeGroup1>();
0659: ComplexTypeWithAttributeGroup1 ret;
0660: if (testDocLiteral) {
0661: ret = docClient.testComplexTypeWithAttributeGroup1(x, y, z);
0662: } else {
0663: ret = rpcClient.testComplexTypeWithAttributeGroup1(x, y, z);
0664: }
0665: if (!perfTestOnly) {
0666: assertTrue(
0667: "testComplexTypeWithAttributeGroup1(): Incorrect value for inout param",
0668: equals(x, y.value));
0669: assertTrue(
0670: "testComplexTypeWithAttributeGroup1(): Incorrect value for out param",
0671: equals(yOrig, z.value));
0672: assertTrue(
0673: "testComplexTypeWithAttributeGroup1(): Incorrect return value",
0674: equals(x, ret));
0675: }
0676: }
0677:
0678: // org.objectweb.type_test.types2.SequenceWithGroupSeq
0679: protected boolean equals(SequenceWithGroupSeq x,
0680: SequenceWithGroupSeq y) {
0681: return x.getVarInt() == y.getVarInt()
0682: && Float.compare(x.getVarFloat(), y.getVarFloat()) == 0
0683: && x.getVarString().equals(y.getVarString())
0684: && x.getVarOtherInt() == y.getVarOtherInt()
0685: && Float.compare(x.getVarOtherFloat(), y
0686: .getVarOtherFloat()) == 0
0687: && x.getVarOtherString().equals(y.getVarOtherString());
0688: }
0689:
0690: public void testSequenceWithGroupSeq() throws Exception {
0691: SequenceWithGroupSeq x = new SequenceWithGroupSeq();
0692: x.setVarInt(100);
0693: x.setVarString("hello");
0694: x.setVarFloat(1.1f);
0695: x.setVarOtherInt(11);
0696: x.setVarOtherString("world");
0697: x.setVarOtherFloat(10.1f);
0698: SequenceWithGroupSeq yOrig = new SequenceWithGroupSeq();
0699: yOrig.setVarInt(11);
0700: yOrig.setVarString("world");
0701: yOrig.setVarFloat(10.1f);
0702: yOrig.setVarOtherInt(100);
0703: yOrig.setVarOtherString("hello");
0704: yOrig.setVarOtherFloat(1.1f);
0705:
0706: Holder<SequenceWithGroupSeq> y = new Holder<SequenceWithGroupSeq>(
0707: yOrig);
0708: Holder<SequenceWithGroupSeq> z = new Holder<SequenceWithGroupSeq>();
0709:
0710: SequenceWithGroupSeq ret;
0711: if (testDocLiteral) {
0712: ret = docClient.testSequenceWithGroupSeq(x, y, z);
0713: } else {
0714: ret = rpcClient.testSequenceWithGroupSeq(x, y, z);
0715: }
0716: if (!perfTestOnly) {
0717: assertTrue(
0718: "testSequenceWithGroupSeq(): Incorrect value for inout param",
0719: equals(x, y.value));
0720: assertTrue(
0721: "testSequenceWithGroupSeq(): Incorrect value for out param",
0722: equals(yOrig, z.value));
0723: assertTrue(
0724: "testSequenceWithGroupSeq(): Incorrect return value",
0725: equals(x, ret));
0726: }
0727: }
0728:
0729: // org.objectweb.type_test.types2.SequenceWithGroupChoice
0730:
0731: protected boolean equals(SequenceWithGroupChoice x,
0732: SequenceWithGroupChoice y) {
0733: if (x.getVarInt() != null && y.getVarInt() != null) {
0734: if (x.getVarInt().compareTo(y.getVarInt()) != 0) {
0735: return false;
0736: }
0737: } else if (x.getVarFloat() != null && y.getVarFloat() != null) {
0738: if (x.getVarFloat().compareTo(y.getVarFloat()) != 0) {
0739: return false;
0740: }
0741: } else if (x.getVarString() != null && y.getVarString() != null) {
0742: if (!x.getVarString().equals(y.getVarString())) {
0743: return false;
0744: }
0745: } else {
0746: return false;
0747: }
0748: if (x.getVarOtherInt() != null && y.getVarOtherInt() != null) {
0749: if (x.getVarOtherInt().compareTo(y.getVarOtherInt()) != 0) {
0750: return false;
0751: }
0752: } else if (x.getVarOtherFloat() != null
0753: && y.getVarOtherFloat() != null) {
0754: if (x.getVarOtherFloat().compareTo(y.getVarOtherFloat()) != 0) {
0755: return false;
0756: }
0757: } else if (x.getVarOtherString() != null
0758: && y.getVarOtherString() != null) {
0759: return x.getVarOtherString().equals(y.getVarOtherString());
0760: } else {
0761: return false;
0762: }
0763: return true;
0764: }
0765:
0766: public void testSequenceWithGroupChoice() throws Exception {
0767: SequenceWithGroupChoice x = new SequenceWithGroupChoice();
0768: x.setVarFloat(1.1f);
0769: x.setVarOtherString("world");
0770: SequenceWithGroupChoice yOrig = new SequenceWithGroupChoice();
0771: yOrig.setVarOtherFloat(2.2f);
0772: yOrig.setVarString("world");
0773:
0774: Holder<SequenceWithGroupChoice> y = new Holder<SequenceWithGroupChoice>(
0775: yOrig);
0776: Holder<SequenceWithGroupChoice> z = new Holder<SequenceWithGroupChoice>();
0777:
0778: SequenceWithGroupChoice ret;
0779: if (testDocLiteral) {
0780: ret = docClient.testSequenceWithGroupChoice(x, y, z);
0781: } else {
0782: ret = rpcClient.testSequenceWithGroupChoice(x, y, z);
0783: }
0784: if (!perfTestOnly) {
0785: assertTrue(
0786: "testSequenceWithGroupChoice(): Incorrect value for inout param",
0787: equals(x, y.value));
0788: assertTrue(
0789: "testSequenceWithGroupChoice(): Incorrect value for out param",
0790: equals(yOrig, z.value));
0791: assertTrue(
0792: "testSequenceWithGroupChoice(): Incorrect return value",
0793: equals(x, ret));
0794: }
0795: }
0796:
0797: // org.objectweb.type_test.types2.SequenceWithGroups
0798:
0799: protected boolean equals(SequenceWithGroups x, SequenceWithGroups y) {
0800: if (x.getVarOtherInt() != null && y.getVarOtherInt() != null) {
0801: if (x.getVarOtherInt().compareTo(y.getVarOtherInt()) != 0) {
0802: return false;
0803: }
0804: } else if (x.getVarOtherFloat() != null
0805: && y.getVarOtherFloat() != null) {
0806: if (x.getVarOtherFloat().compareTo(y.getVarOtherFloat()) != 0) {
0807: return false;
0808: }
0809: } else if (x.getVarOtherString() != null
0810: && y.getVarOtherString() != null) {
0811: if (!x.getVarOtherString().equals(y.getVarOtherString())) {
0812: return false;
0813: }
0814: } else {
0815: return false;
0816: }
0817: return x.getVarInt() == y.getVarInt()
0818: && Float.compare(x.getVarFloat(), y.getVarFloat()) == 0
0819: && x.getVarString().equals(y.getVarString());
0820: }
0821:
0822: public void testSequenceWithGroups() throws Exception {
0823: SequenceWithGroups x = new SequenceWithGroups();
0824: x.setVarInt(100);
0825: x.setVarString("hello");
0826: x.setVarFloat(1.1f);
0827: x.setVarOtherFloat(1.1f);
0828:
0829: SequenceWithGroups yOrig = new SequenceWithGroups();
0830: yOrig.setVarInt(11);
0831: yOrig.setVarString("world");
0832: yOrig.setVarFloat(10.1f);
0833: yOrig.setVarOtherString("world");
0834:
0835: Holder<SequenceWithGroups> y = new Holder<SequenceWithGroups>(
0836: yOrig);
0837: Holder<SequenceWithGroups> z = new Holder<SequenceWithGroups>();
0838:
0839: SequenceWithGroups ret;
0840: if (testDocLiteral) {
0841: ret = docClient.testSequenceWithGroups(x, y, z);
0842: } else {
0843: ret = rpcClient.testSequenceWithGroups(x, y, z);
0844: }
0845: if (!perfTestOnly) {
0846: assertTrue(
0847: "testSequenceWithGroups(): Incorrect value for inout param",
0848: equals(x, y.value));
0849: assertTrue(
0850: "testSequenceWithGroups(): Incorrect value for out param",
0851: equals(yOrig, z.value));
0852: assertTrue(
0853: "testSequenceWithGroups(): Incorrect return value",
0854: equals(x, ret));
0855: }
0856: }
0857:
0858: // org.objectweb.type_test.types2.SequenceWithOccuringGroup
0859:
0860: protected boolean equals(SequenceWithOccuringGroup x,
0861: SequenceWithOccuringGroup y) {
0862: return equalsFloatIntStringList(x.getBatchElementsSeq(), y
0863: .getBatchElementsSeq());
0864: }
0865:
0866: public void testSequenceWithOccuringGroup() throws Exception {
0867: SequenceWithOccuringGroup x = new SequenceWithOccuringGroup();
0868: x.getBatchElementsSeq().add(1.1f);
0869: x.getBatchElementsSeq().add(100);
0870: x.getBatchElementsSeq().add("hello");
0871:
0872: SequenceWithOccuringGroup yOrig = new SequenceWithOccuringGroup();
0873: yOrig.getBatchElementsSeq().add(2.2f);
0874: yOrig.getBatchElementsSeq().add(200);
0875: yOrig.getBatchElementsSeq().add("world");
0876:
0877: Holder<SequenceWithOccuringGroup> y = new Holder<SequenceWithOccuringGroup>(
0878: yOrig);
0879: Holder<SequenceWithOccuringGroup> z = new Holder<SequenceWithOccuringGroup>();
0880:
0881: SequenceWithOccuringGroup ret;
0882: if (testDocLiteral) {
0883: ret = docClient.testSequenceWithOccuringGroup(x, y, z);
0884: } else {
0885: ret = rpcClient.testSequenceWithOccuringGroup(x, y, z);
0886: }
0887: if (!perfTestOnly) {
0888: assertTrue(
0889: "testGroupDirectlyInComplexType(): Incorrect value for inout param",
0890: equals(x, y.value));
0891: assertTrue(
0892: "testGroupDirectlyInComplexType(): Incorrect value for out param",
0893: equals(yOrig, z.value));
0894: assertTrue(
0895: "testGroupDirectlyInComplexType(): Incorrect return value",
0896: equals(x, ret));
0897: }
0898: }
0899:
0900: // org.objectweb.type_test.types2.GroupDirectlyInComplexType
0901:
0902: protected boolean equals(GroupDirectlyInComplexType x,
0903: GroupDirectlyInComplexType y) {
0904: return x.getVarInt() == y.getVarInt()
0905: && x.getVarString().equals(y.getVarString())
0906: && Float.compare(x.getVarFloat(), y.getVarFloat()) == 0
0907: && x.getAttr1().equals(y.getAttr1());
0908: }
0909:
0910: public void testGroupDirectlyInComplexType() throws Exception {
0911: GroupDirectlyInComplexType x = new GroupDirectlyInComplexType();
0912: x.setVarInt(100);
0913: x.setVarString("hello");
0914: x.setVarFloat(1.1f);
0915: x.setAttr1(new Integer(1));
0916: GroupDirectlyInComplexType yOrig = new GroupDirectlyInComplexType();
0917: yOrig.setVarInt(11);
0918: yOrig.setVarString("world");
0919: yOrig.setVarFloat(10.1f);
0920: yOrig.setAttr1(new Integer(2));
0921:
0922: Holder<GroupDirectlyInComplexType> y = new Holder<GroupDirectlyInComplexType>(
0923: yOrig);
0924: Holder<GroupDirectlyInComplexType> z = new Holder<GroupDirectlyInComplexType>();
0925:
0926: GroupDirectlyInComplexType ret;
0927: if (testDocLiteral) {
0928: ret = docClient.testGroupDirectlyInComplexType(x, y, z);
0929: } else {
0930: ret = rpcClient.testGroupDirectlyInComplexType(x, y, z);
0931: }
0932: if (!perfTestOnly) {
0933: assertTrue(
0934: "testGroupDirectlyInComplexType(): Incorrect value for inout param",
0935: equals(x, y.value));
0936: assertTrue(
0937: "testGroupDirectlyInComplexType(): Incorrect value for out param",
0938: equals(yOrig, z.value));
0939: assertTrue(
0940: "testGroupDirectlyInComplexType(): Incorrect return value",
0941: equals(x, ret));
0942: }
0943: }
0944:
0945: // org.objectweb.type_test.types2.ComplexTypeWithAttributes
0946:
0947: protected boolean equals(ComplexTypeWithAttributes x,
0948: ComplexTypeWithAttributes y) {
0949: return x.getAttrInt().equals(y.getAttrInt())
0950: && x.getAttrString().equals(y.getAttrString());
0951: }
0952:
0953: public void testComplexTypeWithAttributes() throws Exception {
0954: ComplexTypeWithAttributes x = new ComplexTypeWithAttributes();
0955: x.setAttrInt(new BigInteger("123"));
0956: x.setAttrString("x123");
0957: ComplexTypeWithAttributes yOrig = new ComplexTypeWithAttributes();
0958: yOrig.setAttrInt(new BigInteger("456"));
0959: yOrig.setAttrString("x456");
0960:
0961: Holder<ComplexTypeWithAttributes> y = new Holder<ComplexTypeWithAttributes>(
0962: yOrig);
0963: Holder<ComplexTypeWithAttributes> z = new Holder<ComplexTypeWithAttributes>();
0964: ComplexTypeWithAttributes ret;
0965: if (testDocLiteral) {
0966: ret = docClient.testComplexTypeWithAttributes(x, y, z);
0967: } else {
0968: ret = rpcClient.testComplexTypeWithAttributes(x, y, z);
0969: }
0970:
0971: if (!perfTestOnly) {
0972: assertTrue(
0973: "testComplexTypeWithAttributes(): Incorrect value for inout param",
0974: equals(x, y.value));
0975: assertTrue(
0976: "testComplexTypeWithAttributes(): Incorrect value for out param",
0977: equals(yOrig, z.value));
0978: assertTrue(
0979: "testComplexTypeWithAttributes(): Incorrect return value",
0980: equals(x, ret));
0981: }
0982: }
0983:
0984: // org.objectweb.type_test.types2.StructWithAny
0985:
0986: public void assertEqualsStructWithAny(StructWithAny a,
0987: StructWithAny b) throws Exception {
0988: assertEquals("StructWithAny names don't match", a.getName(), b
0989: .getName());
0990: assertEquals("StructWithAny addresses don't match", a
0991: .getAddress(), b.getAddress());
0992: assertEquals(a.getAny(), b.getAny());
0993: }
0994:
0995: public void assertEquals(Element elA, Element elB) throws Exception {
0996: if (elA instanceof SOAPElement && elB instanceof SOAPElement) {
0997: SOAPElement soapA = (SOAPElement) elA;
0998: SOAPElement soapB = (SOAPElement) elB;
0999: assertEquals(
1000: "StructWithAny soap element names don't match",
1001: soapA.getElementName(), soapB.getElementName());
1002: assertEquals(
1003: "StructWithAny soap element text nodes don't match",
1004: soapA.getValue(), soapB.getValue());
1005:
1006: Iterator itExp = soapA.getChildElements();
1007: Iterator itGen = soapB.getChildElements();
1008: while (itExp.hasNext()) {
1009: if (!itGen.hasNext()) {
1010: fail("Incorrect number of child elements inside any");
1011: }
1012: Object objA = itExp.next();
1013: Object objB = itGen.next();
1014: if (objA instanceof SOAPElement) {
1015: if (objB instanceof SOAPElement) {
1016: assertEquals((SOAPElement) objA,
1017: (SOAPElement) objB);
1018: } else {
1019: fail("No matching soap element.");
1020: }
1021: }
1022: }
1023: }
1024: }
1025:
1026: public void testStructWithAny() throws Exception {
1027: StructWithAny swa = new StructWithAny();
1028: swa.setName("Name");
1029: swa.setAddress("Some Address");
1030:
1031: StructWithAny yOrig = new StructWithAny();
1032: yOrig.setName("Name2");
1033: yOrig.setAddress("Some Other Address");
1034:
1035: SOAPFactory factory = SOAPFactory.newInstance();
1036: SOAPElement x = factory.createElement("hello", "foo",
1037: "http://some.url.com");
1038: x.addNamespaceDeclaration("foo", "http://some.url.com");
1039: x.addTextNode("This is the text of the node");
1040:
1041: SOAPElement x2 = factory.createElement("hello2", "foo",
1042: "http://some.url.com");
1043: x2.addNamespaceDeclaration("foo", "http://some.url.com");
1044: x2
1045: .addTextNode("This is the text of the node for the second struct");
1046:
1047: swa.setAny(x);
1048: yOrig.setAny(x2);
1049:
1050: Holder<StructWithAny> y = new Holder<StructWithAny>(yOrig);
1051: Holder<StructWithAny> z = new Holder<StructWithAny>();
1052:
1053: StructWithAny ret;
1054: if (testDocLiteral) {
1055: ret = docClient.testStructWithAny(swa, y, z);
1056: } else {
1057: ret = rpcClient.testStructWithAny(swa, y, z);
1058: }
1059: if (!perfTestOnly) {
1060: assertEqualsStructWithAny(swa, y.value);
1061: assertEqualsStructWithAny(yOrig, z.value);
1062: assertEqualsStructWithAny(swa, ret);
1063: }
1064: }
1065:
1066: public void testStructWithAnyXsi() throws Exception {
1067: StructWithAny swa = new StructWithAny();
1068: swa.setName("Name");
1069: swa.setAddress("Some Address");
1070: StructWithAny yOrig = new StructWithAny();
1071: yOrig.setName("Name2");
1072: yOrig.setAddress("Some Other Address");
1073:
1074: SOAPFactory sf = SOAPFactory.newInstance();
1075: Name elementName = sf.createName("UKAddress", "",
1076: "http://objectweb.org/type_test");
1077: Name xsiAttrName = sf.createName("type", "xsi",
1078: "http://www.w3.org/2001/XMLSchema-instance");
1079: SOAPElement x = sf.createElement(elementName);
1080: x.addNamespaceDeclaration("tns",
1081: "http://objectweb.org/type_test");
1082: x.addNamespaceDeclaration("xsi",
1083: "http://www.w3.org/2001/XMLSchema-instance");
1084: x.addAttribute(xsiAttrName, "tns:UKAddressType11");
1085: x
1086: .addTextNode("This is the text of the node for the first struct");
1087:
1088: Name elementName2 = sf.createName("UKAddress", "",
1089: "http://objectweb.org/type_test");
1090: Name xsiAttrName2 = sf.createName("type", "xsi",
1091: "http://www.w3.org/2001/XMLSchema-instance");
1092: SOAPElement x2 = sf.createElement(elementName2);
1093: x2.addNamespaceDeclaration("tns",
1094: "http://objectweb.org/type_test");
1095: x2.addNamespaceDeclaration("xsi",
1096: "http://www.w3.org/2001/XMLSchema-instance");
1097: x2.addAttribute(xsiAttrName2, "tns:UKAddressType22");
1098: x2
1099: .addTextNode("This is the text of the node for the second struct");
1100:
1101: swa.setAny(x);
1102: yOrig.setAny(x2);
1103:
1104: Holder<StructWithAny> y = new Holder<StructWithAny>(yOrig);
1105: Holder<StructWithAny> z = new Holder<StructWithAny>();
1106: StructWithAny ret;
1107: if (testDocLiteral) {
1108: ret = docClient.testStructWithAny(swa, y, z);
1109: } else {
1110: ret = rpcClient.testStructWithAny(swa, y, z);
1111: }
1112: if (!perfTestOnly) {
1113: assertEqualsStructWithAny(swa, y.value);
1114: assertEqualsStructWithAny(yOrig, z.value);
1115: assertEqualsStructWithAny(swa, ret);
1116: }
1117: }
1118:
1119: // StructWithInvalidAny
1120: // XXX - no exception thrown
1121: public void testStructWithInvalidAny() throws Exception {
1122: StructWithAny swa = new StructWithAny();
1123: swa.setName("Name");
1124: swa.setAddress("Some Address");
1125:
1126: StructWithAny yOrig = new StructWithAny();
1127: yOrig.setName("Name2");
1128: yOrig.setAddress("Some Other Address");
1129:
1130: SOAPFactory factory = SOAPFactory.newInstance();
1131: SOAPElement x = factory.createElement("hello", "foo",
1132: "http://some.url.com");
1133: x.addTextNode("This is the text of the node");
1134:
1135: SOAPElement x2 = factory.createElement("hello2", "foo",
1136: "http://some.url.com");
1137: x2
1138: .addTextNode("This is the text of the node for the second struct");
1139:
1140: swa.setAny(x);
1141: yOrig.setAny(x2);
1142:
1143: Holder<StructWithAny> y = new Holder<StructWithAny>(yOrig);
1144: Holder<StructWithAny> z = new Holder<StructWithAny>();
1145:
1146: try {
1147: if (testDocLiteral) {
1148: docClient.testStructWithAny(swa, y, z);
1149: } else {
1150: rpcClient.testStructWithAny(swa, y, z);
1151: }
1152: //fail("testStructWithInvalidAny(): Did not catch expected exception.");
1153: } catch (Exception ex) {
1154: fail("testStructWithInvalidAny(): caught expected exception - woot.");
1155: }
1156: }
1157:
1158: // org.objectweb.type_test.types2.StructWithAnyArray
1159:
1160: public void assertEqualsStructWithAnyArray(StructWithAnyArray a,
1161: StructWithAnyArray b) throws Exception {
1162: assertEquals("StructWithAny names don't match", a.getName(), b
1163: .getName());
1164: assertEquals("StructWithAny addresses don't match", a
1165: .getAddress(), b.getAddress());
1166:
1167: List<Element> ae = a.getAny();
1168: List<Element> be = b.getAny();
1169:
1170: assertEquals("StructWithAny soap element lengths don't match",
1171: ae.size(), be.size());
1172: for (int i = 0; i < ae.size(); i++) {
1173: assertEquals(ae.get(i), be.get(i));
1174: }
1175: }
1176:
1177: public void testStructWithAnyArray() throws Exception {
1178: StructWithAnyArray swa = new StructWithAnyArray();
1179: swa.setName("Name");
1180: swa.setAddress("Some Address");
1181:
1182: StructWithAnyArray yOrig = new StructWithAnyArray();
1183: yOrig.setName("Name2");
1184: yOrig.setAddress("Some Other Address");
1185:
1186: SOAPFactory factory = SOAPFactory.newInstance();
1187: SOAPElement x = factory.createElement("hello", "foo",
1188: "http://some.url.com");
1189: x.addNamespaceDeclaration("foo", "http://some.url.com");
1190: x.addTextNode("This is the text of the node");
1191:
1192: SOAPElement x2 = factory.createElement("hello2", "foo",
1193: "http://some.url.com");
1194: x2.addNamespaceDeclaration("foo", "http://some.url.com");
1195: x2
1196: .addTextNode("This is the text of the node for the second struct");
1197:
1198: swa.getAny().add(x);
1199: yOrig.getAny().add(x2);
1200:
1201: Holder<StructWithAnyArray> y = new Holder<StructWithAnyArray>(
1202: yOrig);
1203: Holder<StructWithAnyArray> z = new Holder<StructWithAnyArray>();
1204:
1205: StructWithAnyArray ret;
1206: if (testDocLiteral) {
1207: ret = docClient.testStructWithAnyArray(swa, y, z);
1208: } else {
1209: ret = rpcClient.testStructWithAnyArray(swa, y, z);
1210: }
1211: if (!perfTestOnly) {
1212: assertEqualsStructWithAnyArray(swa, y.value);
1213: assertEqualsStructWithAnyArray(yOrig, z.value);
1214: assertEqualsStructWithAnyArray(swa, ret);
1215: }
1216: }
1217:
1218: // StructWithInvalidAnyArray
1219: // XXX - no exception thrown
1220: public void testStructWithInvalidAnyArray() throws Exception {
1221: StructWithAnyArray swa = new StructWithAnyArray();
1222: swa.setName("Name");
1223: swa.setAddress("Some Address");
1224:
1225: StructWithAnyArray yOrig = new StructWithAnyArray();
1226: yOrig.setName("Name2");
1227: yOrig.setAddress("Some Other Address");
1228:
1229: SOAPFactory factory = SOAPFactory.newInstance();
1230: SOAPElement x = factory.createElement("hello", "foo",
1231: "http://some.url.com");
1232: x.addTextNode("This is the text of the node");
1233:
1234: SOAPElement x2 = factory.createElement("hello2", "foo",
1235: "http://some.url.com");
1236: x2
1237: .addTextNode("This is the text of the node for the second struct");
1238:
1239: swa.getAny().add(x);
1240: yOrig.getAny().add(x2);
1241:
1242: Holder<StructWithAnyArray> y = new Holder<StructWithAnyArray>(
1243: yOrig);
1244: Holder<StructWithAnyArray> z = new Holder<StructWithAnyArray>();
1245:
1246: try {
1247: if (testDocLiteral) {
1248: docClient.testStructWithAnyArray(swa, y, z);
1249: } else {
1250: rpcClient.testStructWithAnyArray(swa, y, z);
1251: }
1252: //fail("testStructWithInvalidAnyArray(): Did not catch expected exception.");
1253: } catch (Exception ex) {
1254: // Expected
1255: fail("testStructWithInvalidAnyArray(): caught expected exception - woot.");
1256: }
1257: }
1258:
1259: public void testStructWithAnyStrict() throws Exception {
1260: // XXX - only added to the soap typetest
1261: }
1262:
1263: public void testStructWithAnyArrayLax() throws Exception {
1264: // XXX - only added to the soap typetest
1265: }
1266:
1267: // org.objectweb.type_test.types2.IDTypeAttribute
1268:
1269: protected boolean equalsIDTypeAttribute(IDTypeAttribute x,
1270: IDTypeAttribute y) {
1271: return equalsNilable(x.getId(), y.getId());
1272: }
1273:
1274: public void testIDTypeAttribute() throws Exception {
1275: // n.b. to be valid elements with an ID in the response message
1276: // must have a unique ID, so this test does not return x as the
1277: // return value (like the other tests).
1278: IDTypeAttribute x = new IDTypeAttribute();
1279: x.setId("x123");
1280: IDTypeAttribute yOrig = new IDTypeAttribute();
1281: yOrig.setId("x456");
1282:
1283: Holder<IDTypeAttribute> y = new Holder<IDTypeAttribute>(yOrig);
1284: Holder<IDTypeAttribute> z = new Holder<IDTypeAttribute>();
1285: //IDTypeAttribute ret;
1286: if (testDocLiteral) {
1287: /*ret =*/docClient.testIDTypeAttribute(x, y, z);
1288: } else {
1289: /*ret =*/rpcClient.testIDTypeAttribute(x, y, z);
1290: }
1291:
1292: if (!perfTestOnly) {
1293: assertTrue(
1294: "testIDTypeAttribute(): Incorrect value for inout param",
1295: equalsIDTypeAttribute(x, y.value));
1296: assertTrue(
1297: "testIDTypeAttribute(): Incorrect value for out param",
1298: equalsIDTypeAttribute(yOrig, z.value));
1299: }
1300: }
1301:
1302: // org.objectweb.type_test.types2.MultipleOccursSequenceInSequence
1303: protected boolean equals(MultipleOccursSequenceInSequence x,
1304: MultipleOccursSequenceInSequence y) {
1305: int size = x.getValue().size();
1306: if (size != y.getValue().size()) {
1307: return false;
1308: }
1309: for (int i = 0; i < size; i++) {
1310: if (x.getValue().get(i).compareTo(y.getValue().get(i)) != 0) {
1311: return false;
1312: }
1313: }
1314: return true;
1315: }
1316:
1317: public void testMultipleOccursSequenceInSequence() throws Exception {
1318: MultipleOccursSequenceInSequence x = new MultipleOccursSequenceInSequence();
1319: x.getValue().add(new BigInteger("32"));
1320: MultipleOccursSequenceInSequence yOriginal = new MultipleOccursSequenceInSequence();
1321: yOriginal.getValue().add(new BigInteger("3200"));
1322:
1323: Holder<MultipleOccursSequenceInSequence> y = new Holder<MultipleOccursSequenceInSequence>(
1324: yOriginal);
1325: Holder<MultipleOccursSequenceInSequence> z = new Holder<MultipleOccursSequenceInSequence>();
1326:
1327: MultipleOccursSequenceInSequence ret;
1328: if (testDocLiteral) {
1329: ret = docClient.testMultipleOccursSequenceInSequence(x, y,
1330: z);
1331: } else {
1332: ret = rpcClient.testMultipleOccursSequenceInSequence(x, y,
1333: z);
1334: }
1335: if (!perfTestOnly) {
1336: assertTrue(
1337: "testMultipleOccursSequenceInSequence(): Incorrect value for inout param",
1338: equals(x, y.value));
1339: assertTrue(
1340: "testMultipleOccursSequenceInSequence(): Incorrect value for out param",
1341: equals(yOriginal, z.value));
1342: assertTrue(
1343: "testMultipleOccursSequenceInSequence(): Incorrect return value",
1344: equals(x, ret));
1345: }
1346: }
1347:
1348: // org.objectweb.type_test.types2.StructWithBinary;
1349:
1350: protected boolean equals(StructWithBinary x, StructWithBinary y) {
1351: return Arrays.equals(x.getBase64(), y.getBase64())
1352: && Arrays.equals(x.getHex(), y.getHex());
1353: }
1354:
1355: public void testStructWithBinary() throws Exception {
1356: StructWithBinary x = new StructWithBinary();
1357: x.setBase64("base64Binary_x".getBytes());
1358: x.setHex("hexBinary_x".getBytes());
1359:
1360: StructWithBinary yOriginal = new StructWithBinary();
1361: yOriginal.setBase64("base64Binary_y".getBytes());
1362: yOriginal.setHex("hexBinary_y".getBytes());
1363:
1364: Holder<StructWithBinary> y = new Holder<StructWithBinary>(
1365: yOriginal);
1366: Holder<StructWithBinary> z = new Holder<StructWithBinary>();
1367:
1368: StructWithBinary ret;
1369: if (testDocLiteral) {
1370: ret = docClient.testStructWithBinary(x, y, z);
1371: } else {
1372: ret = rpcClient.testStructWithBinary(x, y, z);
1373: }
1374: if (!perfTestOnly) {
1375: assertTrue(
1376: "testStructWithBinary(): Incorrect value for inout param",
1377: equals(x, y.value));
1378: assertTrue(
1379: "testStructWithBinary(): Incorrect value for out param",
1380: equals(yOriginal, z.value));
1381: assertTrue(
1382: "testStructWithBinary(): Incorrect return value",
1383: equals(x, ret));
1384: }
1385: }
1386:
1387: // org.objectweb.type_test.types2.ChoiceWithBinary;
1388:
1389: protected boolean equals(ChoiceWithBinary x, ChoiceWithBinary y) {
1390: if (x.getBase64() != null && y.getBase64() != null) {
1391: return Arrays.equals(x.getBase64(), y.getBase64());
1392: } else {
1393: return x.getHex() != null && y.getHex() != null
1394: && Arrays.equals(x.getHex(), y.getHex());
1395: }
1396: }
1397:
1398: public void testChoiceWithBinary() throws Exception {
1399: ChoiceWithBinary x = new ChoiceWithBinary();
1400: x.setBase64("base64Binary_x".getBytes());
1401:
1402: ChoiceWithBinary yOriginal = new ChoiceWithBinary();
1403: yOriginal.setHex("hexBinary_y".getBytes());
1404:
1405: Holder<ChoiceWithBinary> y = new Holder<ChoiceWithBinary>(
1406: yOriginal);
1407: Holder<ChoiceWithBinary> z = new Holder<ChoiceWithBinary>();
1408:
1409: ChoiceWithBinary ret;
1410: if (testDocLiteral) {
1411: ret = docClient.testChoiceWithBinary(x, y, z);
1412: } else {
1413: ret = rpcClient.testChoiceWithBinary(x, y, z);
1414: }
1415: if (!perfTestOnly) {
1416: assertTrue(
1417: "testChoiceWithBinary(): Incorrect value for inout param",
1418: equals(x, y.value));
1419: assertTrue(
1420: "testChoiceWithBinary(): Incorrect value for out param",
1421: equals(yOriginal, z.value));
1422: assertTrue(
1423: "testChoiceWithBinary(): Incorrect return value",
1424: equals(x, ret));
1425: }
1426: }
1427:
1428: // org.objectweb.type_test.types2.ChoiceWithGroupChoice;
1429:
1430: protected boolean equals(ChoiceWithGroupChoice x,
1431: ChoiceWithGroupChoice y) {
1432: if (x.getVarFloat() != null && y.getVarFloat() != null) {
1433: return x.getVarFloat().compareTo(y.getVarFloat()) == 0;
1434: }
1435: if (x.getVarInt() != null && y.getVarInt() != null) {
1436: return x.getVarInt().compareTo(y.getVarInt()) == 0;
1437: }
1438: if (x.getVarString() != null && y.getVarString() != null) {
1439: return x.getVarString().equals(y.getVarString());
1440: }
1441: if (x.getVarOtherFloat() != null
1442: && y.getVarOtherFloat() != null) {
1443: return x.getVarOtherFloat().compareTo(y.getVarOtherFloat()) == 0;
1444: }
1445: if (x.getVarOtherInt() != null && y.getVarOtherInt() != null) {
1446: return x.getVarOtherInt().compareTo(y.getVarOtherInt()) == 0;
1447: }
1448: if (x.getVarOtherString() != null
1449: && y.getVarOtherString() != null) {
1450: return x.getVarOtherString().equals(y.getVarOtherString());
1451: }
1452: return false;
1453: }
1454:
1455: // XXX - Generated code flattens nested choice
1456: public void testChoiceWithGroupChoice() throws Exception {
1457: ChoiceWithGroupChoice x = new ChoiceWithGroupChoice();
1458: x.setVarFloat(1.1f);
1459: ChoiceWithGroupChoice yOrig = new ChoiceWithGroupChoice();
1460: yOrig.setVarOtherString("world");
1461:
1462: Holder<ChoiceWithGroupChoice> y = new Holder<ChoiceWithGroupChoice>(
1463: yOrig);
1464: Holder<ChoiceWithGroupChoice> z = new Holder<ChoiceWithGroupChoice>();
1465:
1466: ChoiceWithGroupChoice ret;
1467: if (testDocLiteral) {
1468: ret = docClient.testChoiceWithGroupChoice(x, y, z);
1469: } else {
1470: ret = rpcClient.testChoiceWithGroupChoice(x, y, z);
1471: }
1472: if (!perfTestOnly) {
1473: assertTrue(
1474: "testChoiceWithGroupChoice(): Incorrect value for inout param",
1475: equals(x, y.value));
1476: assertTrue(
1477: "testChoiceWithGroupChoice(): Incorrect value for out param",
1478: equals(yOrig, z.value));
1479: assertTrue(
1480: "testChoiceWithGroupChoice(): Incorrect return value",
1481: equals(x, ret));
1482: }
1483: }
1484:
1485: // org.objectweb.type_test.types2.ChoiceWithGroupSeq;
1486:
1487: protected boolean equals(ChoiceWithGroupSeq x, ChoiceWithGroupSeq y) {
1488: if (x.getVarInt() != null && x.getVarFloat() != null
1489: && x.getVarString() != null) {
1490: if (x.getVarInt().compareTo(y.getVarInt()) != 0) {
1491: return false;
1492: }
1493: if (x.getVarFloat().compareTo(y.getVarFloat()) != 0) {
1494: return false;
1495: }
1496: return x.getVarString().equals(y.getVarString());
1497: }
1498: if (x.getVarOtherInt() != null && x.getVarOtherFloat() != null
1499: && x.getVarOtherString() != null) {
1500: if (x.getVarOtherInt().compareTo(y.getVarOtherInt()) != 0) {
1501: return false;
1502: }
1503: if (x.getVarOtherFloat().compareTo(y.getVarOtherFloat()) != 0) {
1504: return false;
1505: }
1506: return x.getVarOtherString().equals(y.getVarOtherString());
1507: }
1508: return false;
1509: }
1510:
1511: // XXX - Generated code flattens nested structs
1512: public void testChoiceWithGroupSeq() throws Exception {
1513: ChoiceWithGroupSeq x = new ChoiceWithGroupSeq();
1514: x.setVarInt(100);
1515: x.setVarString("hello");
1516: x.setVarFloat(1.1f);
1517: ChoiceWithGroupSeq yOrig = new ChoiceWithGroupSeq();
1518: yOrig.setVarOtherInt(11);
1519: yOrig.setVarOtherString("world");
1520: yOrig.setVarOtherFloat(10.1f);
1521:
1522: Holder<ChoiceWithGroupSeq> y = new Holder<ChoiceWithGroupSeq>(
1523: yOrig);
1524: Holder<ChoiceWithGroupSeq> z = new Holder<ChoiceWithGroupSeq>();
1525:
1526: ChoiceWithGroupSeq ret;
1527: if (testDocLiteral) {
1528: ret = docClient.testChoiceWithGroupSeq(x, y, z);
1529: } else {
1530: ret = rpcClient.testChoiceWithGroupSeq(x, y, z);
1531: }
1532: if (!perfTestOnly) {
1533: assertTrue(
1534: "testChoiceWithGroupSeq(): Incorrect value for inout param",
1535: equals(x, y.value));
1536: assertTrue(
1537: "testChoiceWithGroupSeq(): Incorrect value for out param",
1538: equals(yOrig, z.value));
1539: assertTrue(
1540: "testChoiceWithGroupSeq(): Incorrect return value",
1541: equals(x, ret));
1542: }
1543: }
1544:
1545: // org.objectweb.type_test.types2.ChoiceWithGroups;
1546:
1547: protected boolean equals(ChoiceWithGroups x, ChoiceWithGroups y) {
1548: if (x.getVarInt() != null && x.getVarString() != null
1549: && x.getVarFloat() != null) {
1550: if (x.getVarInt().compareTo(y.getVarInt()) == 0
1551: && x.getVarString().equals(y.getVarString())
1552: && x.getVarFloat().compareTo(y.getVarFloat()) == 0) {
1553: return true;
1554: }
1555: return false;
1556: } else {
1557: if (x.getVarOtherFloat() != null
1558: && y.getVarOtherFloat() != null) {
1559: return x.getVarOtherFloat().compareTo(
1560: y.getVarOtherFloat()) == 0;
1561: }
1562: if (x.getVarOtherInt() != null
1563: && y.getVarOtherInt() != null) {
1564: return x.getVarOtherInt().compareTo(y.getVarOtherInt()) == 0;
1565: }
1566: if (x.getVarOtherString() != null
1567: && y.getVarOtherString() != null) {
1568: return x.getVarOtherString().equals(
1569: y.getVarOtherString());
1570: }
1571: return false;
1572: }
1573: }
1574:
1575: // XXX - Generated code flattens nested structs
1576: public void testChoiceWithGroups() throws Exception {
1577: ChoiceWithGroups x = new ChoiceWithGroups();
1578: x.setVarInt(100);
1579: x.setVarString("hello");
1580: x.setVarFloat(1.1f);
1581: ChoiceWithGroups yOrig = new ChoiceWithGroups();
1582: yOrig.setVarOtherString("world");
1583:
1584: Holder<ChoiceWithGroups> y = new Holder<ChoiceWithGroups>(yOrig);
1585: Holder<ChoiceWithGroups> z = new Holder<ChoiceWithGroups>();
1586:
1587: ChoiceWithGroups ret;
1588: if (testDocLiteral) {
1589: ret = docClient.testChoiceWithGroups(x, y, z);
1590: } else {
1591: ret = rpcClient.testChoiceWithGroups(x, y, z);
1592: }
1593: if (!perfTestOnly) {
1594: assertTrue(
1595: "testChoiceWithGroups(): Incorrect value for inout param",
1596: equals(x, y.value));
1597: assertTrue(
1598: "testChoiceWithGroups(): Incorrect value for out param",
1599: equals(yOrig, z.value));
1600: assertTrue(
1601: "testChoiceWithGroups(): Incorrect return value",
1602: equals(x, ret));
1603: }
1604: }
1605:
1606: // org.objectweb.type_test.types2.ExtBase64Binary;
1607:
1608: protected boolean equals(ExtBase64Binary x, ExtBase64Binary y) {
1609: return x.getId() == y.getId()
1610: && Arrays.equals(x.getValue(), y.getValue());
1611: }
1612:
1613: public void testExtBase64Binary() throws Exception {
1614: ExtBase64Binary x1 = new ExtBase64Binary();
1615: x1.setValue("base64a".getBytes());
1616: x1.setId(1);
1617:
1618: ExtBase64Binary y1 = new ExtBase64Binary();
1619: y1.setValue("base64b".getBytes());
1620: y1.setId(2);
1621:
1622: Holder<ExtBase64Binary> y1Holder = new Holder<ExtBase64Binary>(
1623: y1);
1624: Holder<ExtBase64Binary> z1 = new Holder<ExtBase64Binary>();
1625: ExtBase64Binary ret;
1626: if (testDocLiteral) {
1627: ret = docClient.testExtBase64Binary(x1, y1Holder, z1);
1628: } else {
1629: ret = rpcClient.testExtBase64Binary(x1, y1Holder, z1);
1630: }
1631:
1632: if (!perfTestOnly) {
1633: assertTrue(
1634: "testExtBase64Binary(): Incorrect value for inout param",
1635: equals(x1, y1Holder.value));
1636: assertTrue(
1637: "testExtBase64Binary(): Incorrect value for out param",
1638: equals(y1, z1.value));
1639: assertTrue("testExtBase64Binary(): Incorrect return value",
1640: equals(x1, ret));
1641: }
1642: }
1643:
1644: // org.objectweb.type_test.types2.StructWithAnyAttribute;
1645:
1646: protected boolean equals(StructWithAnyAttribute x,
1647: StructWithAnyAttribute y) {
1648: if (!(x.getVarString().equals(y.getVarString()))
1649: || (x.getVarInt() != y.getVarInt())) {
1650: return false;
1651: }
1652: if (!equalsNilable(x.getAtString(), y.getAtString())
1653: || !equalsNilable(x.getAtInt(), y.getAtInt())) {
1654: return false;
1655: }
1656: return equalsQNameStringPairs(x.getOtherAttributes(), y
1657: .getOtherAttributes());
1658: }
1659:
1660: protected boolean equalsQNameStringPairs(Map<QName, String> x,
1661: Map<QName, String> y) {
1662: if ((x == null && y != null) || (x != null && y == null)) {
1663: return false;
1664: }
1665: if (x.isEmpty() && y.isEmpty()) {
1666: return true;
1667: }
1668: if (x.size() != y.size()) {
1669: return false;
1670: }
1671:
1672: Iterator<QName> itx = x.keySet().iterator();
1673: while (itx.hasNext()) {
1674: QName attName = itx.next();
1675: if (attName == null) {
1676: return false;
1677: }
1678:
1679: String attValue = y.get(attName);
1680: if (attValue == null || !attValue.equals(x.get(attName))) {
1681: return false;
1682: }
1683: }
1684: return true;
1685: }
1686:
1687: public void testStructWithAnyAttribute() throws Exception {
1688: QName xAt1Name = new QName("http://schemas.iona.com/type_test",
1689: "at_one");
1690: QName xAt2Name = new QName("http://schemas.iona.com/type_test",
1691: "at_two");
1692: QName yAt3Name = new QName("http://objectweb.org/type_test",
1693: "at_thr");
1694: QName yAt4Name = new QName("http://objectweb.org/type_test",
1695: "at_fou");
1696:
1697: StructWithAnyAttribute x = new StructWithAnyAttribute();
1698: StructWithAnyAttribute y = new StructWithAnyAttribute();
1699:
1700: x.setVarString("hello");
1701: x.setVarInt(1000);
1702: x.setAtString("hello attribute");
1703: x.setAtInt(new Integer(2000));
1704:
1705: y.setVarString("there");
1706: y.setVarInt(1001);
1707: y.setAtString("there attribute");
1708: y.setAtInt(new Integer(2002));
1709:
1710: Map<QName, String> xAttrMap = x.getOtherAttributes();
1711: xAttrMap.put(xAt1Name, "one");
1712: xAttrMap.put(xAt2Name, "two");
1713:
1714: Map<QName, String> yAttrMap = y.getOtherAttributes();
1715: yAttrMap.put(yAt3Name, "three");
1716: yAttrMap.put(yAt4Name, "four");
1717:
1718: Holder<StructWithAnyAttribute> yh = new Holder<StructWithAnyAttribute>(
1719: y);
1720: Holder<StructWithAnyAttribute> zh = new Holder<StructWithAnyAttribute>();
1721: StructWithAnyAttribute ret;
1722: if (testDocLiteral) {
1723: ret = docClient.testStructWithAnyAttribute(x, yh, zh);
1724: } else {
1725: ret = rpcClient.testStructWithAnyAttribute(x, yh, zh);
1726: }
1727:
1728: if (!perfTestOnly) {
1729: assertTrue(
1730: "testStructWithAnyAttribute(): Incorrect value for inout param",
1731: equals(x, yh.value));
1732: assertTrue(
1733: "testStructWithAnyAttribute(): Incorrect value for out param",
1734: equals(y, zh.value));
1735: assertTrue(
1736: "testStructWithAnyAttribute(): Incorrect return value",
1737: equals(ret, x));
1738: }
1739: }
1740:
1741: // org.objectweb.type_test.types2.ChoiceWithAnyAttribute;
1742:
1743: protected boolean equals(ChoiceWithAnyAttribute x,
1744: ChoiceWithAnyAttribute y) {
1745: String xString = x.getVarString();
1746: String yString = y.getVarString();
1747: Integer xInt = x.getVarInt();
1748: Integer yInt = y.getVarInt();
1749: if (xString != null) {
1750: if (yString == null || !xString.equals(yString)) {
1751: fail(xString + " != " + yString);
1752: return false;
1753: }
1754: } else if (xInt != null) {
1755: if (yInt == null || !(xInt.equals(yInt))) {
1756: fail(xInt + " != " + yInt);
1757: return false;
1758: }
1759: } else {
1760: fail("null choice");
1761: return false;
1762: }
1763:
1764: if (!equalsNilable(x.getAtString(), y.getAtString())
1765: || !equalsNilable(x.getAtInt(), y.getAtInt())) {
1766: fail("grrr");
1767: return false;
1768: }
1769: return equalsQNameStringPairs(x.getOtherAttributes(), y
1770: .getOtherAttributes());
1771: }
1772:
1773: public void testChoiceWithAnyAttribute() throws Exception {
1774: QName xAt1Name = new QName("http://schemas.iona.com/type_test",
1775: "at_one");
1776: QName xAt2Name = new QName("http://schemas.iona.com/type_test",
1777: "at_two");
1778: QName yAt3Name = new QName("http://objectweb.org/type_test",
1779: "at_thr");
1780: QName yAt4Name = new QName("http://objectweb.org/type_test",
1781: "at_fou");
1782:
1783: ChoiceWithAnyAttribute x = new ChoiceWithAnyAttribute();
1784: ChoiceWithAnyAttribute y = new ChoiceWithAnyAttribute();
1785:
1786: x.setVarString("hello");
1787: x.setAtString("hello attribute");
1788: x.setAtInt(new Integer(2000));
1789:
1790: y.setVarInt(1001);
1791: y.setAtString("there attribute");
1792: y.setAtInt(new Integer(2002));
1793:
1794: Map<QName, String> xAttrMap = x.getOtherAttributes();
1795: xAttrMap.put(xAt1Name, "one");
1796: xAttrMap.put(xAt2Name, "two");
1797:
1798: Map<QName, String> yAttrMap = y.getOtherAttributes();
1799: yAttrMap.put(yAt3Name, "three");
1800: yAttrMap.put(yAt4Name, "four");
1801:
1802: Holder<ChoiceWithAnyAttribute> yh = new Holder<ChoiceWithAnyAttribute>(
1803: y);
1804: Holder<ChoiceWithAnyAttribute> zh = new Holder<ChoiceWithAnyAttribute>();
1805: ChoiceWithAnyAttribute ret;
1806: if (testDocLiteral) {
1807: ret = docClient.testChoiceWithAnyAttribute(x, yh, zh);
1808: } else {
1809: ret = rpcClient.testChoiceWithAnyAttribute(x, yh, zh);
1810: }
1811:
1812: if (!perfTestOnly) {
1813: assertTrue(
1814: "testChoiceWithAnyAttribute(): Incorrect value for inout param",
1815: equals(x, yh.value));
1816: assertTrue(
1817: "testChoiceWithAnyAttribute(): Incorrect value for out param",
1818: equals(y, zh.value));
1819: assertTrue(
1820: "testChoiceWithAnyAttribute(): Incorrect return value",
1821: equals(ret, x));
1822: }
1823: }
1824:
1825: // org.objectweb.type_test.types3.OccuringStruct;
1826:
1827: protected boolean equals(OccuringStruct x, OccuringStruct y) {
1828: if (!equalsNilable(x.getVarAttrib(), y.getVarAttrib())) {
1829: return false;
1830: }
1831: return equalsFloatIntStringList(x
1832: .getVarFloatAndVarIntAndVarString(), y
1833: .getVarFloatAndVarIntAndVarString());
1834: }
1835:
1836: protected boolean equalsFloatIntStringList(
1837: List<Serializable> xList, List<Serializable> yList) {
1838: int size = xList.size();
1839: if (size != yList.size()) {
1840: return false;
1841: }
1842: for (int i = 0; i < size; i++) {
1843: if (xList.get(i) instanceof Float
1844: && yList.get(i) instanceof Float) {
1845: Float fx = (Float) xList.get(i);
1846: Float fy = (Float) yList.get(i);
1847: if (fx.compareTo(fy) != 0) {
1848: return false;
1849: }
1850: } else if (xList.get(i) instanceof Integer
1851: && yList.get(i) instanceof Integer) {
1852: Integer ix = (Integer) xList.get(i);
1853: Integer iy = (Integer) yList.get(i);
1854: if (iy.compareTo(ix) != 0) {
1855: return false;
1856: }
1857: } else if (xList.get(i) instanceof String
1858: && yList.get(i) instanceof String) {
1859: String sx = (String) xList.get(i);
1860: String sy = (String) yList.get(i);
1861: if (!sx.equals(sy)) {
1862: return false;
1863: }
1864: } else {
1865: return false;
1866: }
1867: }
1868: return true;
1869: }
1870:
1871: public void testOccuringStruct() throws Exception {
1872: OccuringStruct x = new OccuringStruct();
1873: List<Serializable> theList = x
1874: .getVarFloatAndVarIntAndVarString();
1875: theList.add(1.14f);
1876: theList.add(new Integer(0));
1877: theList.add("x1");
1878: theList.add(11.14f);
1879: theList.add(new Integer(1));
1880: theList.add("x2");
1881: x.setVarAttrib("x_attr");
1882:
1883: OccuringStruct yOriginal = new OccuringStruct();
1884: theList = yOriginal.getVarFloatAndVarIntAndVarString();
1885: theList.add(3.14f);
1886: theList.add(new Integer(42));
1887: theList.add("y");
1888: yOriginal.setVarAttrib("y_attr");
1889:
1890: Holder<OccuringStruct> y = new Holder<OccuringStruct>(yOriginal);
1891: Holder<OccuringStruct> z = new Holder<OccuringStruct>();
1892:
1893: OccuringStruct ret;
1894: if (testDocLiteral) {
1895: ret = docClient.testOccuringStruct(x, y, z);
1896: } else {
1897: ret = rpcClient.testOccuringStruct(x, y, z);
1898: }
1899: if (!perfTestOnly) {
1900: assertTrue(
1901: "testOccuringStruct(): Incorrect value for inout param",
1902: equals(x, y.value));
1903: assertTrue(
1904: "testOccuringStruct(): Incorrect value for out param",
1905: equals(yOriginal, z.value));
1906: assertTrue("testOccuringStruct(): Incorrect return value",
1907: equals(x, ret));
1908: }
1909: }
1910:
1911: // org.objectweb.type_test.types3.OccuringStruct1;
1912:
1913: protected boolean equals(OccuringStruct1 x, OccuringStruct1 y) {
1914: return equalsFloatIntStringList(x
1915: .getVarFloatAndVarIntAndVarString(), y
1916: .getVarFloatAndVarIntAndVarString());
1917: }
1918:
1919: public void testOccuringStruct1() throws Exception {
1920: OccuringStruct1 x = new OccuringStruct1();
1921: List<Serializable> theList = x
1922: .getVarFloatAndVarIntAndVarString();
1923: theList.add(1.1f);
1924: theList.add(2);
1925: theList.add("xX");
1926:
1927: OccuringStruct1 yOriginal = new OccuringStruct1();
1928: theList = yOriginal.getVarFloatAndVarIntAndVarString();
1929: theList.add(11.11f);
1930: theList.add(22);
1931: theList.add("yY");
1932:
1933: Holder<OccuringStruct1> y = new Holder<OccuringStruct1>(
1934: yOriginal);
1935: Holder<OccuringStruct1> z = new Holder<OccuringStruct1>();
1936:
1937: OccuringStruct1 ret;
1938: if (testDocLiteral) {
1939: ret = docClient.testOccuringStruct1(x, y, z);
1940: } else {
1941: ret = rpcClient.testOccuringStruct1(x, y, z);
1942: }
1943: if (!perfTestOnly) {
1944: assertTrue(
1945: "testOccuringStruct1(): Incorrect value for inout param",
1946: equals(x, y.value));
1947: assertTrue(
1948: "testOccuringStruct1(): Incorrect value for out param",
1949: equals(yOriginal, z.value));
1950: assertTrue("testOccuringStruct1(): Incorrect return value",
1951: equals(x, ret));
1952: }
1953: }
1954:
1955: // org.objectweb.type_test.types3.OccuringStruct2;
1956:
1957: protected boolean equals(OccuringStruct2 x, OccuringStruct2 y) {
1958: if (Float.compare(x.getVarFloat(), y.getVarFloat()) != 0) {
1959: return false;
1960: }
1961: List<Serializable> xList = x.getVarIntAndVarString();
1962: List<Serializable> yList = y.getVarIntAndVarString();
1963: int size = xList.size();
1964: if (size != yList.size()) {
1965: return false;
1966: }
1967: for (int i = 0; i < size; i++) {
1968: if (xList.get(i) instanceof Integer
1969: && yList.get(i) instanceof Integer) {
1970: Integer ix = (Integer) xList.get(i);
1971: Integer iy = (Integer) yList.get(i);
1972: if (iy.compareTo(ix) != 0) {
1973: return false;
1974: }
1975: } else if (xList.get(i) instanceof String
1976: && yList.get(i) instanceof String) {
1977: String sx = (String) xList.get(i);
1978: String sy = (String) yList.get(i);
1979: if (!sx.equals(sy)) {
1980: return false;
1981: }
1982: } else {
1983: return false;
1984: }
1985: }
1986: return true;
1987: }
1988:
1989: public void testOccuringStruct2() throws Exception {
1990: OccuringStruct2 x = new OccuringStruct2();
1991: x.setVarFloat(1.14f);
1992: List<Serializable> theList = x.getVarIntAndVarString();
1993: theList.add(0);
1994: theList.add("x1");
1995: theList.add(1);
1996: theList.add("x2");
1997:
1998: OccuringStruct2 yOriginal = new OccuringStruct2();
1999: yOriginal.setVarFloat(3.14f);
2000: theList = yOriginal.getVarIntAndVarString();
2001: theList.add(42);
2002: theList.add("the answer");
2003: theList.add(6);
2004: theList.add("hammer");
2005: theList.add(2);
2006: theList.add("anvil");
2007:
2008: Holder<OccuringStruct2> y = new Holder<OccuringStruct2>(
2009: yOriginal);
2010: Holder<OccuringStruct2> z = new Holder<OccuringStruct2>();
2011:
2012: OccuringStruct2 ret;
2013: if (testDocLiteral) {
2014: ret = docClient.testOccuringStruct2(x, y, z);
2015: } else {
2016: ret = rpcClient.testOccuringStruct2(x, y, z);
2017: }
2018: if (!perfTestOnly) {
2019: assertTrue(
2020: "testOccuringStruct2(): Incorrect value for inout param",
2021: equals(x, y.value));
2022: assertTrue(
2023: "testOccuringStruct2(): Incorrect value for out param",
2024: equals(yOriginal, z.value));
2025: assertTrue("testOccuringStruct2(): Incorrect return value",
2026: equals(x, ret));
2027: }
2028: }
2029:
2030: // org.objectweb.type_test.types3.OccuringChoice;
2031:
2032: protected boolean equals(OccuringChoice x, OccuringChoice y) {
2033: if (!equalsNilable(x.getVarAttrib(), y.getVarAttrib())) {
2034: return false;
2035: }
2036: return equalsFloatIntStringList(x
2037: .getVarFloatOrVarIntOrVarString(), y
2038: .getVarFloatOrVarIntOrVarString());
2039: }
2040:
2041: public void testOccuringChoice() throws Exception {
2042: OccuringChoice x = new OccuringChoice();
2043: List<Serializable> theList = x.getVarFloatOrVarIntOrVarString();
2044: theList.add(0);
2045: theList.add(1.14f);
2046: theList.add("x1");
2047: theList.add(1);
2048: theList.add(11.14f);
2049: x.setVarAttrib("x_attr");
2050:
2051: OccuringChoice yOriginal = new OccuringChoice();
2052: theList = yOriginal.getVarFloatOrVarIntOrVarString();
2053: theList.add(3.14f);
2054: theList.add("y");
2055: theList.add(42);
2056: yOriginal.setVarAttrib("y_attr");
2057:
2058: Holder<OccuringChoice> y = new Holder<OccuringChoice>(yOriginal);
2059: Holder<OccuringChoice> z = new Holder<OccuringChoice>();
2060:
2061: OccuringChoice ret;
2062: if (testDocLiteral) {
2063: ret = docClient.testOccuringChoice(x, y, z);
2064: } else {
2065: ret = rpcClient.testOccuringChoice(x, y, z);
2066: }
2067: if (!perfTestOnly) {
2068: assertTrue(
2069: "testOccuringChoice(): Incorrect value for inout param",
2070: equals(x, y.value));
2071: assertTrue(
2072: "testOccuringChoice(): Incorrect value for out param",
2073: equals(yOriginal, z.value));
2074: assertTrue("testOccuringChoice(): Incorrect return value",
2075: equals(x, ret));
2076: }
2077:
2078: theList.add(52);
2079: theList.add(4.14f);
2080:
2081: y = new Holder<OccuringChoice>(yOriginal);
2082: z = new Holder<OccuringChoice>();
2083:
2084: if (testDocLiteral) {
2085: ret = docClient.testOccuringChoice(x, y, z);
2086: } else {
2087: ret = rpcClient.testOccuringChoice(x, y, z);
2088: }
2089: if (!perfTestOnly) {
2090: assertTrue(
2091: "testOccuringChoice(): Incorrect value for inout param",
2092: equals(x, y.value));
2093: assertTrue(
2094: "testOccuringChoice(): Incorrect value for out param",
2095: equals(yOriginal, z.value));
2096: assertTrue("testOccuringChoice(): Incorrect return value",
2097: equals(x, ret));
2098: }
2099: }
2100:
2101: // org.objectweb.type_test.types3.OccuringChoice1;
2102:
2103: protected boolean equals(OccuringChoice1 x, OccuringChoice1 y) {
2104: List<Comparable> xList = x.getVarFloatOrVarInt();
2105: List<Comparable> yList = y.getVarFloatOrVarInt();
2106: int size = xList.size();
2107: if (size != yList.size()) {
2108: return false;
2109: }
2110: for (int i = 0; i < size; i++) {
2111: if (xList.get(i) instanceof Integer
2112: && yList.get(i) instanceof Integer) {
2113: Integer xi = (Integer) xList.get(i);
2114: Integer yi = (Integer) yList.get(i);
2115: if (xi.compareTo(yi) != 0) {
2116: return false;
2117: }
2118: }
2119: if (xList.get(i) instanceof Float
2120: && yList.get(i) instanceof Float) {
2121: Float xf = (Float) xList.get(i);
2122: Float yf = (Float) yList.get(i);
2123: if (xf.compareTo(yf) != 0) {
2124: return false;
2125: }
2126: }
2127: }
2128: return true;
2129: }
2130:
2131: public void testOccuringChoice1() throws Exception {
2132: OccuringChoice1 x = new OccuringChoice1();
2133: List<Comparable> theList = x.getVarFloatOrVarInt();
2134: theList.add(0);
2135: theList.add(new Float(1.14f));
2136: theList.add(1);
2137: theList.add(new Float(11.14f));
2138: // leave y empty
2139: OccuringChoice1 yOriginal = new OccuringChoice1();
2140:
2141: Holder<OccuringChoice1> y = new Holder<OccuringChoice1>(
2142: yOriginal);
2143: Holder<OccuringChoice1> z = new Holder<OccuringChoice1>();
2144:
2145: OccuringChoice1 ret;
2146: if (testDocLiteral) {
2147: ret = docClient.testOccuringChoice1(x, y, z);
2148: } else {
2149: ret = rpcClient.testOccuringChoice1(x, y, z);
2150: }
2151: if (!perfTestOnly) {
2152: assertTrue(
2153: "testOccuringChoice1(): Incorrect value for inout param",
2154: equals(x, y.value));
2155: assertTrue(
2156: "testOccuringChoice1(): Incorrect value for out param",
2157: equals(yOriginal, z.value));
2158: assertTrue("testOccuringChoice1(): Incorrect return value",
2159: equals(x, ret));
2160: }
2161: }
2162:
2163: // org.objectweb.type_test.types3.OccuringChoice2;
2164:
2165: protected boolean equals(OccuringChoice2 x, OccuringChoice2 y) {
2166: if (x.getVarString() != null
2167: && !x.getVarString().equals(y.getVarString())) {
2168: return false;
2169: }
2170: if (x.getVarInt() != null && x.getVarInt() != y.getVarInt()) {
2171: return false;
2172: }
2173: return true;
2174: }
2175:
2176: public void testOccuringChoice2() throws Exception {
2177: OccuringChoice2 x = new OccuringChoice2();
2178: x.setVarString("x1");
2179: OccuringChoice2 yOriginal = new OccuringChoice2();
2180: yOriginal.setVarString("y1");
2181: Holder<OccuringChoice2> y = new Holder<OccuringChoice2>(
2182: yOriginal);
2183: Holder<OccuringChoice2> z = new Holder<OccuringChoice2>();
2184: OccuringChoice2 ret;
2185: if (testDocLiteral) {
2186: ret = docClient.testOccuringChoice2(x, y, z);
2187: } else {
2188: ret = rpcClient.testOccuringChoice2(x, y, z);
2189: }
2190:
2191: if (!perfTestOnly) {
2192: assertTrue(
2193: "testOccuringChoice2(): Incorrect value for inout param",
2194: equals(x, y.value));
2195: assertTrue(
2196: "testOccuringChoice2(): Incorrect value for out param",
2197: equals(yOriginal, z.value));
2198: assertTrue("testOccuringChoice2(): Incorrect return value",
2199: equals(x, ret));
2200: }
2201:
2202: x = new OccuringChoice2();
2203: yOriginal = new OccuringChoice2();
2204: yOriginal.setVarString("y1");
2205: y = new Holder<OccuringChoice2>(yOriginal);
2206: z = new Holder<OccuringChoice2>();
2207: if (testDocLiteral) {
2208: ret = docClient.testOccuringChoice2(x, y, z);
2209: } else {
2210: ret = rpcClient.testOccuringChoice2(x, y, z);
2211: }
2212:
2213: if (!perfTestOnly) {
2214: assertTrue(
2215: "testOccuringChoice2(): Incorrect value for inout param",
2216: equals(x, y.value));
2217: assertTrue(
2218: "testOccuringChoice2(): Incorrect value for out param",
2219: equals(yOriginal, z.value));
2220: assertTrue("testOccuringChoice2(): Incorrect return value",
2221: equals(x, ret));
2222: }
2223: }
2224: }
|