Search in sources :

Example 1 with ChoiceWithSubstitutionGroup

use of org.apache.type_test.types3.ChoiceWithSubstitutionGroup in project cxf by apache.

the class AbstractTypeTestClient2 method testChoiceWithSubstitutionGroup.

@Test
public void testChoiceWithSubstitutionGroup() throws Exception {
    if (!shouldRunTest("ChoiceWithSubstitutionGroup")) {
        return;
    }
    SgBaseTypeA baseA = new SgBaseTypeA();
    baseA.setVarInt(new BigInteger("1"));
    ObjectFactory objectFactory = new ObjectFactory();
    JAXBElement<? extends SgBaseTypeA> elementA = objectFactory.createSg01BaseElementA(baseA);
    SgDerivedTypeB derivedB = new SgDerivedTypeB();
    derivedB.setVarInt(new BigInteger("32"));
    derivedB.setVarString("SgDerivedTypeB");
    JAXBElement<? extends SgBaseTypeA> elementB = objectFactory.createSg01DerivedElementB(derivedB);
    ChoiceWithSubstitutionGroup x = new ChoiceWithSubstitutionGroup();
    x.setSg01BaseElementA(elementA);
    ChoiceWithSubstitutionGroup yOrig = new ChoiceWithSubstitutionGroup();
    yOrig.setSg01BaseElementA(elementB);
    Holder<ChoiceWithSubstitutionGroup> y = new Holder<ChoiceWithSubstitutionGroup>(yOrig);
    Holder<ChoiceWithSubstitutionGroup> z = new Holder<ChoiceWithSubstitutionGroup>();
    assertTrue("yoo: ", equals(y.value, y.value));
    ChoiceWithSubstitutionGroup ret;
    if (testDocLiteral) {
        ret = docClient.testChoiceWithSubstitutionGroup(x, y, z);
    } else if (testXMLBinding) {
        ret = xmlClient.testChoiceWithSubstitutionGroup(x, y, z);
    } else {
        ret = rpcClient.testChoiceWithSubstitutionGroup(x, y, z);
    }
    if (!perfTestOnly) {
        assertTrue("testChoiceWithSubstitutionGroup(): Incorrect value for inout param", equals(x, y.value));
        assertTrue("testChoiceWithSubstitutionGroup(): Incorrect value for out param", equals(yOrig, z.value));
        assertTrue("testChoiceWithSubstitutionGroup(): Incorrect return value", equals(x, ret));
    }
}
Also used : ChoiceWithSubstitutionGroup(org.apache.type_test.types3.ChoiceWithSubstitutionGroup) SgDerivedTypeB(org.apache.type_test.types3.SgDerivedTypeB) ObjectFactory(org.apache.type_test.types3.ObjectFactory) SgBaseTypeA(org.apache.type_test.types3.SgBaseTypeA) Holder(javax.xml.ws.Holder) BigInteger(java.math.BigInteger) Test(org.junit.Test)

Example 2 with ChoiceWithSubstitutionGroup

use of org.apache.type_test.types3.ChoiceWithSubstitutionGroup in project cxf by apache.

the class AbstractTypeTestClient2 method equals.

// org.apache.type_test.types3.ChoiceWithSubstitutionGroup
protected boolean equals(SgBaseTypeA x, SgBaseTypeA y) {
    if (x == null) {
        return y == null;
    } else if (y == null) {
        return false;
    }
    if (x.getVarInt().compareTo(y.getVarInt()) != 0) {
        return false;
    }
    if (x instanceof SgDerivedTypeC) {
        if (y instanceof SgDerivedTypeC) {
            SgDerivedTypeC xTypeC = (SgDerivedTypeC) x;
            SgDerivedTypeC yTypeC = (SgDerivedTypeC) y;
            return equals(xTypeC, yTypeC);
        }
        return false;
    } else if (x instanceof SgDerivedTypeB) {
        if (y instanceof SgDerivedTypeB) {
            SgDerivedTypeB xTypeB = (SgDerivedTypeB) x;
            SgDerivedTypeB yTypeB = (SgDerivedTypeB) y;
            return equals(xTypeB, yTypeB);
        }
        return false;
    }
    return true;
}
Also used : SgDerivedTypeB(org.apache.type_test.types3.SgDerivedTypeB) SgDerivedTypeC(org.apache.type_test.types3.SgDerivedTypeC)

Example 3 with ChoiceWithSubstitutionGroup

use of org.apache.type_test.types3.ChoiceWithSubstitutionGroup in project cxf by apache.

the class AbstractTypeTestClient2 method equals.

protected boolean equals(ChoiceWithSubstitutionGroup x, ChoiceWithSubstitutionGroup y) {
    if (x.getVarInt() != null && y.getVarInt() != null && x.getVarInt().compareTo(y.getVarInt()) == 0) {
        return true;
    }
    if (!x.getSg01BaseElementA().isNil() && !y.getSg01BaseElementA().isNil()) {
        SgBaseTypeA xTypeA = x.getSg01BaseElementA().getValue();
        SgBaseTypeA yTypeA = y.getSg01BaseElementA().getValue();
        return equals(xTypeA, yTypeA);
    }
    return false;
}
Also used : SgBaseTypeA(org.apache.type_test.types3.SgBaseTypeA)

Aggregations

SgBaseTypeA (org.apache.type_test.types3.SgBaseTypeA)2 SgDerivedTypeB (org.apache.type_test.types3.SgDerivedTypeB)2 BigInteger (java.math.BigInteger)1 Holder (javax.xml.ws.Holder)1 ChoiceWithSubstitutionGroup (org.apache.type_test.types3.ChoiceWithSubstitutionGroup)1 ObjectFactory (org.apache.type_test.types3.ObjectFactory)1 SgDerivedTypeC (org.apache.type_test.types3.SgDerivedTypeC)1 Test (org.junit.Test)1