0001: package org.objectweb.celtix.systest.type_test;
0002:
0003: import java.math.BigDecimal;
0004: import java.math.BigInteger;
0005: import java.util.Arrays;
0006: import java.util.List;
0007:
0008: import javax.xml.bind.JAXBElement;
0009: import javax.xml.namespace.QName;
0010: import javax.xml.ws.Holder;
0011:
0012: import org.objectweb.type_test.types1.AnonymousStruct;
0013: import org.objectweb.type_test.types1.BoundedArray;
0014: import org.objectweb.type_test.types1.ChoiceArray;
0015: import org.objectweb.type_test.types1.CompoundArray;
0016: import org.objectweb.type_test.types1.DerivedStructBaseEmpty;
0017: import org.objectweb.type_test.types1.Document;
0018: import org.objectweb.type_test.types1.EmptyAll;
0019: import org.objectweb.type_test.types1.EmptyChoice;
0020: import org.objectweb.type_test.types1.EmptyStruct;
0021: import org.objectweb.type_test.types1.ExtColourEnum;
0022: import org.objectweb.type_test.types1.ExtendsSimpleContent;
0023: import org.objectweb.type_test.types1.ExtendsSimpleType;
0024: import org.objectweb.type_test.types1.FixedArray;
0025: import org.objectweb.type_test.types1.NestedArray;
0026: import org.objectweb.type_test.types1.NestedStruct;
0027: import org.objectweb.type_test.types1.RecursiveStruct;
0028: import org.objectweb.type_test.types1.RecursiveStructArray;
0029: import org.objectweb.type_test.types1.RecursiveUnion;
0030: import org.objectweb.type_test.types1.RecursiveUnionData;
0031: import org.objectweb.type_test.types1.SimpleAll;
0032: import org.objectweb.type_test.types1.SimpleChoice;
0033: import org.objectweb.type_test.types1.SimpleContent1;
0034: import org.objectweb.type_test.types1.SimpleContent2;
0035: import org.objectweb.type_test.types1.SimpleContent3;
0036: import org.objectweb.type_test.types1.SimpleStruct;
0037: import org.objectweb.type_test.types1.StructWithList;
0038: import org.objectweb.type_test.types1.StructWithNillables;
0039: import org.objectweb.type_test.types1.StructWithOptionals;
0040: import org.objectweb.type_test.types1.StructWithUnion;
0041: import org.objectweb.type_test.types1.UnboundedArray;
0042: import org.objectweb.type_test.types1.UnionSimpleContent;
0043: import org.objectweb.type_test.types2.ExtBase64Binary;
0044: import org.objectweb.type_test.types3.ChoiceWithSubstitutionGroup;
0045: import org.objectweb.type_test.types3.ChoiceWithSubstitutionGroupAbstract;
0046: import org.objectweb.type_test.types3.ChoiceWithSubstitutionGroupNil;
0047: import org.objectweb.type_test.types3.ObjectFactory;
0048: import org.objectweb.type_test.types3.RecElNextType;
0049: import org.objectweb.type_test.types3.RecElType;
0050: import org.objectweb.type_test.types3.RecInnerNextType;
0051: import org.objectweb.type_test.types3.RecInnerType;
0052: import org.objectweb.type_test.types3.RecMostInnerNextType;
0053: import org.objectweb.type_test.types3.RecMostInnerType;
0054: import org.objectweb.type_test.types3.RecOuterNextType;
0055: import org.objectweb.type_test.types3.RecOuterType;
0056: import org.objectweb.type_test.types3.SgBaseTypeA;
0057: import org.objectweb.type_test.types3.SgDerivedTypeB;
0058: import org.objectweb.type_test.types3.SgDerivedTypeC;
0059: import org.objectweb.type_test.types3.StructWithMultipleSubstitutionGroups;
0060: import org.objectweb.type_test.types3.StructWithSubstitutionGroup;
0061: import org.objectweb.type_test.types3.StructWithSubstitutionGroupAbstract;
0062: import org.objectweb.type_test.types3.StructWithSubstitutionGroupNil;
0063:
0064: public abstract class AbstractTypeTestClient2 extends
0065: AbstractTypeTestClient {
0066:
0067: public AbstractTypeTestClient2(String name, QName theServicename,
0068: QName thePort, String theWsdlPath) {
0069: super (name, theServicename, thePort, theWsdlPath);
0070: }
0071:
0072: protected <T> boolean equalsNilable(T x, T y) {
0073: if (x == null) {
0074: return y == null;
0075: } else if (y == null) {
0076: return false;
0077: } else {
0078: return x.equals(y);
0079: }
0080: }
0081:
0082: protected <T> boolean notNull(T x, T y) {
0083: return x != null && y != null;
0084: }
0085:
0086: // org.objectweb.type_test.types1.EmptyStruct
0087:
0088: public void testEmptyStruct() throws Exception {
0089: EmptyStruct x = new EmptyStruct();
0090: EmptyStruct yOrig = new EmptyStruct();
0091: Holder<EmptyStruct> y = new Holder<EmptyStruct>(yOrig);
0092: Holder<EmptyStruct> z = new Holder<EmptyStruct>();
0093: EmptyStruct ret;
0094: if (testDocLiteral) {
0095: ret = docClient.testEmptyStruct(x, y, z);
0096: } else {
0097: ret = rpcClient.testEmptyStruct(x, y, z);
0098: }
0099: if (!perfTestOnly) {
0100: assertTrue("testEmptyStruct(): Null value for inout param",
0101: notNull(x, y.value));
0102: assertTrue("testEmptyStruct(): Null value for out param",
0103: notNull(yOrig, z.value));
0104: assertTrue("testEmptyStruct(): Null return value", notNull(
0105: x, ret));
0106: }
0107:
0108: //Test With Derived Instance
0109: DerivedStructBaseEmpty derivedX = new DerivedStructBaseEmpty();
0110: derivedX.setVarFloatExt(-3.14f);
0111: derivedX.setVarStringExt("DerivedStruct-x");
0112: derivedX.setAttrString("DerivedAttr-x");
0113: DerivedStructBaseEmpty derivedY = new DerivedStructBaseEmpty();
0114: derivedY.setVarFloatExt(1.414f);
0115: derivedY.setVarStringExt("DerivedStruct-y");
0116: derivedY.setAttrString("DerivedAttr-y");
0117:
0118: y = new Holder<EmptyStruct>(derivedY);
0119: z = new Holder<EmptyStruct>();
0120: if (testDocLiteral) {
0121: ret = docClient.testEmptyStruct(derivedX, y, z);
0122: } else {
0123: ret = rpcClient.testEmptyStruct(derivedX, y, z);
0124: }
0125: if (!perfTestOnly) {
0126: assertTrue("testEmptyStruct(): Null value for inout param",
0127: notNull(derivedX, y.value));
0128: assertTrue("testEmptyStruct(): Null value for out param",
0129: notNull(derivedY, z.value));
0130: assertTrue("testEmptyStruct(): Null return value", notNull(
0131: derivedX, ret));
0132: }
0133: }
0134:
0135: // org.objectweb.type_test.types1.SimpleStruct
0136:
0137: protected boolean equals(SimpleStruct x, SimpleStruct y) {
0138: return (Double.compare(x.getVarFloat(), y.getVarFloat()) == 0)
0139: && (x.getVarInt().compareTo(y.getVarInt()) == 0)
0140: && (x.getVarString().equals(y.getVarString()))
0141: && (equalsNilable(x.getVarAttrString(), y
0142: .getVarAttrString()));
0143: }
0144:
0145: public void testSimpleStruct() throws Exception {
0146: SimpleStruct x = new SimpleStruct();
0147: x.setVarFloat(3.14f);
0148: x.setVarInt(new BigInteger("42"));
0149: x.setVarString("Hello There");
0150:
0151: SimpleStruct yOrig = new SimpleStruct();
0152: yOrig.setVarFloat(1.414f);
0153: yOrig.setVarInt(new BigInteger("13"));
0154: yOrig.setVarString("Cheerio");
0155:
0156: Holder<SimpleStruct> y = new Holder<SimpleStruct>(yOrig);
0157: Holder<SimpleStruct> z = new Holder<SimpleStruct>();
0158: SimpleStruct ret;
0159: if (testDocLiteral) {
0160: ret = docClient.testSimpleStruct(x, y, z);
0161: } else {
0162: ret = rpcClient.testSimpleStruct(x, y, z);
0163: }
0164: if (!perfTestOnly) {
0165: assertTrue(
0166: "testSimpleStruct(): Incorrect value for inout param",
0167: equals(x, y.value));
0168: assertTrue(
0169: "testSimpleStruct(): Incorrect value for out param",
0170: equals(yOrig, z.value));
0171: assertTrue("testSimpleStruct(): Incorrect return value",
0172: equals(x, ret));
0173: }
0174: }
0175:
0176: // org.objectweb.type_test.types1.StructWithNillables
0177:
0178: protected boolean equals(StructWithNillables x,
0179: StructWithNillables y) {
0180: return equalsNilable(x.getVarFloat(), y.getVarFloat())
0181: && equalsNilable(x.getVarInt(), x.getVarInt())
0182: && equalsNilable(x.getVarString(), y.getVarString())
0183: && equalsNilable(x.getVarStruct(), y.getVarStruct());
0184: }
0185:
0186: public void testStructWithNillables() throws Exception {
0187: StructWithNillables x = new StructWithNillables();
0188: StructWithNillables yOrig = new StructWithNillables();
0189: yOrig.setVarFloat(new Float(1.414f));
0190: yOrig.setVarInt(new Integer(13));
0191: yOrig.setVarString("Cheerio");
0192:
0193: Holder<StructWithNillables> y = new Holder<StructWithNillables>(
0194: yOrig);
0195: Holder<StructWithNillables> z = new Holder<StructWithNillables>();
0196: StructWithNillables ret;
0197: if (testDocLiteral) {
0198: ret = docClient.testStructWithNillables(x, y, z);
0199: } else {
0200: ret = rpcClient.testStructWithNillables(x, y, z);
0201: }
0202: if (!perfTestOnly) {
0203: assertTrue(
0204: "testStructWithNillables(): Incorrect value for inout param",
0205: equals(x, y.value));
0206: assertTrue(
0207: "testStructWithNillables(): Incorrect value for out param",
0208: equals(yOrig, z.value));
0209: assertTrue(
0210: "testStructWithNillables(): Incorrect return value",
0211: equals(x, ret));
0212: }
0213: }
0214:
0215: // org.objectweb.type_test.types1.AnonymousStruct
0216: // XXX - generated code flattens nested struct into top-level class.
0217: protected boolean equals(AnonymousStruct x, AnonymousStruct y) {
0218: return (x.getVarFloat() == y.getVarFloat())
0219: && (x.getVarInt() == y.getVarInt())
0220: && (x.getVarString().equals(y.getVarString()));
0221: }
0222:
0223: public void testAnonymousStruct() throws Exception {
0224: AnonymousStruct x = new AnonymousStruct();
0225: x.setVarInt(100);
0226: x.setVarString("hello");
0227: x.setVarFloat(1.1f);
0228:
0229: AnonymousStruct yOrig = new AnonymousStruct();
0230: yOrig.setVarInt(11);
0231: yOrig.setVarString("world");
0232: yOrig.setVarFloat(10.1f);
0233:
0234: Holder<AnonymousStruct> y = new Holder<AnonymousStruct>(yOrig);
0235: Holder<AnonymousStruct> z = new Holder<AnonymousStruct>();
0236: AnonymousStruct ret;
0237: if (testDocLiteral) {
0238: ret = docClient.testAnonymousStruct(x, y, z);
0239: } else {
0240: ret = rpcClient.testAnonymousStruct(x, y, z);
0241: }
0242: if (!perfTestOnly) {
0243: assertTrue(
0244: "testAnonymousStruct(): Incorrect value for inout param",
0245: equals(x, y.value));
0246: assertTrue(
0247: "testAnonymousStruct(): Incorrect value for out param",
0248: equals(yOrig, z.value));
0249: assertTrue("testAnonymousStruct(): Incorrect return value",
0250: equals(x, ret));
0251: }
0252: }
0253:
0254: // org.objectweb.type_test.types1.NestedStruct
0255:
0256: protected boolean equals(NestedStruct x, NestedStruct y) {
0257: return (x.getVarInt() == y.getVarInt())
0258: && (x.getVarFloat().compareTo(y.getVarFloat()) == 0)
0259: && (x.getVarString().equals(y.getVarString()))
0260: && equalsNilable(x.getVarEmptyStruct(), y
0261: .getVarEmptyStruct())
0262: && equalsNilableStruct(x.getVarStruct(), y
0263: .getVarStruct());
0264: }
0265:
0266: protected boolean equalsNilable(EmptyStruct x, EmptyStruct y) {
0267: if (x == null) {
0268: return y == null;
0269: }
0270: return y != null;
0271: }
0272:
0273: protected boolean equalsNilableStruct(SimpleStruct x, SimpleStruct y) {
0274: if (x == null) {
0275: return y == null;
0276: } else if (y == null) {
0277: return false;
0278: } else {
0279: return equals(x, y);
0280: }
0281: }
0282:
0283: public void testNestedStruct() throws Exception {
0284: SimpleStruct xs = new SimpleStruct();
0285: xs.setVarFloat(30.14);
0286: xs.setVarInt(new BigInteger("420"));
0287: xs.setVarString("NESTED Hello There");
0288: NestedStruct x = new NestedStruct();
0289: x.setVarFloat(new BigDecimal("3.14"));
0290: x.setVarInt(42);
0291: x.setVarString("Hello There");
0292: x.setVarEmptyStruct(new EmptyStruct());
0293: x.setVarStruct(xs);
0294:
0295: SimpleStruct ys = new SimpleStruct();
0296: ys.setVarFloat(10.414);
0297: ys.setVarInt(new BigInteger("130"));
0298: ys.setVarString("NESTED Cheerio");
0299:
0300: NestedStruct yOrig = new NestedStruct();
0301: yOrig.setVarFloat(new BigDecimal("1.414"));
0302: yOrig.setVarInt(13);
0303: yOrig.setVarString("Cheerio");
0304: yOrig.setVarEmptyStruct(new EmptyStruct());
0305: yOrig.setVarStruct(ys);
0306:
0307: Holder<NestedStruct> y = new Holder<NestedStruct>(yOrig);
0308: Holder<NestedStruct> z = new Holder<NestedStruct>();
0309: NestedStruct ret;
0310: if (testDocLiteral) {
0311: ret = docClient.testNestedStruct(x, y, z);
0312: } else {
0313: ret = rpcClient.testNestedStruct(x, y, z);
0314: }
0315: if (!perfTestOnly) {
0316: assertTrue(
0317: "testNestedStruct(): Incorrect value for inout param",
0318: equals(x, y.value));
0319: assertTrue(
0320: "testNestedStruct(): Incorrect value for out param",
0321: equals(yOrig, z.value));
0322: assertTrue("testNestedStruct(): Incorrect return value",
0323: equals(x, ret));
0324: }
0325: }
0326:
0327: // org.objectweb.type_test.types1.FixedArray
0328:
0329: public void testFixedArray() throws Exception {
0330: FixedArray x = new FixedArray();
0331: x.getItem().addAll(
0332: Arrays.asList(Integer.MIN_VALUE, 0, Integer.MAX_VALUE));
0333:
0334: FixedArray yOrig = new FixedArray();
0335: yOrig.getItem().addAll(Arrays.asList(-1, 0, 1));
0336:
0337: Holder<FixedArray> y = new Holder<FixedArray>(yOrig);
0338: Holder<FixedArray> z = new Holder<FixedArray>();
0339: FixedArray ret;
0340: if (testDocLiteral) {
0341: ret = docClient.testFixedArray(x, y, z);
0342: } else {
0343: ret = rpcClient.testFixedArray(x, y, z);
0344: }
0345: if (!perfTestOnly) {
0346: for (int i = 0; i < 3; i++) {
0347: assertEquals(
0348: "testFixedArray(): Incorrect value for inout param",
0349: x.getItem().get(i), y.value.getItem().get(i));
0350: assertEquals(
0351: "testFixedArray(): Incorrect value for out param",
0352: yOrig.getItem().get(i), z.value.getItem()
0353: .get(i));
0354: assertEquals(
0355: "testFixedArray(): Incorrect return value", x
0356: .getItem().get(i), ret.getItem().get(i));
0357: }
0358: }
0359: }
0360:
0361: // org.objectweb.type_test.types1.BoundedArray
0362:
0363: public void testBoundedArray() throws Exception {
0364: BoundedArray x = new BoundedArray();
0365: x.getItem().addAll(Arrays.asList(-100.00f, 0f, 100.00f));
0366: BoundedArray yOrig = new BoundedArray();
0367: yOrig.getItem().addAll(Arrays.asList(-1f, 0f, 1f));
0368:
0369: Holder<BoundedArray> y = new Holder<BoundedArray>(yOrig);
0370: Holder<BoundedArray> z = new Holder<BoundedArray>();
0371: BoundedArray ret;
0372: if (testDocLiteral) {
0373: ret = docClient.testBoundedArray(x, y, z);
0374: } else {
0375: ret = rpcClient.testBoundedArray(x, y, z);
0376: }
0377: if (!perfTestOnly) {
0378: float delta = 0.0f;
0379:
0380: int xSize = x.getItem().size();
0381: int ySize = y.value.getItem().size();
0382: int zSize = z.value.getItem().size();
0383: int retSize = ret.getItem().size();
0384: assertTrue("testBoundedArray() array size incorrect",
0385: xSize == ySize && ySize == zSize
0386: && zSize == retSize && xSize == 3);
0387: for (int i = 0; i < xSize; i++) {
0388: assertEquals(
0389: "testBoundedArray(): Incorrect value for inout param",
0390: x.getItem().get(i), y.value.getItem().get(i),
0391: delta);
0392: assertEquals(
0393: "testBoundedArray(): Incorrect value for out param",
0394: yOrig.getItem().get(i), z.value.getItem()
0395: .get(i), delta);
0396: assertEquals(
0397: "testBoundedArray(): Incorrect return value", x
0398: .getItem().get(i),
0399: ret.getItem().get(i), delta);
0400: }
0401: }
0402: }
0403:
0404: // org.objectweb.type_test.types1.UnboundedArray
0405:
0406: protected boolean equals(UnboundedArray x, UnboundedArray y) {
0407: List<String> xx = x.getItem();
0408: List<String> yy = y.getItem();
0409: if (xx.size() != yy.size()) {
0410: return false;
0411: }
0412: for (int i = 0; i < xx.size(); i++) {
0413: if (!xx.get(i).equals(yy.get(i))) {
0414: return false;
0415: }
0416: }
0417: return true;
0418: }
0419:
0420: public void testUnboundedArray() throws Exception {
0421: UnboundedArray x = new UnboundedArray();
0422: x.getItem().addAll(Arrays.asList("AAA", "BBB", "CCC"));
0423: UnboundedArray yOrig = new UnboundedArray();
0424: yOrig.getItem().addAll(Arrays.asList("XXX", "YYY", "ZZZ"));
0425:
0426: Holder<UnboundedArray> y = new Holder<UnboundedArray>(yOrig);
0427: Holder<UnboundedArray> z = new Holder<UnboundedArray>();
0428: UnboundedArray ret;
0429: if (testDocLiteral) {
0430: ret = docClient.testUnboundedArray(x, y, z);
0431: } else {
0432: ret = rpcClient.testUnboundedArray(x, y, z);
0433: }
0434: if (!perfTestOnly) {
0435: for (int i = 0; i < 3; i++) {
0436: assertTrue(
0437: "testUnboundedArray(): Incorrect value for inout param",
0438: equals(x, y.value));
0439: assertTrue(
0440: "testUnboundedArray(): Incorrect value for out param",
0441: equals(yOrig, z.value));
0442: assertTrue(
0443: "testUnboundedArray(): Incorrect return value",
0444: equals(x, ret));
0445: }
0446: }
0447: }
0448:
0449: // org.objectweb.type_test.types1.CompoundArray
0450:
0451: protected boolean equals(CompoundArray x, CompoundArray y) {
0452: return x.getArray1().equals(y.getArray1())
0453: && x.getArray2().equals(y.getArray2());
0454: }
0455:
0456: public void testCompoundArray() throws Exception {
0457: CompoundArray x = new CompoundArray();
0458: x.getArray1().addAll(Arrays.asList("AAA", "BBB", "CCC"));
0459: x.getArray2().addAll(Arrays.asList("aaa", "bbb", "ccc"));
0460:
0461: CompoundArray yOrig = new CompoundArray();
0462: yOrig.getArray1().addAll(Arrays.asList("XXX", "YYY", "ZZZ"));
0463: yOrig.getArray2().addAll(Arrays.asList("xxx", "yyy", "zzz"));
0464:
0465: Holder<CompoundArray> y = new Holder<CompoundArray>(yOrig);
0466: Holder<CompoundArray> z = new Holder<CompoundArray>();
0467: CompoundArray ret;
0468: if (testDocLiteral) {
0469: ret = docClient.testCompoundArray(x, y, z);
0470: } else {
0471: ret = rpcClient.testCompoundArray(x, y, z);
0472: }
0473: if (!perfTestOnly) {
0474: assertTrue(
0475: "testCompoundArray(): Incorrect value for inout param",
0476: equals(x, y.value));
0477: assertTrue(
0478: "testCompoundArray(): Incorrect value for out param",
0479: equals(yOrig, z.value));
0480: assertTrue("testCompoundArray(): Incorrect return value",
0481: equals(x, ret));
0482: }
0483: }
0484:
0485: // org.objectweb.type_test.types1.NestedArray
0486:
0487: public void testNestedArray() throws Exception {
0488: String[][] xs = { { "AAA", "BBB", "CCC" },
0489: { "aaa", "bbb", "ccc" }, { "a_a_a", "b_b_b", "c_c_c" } };
0490: String[][] ys = { { "XXX", "YYY", "ZZZ" },
0491: { "xxx", "yyy", "zzz" }, { "x_x_x", "y_y_y", "z_z_z" } };
0492:
0493: NestedArray x = new NestedArray();
0494: NestedArray yOrig = new NestedArray();
0495:
0496: List<UnboundedArray> xList = x.getSubarray();
0497: List<UnboundedArray> yList = yOrig.getSubarray();
0498:
0499: for (int i = 0; i < 3; i++) {
0500: UnboundedArray xx = new UnboundedArray();
0501: xx.getItem().addAll(Arrays.asList(xs[i]));
0502: xList.add(xx);
0503: UnboundedArray yy = new UnboundedArray();
0504: yy.getItem().addAll(Arrays.asList(ys[i]));
0505: yList.add(yy);
0506: }
0507:
0508: Holder<NestedArray> y = new Holder<NestedArray>(yOrig);
0509: Holder<NestedArray> z = new Holder<NestedArray>();
0510: NestedArray ret;
0511: if (testDocLiteral) {
0512: ret = docClient.testNestedArray(x, y, z);
0513: } else {
0514: ret = rpcClient.testNestedArray(x, y, z);
0515: }
0516: if (!perfTestOnly) {
0517: for (int i = 0; i < 3; i++) {
0518: for (int j = 0; j < 3; j++) {
0519: assertEquals(
0520: "testNestedArray(): Incorrect value for inout param",
0521: x.getSubarray().get(i).getItem().get(j),
0522: y.value.getSubarray().get(i).getItem().get(
0523: j));
0524: assertEquals(
0525: "testNestedArray(): Incorrect value for out param",
0526: yOrig.getSubarray().get(i).getItem().get(j),
0527: z.value.getSubarray().get(i).getItem().get(
0528: j));
0529: assertEquals(
0530: "testNestedArray(): Incorrect return value",
0531: x.getSubarray().get(i).getItem().get(j),
0532: ret.getSubarray().get(i).getItem().get(j));
0533: }
0534: }
0535: }
0536: }
0537:
0538: // org.objectweb.type_test.types1.StructWithList
0539:
0540: protected void assertEquals(String msg, StructWithList x,
0541: StructWithList y) throws Exception {
0542: assertTrue(msg, x != null);
0543: assertTrue(msg, y != null);
0544:
0545: List<String> xVar = x.getVarList();
0546: List<String> yVar = y.getVarList();
0547: assertTrue(xVar.size() == yVar.size());
0548: for (int i = 0; i < xVar.size(); ++i) {
0549: assertEquals(msg, xVar.get(i), yVar.get(i));
0550: }
0551:
0552: List<Integer> xAttr = x.getAttribList();
0553: List<Integer> yAttr = y.getAttribList();
0554: if (xAttr == null) {
0555: assertTrue(msg, yAttr == null);
0556: } else {
0557: assertTrue(xAttr.size() == yAttr.size());
0558: for (int i = 0; i < xAttr.size(); ++i) {
0559: assertEquals(msg, xAttr.get(i), yAttr.get(i));
0560: }
0561: }
0562: }
0563:
0564: public void testStructWithList() throws Exception {
0565: StructWithList x = new StructWithList();
0566: x.getVarList().add("I");
0567: x.getVarList().add("am");
0568: x.getVarList().add("StructWithList");
0569:
0570: StructWithList yOrig = new StructWithList();
0571: yOrig.getVarList().add("Does");
0572: yOrig.getVarList().add("StructWithList");
0573: yOrig.getVarList().add("work");
0574:
0575: Holder<StructWithList> y = new Holder<StructWithList>(yOrig);
0576: Holder<StructWithList> z = new Holder<StructWithList>();
0577: StructWithList ret;
0578: if (testDocLiteral) {
0579: ret = docClient.testStructWithList(x, y, z);
0580: } else {
0581: ret = rpcClient.testStructWithList(x, y, z);
0582: }
0583: if (!perfTestOnly) {
0584: assertEquals(
0585: "testStructWithList(): Incorrect value for inout param",
0586: x, y.value);
0587: assertEquals(
0588: "testStructWithList(): Incorrect value for out param",
0589: yOrig, z.value);
0590: assertEquals(
0591: "testStructWithList(): Incorrect return value", x,
0592: ret);
0593: }
0594:
0595: x.getAttribList().add(1);
0596: x.getAttribList().add(2);
0597: x.getAttribList().add(3);
0598: y.value = yOrig;
0599: if (testDocLiteral) {
0600: ret = docClient.testStructWithList(x, y, z);
0601: } else {
0602: ret = rpcClient.testStructWithList(x, y, z);
0603: }
0604: if (!perfTestOnly) {
0605: assertEquals(
0606: "testStructWithList(): Incorrect value for inout param",
0607: x, y.value);
0608: assertEquals(
0609: "testStructWithList(): Incorrect value for out param",
0610: yOrig, z.value);
0611: assertEquals(
0612: "testStructWithList(): Incorrect return value", x,
0613: ret);
0614: }
0615:
0616: yOrig.getAttribList().add(4);
0617: yOrig.getAttribList().add(5);
0618: yOrig.getAttribList().add(6);
0619: y.value = yOrig;
0620: if (testDocLiteral) {
0621: ret = docClient.testStructWithList(x, y, z);
0622: } else {
0623: ret = rpcClient.testStructWithList(x, y, z);
0624: }
0625: if (!perfTestOnly) {
0626: assertEquals(
0627: "testStructWithList(): Incorrect value for inout param",
0628: x, y.value);
0629: assertEquals(
0630: "testStructWithList(): Incorrect value for out param",
0631: yOrig, z.value);
0632: assertEquals(
0633: "testStructWithList(): Incorrect return value", x,
0634: ret);
0635: }
0636: }
0637:
0638: // org.objectweb.type_test.types1.StructWithUnion
0639:
0640: protected void assertEquals(String msg, StructWithUnion x,
0641: StructWithUnion y) throws Exception {
0642: assertTrue(msg, x != null);
0643: assertTrue(msg, y != null);
0644: assertEquals(msg, x.getVarUnion(), y.getVarUnion());
0645: assertEquals(msg, x.getAttribUnion(), y.getAttribUnion());
0646: }
0647:
0648: public void testStructWithUnion() throws Exception {
0649: StructWithUnion x = new StructWithUnion();
0650: x.setVarUnion("999");
0651: StructWithUnion yOrig = new StructWithUnion();
0652: yOrig.setVarUnion("-999");
0653:
0654: Holder<StructWithUnion> y = new Holder<StructWithUnion>(yOrig);
0655: Holder<StructWithUnion> z = new Holder<StructWithUnion>();
0656: StructWithUnion ret;
0657: if (testDocLiteral) {
0658: ret = docClient.testStructWithUnion(x, y, z);
0659: } else {
0660: ret = rpcClient.testStructWithUnion(x, y, z);
0661: }
0662: if (!perfTestOnly) {
0663: assertEquals(
0664: "testStructWithUnion(): Incorrect value for inout param",
0665: x, y.value);
0666: assertEquals(
0667: "testStructWithUnion(): Incorrect value for out param",
0668: yOrig, z.value);
0669: assertEquals(
0670: "testStructWithUnion(): Incorrect return value", x,
0671: ret);
0672: }
0673:
0674: x.setAttribUnion("99");
0675: y.value = yOrig;
0676: if (testDocLiteral) {
0677: ret = docClient.testStructWithUnion(x, y, z);
0678: } else {
0679: ret = rpcClient.testStructWithUnion(x, y, z);
0680: }
0681: if (!perfTestOnly) {
0682: assertEquals(
0683: "testStructWithUnion(): Incorrect value for inout param",
0684: x, y.value);
0685: assertEquals(
0686: "testStructWithUnion(): Incorrect value for out param",
0687: yOrig, z.value);
0688: assertEquals(
0689: "testStructWithUnion(): Incorrect return value", x,
0690: ret);
0691: }
0692:
0693: yOrig.setAttribUnion("-99");
0694: y.value = yOrig;
0695: if (testDocLiteral) {
0696: ret = docClient.testStructWithUnion(x, y, z);
0697: } else {
0698: ret = rpcClient.testStructWithUnion(x, y, z);
0699: }
0700: if (!perfTestOnly) {
0701: assertEquals(
0702: "testStructWithUnion(): Incorrect value for inout param",
0703: x, y.value);
0704: assertEquals(
0705: "testStructWithUnion(): Incorrect value for out param",
0706: yOrig, z.value);
0707: assertEquals(
0708: "testStructWithUnion(): Incorrect return value", x,
0709: ret);
0710: }
0711: }
0712:
0713: // org.objectweb.type_test.types1.EmptyChoice
0714:
0715: public void testEmptyChoice() throws Exception {
0716: EmptyChoice x = new EmptyChoice();
0717: EmptyChoice yOrig = new EmptyChoice();
0718: Holder<EmptyChoice> y = new Holder<EmptyChoice>(yOrig);
0719: Holder<EmptyChoice> z = new Holder<EmptyChoice>();
0720: EmptyChoice ret;
0721: if (testDocLiteral) {
0722: ret = docClient.testEmptyChoice(x, y, z);
0723: } else {
0724: ret = rpcClient.testEmptyChoice(x, y, z);
0725: }
0726: if (!perfTestOnly) {
0727: assertTrue("testEmptyChoice(): Null value for inout param",
0728: notNull(x, y.value));
0729: assertTrue("testEmptyChoice(): Null value for out param",
0730: notNull(yOrig, z.value));
0731: assertTrue("testEmptyChoice(): Null return value", notNull(
0732: x, ret));
0733: }
0734: }
0735:
0736: // org.objectweb.type_test.types1.SimpleChoice
0737:
0738: protected boolean equals(SimpleChoice x, SimpleChoice y) {
0739: if (x.getVarFloat() != null && y.getVarFloat() != null) {
0740: return x.getVarFloat().compareTo(y.getVarFloat()) == 0;
0741: } else if (x.getVarInt() != null && y.getVarInt() != null) {
0742: return x.getVarInt().compareTo(y.getVarInt()) == 0;
0743: } else if (x.getVarString() != null && y.getVarString() != null) {
0744: return x.getVarString().equals(y.getVarString());
0745: } else {
0746: return false;
0747: }
0748: }
0749:
0750: public void testSimpleChoice() throws Exception {
0751: SimpleChoice x = new SimpleChoice();
0752: x.setVarFloat(-3.14f);
0753: SimpleChoice yOrig = new SimpleChoice();
0754: yOrig.setVarString("Cheerio");
0755:
0756: Holder<SimpleChoice> y = new Holder<SimpleChoice>(yOrig);
0757: Holder<SimpleChoice> z = new Holder<SimpleChoice>();
0758:
0759: SimpleChoice ret;
0760: if (testDocLiteral) {
0761: ret = docClient.testSimpleChoice(x, y, z);
0762: } else {
0763: ret = rpcClient.testSimpleChoice(x, y, z);
0764: }
0765: if (!perfTestOnly) {
0766: assertTrue(
0767: "testSimpleChoice(): Incorrect value for inout param",
0768: equals(x, y.value));
0769: assertTrue(
0770: "testSimpleChoice(): Incorrect value for out param",
0771: equals(yOrig, z.value));
0772: assertTrue("testSimpleChoice(): Incorrect return value",
0773: equals(x, ret));
0774: }
0775: }
0776:
0777: // org.objectweb.type_test.types1.EmptyAll
0778:
0779: public void testEmptyAll() throws Exception {
0780: EmptyAll x = new EmptyAll();
0781: EmptyAll yOrig = new EmptyAll();
0782: Holder<EmptyAll> y = new Holder<EmptyAll>(yOrig);
0783: Holder<EmptyAll> z = new Holder<EmptyAll>();
0784: EmptyAll ret;
0785: if (testDocLiteral) {
0786: ret = docClient.testEmptyAll(x, y, z);
0787: } else {
0788: ret = rpcClient.testEmptyAll(x, y, z);
0789: }
0790: if (!perfTestOnly) {
0791: assertTrue("testEmptyAll(): Null value for inout param",
0792: notNull(x, y.value));
0793: assertTrue("testEmptyAll(): Null value for out param",
0794: notNull(yOrig, z.value));
0795: assertTrue("testEmptyAll(): Null return value", notNull(x,
0796: ret));
0797: }
0798: }
0799:
0800: // org.objectweb.type_test.types1.SimpleAll
0801:
0802: protected boolean equals(SimpleAll x, SimpleAll y) {
0803: return (x.getVarFloat() == y.getVarFloat())
0804: && (x.getVarInt() == y.getVarInt())
0805: && (x.getVarString().equals(y.getVarString()))
0806: && (x.getVarAttrString().equals(y.getVarAttrString()));
0807: }
0808:
0809: public void testSimpleAll() throws Exception {
0810: SimpleAll x = new SimpleAll();
0811: x.setVarFloat(3.14f);
0812: x.setVarInt(42);
0813: x.setVarString("Hello There");
0814: x.setVarAttrString("Attr-x");
0815:
0816: SimpleAll yOrig = new SimpleAll();
0817: yOrig.setVarFloat(-9.14f);
0818: yOrig.setVarInt(10);
0819: yOrig.setVarString("Cheerio");
0820: yOrig.setVarAttrString("Attr-y");
0821:
0822: Holder<SimpleAll> y = new Holder<SimpleAll>(yOrig);
0823: Holder<SimpleAll> z = new Holder<SimpleAll>();
0824:
0825: SimpleAll ret;
0826: if (testDocLiteral) {
0827: ret = docClient.testSimpleAll(x, y, z);
0828: } else {
0829: ret = rpcClient.testSimpleAll(x, y, z);
0830: }
0831: if (!perfTestOnly) {
0832: assertTrue(
0833: "testSimpleAll(): Incorrect value for inout param",
0834: equals(x, y.value));
0835: assertTrue(
0836: "testSimpleAll(): Incorrect value for out param",
0837: equals(yOrig, z.value));
0838: assertTrue("testSimpleAll(): Incorrect return value",
0839: equals(x, ret));
0840: }
0841: }
0842:
0843: // org.objectweb.type_test.types1.StructWithOptionals
0844:
0845: protected boolean equals(StructWithOptionals x,
0846: StructWithOptionals y) {
0847: return equalsNilable(x.getVarFloat(), y.getVarFloat())
0848: && equalsNilable(x.getVarInt(), x.getVarInt())
0849: && equalsNilable(x.getVarString(), y.getVarString())
0850: && equalsNilable(x.getVarStruct(), y.getVarStruct());
0851: }
0852:
0853: public void testStructWithOptionals() throws Exception {
0854: StructWithOptionals x = new StructWithOptionals();
0855: StructWithOptionals yOrig = new StructWithOptionals();
0856: yOrig.setVarFloat(new Float(1.414f));
0857: yOrig.setVarInt(new Integer(13));
0858: yOrig.setVarString("Cheerio");
0859:
0860: Holder<StructWithOptionals> y = new Holder<StructWithOptionals>(
0861: yOrig);
0862: Holder<StructWithOptionals> z = new Holder<StructWithOptionals>();
0863:
0864: StructWithOptionals ret;
0865: if (testDocLiteral) {
0866: ret = docClient.testStructWithOptionals(x, y, z);
0867: } else {
0868: ret = rpcClient.testStructWithOptionals(x, y, z);
0869: }
0870: if (!perfTestOnly) {
0871: assertTrue(
0872: "testStructWithOptionals(): Incorrect value for inout param",
0873: equals(x, y.value));
0874: assertTrue(
0875: "testStructWithOptionals(): Incorrect value for out param",
0876: equals(yOrig, z.value));
0877: assertTrue(
0878: "testStructWithOptionals(): Incorrect return value",
0879: equals(x, ret));
0880: }
0881: }
0882:
0883: // org.objectweb.type_test.types1.RecursiveStruct
0884:
0885: protected boolean equals(RecursiveStruct x, RecursiveStruct y) {
0886: return (x.getVarFloat() == y.getVarFloat())
0887: && (x.getVarInt() == y.getVarInt())
0888: && (x.getVarString().equals(y.getVarString()))
0889: && equals(x.getVarStructArray(), y.getVarStructArray());
0890: }
0891:
0892: public void testRecursiveStruct() throws Exception {
0893: RecursiveStruct xtmp = new RecursiveStruct();
0894: xtmp.setVarFloat(0.14f);
0895: xtmp.setVarInt(4);
0896: xtmp.setVarString("tmp-x");
0897: xtmp.setVarStructArray(new RecursiveStructArray());
0898:
0899: RecursiveStruct ytmp = new RecursiveStruct();
0900: ytmp.setVarFloat(0.414f);
0901: ytmp.setVarInt(1);
0902: ytmp.setVarString("tmp-y");
0903: ytmp.setVarStructArray(new RecursiveStructArray());
0904:
0905: RecursiveStructArray arr = new RecursiveStructArray();
0906: arr.getItem().add(xtmp);
0907: arr.getItem().add(ytmp);
0908:
0909: RecursiveStruct x = new RecursiveStruct();
0910: x.setVarFloat(3.14f);
0911: x.setVarInt(42);
0912: x.setVarString("RecStruct-x");
0913: x.setVarStructArray(arr);
0914:
0915: RecursiveStruct yOrig = new RecursiveStruct();
0916: yOrig.setVarFloat(1.414f);
0917: yOrig.setVarInt(13);
0918: yOrig.setVarString("RecStruct-y");
0919: yOrig.setVarStructArray(arr);
0920:
0921: Holder<RecursiveStruct> y = new Holder<RecursiveStruct>(yOrig);
0922: Holder<RecursiveStruct> z = new Holder<RecursiveStruct>();
0923: RecursiveStruct ret;
0924: if (testDocLiteral) {
0925: ret = docClient.testRecursiveStruct(x, y, z);
0926: } else {
0927: ret = rpcClient.testRecursiveStruct(x, y, z);
0928: }
0929: if (!perfTestOnly) {
0930: assertTrue(
0931: "testRecursiveStruct(): Incorrect value for inout param",
0932: equals(x, y.value));
0933: assertTrue(
0934: "testRecursiveStruct(): Incorrect value for out param",
0935: equals(yOrig, z.value));
0936: assertTrue("testRecursiveStruct(): Incorrect return value",
0937: equals(ret, x));
0938: }
0939: }
0940:
0941: // org.objectweb.type_test.types1.RecursiveStructArray
0942:
0943: protected boolean equals(RecursiveStructArray x,
0944: RecursiveStructArray y) {
0945: List<RecursiveStruct> xx = x.getItem();
0946: List<RecursiveStruct> yy = y.getItem();
0947: if (xx.isEmpty() && yy.isEmpty()) {
0948: return true;
0949: }
0950: if (xx.size() != yy.size()) {
0951: return false;
0952: }
0953: for (int i = 0; i < xx.size(); i++) {
0954: if (!equals(xx.get(i), yy.get(i))) {
0955: return false;
0956: }
0957: }
0958: return true;
0959: }
0960:
0961: public void testRecursiveStructArray() throws Exception {
0962: RecursiveStruct xtmp = new RecursiveStruct();
0963: xtmp.setVarFloat(0.14f);
0964: xtmp.setVarInt(4);
0965: xtmp.setVarString("tmp-x");
0966: xtmp.setVarStructArray(new RecursiveStructArray());
0967:
0968: RecursiveStruct ytmp = new RecursiveStruct();
0969: ytmp.setVarFloat(0.414f);
0970: ytmp.setVarInt(1);
0971: ytmp.setVarString("tmp-y");
0972: ytmp.setVarStructArray(new RecursiveStructArray());
0973:
0974: RecursiveStructArray x = new RecursiveStructArray();
0975: x.getItem().add(xtmp);
0976: x.getItem().add(ytmp);
0977: RecursiveStructArray yOrig = new RecursiveStructArray();
0978: yOrig.getItem().add(ytmp);
0979: yOrig.getItem().add(xtmp);
0980:
0981: Holder<RecursiveStructArray> y = new Holder<RecursiveStructArray>(
0982: yOrig);
0983: Holder<RecursiveStructArray> z = new Holder<RecursiveStructArray>();
0984: RecursiveStructArray ret;
0985: if (testDocLiteral) {
0986: ret = docClient.testRecursiveStructArray(x, y, z);
0987: } else {
0988: ret = rpcClient.testRecursiveStructArray(x, y, z);
0989: }
0990: if (!perfTestOnly) {
0991: assertTrue(
0992: "testRecursiveStructArray(): Incorrect value for inout param",
0993: equals(x, y.value));
0994: assertTrue(
0995: "testRecursiveStructArray(): Incorrect value for out param",
0996: equals(yOrig, z.value));
0997: assertTrue(
0998: "testRecursiveStructArray(): Incorrect return value",
0999: equals(ret, x));
1000: }
1001: }
1002:
1003: // org.objectweb.type_test.types1.RecursiveUnionData
1004:
1005: protected boolean equals(RecursiveUnion x, RecursiveUnion y) {
1006: if (x.getVarString() != null && y.getVarString() != null) {
1007: return x.getVarString().equals(y.getVarString());
1008: }
1009: if (x.getVarChoice() != null && y.getVarChoice() != null) {
1010: return equals(x.getVarChoice(), y.getVarChoice());
1011: }
1012: return false;
1013: }
1014:
1015: public void testRecursiveUnion() throws Exception {
1016: RecursiveUnion tmp1 = new RecursiveUnion();
1017: tmp1.setVarString("RecusiveUnion-1");
1018: RecursiveUnion tmp2 = new RecursiveUnion();
1019: tmp2.setVarString("RecusiveUnion-2");
1020:
1021: RecursiveUnionData xData = new RecursiveUnionData();
1022: ChoiceArray xChoice = new ChoiceArray();
1023: xChoice.getItem().add(tmp1);
1024: xChoice.getItem().add(tmp2);
1025: xData.setVarInt(5);
1026: xData.setVarChoiceArray(xChoice);
1027:
1028: RecursiveUnion x = new RecursiveUnion();
1029: x.setVarChoice(xData);
1030:
1031: RecursiveUnionData yData = new RecursiveUnionData();
1032: ChoiceArray yChoice = new ChoiceArray();
1033: yChoice.getItem().add(tmp1);
1034: yChoice.getItem().add(tmp2);
1035: yData.setVarInt(-5);
1036: yData.setVarChoiceArray(yChoice);
1037:
1038: RecursiveUnion yOrig = new RecursiveUnion();
1039: yOrig.setVarChoice(yData);
1040:
1041: Holder<RecursiveUnion> y = new Holder<RecursiveUnion>(yOrig);
1042: Holder<RecursiveUnion> z = new Holder<RecursiveUnion>();
1043: RecursiveUnion ret;
1044: if (testDocLiteral) {
1045: ret = docClient.testRecursiveUnion(x, y, z);
1046: } else {
1047: ret = rpcClient.testRecursiveUnion(x, y, z);
1048: }
1049: if (!perfTestOnly) {
1050: assertTrue(
1051: "testRecursiveUnion(): Incorrect value for inout param",
1052: equals(x, y.value));
1053: assertTrue(
1054: "testRecursiveUnion(): Incorrect value for out param",
1055: equals(yOrig, z.value));
1056: assertTrue("testRecursiveUnion(): Incorrect return value",
1057: equals(ret, x));
1058: }
1059: }
1060:
1061: // org.objectweb.type_test.types1.RecursiveUnionData
1062:
1063: protected boolean equals(RecursiveUnionData x, RecursiveUnionData y) {
1064: return x.getVarInt() == y.getVarInt()
1065: && equals(x.getVarChoiceArray(), y.getVarChoiceArray());
1066: }
1067:
1068: public void testRecursiveUnionData() throws Exception {
1069: RecursiveUnion tmp1 = new RecursiveUnion();
1070: tmp1.setVarString("RecusiveUnion-1");
1071: RecursiveUnion tmp2 = new RecursiveUnion();
1072: tmp2.setVarString("RecusiveUnion-2");
1073:
1074: RecursiveUnionData x = new RecursiveUnionData();
1075: ChoiceArray xChoice = new ChoiceArray();
1076: xChoice.getItem().add(tmp1);
1077: xChoice.getItem().add(tmp2);
1078: x.setVarInt(5);
1079: x.setVarChoiceArray(xChoice);
1080:
1081: RecursiveUnionData yOrig = new RecursiveUnionData();
1082: ChoiceArray yOrigchoice = new ChoiceArray();
1083: xChoice.getItem().add(tmp1);
1084: xChoice.getItem().add(tmp2);
1085: yOrig.setVarInt(-5);
1086: yOrig.setVarChoiceArray(yOrigchoice);
1087:
1088: Holder<RecursiveUnionData> y = new Holder<RecursiveUnionData>(
1089: yOrig);
1090: Holder<RecursiveUnionData> z = new Holder<RecursiveUnionData>();
1091: RecursiveUnionData ret;
1092: if (testDocLiteral) {
1093: ret = docClient.testRecursiveUnionData(x, y, z);
1094: } else {
1095: ret = rpcClient.testRecursiveUnionData(x, y, z);
1096: }
1097: if (!perfTestOnly) {
1098: assertTrue(
1099: "testRecursiveUnionData(): Incorrect value for inout param",
1100: equals(x, y.value));
1101: assertTrue(
1102: "testRecursiveUnionData(): Incorrect value for out param",
1103: equals(yOrig, z.value));
1104: assertTrue(
1105: "testRecursiveUnionData(): Incorrect return value",
1106: equals(ret, x));
1107: }
1108: }
1109:
1110: // org.objectweb.type_test.types1.ChoiceArray
1111:
1112: protected boolean equals(ChoiceArray x, ChoiceArray y) {
1113: List<RecursiveUnion> xx = x.getItem();
1114: List<RecursiveUnion> yy = y.getItem();
1115: if (xx.isEmpty() && yy.isEmpty()) {
1116: return true;
1117: }
1118: if (xx.size() != yy.size()) {
1119: return false;
1120: }
1121: for (int i = 0; i < xx.size(); i++) {
1122: if (!equals(xx.get(i), yy.get(i))) {
1123: return false;
1124: }
1125: }
1126: return true;
1127: }
1128:
1129: public void testChoiceArray() throws Exception {
1130: RecursiveUnion tmp1 = new RecursiveUnion();
1131: tmp1.setVarString("RecusiveUnion-1");
1132: RecursiveUnion tmp2 = new RecursiveUnion();
1133: tmp2.setVarString("RecusiveUnion-2");
1134:
1135: ChoiceArray x = new ChoiceArray();
1136: x.getItem().add(tmp1);
1137: x.getItem().add(tmp2);
1138: ChoiceArray yOrig = new ChoiceArray();
1139: yOrig.getItem().add(tmp2);
1140: yOrig.getItem().add(tmp1);
1141:
1142: Holder<ChoiceArray> y = new Holder<ChoiceArray>(yOrig);
1143: Holder<ChoiceArray> z = new Holder<ChoiceArray>();
1144: ChoiceArray ret;
1145: if (testDocLiteral) {
1146: ret = docClient.testChoiceArray(x, y, z);
1147: } else {
1148: ret = rpcClient.testChoiceArray(x, y, z);
1149: }
1150:
1151: if (!perfTestOnly) {
1152: assertTrue(
1153: "testChoiceArray(): Incorrect value for inout param",
1154: equals(x, y.value));
1155: assertTrue(
1156: "testChoiceArray(): Incorrect value for out param",
1157: equals(yOrig, z.value));
1158: assertTrue("testChoiceArray(): Incorrect return value",
1159: equals(ret, x));
1160: }
1161: }
1162:
1163: // org.objectweb.type_test.types2.ExtendsSimpleType
1164:
1165: public void testExtendsSimpleType() throws Exception {
1166: ExtendsSimpleType x = new ExtendsSimpleType();
1167: x.setValue("foo");
1168: ExtendsSimpleType yOriginal = new ExtendsSimpleType();
1169: yOriginal.setValue("bar");
1170: Holder<ExtendsSimpleType> y = new Holder<ExtendsSimpleType>(
1171: yOriginal);
1172: Holder<ExtendsSimpleType> z = new Holder<ExtendsSimpleType>();
1173: ExtendsSimpleType ret;
1174: if (testDocLiteral) {
1175: ret = docClient.testExtendsSimpleType(x, y, z);
1176: } else {
1177: ret = rpcClient.testExtendsSimpleType(x, y, z);
1178: }
1179: if (!perfTestOnly) {
1180: assertEquals(x.getValue(), y.value.getValue());
1181: assertEquals(yOriginal.getValue(), z.value.getValue());
1182: assertEquals(x.getValue(), ret.getValue());
1183: }
1184: }
1185:
1186: // org.objectweb.type_test.types1.ExtendsSimpleContent
1187:
1188: public void testExtendsSimpleContent() throws Exception {
1189: ExtendsSimpleContent x = new ExtendsSimpleContent();
1190: x.setValue("foo");
1191:
1192: ExtendsSimpleContent yOriginal = new ExtendsSimpleContent();
1193: yOriginal.setValue("bar");
1194: Holder<ExtendsSimpleContent> y = new Holder<ExtendsSimpleContent>(
1195: yOriginal);
1196: Holder<ExtendsSimpleContent> z = new Holder<ExtendsSimpleContent>();
1197: ExtendsSimpleContent ret;
1198: if (testDocLiteral) {
1199: ret = docClient.testExtendsSimpleContent(x, y, z);
1200: } else {
1201: ret = rpcClient.testExtendsSimpleContent(x, y, z);
1202: }
1203: if (!perfTestOnly) {
1204: assertEquals(x.getValue(), y.value.getValue());
1205: assertEquals(yOriginal.getValue(), z.value.getValue());
1206: assertEquals(x.getValue(), ret.getValue());
1207: }
1208: }
1209:
1210: // org.objectweb.type_test.types1.Document
1211:
1212: protected void equals(String msg, Document x, Document y)
1213: throws Exception {
1214: assertEquals(msg, x.getValue(), y.getValue());
1215: assertEquals(msg, x.getID(), y.getID());
1216: }
1217:
1218: public void testDocument() throws Exception {
1219: Document x = new Document();
1220: x.setValue("content-x");
1221: x.setID("Hello There");
1222: Document yOrig = new Document();
1223: yOrig.setID("Cheerio");
1224: yOrig.setValue("content-y");
1225:
1226: Holder<Document> y = new Holder<Document>(yOrig);
1227: Holder<Document> z = new Holder<Document>();
1228:
1229: Document ret;
1230: if (testDocLiteral) {
1231: ret = docClient.testDocument(x, y, z);
1232: } else {
1233: ret = rpcClient.testDocument(x, y, z);
1234: }
1235: if (!perfTestOnly) {
1236: equals("testDocument(): Incorrect value for inout param",
1237: x, y.value);
1238: equals("testDocument(): Incorrect value for out param",
1239: yOrig, z.value);
1240: equals("testDocument(): Incorrect return value", x, ret);
1241: }
1242:
1243: x = new Document();
1244: yOrig = new Document();
1245: x.setValue("content-x");
1246: yOrig.setValue("content-y");
1247: x.setID(null);
1248: yOrig.setID(null);
1249: y = new Holder<Document>(yOrig);
1250: z = new Holder<Document>();
1251:
1252: if (testDocLiteral) {
1253: ret = docClient.testDocument(x, y, z);
1254: } else {
1255: ret = rpcClient.testDocument(x, y, z);
1256: }
1257: if (!perfTestOnly) {
1258: equals("testDocument(): Incorrect value for inout param",
1259: x, y.value);
1260: equals("testDocument(): Incorrect value for out param",
1261: yOrig, z.value);
1262: equals("testDocument(): Incorrect return value", x, ret);
1263: assertNull(y.value.getID());
1264: assertNull(ret.getID());
1265: }
1266: }
1267:
1268: // org.objectweb.type_test.types1.ExtColourEnum
1269: // XXX - TODO - ColourEnum generated method fromValue() isn't static...
1270: protected boolean equals(ExtColourEnum x, ExtColourEnum y) {
1271: return (x.getAttrib1() == y.getAttrib1())
1272: && (x.getAttrib2().equals(y.getAttrib2()))
1273: && (x.getValue().equals(y.getValue()));
1274: }
1275:
1276: public void testExtColourEnum() throws Exception {
1277: /*
1278: ExtColourEnum x = new ExtColourEnum();
1279: x.setAttrib1(new Integer(1));
1280: x.setAttrib2("Ax");
1281: x.setValue(ColourEnum.fromValue("RED"));
1282:
1283: ExtColourEnum yOrig = new ExtColourEnum();
1284: yOrig.setAttrib1(new Integer(10));
1285: yOrig.setAttrib2("Ay");
1286: yOrig.setValue(ColourEnum.fromValue("GREEN"));
1287:
1288: Holder<ExtColourEnum> y = new Holder<ExtColourEnum>(yOrig);
1289: Holder<ExtColourEnum> z = new Holder<ExtColourEnum>();
1290: ExtColourEnum ret;
1291: if (testDocLiteral) {
1292: ret = docClient.testExtColourEnum(x, y, z);
1293: } else {
1294: ret = rpcClient.testExtColourEnum(x, y, z);
1295: }
1296: if (!perfTestOnly) {
1297: assertTrue("testExtColourEnum(): Incorrect value for inout param",
1298: equals(x, y.value));
1299: assertTrue("testExtColourEnum(): Incorrect value for out param",
1300: equals(yOrig, z.value));
1301: assertTrue("testExtColourEnum(): Incorrect return value", equals(x, ret));
1302: }
1303: */
1304: }
1305:
1306: // org.objectweb.type_test.types1.ExtBase64Binary;
1307:
1308: protected boolean equals(ExtBase64Binary x, ExtBase64Binary y) {
1309: return x.getId() == y.getId()
1310: && Arrays.equals(x.getValue(), y.getValue());
1311: }
1312:
1313: public void testExtBase64Binary() throws Exception {
1314: ExtBase64Binary x1 = new ExtBase64Binary();
1315: x1.setValue("base64a".getBytes());
1316: x1.setId(1);
1317:
1318: ExtBase64Binary y1 = new ExtBase64Binary();
1319: y1.setValue("base64b".getBytes());
1320: y1.setId(2);
1321:
1322: Holder<ExtBase64Binary> y1Holder = new Holder<ExtBase64Binary>(
1323: y1);
1324: Holder<ExtBase64Binary> z1 = new Holder<ExtBase64Binary>();
1325: ExtBase64Binary ret;
1326: if (testDocLiteral) {
1327: ret = docClient.testExtBase64Binary(x1, y1Holder, z1);
1328: } else {
1329: ret = rpcClient.testExtBase64Binary(x1, y1Holder, z1);
1330: }
1331:
1332: if (!perfTestOnly) {
1333: assertTrue(
1334: "testExtBase64Binary(): Incorrect value for inout param",
1335: equals(x1, y1Holder.value));
1336: assertTrue(
1337: "testExtBase64Binary(): Incorrect value for out param",
1338: equals(y1, z1.value));
1339: assertTrue("testExtBase64Binary(): Incorrect return value",
1340: equals(x1, ret));
1341: }
1342: }
1343:
1344: // org.objectweb.type_test.types3.StructWithSubstitutionGroup
1345:
1346: protected boolean equals(StructWithSubstitutionGroup x,
1347: StructWithSubstitutionGroup y) {
1348: if (!x.getSg01BaseElementA().isNil()
1349: && !y.getSg01BaseElementA().isNil()) {
1350: SgBaseTypeA xTypeA = x.getSg01BaseElementA().getValue();
1351: SgBaseTypeA yTypeA = y.getSg01BaseElementA().getValue();
1352: return equals(xTypeA, yTypeA);
1353: }
1354: return false;
1355: }
1356:
1357: public void testStructWithSubstitutionGroup() throws Exception {
1358: SgBaseTypeA baseA = new SgBaseTypeA();
1359: baseA.setVarInt(new BigInteger("1"));
1360:
1361: SgDerivedTypeB derivedB = new SgDerivedTypeB();
1362: derivedB.setVarInt(new BigInteger("32"));
1363: derivedB.setVarString("foo");
1364:
1365: ObjectFactory objectFactory = new ObjectFactory();
1366:
1367: StructWithSubstitutionGroup x = new StructWithSubstitutionGroup();
1368: JAXBElement<? extends SgBaseTypeA> elementA = objectFactory
1369: .createSg01BaseElementA(baseA);
1370: x.setSg01BaseElementA(elementA);
1371: StructWithSubstitutionGroup yOrig = new StructWithSubstitutionGroup();
1372: JAXBElement<? extends SgBaseTypeA> elementB = objectFactory
1373: .createSg01DerivedElementB(derivedB);
1374: yOrig.setSg01BaseElementA(elementB);
1375:
1376: Holder<StructWithSubstitutionGroup> y = new Holder<StructWithSubstitutionGroup>(
1377: yOrig);
1378: Holder<StructWithSubstitutionGroup> z = new Holder<StructWithSubstitutionGroup>();
1379: StructWithSubstitutionGroup ret;
1380: if (testDocLiteral) {
1381: ret = docClient.testStructWithSubstitutionGroup(x, y, z);
1382: } else {
1383: ret = rpcClient.testStructWithSubstitutionGroup(x, y, z);
1384: }
1385: if (!perfTestOnly) {
1386: assertTrue(
1387: "testStructWithSubstitutionGroup(): Incorrect value for inout param",
1388: equals(x, y.value));
1389: assertTrue(
1390: "testStructWithSubstitutionGroup(): Incorrect value for out param",
1391: equals(yOrig, z.value));
1392: assertTrue(
1393: "testStructWithSubstitutionGroup(): Incorrect return value",
1394: equals(x, ret));
1395: }
1396: }
1397:
1398: // org.objectweb.type_test.types3.StructWithSubstitutionGroupAbstract
1399:
1400: protected boolean equals(StructWithSubstitutionGroupAbstract x,
1401: StructWithSubstitutionGroupAbstract y) {
1402: if (x.getSg03AbstractBaseElementA() != null
1403: && y.getSg03AbstractBaseElementA() != null) {
1404: SgBaseTypeA xTypeA = x.getSg03AbstractBaseElementA()
1405: .getValue();
1406: SgBaseTypeA yTypeA = y.getSg03AbstractBaseElementA()
1407: .getValue();
1408: return equals(xTypeA, yTypeA);
1409: }
1410: return false;
1411: }
1412:
1413: public void testStructWithSubstitutionGroupAbstract()
1414: throws Exception {
1415: SgDerivedTypeB derivedB = new SgDerivedTypeB();
1416: derivedB.setVarInt(new BigInteger("32"));
1417: derivedB.setVarString("foo");
1418:
1419: ObjectFactory objectFactory = new ObjectFactory();
1420: JAXBElement<SgDerivedTypeB> elementB = objectFactory
1421: .createSg03DerivedElementB(derivedB);
1422:
1423: SgDerivedTypeC derivedC = new SgDerivedTypeC();
1424: derivedC.setVarInt(new BigInteger("32"));
1425: derivedC.setVarFloat(3.14f);
1426:
1427: JAXBElement<SgDerivedTypeC> elementC = objectFactory
1428: .createSg03DerivedElementC(derivedC);
1429:
1430: StructWithSubstitutionGroupAbstract x = new StructWithSubstitutionGroupAbstract();
1431: x.setSg03AbstractBaseElementA(elementC);
1432: StructWithSubstitutionGroupAbstract yOrig = new StructWithSubstitutionGroupAbstract();
1433: yOrig.setSg03AbstractBaseElementA(elementB);
1434:
1435: Holder<StructWithSubstitutionGroupAbstract> y = new Holder<StructWithSubstitutionGroupAbstract>(
1436: yOrig);
1437: Holder<StructWithSubstitutionGroupAbstract> z = new Holder<StructWithSubstitutionGroupAbstract>();
1438: StructWithSubstitutionGroupAbstract ret;
1439: if (testDocLiteral) {
1440: ret = docClient.testStructWithSubstitutionGroupAbstract(x,
1441: y, z);
1442: } else {
1443: ret = rpcClient.testStructWithSubstitutionGroupAbstract(x,
1444: y, z);
1445: }
1446: if (!perfTestOnly) {
1447: assertTrue(
1448: "testStructWithSubstitutionGroupAbstract(): Incorrect value for inout param",
1449: equals(x, y.value));
1450: assertTrue(
1451: "testStructWithSubstitutionGroupAbstract(): Incorrect value for out param",
1452: equals(yOrig, z.value));
1453: assertTrue(
1454: "testStructWithSubstitutionGroupAbstract(): Incorrect return value",
1455: equals(x, ret));
1456: }
1457: }
1458:
1459: // org.objectweb.type_test.types3.StructWithSubstitutionGroupNil
1460:
1461: protected boolean equals(StructWithSubstitutionGroupNil x,
1462: StructWithSubstitutionGroupNil y) {
1463: if (x.getSg04NillableBaseElementA().isNil()) {
1464: return y.getSg04NillableBaseElementA().isNil();
1465: } else if (y.getSg04NillableBaseElementA().isNil()) {
1466: return false;
1467: } else {
1468: SgBaseTypeA xTypeA = x.getSg04NillableBaseElementA()
1469: .getValue();
1470: SgBaseTypeA yTypeA = y.getSg04NillableBaseElementA()
1471: .getValue();
1472: return equals(xTypeA, yTypeA);
1473: }
1474: }
1475:
1476: public void testStructWithSubstitutionGroupNil() throws Exception {
1477: StructWithSubstitutionGroupNil x = new StructWithSubstitutionGroupNil();
1478: ObjectFactory objectFactory = new ObjectFactory();
1479: JAXBElement<? extends SgBaseTypeA> element = objectFactory
1480: .createSg04NillableBaseElementA(null);
1481: x.setSg04NillableBaseElementA(element);
1482: StructWithSubstitutionGroupNil yOrig = new StructWithSubstitutionGroupNil();
1483: element = objectFactory.createSg04NillableBaseElementA(null);
1484: yOrig.setSg04NillableBaseElementA(element);
1485:
1486: Holder<StructWithSubstitutionGroupNil> y = new Holder<StructWithSubstitutionGroupNil>(
1487: yOrig);
1488: Holder<StructWithSubstitutionGroupNil> z = new Holder<StructWithSubstitutionGroupNil>();
1489: StructWithSubstitutionGroupNil ret;
1490: if (testDocLiteral) {
1491: ret = docClient.testStructWithSubstitutionGroupNil(x, y, z);
1492: } else {
1493: ret = rpcClient.testStructWithSubstitutionGroupNil(x, y, z);
1494: }
1495: if (!perfTestOnly) {
1496: assertTrue(
1497: "testStructWithSubstitutionGroupNil(): Incorrect value for inout param",
1498: equals(x, y.value));
1499: assertTrue(
1500: "testStructWithSubstitutionGroupNil(): Incorrect value for out param",
1501: equals(yOrig, z.value));
1502: assertTrue(
1503: "testStructWithSubstitutionGroupNil(): Incorrect return value",
1504: equals(x, ret));
1505: }
1506: }
1507:
1508: // org.objectweb.type_test.types3.StructWithMultipleSubstitutionGroups
1509:
1510: protected boolean equals(StructWithMultipleSubstitutionGroups x,
1511: StructWithMultipleSubstitutionGroups y) {
1512: if (Double.compare(x.getVarFloat(), y.getVarFloat()) != 0) {
1513: return false;
1514: }
1515: if (x.getVarInt().compareTo(y.getVarInt()) != 0) {
1516: return false;
1517: }
1518: if (!x.getVarString().equals(y.getVarString())) {
1519: return false;
1520: }
1521: if (x.getSg01BaseElementA().isNil()) {
1522: if (!y.getSg01BaseElementA().isNil()) {
1523: return false;
1524: }
1525: } else if (y.getSg01BaseElementA().isNil()) {
1526: return false;
1527: } else {
1528: SgBaseTypeA xTypeA = x.getSg01BaseElementA().getValue();
1529: SgBaseTypeA yTypeA = y.getSg01BaseElementA().getValue();
1530: if (!equals(xTypeA, yTypeA)) {
1531: return false;
1532: }
1533: }
1534: if (x.getSg02BaseElementA().isNil()) {
1535: if (!y.getSg02BaseElementA().isNil()) {
1536: return false;
1537: }
1538: } else if (y.getSg02BaseElementA().isNil()) {
1539: return false;
1540: } else {
1541: SgBaseTypeA xTypeA = x.getSg02BaseElementA().getValue();
1542: SgBaseTypeA yTypeA = y.getSg02BaseElementA().getValue();
1543: return equals(xTypeA, yTypeA);
1544: }
1545: return true;
1546: }
1547:
1548: public void testStructWithMultipleSubstitutionGroups()
1549: throws Exception {
1550: SgBaseTypeA baseA = new SgBaseTypeA();
1551: baseA.setVarInt(new BigInteger("1"));
1552:
1553: SgDerivedTypeB derivedB = new SgDerivedTypeB();
1554: derivedB.setVarInt(new BigInteger("32"));
1555: derivedB.setVarString("y-SgDerivedTypeB");
1556:
1557: SgDerivedTypeC derivedC = new SgDerivedTypeC();
1558: derivedC.setVarInt(new BigInteger("1"));
1559: derivedC.setVarFloat(3.14f);
1560:
1561: ObjectFactory objectFactory = new ObjectFactory();
1562: JAXBElement<? extends SgBaseTypeA> x1 = objectFactory
1563: .createSg01DerivedElementB(derivedB);
1564: JAXBElement<? extends SgBaseTypeA> x2 = objectFactory
1565: .createSg02BaseElementA(baseA);
1566: JAXBElement<? extends SgBaseTypeA> y1 = objectFactory
1567: .createSg01DerivedElementB(derivedB);
1568: JAXBElement<? extends SgBaseTypeA> y2 = objectFactory
1569: .createSg02DerivedElementC(derivedC);
1570:
1571: StructWithMultipleSubstitutionGroups x = new StructWithMultipleSubstitutionGroups();
1572: x.setVarFloat(111.1f);
1573: x.setVarInt(new BigInteger("100"));
1574: x.setVarString("x-varString");
1575: x.setSg01BaseElementA(x1);
1576: x.setSg02BaseElementA(x2);
1577: StructWithMultipleSubstitutionGroups yOrig = new StructWithMultipleSubstitutionGroups();
1578: yOrig.setVarFloat(1.1f);
1579: yOrig.setVarInt(new BigInteger("10"));
1580: yOrig.setVarString("y-varString");
1581: yOrig.setSg01BaseElementA(y1);
1582: yOrig.setSg02BaseElementA(y2);
1583:
1584: Holder<StructWithMultipleSubstitutionGroups> y = new Holder<StructWithMultipleSubstitutionGroups>(
1585: yOrig);
1586: Holder<StructWithMultipleSubstitutionGroups> z = new Holder<StructWithMultipleSubstitutionGroups>();
1587: StructWithMultipleSubstitutionGroups ret;
1588: if (testDocLiteral) {
1589: ret = docClient.testStructWithMultipleSubstitutionGroups(x,
1590: y, z);
1591: } else {
1592: ret = rpcClient.testStructWithMultipleSubstitutionGroups(x,
1593: y, z);
1594: }
1595: if (!perfTestOnly) {
1596: assertTrue(
1597: "testStructWithMultipleSubstitutionGroups(): Incorrect value for inout param",
1598: equals(x, y.value));
1599: assertTrue(
1600: "testStructWithMultipleSubstitutionGroups(): Incorrect value for out param",
1601: equals(yOrig, z.value));
1602: assertTrue(
1603: "testStructWithMultipleSubstitutionGroups(): Incorrect return value",
1604: equals(x, ret));
1605: }
1606: }
1607:
1608: // org.objectweb.type_test.types3.ChoiceWithSubstitutionGroupAbstract
1609:
1610: protected boolean equals(ChoiceWithSubstitutionGroupAbstract x,
1611: ChoiceWithSubstitutionGroupAbstract y) {
1612: if (x.getVarInt() != null && y.getVarInt() != null
1613: && x.getVarInt().equals(y.getVarInt())) {
1614: return true;
1615: }
1616: if (!x.getSg03AbstractBaseElementA().isNil()
1617: && !y.getSg03AbstractBaseElementA().isNil()) {
1618: SgBaseTypeA xTypeA = x.getSg03AbstractBaseElementA()
1619: .getValue();
1620: SgBaseTypeA yTypeA = y.getSg03AbstractBaseElementA()
1621: .getValue();
1622: return equals(xTypeA, yTypeA);
1623: }
1624: return false;
1625: }
1626:
1627: public void testChoiceWithSubstitutionGroupAbstract()
1628: throws Exception {
1629: SgDerivedTypeB derivedB = new SgDerivedTypeB();
1630: derivedB.setVarInt(new BigInteger("32"));
1631: derivedB.setVarString("foo");
1632:
1633: SgDerivedTypeC derivedC = new SgDerivedTypeC();
1634: derivedC.setVarInt(new BigInteger("32"));
1635: derivedC.setVarFloat(3.14f);
1636:
1637: ObjectFactory objectFactory = new ObjectFactory();
1638: JAXBElement<? extends SgBaseTypeA> elementB = objectFactory
1639: .createSg03DerivedElementB(derivedB);
1640: JAXBElement<? extends SgBaseTypeA> elementC = objectFactory
1641: .createSg03DerivedElementC(derivedC);
1642:
1643: ChoiceWithSubstitutionGroupAbstract x = new ChoiceWithSubstitutionGroupAbstract();
1644: x.setSg03AbstractBaseElementA(elementC);
1645: ChoiceWithSubstitutionGroupAbstract yOrig = new ChoiceWithSubstitutionGroupAbstract();
1646: yOrig.setSg03AbstractBaseElementA(elementB);
1647:
1648: Holder<ChoiceWithSubstitutionGroupAbstract> y = new Holder<ChoiceWithSubstitutionGroupAbstract>(
1649: yOrig);
1650: Holder<ChoiceWithSubstitutionGroupAbstract> z = new Holder<ChoiceWithSubstitutionGroupAbstract>();
1651: ChoiceWithSubstitutionGroupAbstract ret;
1652: if (testDocLiteral) {
1653: ret = docClient.testChoiceWithSubstitutionGroupAbstract(x,
1654: y, z);
1655: } else {
1656: ret = rpcClient.testChoiceWithSubstitutionGroupAbstract(x,
1657: y, z);
1658: }
1659: if (!perfTestOnly) {
1660: assertTrue(
1661: "testChoiceWithSubstitutionGroupAbstract(): Incorrect value for inout param",
1662: equals(x, y.value));
1663: assertTrue(
1664: "testChoiceWithSubstitutionGroupAbstract(): Incorrect value for out param",
1665: equals(yOrig, z.value));
1666: assertTrue(
1667: "testChoiceWithSubstitutionGroupAbstract(): Incorrect return value",
1668: equals(x, ret));
1669: }
1670: }
1671:
1672: // org.objectweb.type_test.types3.ChoiceWithSubstitutionGroupNil
1673:
1674: protected boolean equals(ChoiceWithSubstitutionGroupNil x,
1675: ChoiceWithSubstitutionGroupNil y) {
1676: if (x.getVarInt() != null) {
1677: if (y.getVarInt() == null) {
1678: // x null, y non-null
1679: return false;
1680: } else if (x.getVarInt().isNil()) {
1681: return y.getVarInt().isNil();
1682: } else {
1683: if (y.getVarInt().isNil()) {
1684: return false;
1685: }
1686: return x.getVarInt().getValue().equals(
1687: y.getVarInt().getValue());
1688: }
1689: } else if (y.getVarInt() != null) {
1690: return false;
1691: }
1692: if (x.getSg04NillableBaseElementA() != null) {
1693: if (y.getSg04NillableBaseElementA() == null) {
1694: // x null, y non-null
1695: return false;
1696: } else if (x.getSg04NillableBaseElementA().isNil()) {
1697: return y.getSg04NillableBaseElementA().isNil();
1698: } else {
1699: if (y.getSg04NillableBaseElementA().isNil()) {
1700: return false;
1701: }
1702: SgBaseTypeA xTypeA = x.getSg04NillableBaseElementA()
1703: .getValue();
1704: SgBaseTypeA yTypeA = y.getSg04NillableBaseElementA()
1705: .getValue();
1706: return equals(xTypeA, yTypeA);
1707: }
1708: } else {
1709: return y.getSg04NillableBaseElementA() == null;
1710: }
1711: }
1712:
1713: public void testChoiceWithSubstitutionGroupNil() throws Exception {
1714: ObjectFactory objectFactory = new ObjectFactory();
1715:
1716: ChoiceWithSubstitutionGroupNil x = new ChoiceWithSubstitutionGroupNil();
1717: JAXBElement<BigInteger> varInt = objectFactory
1718: .createChoiceWithSubstitutionGroupNilVarInt(null);
1719: x.setVarInt(varInt);
1720: ChoiceWithSubstitutionGroupNil yOrig = new ChoiceWithSubstitutionGroupNil();
1721: JAXBElement<? extends SgBaseTypeA> elementA = objectFactory
1722: .createSg04NillableBaseElementA(null);
1723: yOrig.setSg04NillableBaseElementA(elementA);
1724:
1725: Holder<ChoiceWithSubstitutionGroupNil> y = new Holder<ChoiceWithSubstitutionGroupNil>(
1726: yOrig);
1727: Holder<ChoiceWithSubstitutionGroupNil> z = new Holder<ChoiceWithSubstitutionGroupNil>();
1728: ChoiceWithSubstitutionGroupNil ret;
1729: if (testDocLiteral) {
1730: ret = docClient.testChoiceWithSubstitutionGroupNil(x, y, z);
1731: } else {
1732: ret = rpcClient.testChoiceWithSubstitutionGroupNil(x, y, z);
1733: }
1734: if (!perfTestOnly) {
1735: assertTrue(
1736: "testChoiceWithSubstitutionGroupNil(): Incorrect value for inout param",
1737: equals(x, y.value));
1738: assertTrue(
1739: "testChoiceWithSubstitutionGroupNil(): Incorrect value for out param",
1740: equals(yOrig, z.value));
1741: assertTrue(
1742: "testChoiceWithSubstitutionGroupNil(): Incorrect return value",
1743: equals(x, ret));
1744: }
1745: }
1746:
1747: // org.objectweb.type_test.types3.ChoiceWithSubstitutionGroup
1748:
1749: protected boolean equals(SgBaseTypeA x, SgBaseTypeA y) {
1750: if (x == null) {
1751: return y == null;
1752: } else if (y == null) {
1753: return false;
1754: }
1755: if (x.getVarInt().compareTo(y.getVarInt()) != 0) {
1756: return false;
1757: }
1758: if (x instanceof SgDerivedTypeC) {
1759: if (y instanceof SgDerivedTypeC) {
1760: SgDerivedTypeC xTypeC = (SgDerivedTypeC) x;
1761: SgDerivedTypeC yTypeC = (SgDerivedTypeC) y;
1762: return equals(xTypeC, yTypeC);
1763: } else {
1764: return false;
1765: }
1766: } else if (x instanceof SgDerivedTypeB) {
1767: if (y instanceof SgDerivedTypeB) {
1768: SgDerivedTypeB xTypeB = (SgDerivedTypeB) x;
1769: SgDerivedTypeB yTypeB = (SgDerivedTypeB) y;
1770: return equals(xTypeB, yTypeB);
1771: } else {
1772: return false;
1773: }
1774: }
1775: return true;
1776: }
1777:
1778: protected boolean equals(SgDerivedTypeB x, SgDerivedTypeB y) {
1779: return x.getVarString().equals(y.getVarString());
1780: }
1781:
1782: protected boolean equals(SgDerivedTypeC x, SgDerivedTypeC y) {
1783: return Double.compare(x.getVarFloat(), y.getVarFloat()) == 0;
1784: }
1785:
1786: protected boolean equals(ChoiceWithSubstitutionGroup x,
1787: ChoiceWithSubstitutionGroup y) {
1788: if (x.getVarInt() != null && y.getVarInt() != null
1789: && x.getVarInt().compareTo(y.getVarInt()) == 0) {
1790: return true;
1791: }
1792: if (!x.getSg01BaseElementA().isNil()
1793: && !y.getSg01BaseElementA().isNil()) {
1794: SgBaseTypeA xTypeA = x.getSg01BaseElementA().getValue();
1795: SgBaseTypeA yTypeA = y.getSg01BaseElementA().getValue();
1796: return equals(xTypeA, yTypeA);
1797: }
1798: return false;
1799: }
1800:
1801: public void testChoiceWithSubstitutionGroup() throws Exception {
1802: SgBaseTypeA baseA = new SgBaseTypeA();
1803: baseA.setVarInt(new BigInteger("1"));
1804:
1805: ObjectFactory objectFactory = new ObjectFactory();
1806: JAXBElement<? extends SgBaseTypeA> elementA = objectFactory
1807: .createSg01BaseElementA(baseA);
1808:
1809: SgDerivedTypeB derivedB = new SgDerivedTypeB();
1810: derivedB.setVarInt(new BigInteger("32"));
1811: derivedB.setVarString("SgDerivedTypeB");
1812:
1813: JAXBElement<? extends SgBaseTypeA> elementB = objectFactory
1814: .createSg01DerivedElementB(derivedB);
1815:
1816: ChoiceWithSubstitutionGroup x = new ChoiceWithSubstitutionGroup();
1817: x.setSg01BaseElementA(elementA);
1818: ChoiceWithSubstitutionGroup yOrig = new ChoiceWithSubstitutionGroup();
1819: yOrig.setSg01BaseElementA(elementB);
1820:
1821: Holder<ChoiceWithSubstitutionGroup> y = new Holder<ChoiceWithSubstitutionGroup>(
1822: yOrig);
1823: Holder<ChoiceWithSubstitutionGroup> z = new Holder<ChoiceWithSubstitutionGroup>();
1824: assertTrue("yoo: ", equals(y.value, y.value));
1825: ChoiceWithSubstitutionGroup ret;
1826: if (testDocLiteral) {
1827: ret = docClient.testChoiceWithSubstitutionGroup(x, y, z);
1828: } else {
1829: ret = rpcClient.testChoiceWithSubstitutionGroup(x, y, z);
1830: }
1831: if (!perfTestOnly) {
1832: assertTrue(
1833: "testChoiceWithSubstitutionGroup(): Incorrect value for inout param",
1834: equals(x, y.value));
1835: assertTrue(
1836: "testChoiceWithSubstitutionGroup(): Incorrect value for out param",
1837: equals(yOrig, z.value));
1838: assertTrue(
1839: "testChoiceWithSubstitutionGroup(): Incorrect return value",
1840: equals(x, ret));
1841: }
1842: }
1843:
1844: // org.objectweb.type_test.types3.RecElNextType
1845:
1846: protected boolean equals(RecElNextType x, RecElNextType y) {
1847: List<RecElType> xx = x.getRecEl();
1848: List<RecElType> yy = y.getRecEl();
1849:
1850: if (xx.size() != yy.size()) {
1851: return false;
1852: }
1853: for (int i = 0; i < xx.size(); i++) {
1854: if (!equals(xx.get(i), yy.get(i))) {
1855: return false;
1856: }
1857: }
1858:
1859: return true;
1860: }
1861:
1862: protected boolean equals(RecElType x, RecElType y) {
1863: return x.getVarInt() == y.getVarInt()
1864: && equals(x.getRecElNext(), y.getRecElNext());
1865: }
1866:
1867: public void testRecElType() throws Exception {
1868: RecElType x = new RecElType();
1869: RecElType y = new RecElType();
1870: RecElNextType xn = new RecElNextType();
1871: RecElNextType yn = new RecElNextType();
1872:
1873: y.setVarInt(123);
1874: y.setRecElNext(yn);
1875:
1876: xn.getRecEl().add(y);
1877: x.setVarInt(456);
1878: x.setRecElNext(xn);
1879:
1880: Holder<RecElType> yh = new Holder<RecElType>(y);
1881: Holder<RecElType> zh = new Holder<RecElType>();
1882: RecElType ret;
1883: if (testDocLiteral) {
1884: ret = docClient.testRecElType(x, yh, zh);
1885: } else {
1886: ret = rpcClient.testRecElType(x, yh, zh);
1887: }
1888:
1889: if (!perfTestOnly) {
1890: assertTrue(
1891: "testRecElType(): Incorrect value for inout param",
1892: equals(x, yh.value));
1893: assertTrue(
1894: "testRecElType(): Incorrect value for inout param",
1895: equals(y, zh.value));
1896: assertTrue(
1897: "testRecElType(): Incorrect value for inout param",
1898: equals(ret, x));
1899: }
1900: }
1901:
1902: // org.objectweb.type_test.types3.RecOuterType
1903:
1904: protected boolean equals(RecMostInnerType x, RecMostInnerType y) {
1905: return x.getVarInt() == y.getVarInt()
1906: && equals(x.getRecMostInnerNext(), y
1907: .getRecMostInnerNext());
1908: }
1909:
1910: protected boolean equals(RecMostInnerNextType x,
1911: RecMostInnerNextType y) {
1912: List<RecMostInnerType> xx = x.getRecMostInner();
1913: List<RecMostInnerType> yy = y.getRecMostInner();
1914:
1915: if (xx.size() != yy.size()) {
1916: return false;
1917: }
1918: for (int i = 0; i < xx.size(); i++) {
1919: if (!equals(xx.get(i), yy.get(i))) {
1920: return false;
1921: }
1922: }
1923:
1924: return true;
1925: }
1926:
1927: protected boolean equals(RecInnerType x, RecInnerType y) {
1928: List<RecMostInnerType> mitx = x.getRecMostInner();
1929: List<RecMostInnerType> mity = y.getRecMostInner();
1930:
1931: if (mitx.size() != mity.size()) {
1932: return false;
1933: }
1934: for (int i = 0; i < mitx.size(); i++) {
1935: if (!equals(mitx.get(i), mity.get(i))) {
1936: return false;
1937: }
1938: }
1939:
1940: return x.getVarInt() == y.getVarInt()
1941: && equals(x.getRecInnerNext(), y.getRecInnerNext());
1942: }
1943:
1944: protected boolean equals(RecInnerNextType x, RecInnerNextType y) {
1945: List<RecInnerType> xx = x.getRecInner();
1946: List<RecInnerType> yy = y.getRecInner();
1947:
1948: if (xx.size() != yy.size()) {
1949: return false;
1950: }
1951: for (int i = 0; i < xx.size(); i++) {
1952: if (!equals(xx.get(i), yy.get(i))) {
1953: return false;
1954: }
1955: }
1956:
1957: return true;
1958: }
1959:
1960: protected boolean equals(RecOuterNextType x, RecOuterNextType y) {
1961: List<RecOuterType> xx = x.getRecOuter();
1962: List<RecOuterType> yy = y.getRecOuter();
1963:
1964: if (xx.size() != yy.size()) {
1965: return false;
1966: }
1967: for (int i = 0; i < xx.size(); i++) {
1968: if (!equals(xx.get(i), yy.get(i))) {
1969: return false;
1970: }
1971: }
1972:
1973: return true;
1974: }
1975:
1976: protected boolean equals(RecOuterType x, RecOuterType y) {
1977: List<RecMostInnerType> mitx = x.getRecMostInner();
1978: List<RecMostInnerType> mity = y.getRecMostInner();
1979: List<RecInnerType> itx = x.getRecInner();
1980: List<RecInnerType> ity = y.getRecInner();
1981:
1982: if (mitx.size() != mity.size() || itx.size() != ity.size()) {
1983: return false;
1984: }
1985: for (int i = 0; i < mitx.size(); i++) {
1986: if (!equals(mitx.get(i), mity.get(i))) {
1987: return false;
1988: }
1989: }
1990: for (int i = 0; i < itx.size(); i++) {
1991: if (!equals(itx.get(i), ity.get(i))) {
1992: return false;
1993: }
1994: }
1995: return x.getVarInt() == y.getVarInt()
1996: && equals(x.getRecOuterNext(), y.getRecOuterNext());
1997: }
1998:
1999: public void testRecOuterType() throws Exception {
2000: RecMostInnerType mitx = new RecMostInnerType();
2001: RecMostInnerType mity = new RecMostInnerType();
2002: RecMostInnerNextType mitxNext = new RecMostInnerNextType();
2003: RecMostInnerNextType mityNext = new RecMostInnerNextType();
2004: mitx.setRecMostInnerNext(mitxNext);
2005: mity.setRecMostInnerNext(mityNext);
2006:
2007: RecInnerType itx = new RecInnerType();
2008: RecInnerType ity = new RecInnerType();
2009: RecInnerNextType itxNext = new RecInnerNextType();
2010: RecInnerNextType ityNext = new RecInnerNextType();
2011: itx.setRecInnerNext(itxNext);
2012: ity.setRecInnerNext(ityNext);
2013:
2014: RecOuterType otx = new RecOuterType();
2015: RecOuterType oty = new RecOuterType();
2016: RecOuterNextType otxNext = new RecOuterNextType();
2017: RecOuterNextType otyNext = new RecOuterNextType();
2018: otx.setRecOuterNext(otxNext);
2019: oty.setRecOuterNext(otyNext);
2020:
2021: mitx.setVarInt(11);
2022: mity.setVarInt(12);
2023: mitxNext.getRecMostInner().add(mity);
2024:
2025: itx.setVarInt(21);
2026: ity.setVarInt(22);
2027: itxNext.getRecInner().add(ity);
2028: itx.getRecMostInner().add(mitx);
2029:
2030: otx.setVarInt(31);
2031: oty.setVarInt(32);
2032: otxNext.getRecOuter().add(oty);
2033: otx.getRecInner().add(itx);
2034: otx.getRecMostInner().add(mitx);
2035:
2036: Holder<RecOuterType> yh = new Holder<RecOuterType>(oty);
2037: Holder<RecOuterType> zh = new Holder<RecOuterType>();
2038: RecOuterType ret;
2039: if (testDocLiteral) {
2040: ret = docClient.testRecOuterType(otx, yh, zh);
2041: } else {
2042: ret = rpcClient.testRecOuterType(otx, yh, zh);
2043: }
2044: if (!perfTestOnly) {
2045: assertTrue(
2046: "testRecOuterType(): Incorrect value for inout param",
2047: equals(otx, yh.value));
2048: assertTrue(
2049: "testRecOuterType(): Incorrect value for inout param",
2050: equals(oty, zh.value));
2051: assertTrue(
2052: "testRecOuterType(): Incorrect value for inout param",
2053: equals(ret, otx));
2054: }
2055: }
2056:
2057: // org.objectweb.type_test.types1.SimpleContent1
2058:
2059: protected void equals(String msg, SimpleContent1 x, SimpleContent1 y)
2060: throws Exception {
2061: assertEquals(msg, x.getAttrib1A(), y.getAttrib1A());
2062: assertEquals(msg, x.getAttrib1B(), y.getAttrib1B());
2063: assertEquals(msg, x.getValue(), y.getValue());
2064: }
2065:
2066: public void testSimpleContent1() throws Exception {
2067: SimpleContent1 x1 = new SimpleContent1();
2068: x1.setValue("foo");
2069: x1.setAttrib1A(new Byte((byte) 1));
2070: x1.setAttrib1B(new Short((short) 2));
2071:
2072: SimpleContent1 y1 = new SimpleContent1();
2073: y1.setValue("bar");
2074: y1.setAttrib1A(new Byte((byte) 3));
2075: y1.setAttrib1B(new Short((short) 4));
2076:
2077: Holder<SimpleContent1> y1Holder = new Holder<SimpleContent1>(y1);
2078: Holder<SimpleContent1> z1 = new Holder<SimpleContent1>();
2079: SimpleContent1 ret;
2080: if (testDocLiteral) {
2081: ret = docClient.testSimpleContent1(x1, y1Holder, z1);
2082: } else {
2083: ret = rpcClient.testSimpleContent1(x1, y1Holder, z1);
2084: }
2085: if (!perfTestOnly) {
2086: equals(
2087: "testSimpleContent1(): Incorrect value for inout param",
2088: x1, y1Holder.value);
2089: equals(
2090: "testSimpleContent1(): Incorrect value for out param",
2091: y1, z1.value);
2092: equals("testSimpleContent1(): Incorrect return value", x1,
2093: ret);
2094: }
2095: }
2096:
2097: // org.objectweb.type_test.types1.SimpleContent2
2098:
2099: protected void equals(String msg, SimpleContent2 x, SimpleContent2 y)
2100: throws Exception {
2101: assertEquals(msg, x.getAttrib2A(), y.getAttrib2A());
2102: assertEquals(msg, x.getAttrib2B(), y.getAttrib2B());
2103: equals(msg, (SimpleContent1) x, (SimpleContent1) y);
2104: }
2105:
2106: public void testSimpleContent2() throws Exception {
2107: SimpleContent2 x2 = new SimpleContent2();
2108: x2.setValue("foo");
2109: x2.setAttrib1A(new Byte((byte) 1));
2110: x2.setAttrib1B(new Short((short) 2));
2111: x2.setAttrib2A(new Integer(5));
2112: x2.setAttrib2B(new Long(6));
2113:
2114: SimpleContent2 y2 = new SimpleContent2();
2115: y2.setValue("bar");
2116: y2.setAttrib1A(new Byte((byte) 3));
2117: y2.setAttrib1B(new Short((short) 4));
2118: y2.setAttrib2A(new Integer(7));
2119: y2.setAttrib2B(new Long(8));
2120:
2121: Holder<SimpleContent2> y2Holder = new Holder<SimpleContent2>(y2);
2122: Holder<SimpleContent2> z2 = new Holder<SimpleContent2>();
2123: SimpleContent2 ret;
2124: if (testDocLiteral) {
2125: ret = docClient.testSimpleContent2(x2, y2Holder, z2);
2126: } else {
2127: ret = rpcClient.testSimpleContent2(x2, y2Holder, z2);
2128: }
2129: if (!perfTestOnly) {
2130: equals(
2131: "testSimpleContent2(): Incorrect value for inout param",
2132: x2, y2Holder.value);
2133: equals(
2134: "testSimpleContent2(): Incorrect value for out param",
2135: y2, z2.value);
2136: equals("testSimpleContent2(): Incorrect return value", x2,
2137: ret);
2138: }
2139: }
2140:
2141: // org.objectweb.type_test.types1.SimpleContent3
2142:
2143: protected void equals(String msg, SimpleContent3 x, SimpleContent3 y)
2144: throws Exception {
2145: assertEquals(msg, x.getAttrib3A(), y.getAttrib3A());
2146: assertEquals(msg, x.isAttrib3B(), y.isAttrib3B());
2147: equals(msg, (SimpleContent2) x, (SimpleContent2) y);
2148: }
2149:
2150: public void testSimpleContent3() throws Exception {
2151: SimpleContent3 x3 = new SimpleContent3();
2152: x3.setValue("foo");
2153: x3.setAttrib1A(new Byte((byte) 1));
2154: x3.setAttrib1B(new Short((short) 2));
2155: x3.setAttrib2A(new Integer(5));
2156: x3.setAttrib2B(new Long(6));
2157: x3.setAttrib3A("xxx");
2158: x3.setAttrib3B(Boolean.TRUE);
2159:
2160: SimpleContent3 y3 = new SimpleContent3();
2161: y3.setValue("bar");
2162: y3.setAttrib1A(new Byte((byte) 3));
2163: y3.setAttrib1B(new Short((short) 4));
2164: y3.setAttrib2A(new Integer(7));
2165: y3.setAttrib2B(new Long(8));
2166: y3.setAttrib3A("yyy");
2167: y3.setAttrib3B(Boolean.FALSE);
2168:
2169: Holder<SimpleContent3> y3Holder = new Holder<SimpleContent3>(y3);
2170: Holder<SimpleContent3> z3 = new Holder<SimpleContent3>();
2171: SimpleContent3 ret;
2172: if (testDocLiteral) {
2173: ret = docClient.testSimpleContent3(x3, y3Holder, z3);
2174: } else {
2175: ret = rpcClient.testSimpleContent3(x3, y3Holder, z3);
2176: }
2177: if (!perfTestOnly) {
2178: equals(
2179: "testSimpleContent3(): Incorrect value for inout param",
2180: x3, y3Holder.value);
2181: equals(
2182: "testSimpleContent3(): Incorrect value for out param",
2183: y3, z3.value);
2184: equals("testSimpleContent3(): Incorrect return value", x3,
2185: ret);
2186: }
2187: }
2188:
2189: // org.objectweb.type_test.types1.UnionSimpleContent
2190:
2191: protected void assertEquals(String msg, UnionSimpleContent x,
2192: UnionSimpleContent y) throws Exception {
2193: assertTrue(msg, x != null);
2194: assertTrue(msg, y != null);
2195: assertEquals(msg, x.getValue(), y.getValue());
2196: }
2197:
2198: // XXX - union setValue(String)
2199: public void testUnionSimpleContent() throws Exception {
2200: UnionSimpleContent x = new UnionSimpleContent();
2201: x.setValue("5");
2202: UnionSimpleContent yOrig = new UnionSimpleContent();
2203: yOrig.setValue("-7");
2204:
2205: Holder<UnionSimpleContent> y = new Holder<UnionSimpleContent>(
2206: yOrig);
2207: Holder<UnionSimpleContent> z = new Holder<UnionSimpleContent>();
2208: UnionSimpleContent ret;
2209: if (testDocLiteral) {
2210: ret = docClient.testUnionSimpleContent(x, y, z);
2211: } else {
2212: ret = rpcClient.testUnionSimpleContent(x, y, z);
2213: }
2214: if (!perfTestOnly) {
2215: assertEquals(
2216: "testUnionSimpleContent(): Incorrect value for inout param",
2217: x, y.value);
2218: assertEquals(
2219: "testUnionSimpleContent(): Incorrect value for out param",
2220: yOrig, z.value);
2221: assertEquals(
2222: "testUnionSimpleContent(): Incorrect return value",
2223: x, ret);
2224: }
2225: }
2226:
2227: }
|