Search in sources :

Example 21 with FeatureCollectionType

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

the class WFSGetFeatureTest method h_statesContainsRestrictionTest.

@Test
public void h_statesContainsRestrictionTest() 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>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("##############################statesContainsRestrictionTest#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 22 with FeatureCollectionType

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

the class WFSGetFeatureTest method n_statesGreatherThanRestrictionTest.

@Test
public void n_statesGreatherThanRestrictionTest() 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>ALL</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("#########################################statesGreatherThanRestrictionTest#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 23 with FeatureCollectionType

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

the class WFSGetFeatureTest method e_statesResults.

@Test
public void e_statesResults() throws Exception {
    WFSGetFeatureRequest<FeatureCollectionType> request = serverConnector.createGetFeatureRequest();
    request.setResultType(ResultTypeType.RESULTS.value());
    request.setTypeName(statesName);
    request.setMaxFeatures(BigInteger.ONE);
    logger.info("RESPONSE @@@@@@@@@@@@@@@@@@@@@@@@@@@@@ {}\n", request.getResponseAsString());
    FeatureCollectionType response = request.getResponse();
    logger.info("xxxxxxxxxxx {}", response.getNumberOfFeatures());
    logger.info("xxxxxxxxxxx {}", response.getTimeStamp());
    FeatureArrayPropertyType featureMembers = response.getFeatureMembers();
    logger.info("----------- {}", featureMembers.isSetFeature());
    logger.info("----------- {}", featureMembers.getFeature());
    logger.info("----------- {}", featureMembers.getFeature().size());
    logger.info("+++++++++++ {}", response.getFeatureMember());
    logger.info("+++++++++++ {}\n\n", response.getFeatureMember().size());
}
Also used : FeatureCollectionType(org.geosdi.geoplatform.xml.wfs.v110.FeatureCollectionType) FeatureArrayPropertyType(org.geosdi.geoplatform.xml.gml.v311.FeatureArrayPropertyType) Test(org.junit.Test)

Example 24 with FeatureCollectionType

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

the class WFSGetFeatureWithSpatialRestrictionsTest method c_stateQueryRestrictionsNotInBboxTest.

@Test
public void c_stateQueryRestrictionsNotInBboxTest() 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.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_OR_EQUAL</operator>\n" + "            <restriction>2248972.0</restriction>\n" + "        </queryRestriction>\n" + "        <queryRestriction>\n" + "            <attribute>\n" + "                <maxOccurs>1</maxOccurs>\n" + "                <minOccurs>0</minOccurs>\n" + "                <name>MANUAL</name>\n" + "                <nillable>true</nillable>\n" + "                <type>double</type>\n" + "                <value></value>\n" + "            </attribute>\n" + "            <operator>GREATER_OR_EQUAL</operator>\n" + "            <restriction>0.25</restriction>\n" + "        </queryRestriction>\n" + "    </queryRestrictionList>\n" + "</QueryDTO>"), QueryDTO.class));
    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() == 46);
    logger.info("#############################c_stateQueryRestrictionsNotInBboxTest#ResponseAsString {}\n", request.formatResponseAsString(2));
}
Also used : FeatureCollectionType(org.geosdi.geoplatform.xml.wfs.v110.FeatureCollectionType) BBox(org.geosdi.geoplatform.gui.shared.bean.BBox) QueryDTO(org.geosdi.geoplatform.connector.wfs.response.QueryDTO) StringReader(java.io.StringReader) Test(org.junit.Test)

Example 25 with FeatureCollectionType

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

the class WFSGetFeatureWithSpatialRestrictionsTest method e_stateQueryRestrictionNotInBboxTest.

@Test
public void e_stateQueryRestrictionNotInBboxTest() 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.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_OR_EQUAL</operator>\n" + "            <restriction>1248972.0</restriction>\n" + "        </queryRestriction>\n" + "    </queryRestrictionList>\n" + "</QueryDTO>"), QueryDTO.class));
    request.setBBox(new BBox(-75.102613, 40.212597, -72.361859, 41.512517));
    request.setSRS("EPSG:4326");
    logger.info("######################\n{}\n", request.showRequestAsString());
    logger.info("#############################e_stateQueryRestrictionNotInBboxTest#ResponseAsString {}\n", request.formatResponseAsString(2));
}
Also used : FeatureCollectionType(org.geosdi.geoplatform.xml.wfs.v110.FeatureCollectionType) BBox(org.geosdi.geoplatform.gui.shared.bean.BBox) QueryDTO(org.geosdi.geoplatform.connector.wfs.response.QueryDTO) StringReader(java.io.StringReader) 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