Search in sources :

Example 31 with FeatureCollectionType

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

the class GPWFSGetFeatureLayerTempoTest method b_searchEndsWithLayerTempoTest.

@Test
public void b_searchEndsWithLayerTempoTest() throws Exception {
    WFSGetFeatureRequest<FeatureCollectionType> request = serverConnector.createGetFeatureRequest();
    request.setResultType(RESULTS.value());
    request.setTypeName(new QName("admin:tempo"));
    QueryDTO queryDTO = new QueryDTO();
    queryDTO.setMatchOperator("ALL");
    AttributeDTO attributeDTO = new AttributeDTO();
    attributeDTO.setName("string");
    attributeDTO.setType("string");
    QueryRestrictionDTO queryRestrictionDTO = new QueryRestrictionDTO(attributeDTO, OperatorType.ENDS_WITH, "te");
    queryDTO.setQueryRestrictionList(Arrays.asList(queryRestrictionDTO));
    request.setQueryDTO(queryDTO);
    logger.info("######################\n{}\n", request.showRequestAsString());
    FeatureCollectionType response = request.getResponse();
    assertTrue(response.getNumberOfFeatures().intValue() == 0);
}
Also used : FeatureCollectionType(org.geosdi.geoplatform.xml.wfs.v110.FeatureCollectionType) AttributeDTO(org.geosdi.geoplatform.connector.wfs.response.AttributeDTO) QName(javax.xml.namespace.QName) QueryDTO(org.geosdi.geoplatform.connector.wfs.response.QueryDTO) QueryRestrictionDTO(org.geosdi.geoplatform.connector.wfs.response.QueryRestrictionDTO) Test(org.junit.Test)

Example 32 with FeatureCollectionType

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

the class GPWFSGetFeatureLayerTempoTest method c_searchEndsWithLayerTempoTest.

@Test
public void c_searchEndsWithLayerTempoTest() throws Exception {
    WFSGetFeatureRequest<FeatureCollectionType> request = serverConnector.createGetFeatureRequest();
    request.setResultType(RESULTS.value());
    request.setTypeName(new QName("admin:tempo"));
    QueryDTO queryDTO = new QueryDTO();
    queryDTO.setMatchOperator("ALL");
    AttributeDTO attributeDTO = new AttributeDTO();
    attributeDTO.setName("string");
    attributeDTO.setType("string");
    QueryRestrictionDTO queryRestrictionDTO = new QueryRestrictionDTO(attributeDTO, OperatorType.ENDS_WITH, "sto");
    queryDTO.setQueryRestrictionList(Arrays.asList(queryRestrictionDTO));
    request.setQueryDTO(queryDTO);
    logger.info("######################\n{}\n", request.showRequestAsString());
    FeatureCollectionType response = request.getResponse();
    assertTrue(response.getNumberOfFeatures().intValue() == 1);
}
Also used : FeatureCollectionType(org.geosdi.geoplatform.xml.wfs.v110.FeatureCollectionType) AttributeDTO(org.geosdi.geoplatform.connector.wfs.response.AttributeDTO) QName(javax.xml.namespace.QName) QueryDTO(org.geosdi.geoplatform.connector.wfs.response.QueryDTO) QueryRestrictionDTO(org.geosdi.geoplatform.connector.wfs.response.QueryRestrictionDTO) Test(org.junit.Test)

Example 33 with FeatureCollectionType

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

the class SamplingXMLBindingTest method UnmarshalingTest.

/**
 * Test simple Record Marshalling.
 *
 * @throws java.lang.Exception
 */
@Test
public void UnmarshalingTest() throws JAXBException {
    /*
         * Test Unmarshalling spatial filter.
         */
    String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" + '\n' + "<sa:SamplingPoint xmlns:sa=\"http://www.opengis.net/sampling/1.0\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:gml=\"http://www.opengis.net/gml\" 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' + "    <sa:sampledFeature xlink:href=\"\"/>" + '\n' + "    <sa: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' + "    </sa:position>" + '\n' + "</sa:SamplingPoint>" + '\n';
    StringReader sr = new StringReader(xml);
    JAXBElement jb = (JAXBElement) unmarshaller.unmarshal(sr);
    final SamplingPointType result = (SamplingPointType) jb.getValue();
    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 expResult = new SamplingPointType("samplingID-007", "urn:sampling:test:007", "a sampling Test", new FeaturePropertyType(""), location);
    assertEquals(expResult.getPosition(), result.getPosition());
    assertEquals(expResult.getName(), result.getName());
    assertEquals(expResult, result);
    xml = "<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';
    sr = new StringReader(xml);
    Object obj = ((JAXBElement) unmarshaller.unmarshal(sr)).getValue();
    final ObjectFactory facto = new ObjectFactory();
    FeatureCollectionType collection = new FeatureCollectionType();
    List<FeaturePropertyType> featProps = new ArrayList<FeaturePropertyType>();
    featProps.add(new FeaturePropertyType(facto.createSamplingPoint(expResult)));
    collection.getFeatureMember().addAll(featProps);
    assertEquals(collection, obj);
}
Also used : FeatureCollectionType(org.geotoolkit.gml.xml.v311.FeatureCollectionType) DirectPositionType(org.geotoolkit.gml.xml.v311.DirectPositionType) ObjectFactory(org.geotoolkit.sampling.xml.v100.ObjectFactory) SamplingPointType(org.geotoolkit.sampling.xml.v100.SamplingPointType) StringReader(java.io.StringReader) ArrayList(java.util.ArrayList) PointType(org.geotoolkit.gml.xml.v311.PointType) SamplingPointType(org.geotoolkit.sampling.xml.v100.SamplingPointType) JAXBElement(javax.xml.bind.JAXBElement) 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