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());
}
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());
}
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());
}
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());
}
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:*");
}
Aggregations