Search in sources :

Example 26 with FeatureCollectionType

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

the class WFSGetFeatureWithSpatialRestrictionsTest method a_stateQueryRestrictionBboxTest.

@Test
public void a_stateQueryRestrictionBboxTest() throws Exception {
    WFSGetFeatureRequest<FeatureCollectionType> request = serverConnector.createGetFeatureRequest();
    request.setResultType(ResultTypeType.RESULTS.value());
    request.setTypeName(statesName);
    request.setPropertyNames(Arrays.asList(new String[] { "WORKERS", "MANUAL", "SUB_REGION" }));
    request.setBBox(new BBox(-75.102613, 40.212597, -72.361859, 41.512517));
    request.setSRS("EPSG:4326");
    logger.info("######################\n{}\n", request.showRequestAsString());
    FeatureCollectionType response = request.getResponse();
    assertTrue(response.getNumberOfFeatures().intValue() == 4);
    logger.info("#############################a_stateQueryBboxTest#ResponseAsString {}\n", request.formatResponseAsString(2));
}
Also used : FeatureCollectionType(org.geosdi.geoplatform.xml.wfs.v110.FeatureCollectionType) BBox(org.geosdi.geoplatform.gui.shared.bean.BBox) Test(org.junit.Test)

Example 27 with FeatureCollectionType

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

the class WFSGetFeatureWithSpatialRestrictionsTest method f_queryWithBboxTest.

@Test
public void f_queryWithBboxTest() throws Exception {
    WFSGetFeatureRequest<FeatureCollectionType> request = serverConnector.createGetFeatureRequest();
    request.setResultType(ResultTypeType.RESULTS.value());
    request.setTypeName(new QName("topp:admin_shp_com2016_wgs84_g"));
    request.setBBox(new BBox(16.13123416900635, 40.83818500873241, 16.138143539428714, 40.84040902994519));
    request.setSRS("EPSG:4326");
    logger.info("######################\n{}\n", request.showRequestAsString());
    FeatureCollectionType response = request.getResponse();
    logger.info("########################FEATURES : {}\n", response.getNumberOfFeatures());
}
Also used : FeatureCollectionType(org.geosdi.geoplatform.xml.wfs.v110.FeatureCollectionType) QName(javax.xml.namespace.QName) BBox(org.geosdi.geoplatform.gui.shared.bean.BBox) Test(org.junit.Test)

Example 28 with FeatureCollectionType

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

the class WFSGetFeatureTest method i_statesSecureContainsRestrictionTest.

@Test
public void i_statesSecureContainsRestrictionTest() throws Exception {
    WFSGetFeatureRequest<FeatureCollectionType> request = secureServerConnector.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>ALL</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("###################################statesSecureContainsRestrictionTest#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 29 with FeatureCollectionType

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

the class GPWFSGetFeatureLayerTempoTest method d_searchEndsWithLayerTempoTest.

@Test
public void d_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, "sto1");
    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 30 with FeatureCollectionType

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

the class GPWFSGetFeatureLayerTempoTest method a_searchStartWithLayerTempoTest.

@Test
public void a_searchStartWithLayerTempoTest() 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.STARTS_WITH, "te");
    queryDTO.setQueryRestrictionList(Arrays.asList(queryRestrictionDTO));
    request.setQueryDTO(queryDTO);
    logger.info("######################\n{}\n", request.showRequestAsString());
    FeatureCollectionType response = request.getResponse();
    assertTrue(response.getNumberOfFeatures().intValue() == 7);
}
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)

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