Search in sources :

Example 1 with SgDerivedTypeC

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

the class AbstractTypeTestClient2 method testStructWithMultipleSubstitutionGroups.

@Test
public void testStructWithMultipleSubstitutionGroups() throws Exception {
    if (!shouldRunTest("StructWithMultipleSubstitutionGroups")) {
        return;
    }
    SgBaseTypeA baseA = new SgBaseTypeA();
    baseA.setVarInt(new BigInteger("1"));
    SgDerivedTypeB derivedB = new SgDerivedTypeB();
    derivedB.setVarInt(new BigInteger("32"));
    derivedB.setVarString("y-SgDerivedTypeB");
    SgDerivedTypeC derivedC = new SgDerivedTypeC();
    derivedC.setVarInt(new BigInteger("1"));
    derivedC.setVarFloat(3.14f);
    ObjectFactory objectFactory = new ObjectFactory();
    JAXBElement<? extends SgBaseTypeA> x1 = objectFactory.createSg01DerivedElementB(derivedB);
    JAXBElement<? extends SgBaseTypeA> x2 = objectFactory.createSg02BaseElementA(baseA);
    JAXBElement<? extends SgBaseTypeA> y1 = objectFactory.createSg01DerivedElementB(derivedB);
    JAXBElement<? extends SgBaseTypeA> y2 = objectFactory.createSg02DerivedElementC(derivedC);
    StructWithMultipleSubstitutionGroups x = new StructWithMultipleSubstitutionGroups();
    x.setVarFloat(111.1f);
    x.setVarInt(new BigInteger("100"));
    x.setVarString("x-varString");
    x.setSg01BaseElementA(x1);
    x.setSg02BaseElementA(x2);
    StructWithMultipleSubstitutionGroups yOrig = new StructWithMultipleSubstitutionGroups();
    yOrig.setVarFloat(1.1f);
    yOrig.setVarInt(new BigInteger("10"));
    yOrig.setVarString("y-varString");
    yOrig.setSg01BaseElementA(y1);
    yOrig.setSg02BaseElementA(y2);
    Holder<StructWithMultipleSubstitutionGroups> y = new Holder<StructWithMultipleSubstitutionGroups>(yOrig);
    Holder<StructWithMultipleSubstitutionGroups> z = new Holder<StructWithMultipleSubstitutionGroups>();
    StructWithMultipleSubstitutionGroups ret;
    if (testDocLiteral) {
        ret = docClient.testStructWithMultipleSubstitutionGroups(x, y, z);
    } else if (testXMLBinding) {
        ret = xmlClient.testStructWithMultipleSubstitutionGroups(x, y, z);
    } else {
        ret = rpcClient.testStructWithMultipleSubstitutionGroups(x, y, z);
    }
    if (!perfTestOnly) {
        assertTrue("testStructWithMultipleSubstitutionGroups(): Incorrect value for inout param", equals(x, y.value));
        assertTrue("testStructWithMultipleSubstitutionGroups(): Incorrect value for out param", equals(yOrig, z.value));
        assertTrue("testStructWithMultipleSubstitutionGroups(): Incorrect return value", equals(x, ret));
    }
}
Also used : SgDerivedTypeB(org.apache.type_test.types3.SgDerivedTypeB) ObjectFactory(org.apache.type_test.types3.ObjectFactory) SgBaseTypeA(org.apache.type_test.types3.SgBaseTypeA) StructWithMultipleSubstitutionGroups(org.apache.type_test.types3.StructWithMultipleSubstitutionGroups) Holder(javax.xml.ws.Holder) BigInteger(java.math.BigInteger) SgDerivedTypeC(org.apache.type_test.types3.SgDerivedTypeC) Test(org.junit.Test)

Example 2 with SgDerivedTypeC

use of org.apache.type_test.types3.SgDerivedTypeC 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 SgDerivedTypeC

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

the class AbstractTypeTestClient2 method testStructWithSubstitutionGroupAbstract.

