Search in sources :

Example 6 with FeatureCollectionType

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

the class WFSTransactionUpdateTest method sfRoads.

@Test
public void sfRoads() throws Exception {
    WFSTransactionRequest<TransactionResponseType> request = super.serverConnector.createTransactionRequest();
    request.setOperation(TransactionOperation.UPDATE);
    request.setTypeName(sfRoads);
    request.setFID("roads.23");
    GeometryAttributeDTO geometry = new GeometryAttributeDTO();
    geometry.setName("the_geom");
    geometry.setSrid(new Integer(4326));
    geometry.setValue("MULTILINESTRING((-103.89135254479997 44.62794736744623,-103.89096632362241 44.627735453174864,-103.89062170872486 44.62730973343466,-103.89002953848615 44.625163198149565,-103.89024101107378 44.62483551115963,-103.89114993132819 44.62388221415969,-103.89139774483179 44.623670144891136))");
    request.setAttributes(Arrays.asList(geometry));
    logger.info("HERE THE REQUEST SF_ROADS ########################## \n{}\n", request.showRequestAsString());
    WFSGetFeatureRequest<FeatureCollectionType> requestGet = super.serverConnector.createGetFeatureRequest();
    requestGet.setResultType(ResultTypeType.RESULTS.value());
    requestGet.setTypeName(sfRoads);
    requestGet.setFeatureIDs(Arrays.asList("roads.23"));
    logger.info("HERE THE REQUEST GET_FEATURE SF_ROADS ########################## \n{}\n", requestGet.showRequestAsString());
    logger.info("RESPONSE GET FEATURE SF_ROADS @@@@@@@@@@@@@@@@@@@@@@@@@@@@@ \n{}\n", requestGet.formatResponseAsString(2));
}
Also used : FeatureCollectionType(org.geosdi.geoplatform.xml.wfs.v110.FeatureCollectionType) GeometryAttributeDTO(org.geosdi.geoplatform.connector.wfs.response.GeometryAttributeDTO) TransactionResponseType(org.geosdi.geoplatform.xml.wfs.v110.TransactionResponseType) Test(org.junit.Test)

Example 7 with FeatureCollectionType

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

the class GPWFSGetFeatureLayerTempoTest method e_searchLikeLayerTempoTest.

@Test
public void e_searchLikeLayerTempoTest() 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.LIKE, "testo");
    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)

Example 8 with FeatureCollectionType

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

the class WFSGetFeatureTest method m_statesSecureNotContainsRestrictionTest.

@Test
public void m_statesSecureNotContainsRestrictionTest() 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>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("#####################################statesSecureNotContainsRestrictionTest#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 9 with FeatureCollectionType

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

the class WFSGetFeatureTest method q_statesSecureNotGreatherThanRestrictionTest.

@Test
public void q_statesSecureNotGreatherThanRestrictionTest() 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>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("########################################statesSecureNotGreatherThanRestrictionTest#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 10 with FeatureCollectionType

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

the class WFSGetFeatureTest method d_secureStatesHitsQueryRestrictions.

@Test
public void d_secureStatesHitsQueryRestrictions() throws Exception {
    WFSGetFeatureRequest<FeatureCollectionType> request = secureServerConnector.createGetFeatureRequest();
    request.setResultType(HITS.value());
    request.setTypeName(statesName);
    request.setQueryDTO(queryDTOAnd);
    logger.info("######################\n{}\n", request.showRequestAsString());
    FeatureCollectionType response = request.getResponse();
    logger.info("###############################secureStatesHitsQueryRestrictions#Features {}\n", response.getNumberOfFeatures().intValue());
}
Also used : FeatureCollectionType(org.geosdi.geoplatform.xml.wfs.v110.FeatureCollectionType) 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