Search in sources :

Example 31 with ObjectFactory

use of net.opengis.wfs.v_1_1_0.ObjectFactory 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(BigInteger.ONE);
    SgDerivedTypeB derivedB = new SgDerivedTypeB();
    derivedB.setVarInt(new BigInteger("32"));
    derivedB.setVarString("y-SgDerivedTypeB");
    SgDerivedTypeC derivedC = new SgDerivedTypeC();
    derivedC.setVarInt(BigInteger.ONE);
    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(BigInteger.TEN);
    yOrig.setVarString("y-varString");
    yOrig.setSg01BaseElementA(y1);
    yOrig.setSg02BaseElementA(y2);
    Holder<StructWithMultipleSubstitutionGroups> y = new Holder<>(yOrig);
    Holder<StructWithMultipleSubstitutionGroups> z = new Holder<>();
    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 32 with ObjectFactory

use of net.opengis.wfs.v_1_1_0.ObjectFactory in project cxf by apache.

the class AbstractTypeTestClient2 method testChoiceWithSubstitutionGroupNil.

@Test
public void testChoiceWithSubstitutionGroupNil() throws Exception {
    if (!shouldRunTest("ChoiceWithSubstitutionGroupNil")) {
        return;
    }
    ObjectFactory objectFactory = new ObjectFactory();
    ChoiceWithSubstitutionGroupNil x = new ChoiceWithSubstitutionGroupNil();
    JAXBElement<BigInteger> varInt = objectFactory.createChoiceWithSubstitutionGroupNilVarInt(null);
    x.setVarInt(varInt);
    ChoiceWithSubstitutionGroupNil yOrig = new ChoiceWithSubstitutionGroupNil();
    JAXBElement<? extends SgBaseTypeA> elementA = objectFactory.createSg04NillableBaseElementA(null);
    yOrig.setSg04NillableBaseElementA(elementA);
    Holder<ChoiceWithSubstitutionGroupNil> y = new Holder<>(yOrig);
    Holder<ChoiceWithSubstitutionGroupNil> z = new Holder<>();
    ChoiceWithSubstitutionGroupNil ret;
    if (testDocLiteral) {
        ret = docClient.testChoiceWithSubstitutionGroupNil(x, y, z);
    } else if (testXMLBinding) {
        ret = xmlClient.testChoiceWithSubstitutionGroupNil(x, y, z);
    } else {
        ret = rpcClient.testChoiceWithSubstitutionGroupNil(x, y, z);
    }
    if (!perfTestOnly) {
        assertTrue("testChoiceWithSubstitutionGroupNil(): Incorrect value for inout param", equals(x, y.value));
        assertTrue("testChoiceWithSubstitutionGroupNil(): Incorrect value for out param", equals(yOrig, z.value));
        assertTrue("testChoiceWithSubstitutionGroupNil(): Incorrect return value", equals(x, ret));
    }
}
Also used : ObjectFactory(org.apache.type_test.types3.ObjectFactory) Holder(javax.xml.ws.Holder) BigInteger(java.math.BigInteger) ChoiceWithSubstitutionGroupNil(org.apache.type_test.types3.ChoiceWithSubstitutionGroupNil) Test(org.junit.Test)

Example 33 with ObjectFactory

use of net.opengis.wfs.v_1_1_0.ObjectFactory 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(BigInteger.ONE);
    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<>(yOrig);
    Holder<ChoiceWithSubstitutionGroup> z = new Holder<>();
    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 34 with ObjectFactory

use of net.opengis.wfs.v_1_1_0.ObjectFactory in project cxf by apache.

the class AbstractTypeTestClient2 method testStructWithSubstitutionGroup.

@Test
public void testStructWithSubstitutionGroup() throws Exception {
    if (!shouldRunTest("StructWithSubstitutionGroup")) {
        return;
    }
    SgBaseTypeA baseA = new SgBaseTypeA();
    baseA.setVarInt(BigInteger.ONE);
    SgDerivedTypeB derivedB = new SgDerivedTypeB();
    derivedB.setVarInt(new BigInteger("32"));
    derivedB.setVarString("foo");
    ObjectFactory objectFactory = new ObjectFactory();
    StructWithSubstitutionGroup x = new StructWithSubstitutionGroup();
    JAXBElement<? extends SgBaseTypeA> elementA = objectFactory.createSg01BaseElementA(baseA);
    x.setSg01BaseElementA(elementA);
    StructWithSubstitutionGroup yOrig = new StructWithSubstitutionGroup();
    JAXBElement<? extends SgBaseTypeA> elementB = objectFactory.createSg01DerivedElementB(derivedB);
    yOrig.setSg01BaseElementA(elementB);
    Holder<StructWithSubstitutionGroup> y = new Holder<>(yOrig);
    Holder<StructWithSubstitutionGroup> z = new Holder<>();
    StructWithSubstitutionGroup ret;
    if (testDocLiteral) {
        ret = docClient.testStructWithSubstitutionGroup(x, y, z);
    } else if (testXMLBinding) {
        ret = xmlClient.testStructWithSubstitutionGroup(x, y, z);
    } else {
        ret = rpcClient.testStructWithSubstitutionGroup(x, y, z);
    }
    if (!perfTestOnly) {
        assertTrue("testStructWithSubstitutionGroup(): Incorrect value for inout param", equals(x, y.value));
        assertTrue("testStructWithSubstitutionGroup(): Incorrect value for out param", equals(yOrig, z.value));
        assertTrue("testStructWithSubstitutionGroup(): Incorrect return value", equals(x, ret));
    }
}
Also used : SgDerivedTypeB(org.apache.type_test.types3.SgDerivedTypeB) StructWithSubstitutionGroup(org.apache.type_test.types3.StructWithSubstitutionGroup) 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 35 with ObjectFactory