@Test
public void testStructWithSubstitutionGroupAbstract() throws Exception {
    if (!shouldRunTest("StructWithSubstitutionGroupAbstract")) {
        return;
    }
    SgDerivedTypeB derivedB = new SgDerivedTypeB();
    derivedB.setVarInt(new BigInteger("32"));
    derivedB.setVarString("foo");
    ObjectFactory objectFactory = new ObjectFactory();
    JAXBElement<SgDerivedTypeB> elementB = objectFactory.createSg03DerivedElementB(derivedB);
    SgDerivedTypeC derivedC = new SgDerivedTypeC();
    derivedC.setVarInt(new BigInteger("32"));
    derivedC.setVarFloat(3.14f);
    JAXBElement<SgDerivedTypeC> elementC = objectFactory.createSg03DerivedElementC(derivedC);
    StructWithSubstitutionGroupAbstract x = new StructWithSubstitutionGroupAbstract();
    x.setSg03AbstractBaseElementA(elementC);
    StructWithSubstitutionGroupAbstract yOrig = new StructWithSubstitutionGroupAbstract();
    yOrig.setSg03AbstractBaseElementA(elementB);
    Holder<StructWithSubstitutionGroupAbstract> y = new Holder<StructWithSubstitutionGroupAbstract>(yOrig);
    Holder<StructWithSubstitutionGroupAbstract> z = new Holder<StructWithSubstitutionGroupAbstract>();
    StructWithSubstitutionGroupAbstract ret;
    if (testDocLiteral) {
        ret = docClient.testStructWithSubstitutionGroupAbstract(x, y, z);
    } else if (testXMLBinding) {
        ret = xmlClient.testStructWithSubstitutionGroupAbstract(x, y, z);
    } else {
        ret = rpcClient.testStructWithSubstitutionGroupAbstract(x, y, z);
    }
    if (!perfTestOnly) {
        assertTrue("testStructWithSubstitutionGroupAbstract(): Incorrect value for inout param", equals(x, y.value));
        assertTrue("testStructWithSubstitutionGroupAbstract(): Incorrect value for out param", equals(yOrig, z.value));
        assertTrue("testStructWithSubstitutionGroupAbstract(): Incorrect return value", equals(x, ret));
    }
}
Also used : SgDerivedTypeB(org.apache.type_test.types3.SgDerivedTypeB) ObjectFactory(org.apache.type_test.types3.ObjectFactory) Holder(javax.xml.ws.Holder) BigInteger(java.math.BigInteger) StructWithSubstitutionGroupAbstract(org.apache.type_test.types3.StructWithSubstitutionGroupAbstract) SgDerivedTypeC(org.apache.type_test.types3.SgDerivedTypeC) Test(org.junit.Test)

Example 4 with SgDerivedTypeC

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

the class AbstractTypeTestClient2 method testChoiceWithSubstitutionGroupAbstract.

@Test
public void testChoiceWithSubstitutionGroupAbstract() throws Exception {
    if (!shouldRunTest("ChoiceWithSubstitutionGroupAbstract")) {
        return;
    }
    SgDerivedTypeB derivedB = new SgDerivedTypeB();
    derivedB.setVarInt(new BigInteger("32"));
    derivedB.setVarString("foo");
    SgDerivedTypeC derivedC = new SgDerivedTypeC();
    derivedC.setVarInt(new BigInteger("32"));
    derivedC.setVarFloat(3.14f);
    ObjectFactory objectFactory = new ObjectFactory();
    JAXBElement<? extends SgBaseTypeA> elementB = objectFactory.createSg03DerivedElementB(derivedB);
    JAXBElement<? extends SgBaseTypeA> elementC = objectFactory.createSg03DerivedElementC(derivedC);
    ChoiceWithSubstitutionGroupAbstract x = new ChoiceWithSubstitutionGroupAbstract();
    x.setSg03AbstractBaseElementA(elementC);
    ChoiceWithSubstitutionGroupAbstract yOrig = new ChoiceWithSubstitutionGroupAbstract();
    yOrig.setSg03AbstractBaseElementA(elementB);
    Holder<ChoiceWithSubstitutionGroupAbstract> y = new Holder<ChoiceWithSubstitutionGroupAbstract>(yOrig);
    Holder<ChoiceWithSubstitutionGroupAbstract> z = new Holder<ChoiceWithSubstitutionGroupAbstract>();
    ChoiceWithSubstitutionGroupAbstract ret;
    if (testDocLiteral) {
        ret = docClient.testChoiceWithSubstitutionGroupAbstract(x, y, z);
    } else if (testXMLBinding) {
        ret = xmlClient.testChoiceWithSubstitutionGroupAbstract(x, y, z);
    } else {
        ret = rpcClient.testChoiceWithSubstitutionGroupAbstract(x, y, z);
    }
    if (!perfTestOnly) {
        assertTrue("testChoiceWithSubstitutionGroupAbstract(): Incorrect value for inout param", equals(x, y.value));
        assertTrue("testChoiceWithSubstitutionGroupAbstract(): Incorrect value for out param", equals(yOrig, z.value));
        assertTrue("testChoiceWithSubstitutionGroupAbstract(): Incorrect return value", equals(x, ret));
    }
}
Also used : SgDerivedTypeB(org.apache.type_test.types3.SgDerivedTypeB) ObjectFactory(org.apache.type_test.types3.ObjectFactory) Holder(javax.xml.ws.Holder) BigInteger(java.math.BigInteger) ChoiceWithSubstitutionGroupAbstract(org.apache.type_test.types3.ChoiceWithSubstitutionGroupAbstract) SgDerivedTypeC(org.apache.type_test.types3.SgDerivedTypeC) Test(org.junit.Test)

Aggregations

SgDerivedTypeB (org.apache.type_test.types3.SgDerivedTypeB)4 SgDerivedTypeC (org.apache.type_test.types3.SgDerivedTypeC)4 BigInteger (java.math.BigInteger)3 Holder (javax.xml.ws.Holder)3 ObjectFactory (org.apache.type_test.types3.ObjectFactory)3 Test (org.junit.Test)3 ChoiceWithSubstitutionGroupAbstract (org.apache.type_test.types3.ChoiceWithSubstitutionGroupAbstract)1 SgBaseTypeA (org.apache.type_test.types3.SgBaseTypeA)1 StructWithMultipleSubstitutionGroups (org.apache.type_test.types3.StructWithMultipleSubstitutionGroups)1 StructWithSubstitutionGroupAbstract (org.apache.type_test.types3.StructWithSubstitutionGroupAbstract)1