Search in sources :

Example 11 with FeatureCollectionType

use of org.geotoolkit.gml.xml.v311.FeatureCollectionType in project geo-platform by geosdi.

the class WFSGetFeatureTest method b_statesHitsQueryRestrictions.

@Test
public void b_statesHitsQueryRestrictions() throws Exception {
    WFSGetFeatureRequest<FeatureCollectionType> request = serverConnector.createGetFeatureRequest();
    request.setResultType(HITS.value());
    request.setTypeName(statesName);
    request.setQueryDTO(queryDTOAnd);
    logger.info("######################\n{}\n", request.showRequestAsString());
    FeatureCollectionType response = request.getResponse();
    logger.info("#############################statesHitsQueryRestrictions#Features {}\n", response.getNumberOfFeatures().intValue());
}
Also used : FeatureCollectionType(org.geosdi.geoplatform.xml.wfs.v110.FeatureCollectionType) Test(org.junit.Test)

Example 12 with FeatureCollectionType

use of org.geotoolkit.gml.xml.v311.FeatureCollectionType in project geo-platform by geosdi.

the class WFSGetFeatureTest method f_statesFeatureIDs.

@Test
public void f_statesFeatureIDs() throws Exception {
    WFSGetFeatureRequest<FeatureCollectionType> request = serverConnector.createGetFeatureRequest();
    request.setResultType(ResultTypeType.RESULTS.value());
    request.setTypeName(statesName);
    request.setFeatureIDs(Arrays.asList("states.1", "states.49"));
    logger.info("RESPONSE @@@@@@@@@@@@@@@@@@@@@@@@@@@@@ {}\n", request.getResponseAsString());
    FeatureCollectionType response = request.getResponse();
    logger.info("#############################statesFeatureIDs#Features : {}\n", response.getNumberOfFeatures().intValue());
}
Also used : FeatureCollectionType(org.geosdi.geoplatform.xml.wfs.v110.FeatureCollectionType) Test(org.junit.Test)

Example 13 with FeatureCollectionType

use of org.geotoolkit.gml.xml.v311.FeatureCollectionType in project geo-platform by geosdi.

the class WFSGetFeatureTest method l_statesNotContainsRestrictionTest.

@Test
public void l_statesNotContainsRestrictionTest() throws Exception {
    WFSGetFeatureRequest<FeatureCollectionType> request = serverConnector.createGetFeatureRequest();
    request.setTypeName(statesName);
    request.setResultType(HITS.value());
    request.setQueryDTO(GPJAXBContextBuilder.newInstance().unmarshal(new StringReader("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" + "<QueryDTO>\n" + "    <matchOperator>NONE</matchOperator>\n" + "    <queryRestrictionList>\n" + "        <queryRestriction>\n" + "            <attribute>\n" + "                <maxOccurs>1</maxOccurs>\n" + "                <minOccurs>0</minOccurs>\n" + "                <name>SUB_REGION</name>\n" + "                <nillable>true</nillable>\n" + "                <type>string</type>\n" + "                <value></value>\n" + "            </attribute>\n" + "            <operator>CONTAINS</operator>\n" + "            <restriction>Mtn</restriction>\n" + "        </queryRestriction>\n" + "    </queryRestrictionList>\n" + "</QueryDTO>"), QueryDTO.class));
    logger.info("#############################REQUEST_AS_STRING : \n{}\n", request.showRequestAsString());
    FeatureCollectionType response = request.getResponse();
    logger.info("##################################statesNotContainsRestrictionTest#Features : {}\n", response.getNumberOfFeatures().intValue());
}
Also used : FeatureCollectionType(org.geosdi.geoplatform.xml.wfs.v110.FeatureCollectionType) QueryDTO(org.geosdi.geoplatform.connector.wfs.response.QueryDTO) StringReader(java.io.StringReader) Test(org.junit.Test)

Example 14 with FeatureCollectionType

use of org.geotoolkit.gml.xml.v311.FeatureCollectionType in project geo-platform by geosdi.

