more tests and typedefs.

Once feature editing is more stable, this format can be extended with Update, Delete and Insert
This commit is contained in:
Bart van den Eijnden
2013-10-24 14:51:04 +02:00
parent 46b79d88f8
commit c9569ed9e2
7 changed files with 131 additions and 3 deletions

View File

@@ -15,9 +15,80 @@ describe('ol.parser.ogc.WFS', function() {
});
});
it('handles writing out GetFeature with a handle', function(done) {
var url = 'spec/ol/parser/ogc/xml/wfs_v1/GetFeature.xml';
afterLoadXml(url, function(xml) {
var p = new ol.parser.ogc.WFS_v1_0_0();
var output = p.writers[p.defaultNamespaceURI]['GetFeature'].
apply(p, [{
featureNS: 'http://www.openplans.org/topp',
featureTypes: ['states'],
featurePrefix: 'topp',
handle: 'handle_g',
maxFeatures: 1,
outputFormat: 'json'
}
]);
expect(goog.dom.xml.loadXml(p.serialize(output))).to.xmleql(xml);
done();
});
});
it('handles writing out Transaction with a handle', function(done) {
var url = 'spec/ol/parser/ogc/xml/wfs_v1/Transaction.xml';
afterLoadXml(url, function(xml) {
var p = new ol.parser.ogc.WFS_v1_0_0();
var output = p.writers[p.defaultNamespaceURI]['Transaction'].
apply(p, [{
options: {handle: 'handle_t'}
}
]);
expect(goog.dom.xml.loadXml(p.serialize(output))).to.xmleql(xml);
done();
});
});
it('handles writing out Native', function(done) {
var url = 'spec/ol/parser/ogc/xml/wfs_v1/Native.xml';
afterLoadXml(url, function(xml) {
var p = new ol.parser.ogc.WFS_v1_1_0();
var output = p.write(null, {
nativeElements: [{
vendorId: 'ORACLE',
safeToIgnore: true,
value: 'ALTER SESSION ENABLE PARALLEL DML'
}, {
vendorId: 'ORACLE',
safeToIgnore: false,
value: 'Another native line goes here'
}]
});
expect(goog.dom.xml.loadXml(output)).to.xmleql(xml);
done();
});
});
it('handles writing out GetFeature with > 1 typename', function(done) {
var url = 'spec/ol/parser/ogc/xml/wfs_v1/GetFeatureMultiple.xml';
afterLoadXml(url, function(xml) {
var p = new ol.parser.ogc.WFS_v1_0_0();
var output = p.writers[p.defaultNamespaceURI]['GetFeature'].
apply(p, [{
featureNS: 'http://www.openplans.org/topp',
featureTypes: ['states', 'cities'],
featurePrefix: 'topp'
}
]);
expect(goog.dom.xml.loadXml(p.serialize(output))).to.xmleql(xml);
done();
});
});
});
});
goog.require('goog.dom.xml');
goog.require('ol.parser.ogc.WFS');
goog.require('ol.parser.ogc.WFS_v1_0_0');
goog.require('ol.parser.ogc.WFS_v1_1_0');

View File

@@ -0,0 +1,3 @@
<wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" service="WFS" version="1.0.0" handle="handle_g" outputFormat="json" maxFeatures="1" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<wfs:Query typeName="topp:states" xmlns:topp="http://www.openplans.org/topp"/>
</wfs:GetFeature>

View File

@@ -0,0 +1,4 @@
<wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" service="WFS" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<wfs:Query typeName="topp:states" xmlns:topp="http://www.openplans.org/topp"/>
<wfs:Query typeName="topp:cities" xmlns:topp="http://www.openplans.org/topp"/>
</wfs:GetFeature>

View File

@@ -0,0 +1 @@
<wfs:Transaction xmlns:wfs="http://www.opengis.net/wfs" service="WFS" version="1.1.0" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><wfs:Native vendorId="ORACLE" safeToIgnore="true">ALTER SESSION ENABLE PARALLEL DML</wfs:Native><wfs:Native vendorId="ORACLE" safeToIgnore="false">Another native line goes here</wfs:Native></wfs:Transaction>

View File

@@ -0,0 +1 @@
<wfs:Transaction xmlns:wfs="http://www.opengis.net/wfs" service="WFS" version="1.0.0" handle="handle_t" />