use of net.opengis.wfs.v_1_1_0.ObjectFactory in project BibleMultiConverter by schierlm.

the class ZefDicMyBible method createXMLBible.

protected Dictionary createXMLBible(Bible bible, String[] idfields) throws Exception {
    final ObjectFactory of = new ObjectFactory();
    Dictionary doc = of.createDictionary();
    doc.setRevision("1");
    doc.setINFORMATION(of.createTINFORMATION());
    doc.getINFORMATION().getTitleOrCreatorOrDescription().add(of.createTINFORMATIONTitle(bible.getName()));
    Map<String, String> xrefMap = new HashMap<String, String>();
    if (!idfields[0].equals("abbr")) {
        for (Book bk : bible.getBooks()) {
            String value;
            switch(idfields[0].toLowerCase()) {
                case "abbr":
                    value = bk.getAbbr();
                    break;
                case "short":
                    value = bk.getShortName();
                    break;
                case "long":
                    value = bk.getLongName();
                    break;
                default:
                    value = null;
            }
            if (value != null && !value.equals(bk.getAbbr())) {
                xrefMap.put(bk.getAbbr(), value);
            }
        }
    }
    for (Book bk : bible.getBooks()) {
        if (bk.getId().equals(BookID.METADATA))
            continue;
        if (!bk.getId().equals(BookID.DICTIONARY_ENTRY)) {
            System.out.println("WARNING: Unable to export book " + bk.getAbbr());
            continue;
        }
        List<String> ids = new ArrayList<>();
        for (String idfield : idfields) {
            String value;
            switch(idfield.toLowerCase()) {
                case "abbr":
                    value = bk.getAbbr();
                    break;
                case "short":
                    value = bk.getShortName();
                    break;
                case "long":
                    value = bk.getLongName();
                    break;
                default:
                    continue;
            }
            if (!ids.contains(value))
                ids.add(value);
        }
        if (ids.isEmpty()) {
            System.out.println("WARNING: Skipping book " + bk.getAbbr() + "due to missing ID.");
            continue;
        }
        for (int i = 1; i < ids.size(); i++) {
            TItem item = of.createTItem();
            item.setId(ids.get(i));
            TParagraph para = of.createTParagraph();
            SeeType see = of.createSeeType();
            see.setContent(ids.get(0));
            para.getContent().add(of.createSee(see));
            item.getContent().add(of.createTParagraphDescription(para));
            doc.getItem().add(item);
        }
        final TItem item = of.createTItem();
        item.setId(ids.get(0));
        doc.getItem().add(item);
        TParagraph description = of.createTParagraph();
        item.getContent().add(of.createTParagraphDescription(description));
        bk.getChapters().get(0).getProlog().accept(new ZefDicVisitor(description.getContent(), xrefMap));
    }
    return doc;
}
Also used : Dictionary(biblemulticonverter.schema.zefdic1.Dictionary) TParagraph(biblemulticonverter.schema.zefdic1.TParagraph) HashMap(java.util.HashMap) TItem(biblemulticonverter.schema.zefdic1.TItem) ArrayList(java.util.ArrayList) ObjectFactory(biblemulticonverter.schema.zefdic1.ObjectFactory) Book(biblemulticonverter.data.Book) SeeType(biblemulticonverter.schema.zefdic1.SeeType)

Aggregations

Test (org.junit.Test)23 JAXBElement (javax.xml.bind.JAXBElement)22 ObjectFactory (net.opengis.cat.csw.v_2_0_2.ObjectFactory)20 QueryType (net.opengis.cat.csw.v_2_0_2.QueryType)18 GetRecordsType (net.opengis.cat.csw.v_2_0_2.GetRecordsType)17 QName (javax.xml.namespace.QName)13 CswRecordCollection (org.codice.ddf.spatial.ogc.csw.catalog.common.CswRecordCollection)13 XStream (com.thoughtworks.xstream.XStream)12 ByteArrayInputStream (java.io.ByteArrayInputStream)12 Marshaller (javax.xml.bind.Marshaller)12 GetRecordsResponseType (net.opengis.cat.csw.v_2_0_2.GetRecordsResponseType)12 SearchResultsType (net.opengis.cat.csw.v_2_0_2.SearchResultsType)12 ArrayList (java.util.ArrayList)11 JAXBContext (javax.xml.bind.JAXBContext)11 ElementSetNameType (net.opengis.cat.csw.v_2_0_2.ElementSetNameType)11 MarshallingContext (com.thoughtworks.xstream.converters.MarshallingContext)10 HierarchicalStreamWriter (com.thoughtworks.xstream.io.HierarchicalStreamWriter)10 StringWriter (java.io.StringWriter)10 BigInteger (java.math.BigInteger)10 ObjectFactory (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectFactory)8