the class WFSGetFeatureTest method p_statesNotGreatherThanRestrictionTest.

@Test
public void p_statesNotGreatherThanRestrictionTest() throws Exception {
    WFSGetFeatureRequest<FeatureCollectionType> request = serverConnector.createGetFeatureRequest();
    request.setTypeName(statesName);
    request.setResultType(HITS.value());
    request.setQueryDTO(GPJAXBContextBuilder.newInstance().unmarshal(new StringReader("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" + "<QueryDTO>\n" + "    <matchOperator>NONE</matchOperator>\n" + "    <queryRestrictionList>\n" + "        <queryRestriction>\n" + "            <attribute>\n" + "                <maxOccurs>1</maxOccurs>\n" + "                <minOccurs>0</minOccurs>\n" + "                <name>WORKERS</name>\n" + "                <nillable>true</nillable>\n" + "                <type>double</type>\n" + "                <value></value>\n" + "            </attribute>\n" + "            <operator>GREATER</operator>\n" + "            <restriction>6000000</restriction>\n" + "        </queryRestriction>\n" + "    </queryRestrictionList>\n" + "</QueryDTO>"), QueryDTO.class));
    logger.info("#############################REQUEST_AS_STRING : \n{}\n", request.showRequestAsString());
    FeatureCollectionType response = request.getResponse();
    logger.info("##################################statesNotGreatherThanRestrictionTest#Features {}\n", response.getNumberOfFeatures().intValue());
}
Also used : FeatureCollectionType(org.geosdi.geoplatform.xml.wfs.v110.FeatureCollectionType) QueryDTO(org.geosdi.geoplatform.connector.wfs.response.QueryDTO) StringReader(java.io.StringReader) Test(org.junit.Test)

Example 15 with FeatureCollectionType

use of org.geotoolkit.gml.xml.v311.FeatureCollectionType in project geotoolkit by Geomatys.

the class SamplingXMLBindingTest method marshallingTest.

/**
 * Test simple Record Marshalling.
 *
 * @throws java.lang.Exception
 */
