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);
}
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);
}
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);
}
Aggregations