Add reading of TransactionResponse

This commit is contained in:
Bart van den Eijnden
2014-03-06 19:04:23 +01:00
parent 7ebf97406d
commit 2310ccdb91
3 changed files with 173 additions and 3 deletions

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>

View File

@@ -33,6 +33,28 @@ describe('ol.format.WFS', function() {
});
describe('when parsing TransactionResponse', function() {
var response;
before(function(done) {
afterLoadText('spec/ol/format/wfs/TransactionResponse.xml',
function(xml) {
try {
response = new ol.format.WFS().readTransactionResponse(xml);
} catch (e) {
done(e);
}
done();
});
});
it('returns the correct TransactionResponse object', function() {
expect(response.transactionSummary.totalDeleted).to.equal(0);
expect(response.transactionSummary.totalInserted).to.equal(0);
expect(response.transactionSummary.totalUpdated).to.equal(1);
expect(response.insertIds).to.have.length(2);
expect(response.insertIds[0]).to.equal('parcelle.40');
});
});
describe('when writing out a GetFeature request', function() {
it('creates the expected output', function() {