@Test
public void marshallingTest() throws JAXBException, IOException, ParserConfigurationException, SAXException {
    final DirectPositionType pos = new DirectPositionType("urn:ogc:crs:espg:4326", 2, Arrays.asList(3.2, 6.5));
    final PointType location = new PointType("point-ID", pos);
    final SamplingPointType sp = new SamplingPointType("samplingID-007", "urn:sampling:test:007", "a sampling Test", new FeaturePropertyType(""), location);
    StringWriter sw = new StringWriter();
    marshaller.marshal(sp, sw);
    String result = sw.toString();
    // we remove the first line
    result = result.substring(result.indexOf("?>") + 2).trim();
    String expResult = "<sampling:SamplingPoint gml:id=\"samplingID-007\"" + " xmlns:sampling=\"http://www.opengis.net/sampling/1.0\"" + " xmlns:xlink=\"http://www.w3.org/1999/xlink\"" + " xmlns:gml=\"http://www.opengis.net/gml\">" + '\n' + "    <gml:description>a sampling Test</gml:description>" + '\n' + "    <gml:name>urn:sampling:test:007</gml:name>" + '\n' + "    <gml:boundedBy>" + '\n' + "        <gml:Null>not_bounded</gml:Null>" + '\n' + "    </gml:boundedBy>" + '\n' + "    <sampling:sampledFeature xlink:href=\"\"/>" + '\n' + "    <sampling:position>" + '\n' + "        <gml:Point gml:id=\"point-ID\">" + '\n' + "            <gml:pos srsName=\"urn:ogc:crs:espg:4326\" srsDimension=\"2\">3.2 6.5</gml:pos>" + '\n' + "        </gml:Point>" + '\n' + "    </sampling:position>" + '\n' + "</sampling:SamplingPoint>" + '\n';
    assertXmlEquals(expResult, result, "xmlns:*");
    final ObjectFactory facto = new ObjectFactory();
    FeatureCollectionType collection = new FeatureCollectionType();
    List<FeaturePropertyType> featProps = new ArrayList<FeaturePropertyType>();
    featProps.add(new FeaturePropertyType(facto.createSamplingPoint(sp)));
    collection.getFeatureMember().addAll(featProps);
    sw = new StringWriter();
    marshaller.marshal(collection, sw);
    result = sw.toString();
    // we remove the first line
    result = result.substring(result.indexOf("?>") + 2).trim();
    expResult = "<gml:FeatureCollection" + " xmlns:sampling=\"http://www.opengis.net/sampling/1.0\"" + " xmlns:xlink=\"http://www.w3.org/1999/xlink\"" + " xmlns:gml=\"http://www.opengis.net/gml\">" + '\n' + "    <gml:featureMember>" + '\n' + "        <sampling:SamplingPoint gml:id=\"samplingID-007\">" + '\n' + "            <gml:description>a sampling Test</gml:description>" + '\n' + "            <gml:name>urn:sampling:test:007</gml:name>" + '\n' + "            <gml:boundedBy>" + '\n' + "                <gml:Null>not_bounded</gml:Null>" + '\n' + "            </gml:boundedBy>" + '\n' + "            <sampling:sampledFeature xlink:href=\"\"/>" + '\n' + "            <sampling:position>" + '\n' + "                <gml:Point gml:id=\"point-ID\">" + '\n' + "                    <gml:pos srsName=\"urn:ogc:crs:espg:4326\" srsDimension=\"2\">3.2 6.5</gml:pos>" + '\n' + "                </gml:Point>" + '\n' + "            </sampling:position>" + '\n' + "        </sampling:SamplingPoint>" + '\n' + "    </gml:featureMember>" + '\n' + "</gml:FeatureCollection>" + '\n';
    assertXmlEquals(expResult, result, "xmlns:*");
}
Also used : FeatureCollectionType(org.geotoolkit.gml.xml.v311.FeatureCollectionType) DirectPositionType(org.geotoolkit.gml.xml.v311.DirectPositionType) StringWriter(java.io.StringWriter) ObjectFactory(org.geotoolkit.sampling.xml.v100.ObjectFactory) SamplingPointType(org.geotoolkit.sampling.xml.v100.SamplingPointType) ArrayList(java.util.ArrayList) PointType(org.geotoolkit.gml.xml.v311.PointType) SamplingPointType(org.geotoolkit.sampling.xml.v100.SamplingPointType) FeaturePropertyType(org.geotoolkit.gml.xml.v311.FeaturePropertyType)

Aggregations

FeatureCollectionType (org.geosdi.geoplatform.xml.wfs.v110.FeatureCollectionType)29 Test (org.junit.Test)28 QueryDTO (org.geosdi.geoplatform.connector.wfs.response.QueryDTO)17 StringReader (java.io.StringReader)14 QName (javax.xml.namespace.QName)6 AttributeDTO (org.geosdi.geoplatform.connector.wfs.response.AttributeDTO)6 BBox (org.geosdi.geoplatform.gui.shared.bean.BBox)6 QueryRestrictionDTO (org.geosdi.geoplatform.connector.wfs.response.QueryRestrictionDTO)5 ArrayList (java.util.ArrayList)2 GeometryAttributeDTO (org.geosdi.geoplatform.connector.wfs.response.GeometryAttributeDTO)2 TransactionResponseType (org.geosdi.geoplatform.xml.wfs.v110.TransactionResponseType)2 DirectPositionType (org.geotoolkit.gml.xml.v311.DirectPositionType)2 FeatureCollectionType (org.geotoolkit.gml.xml.v311.FeatureCollectionType)2 FeaturePropertyType (org.geotoolkit.gml.xml.v311.FeaturePropertyType)2 PointType (org.geotoolkit.gml.xml.v311.PointType)2 ObjectFactory (org.geotoolkit.sampling.xml.v100.ObjectFactory)2 SamplingPointType (org.geotoolkit.sampling.xml.v100.SamplingPointType)2 XStreamException (com.thoughtworks.xstream.XStreamException)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 File (java.io.File)1