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