starting to add tests for WFS 1.1.0

make sure we don't override the wfs:FeatureCollection reader with the one from GML
This commit is contained in:
Bart van den Eijnden
2013-10-22 20:34:55 +02:00
parent 0581a49378
commit d2ac206ca3
6 changed files with 104 additions and 22 deletions

View File

@@ -0,0 +1,38 @@
goog.provide('ol.test.parser.ogc.WFS_v1_1_0');
describe('ol.parser.ogc.WFS_v1_1_0', function() {
var parser = new ol.parser.ogc.WFS();
describe('reading and writing', function() {
it('handles read of transaction response', function(done) {
var url = 'spec/ol/parser/ogc/xml/wfs_v1_1_0/TransactionResponse.xml';
afterLoadXml(url, function(xml) {
var obj = parser.read(xml);
expect(obj.insertIds.length).to.equal(2);
expect(obj.insertIds[0]).to.equal('parcelle.40');
expect(obj.insertIds[1]).to.equal('parcelle.41');
expect(obj.version).to.equal('1.1.0');
expect(obj.success).to.be(true);
done();
});
});
it('handles read of number of features', function(done) {
var url = 'spec/ol/parser/ogc/xml/wfs_v1_1_0/NumberOfFeatures.xml';
afterLoadXml(url, function(xml) {
// the XML does not contain a version attribute on the root node
var p = new ol.parser.ogc.WFS_v1_1_0();
var obj = p.read(xml);
expect(obj.numberOfFeatures).to.equal(625);
done();
});
});
});
});
goog.require('goog.dom.xml');
goog.require('ol.parser.ogc.WFS');
goog.require('ol.parser.ogc.WFS_v1_1_0');

View File

@@ -0,0 +1,9 @@
<?xml version='1.0' encoding="ISO-8859-1" ?>
<wfs:FeatureCollection
xmlns:rws="http://mapserver.gis.umn.edu/mapserver"
xmlns:gml="http://www.opengis.net/gml"
xmlns:wfs="http://www.opengis.net/wfs"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://mapserver.gis.umn.edu/mapserver http://intranet.rijkswaterstaat.nl/services/geoservices/nwb_wegen?SERVICE=WFS&amp;VERSION=1.1.0&amp;REQUEST=DescribeFeatureType&amp;TYPENAME=feature:AAA64&amp;OUTPUTFORMAT=text/xml; subtype=gml/3.1.1 http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd" numberOfFeatures="625">
</wfs:FeatureCollection>

View File

@@ -0,0 +1,16 @@
<wfs:TransactionResponse version="1.1.0" xmlns:ogc="http://www.opengis.net/ogc" xmlns:tiger="http://www.census.gov" xmlns:wfs="http://www.opengis.net/wfs" xmlns:topp="http://www.openplans.org/topp" xmlns:sf="http://www.openplans.org/spearfish" xmlns:ows="http://www.opengis.net/ows" xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink">
<wfs:TransactionSummary>
<wfs:totalInserted>0</wfs:totalInserted>
<wfs:totalUpdated>1</wfs:totalUpdated>
<wfs:totalDeleted>0</wfs:totalDeleted>
</wfs:TransactionSummary>
<wfs:TransactionResults/>
<wfs:InsertResults>
<wfs:Feature>
<ogc:FeatureId fid="parcelle.40"/>
</wfs:Feature>
<wfs:Feature>
<ogc:FeatureId fid="parcelle.41"/>
</wfs:Feature>
</wfs:InsertResults>
</wfs:TransactionResponse>