Remove old WFS parser tests

This commit is contained in:
Tom Payne
2014-03-12 13:44:57 +01:00
parent bdca074077
commit 6d3f30328b
12 changed files with 0 additions and 423 deletions

View File

@@ -1,122 +0,0 @@
goog.provide('ol.test.parser.ogc.WFS_v1');
describe('ol.parser.ogc.WFS', function() {
var parser = new ol.parser.ogc.WFS();
describe('reading and writing', function() {
it('handles read of FeatureCollection', function(done) {
var url = 'spec/ol/parser/ogc/xml/wfs_v1/FeatureCollection.xml';
afterLoadXml(url, function(xml) {
var obj = parser.read(xml);
expect(obj.features.length).to.equal(1);
done();
});
});
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.writeGetFeature({
featureNS: 'http://www.openplans.org/topp',
featureTypes: ['states'],
featurePrefix: 'topp',
handle: 'handle_g',
maxFeatures: 1,
outputFormat: 'json'
});
expect(goog.dom.xml.loadXml(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.writeTransaction(null, null, null, {handle: 'handle_t'});
expect(goog.dom.xml.loadXml(output)).to.xmleql(xml);
done();
});
});
it('handles writing out transactions', function(done) {
var url = 'spec/ol/parser/ogc/xml/wfs_v1/TransactionMulti.xml';
afterLoadXml(url, function(xml) {
var parser = new ol.parser.ogc.WFS_v1_0_0();
var insertFeature = new ol.Feature({
the_geom: new ol.geom.MultiPoint([[1, 2]]),
foo: 'bar',
nul: null
});
var inserts = [insertFeature];
var updateFeature = new ol.Feature({
the_geom: new ol.geom.MultiPoint([[1, 2]]),
foo: 'bar',
// null value gets Property element with no Value
nul: null,
// undefined value means don't create a Property element
unwritten: undefined
});
updateFeature.setId('fid.42');
var updates = [updateFeature];
var deleteFeature = new ol.Feature();
deleteFeature.setId('fid.37');
var deletes = [deleteFeature];
var output = parser.writeTransaction(inserts, updates, deletes, {
featureNS: 'http://www.openplans.org/topp',
featureType: 'states',
featurePrefix: 'topp'
});
expect(goog.dom.xml.loadXml(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.writeTransaction(null, null, 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.writeGetFeature({
featureNS: 'http://www.openplans.org/topp',
featureTypes: ['states', 'cities'],
featurePrefix: 'topp'
});
expect(goog.dom.xml.loadXml(output)).to.xmleql(xml);
done();
});
});
});
});
goog.require('goog.dom.xml');
goog.require('ol.Feature');
goog.require('ol.geom.MultiPoint');
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

@@ -1,72 +0,0 @@
goog.provide('ol.test.parser.ogc.WFS_v1_0_0');
describe('ol.parser.ogc.WFS_v1_0_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_0_0/Transaction_Response.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.0.0');
expect(obj.success).to.be(true);
done();
});
});
it('handles writing Query with BBOX Filter', function(done) {
var url = 'spec/ol/parser/ogc/xml/wfs_v1_0_0/query0.xml';
afterLoadXml(url, function(xml) {
var p = new ol.parser.ogc.WFS_v1_0_0();
var filter = new ol.expr.Call(
new ol.expr.Identifier(ol.expr.functions.EXTENT),
[new ol.expr.Literal(1), new ol.expr.Literal(2),
new ol.expr.Literal(3), new ol.expr.Literal(4),
undefined,
new ol.expr.Identifier('the_geom')]);
p.getFilterParser().getGmlParser().axisOrientation = 'enu';
var output = p.writers[p.defaultNamespaceURI]['Query'].apply(
p, [{
filter: filter,
featureType: 'states',
featureNS: 'http://www.openplans.org/topp',
featurePrefix: 'topp'
}]);
expect(goog.dom.xml.loadXml(p.serialize(output))).to.xmleql(xml);
done();
});
});
it('handles writing GetFeature with PropertyName', function(done) {
var url = 'spec/ol/parser/ogc/xml/wfs_v1_0_0/getfeature0.xml';
afterLoadXml(url, function(xml) {
var p = new ol.parser.ogc.WFS_v1_0_0();
var output = p.writers[p.defaultNamespaceURI]['GetFeature'].apply(
p, [{
propertyNames: [new ol.expr.Identifier('STATE_NAME'),
new ol.expr.Identifier('STATE_FIPS'),
new ol.expr.Identifier('STATE_ABBR')],
featureNS: 'http://www.openplans.org/topp',
featurePrefix: 'topp',
featureTypes: ['states']
}]);
expect(goog.dom.xml.loadXml(p.serialize(output))).to.xmleql(xml);
done();
});
});
});
});
goog.require('goog.dom.xml');
goog.require('ol.expr.Call');
goog.require('ol.expr.Identifier');
goog.require('ol.expr.Literal');
goog.require('ol.parser.ogc.WFS');
goog.require('ol.parser.ogc.WFS_v1_0_0');

View File

@@ -1,122 +0,0 @@
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();
});
});
it('handles read of boundedBy on the FeatureCollection', function(done) {
var url = 'spec/ol/parser/ogc/xml/wfs_v1_1_0/boundedBy.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.bounds[0]).to.equal(3197.88);
expect(obj.bounds[1]).to.equal(306457.313);
expect(obj.bounds[2]).to.equal(280339.156);
expect(obj.bounds[3]).to.equal(613850.438);
done();
});
});
it('handles writing Query with BBOX Filter', function(done) {
var url = 'spec/ol/parser/ogc/xml/wfs_v1_1_0/query0.xml';
afterLoadXml(url, function(xml) {
var p = new ol.parser.ogc.WFS_v1_1_0();
var srs = 'urn:ogc:def:crs:EPSG::4326';
var filter = new ol.expr.Call(
new ol.expr.Identifier(ol.expr.functions.EXTENT),
[new ol.expr.Literal(1), new ol.expr.Literal(2),
new ol.expr.Literal(3), new ol.expr.Literal(4),
new ol.expr.Literal(srs),
new ol.expr.Identifier('the_geom')]);
p.getFilterParser().getGmlParser().axisOrientation =
ol.proj.get(srs).getAxisOrientation();
var output = p.writers[p.defaultNamespaceURI]['Query'].apply(
p, [{
srsName: srs,
filter: filter,
featureType: 'states',
featureNS: 'http://www.openplans.org/topp',
featurePrefix: 'topp'
}]);
expect(goog.dom.xml.loadXml(p.serialize(output))).to.xmleql(xml);
done();
});
});
it('handles writing GetFeature with resultType hits', function(done) {
var url = 'spec/ol/parser/ogc/xml/wfs_v1_1_0/getfeature0.xml';
afterLoadXml(url, function(xml) {
var p = new ol.parser.ogc.WFS_v1_1_0();
var output = p.writers[p.defaultNamespaceURI]['GetFeature'].apply(
p, [{
resultType: 'hits',
srsName: 'urn:ogc:def:crs:EPSG::4326',
propertyNames: [new ol.expr.Identifier('STATE_NAME'),
new ol.expr.Identifier('STATE_FIPS'),
new ol.expr.Identifier('STATE_ABBR')],
featureNS: 'http://www.openplans.org/topp',
featurePrefix: 'topp',
featureTypes: ['states']
}]);
expect(goog.dom.xml.loadXml(p.serialize(output))).to.xmleql(xml);
done();
});
});
it('handles writing GetFeature with paging info', function(done) {
var url = 'spec/ol/parser/ogc/xml/wfs_v1_1_0/getfeature1.xml';
afterLoadXml(url, function(xml) {
var p = new ol.parser.ogc.WFS_v1_1_0();
var output = p.writers[p.defaultNamespaceURI]['GetFeature'].apply(
p, [{
count: 10,
startIndex: 20,
srsName: 'urn:ogc:def:crs:EPSG::4326',
featureNS: 'http://www.openplans.org/topp',
featurePrefix: 'topp',
featureTypes: ['states']
}]);
expect(goog.dom.xml.loadXml(p.serialize(output))).to.xmleql(xml);
done();
});
});
});
});
goog.require('goog.dom.xml');
goog.require('ol.expr.Call');
goog.require('ol.expr.Identifier');
goog.require('ol.expr.Literal');
goog.require('ol.parser.ogc.WFS');
goog.require('ol.parser.ogc.WFS_v1_1_0');
goog.require('ol.proj');

View File

@@ -1,41 +0,0 @@
<wfs:FeatureCollection xmlns:wfs="http://www.opengis.net/wfs" xmlns:topp="http://www.openplans.org/topp" xmlns:gml="http://www.opengis.net/gml">
<gml:featureMember>
<topp:states fid="states.3">
<topp:the_geom>
<gml:MultiPolygon srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
<gml:polygonMember>
<gml:Polygon>
<gml:outerBoundaryIs>
<gml:LinearRing>
<gml:coordinates decimal="." cs="," ts=" ">-75.70742,38.557476 -75.71106,38.649551 -75.724937,38.83017 -75.752922,39.141548 -75.761658,39.247753 -75.764664,39.295849 -75.772697,39.383007 -75.791435,39.723755 -75.775269,39.724442 -75.745934,39.774818 -75.695114,39.820347 -75.644341,39.838196 -75.583794,39.840008 -75.470345,39.826435 -75.42083,39.79887 -75.412117,39.789658 -75.428009,39.77813 -75.460754,39.763248 -75.475128,39.741718 -75.476334,39.719971 -75.489639,39.714745 -75.610725,39.612793 -75.562996,39.566723 -75.590187,39.463768 -75.515572,39.36694 -75.402481,39.257637 -75.397728,39.073036 -75.324852,39.012386 -75.307899,38.945911 -75.190941,38.80867 -75.083138,38.799812 -75.045998,38.44949 -75.068298,38.449963 -75.093094,38.450451 -75.350204,38.455208 -75.69915,38.463066 -75.70742,38.557476</gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</gml:polygonMember>
</gml:MultiPolygon>
</topp:the_geom>
<topp:STATE_NAME>Delaware</topp:STATE_NAME>
<topp:STATE_FIPS>10</topp:STATE_FIPS>
<topp:SUB_REGION>S Atl</topp:SUB_REGION>
<topp:STATE_ABBR>DE</topp:STATE_ABBR>
<topp:LAND_KM>5062.456</topp:LAND_KM>
<topp:WATER_KM>1385.022</topp:WATER_KM>
<topp:PERSONS>666168.0</topp:PERSONS>
<topp:FAMILIES>175867.0</topp:FAMILIES>
<topp:HOUSHOLD>247497.0</topp:HOUSHOLD>
<topp:MALE>322968.0</topp:MALE>
<topp:FEMALE>343200.0</topp:FEMALE>
<topp:WORKERS>247566.0</topp:WORKERS>
<topp:DRVALONE>258087.0</topp:DRVALONE>
<topp:CARPOOL>42968.0</topp:CARPOOL>
<topp:PUBTRANS>8069.0</topp:PUBTRANS>
<topp:EMPLOYED>335147.0</topp:EMPLOYED>
<topp:UNEMPLOY>13945.0</topp:UNEMPLOY>
<topp:SERVICE>87973.0</topp:SERVICE>
<topp:MANUAL>44140.0</topp:MANUAL>
<topp:P_MALE>0.485</topp:P_MALE>
<topp:P_FEMALE>0.515</topp:P_FEMALE>
<topp:SAMP_POP>102776.0</topp:SAMP_POP>
</topp:states>
</gml:featureMember>
</wfs:FeatureCollection>

View File

@@ -1,3 +0,0 @@
<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

@@ -1 +0,0 @@
<wfs:Transaction xmlns:wfs="http://www.opengis.net/wfs" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" service="WFS" version="1.0.0" handle="handle_t" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd"/>

View File

@@ -1,11 +0,0 @@
<wfs:WFS_TransactionResponse version="1.0.0" xmlns:wfs="http://www.opengis.net/wfs" xmlns:ogc="http://www.opengis.net/ogc">
<wfs:InsertResult>
<ogc:FeatureId fid="parcelle.40"/>
<ogc:FeatureId fid="parcelle.41"/>
</wfs:InsertResult>
<wfs:TransactionResult>
<wfs:Status>
<wfs:SUCCESS/>
</wfs:Status>
</wfs:TransactionResult>
</wfs:WFS_TransactionResponse>

View File

@@ -1,11 +0,0 @@
<wfs:GetFeature service="WFS" version="1.0.0" xmlns:topp="http://www.openplans.org/topp"
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://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd">
<wfs:Query xmlns:wfs="http://www.opengis.net/wfs" typeName="topp:states" xmlns:topp="http://www.openplans.org/topp">
<ogc:PropertyName>STATE_NAME</ogc:PropertyName>
<ogc:PropertyName>STATE_FIPS</ogc:PropertyName>
<ogc:PropertyName>STATE_ABBR</ogc:PropertyName>
</wfs:Query>
</wfs:GetFeature>

View File

@@ -1,10 +0,0 @@
<wfs:Query xmlns:wfs="http://www.opengis.net/wfs" typeName="topp:states" xmlns:topp="http://www.openplans.org/topp">
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
<ogc:BBOX>
<ogc:PropertyName>the_geom</ogc:PropertyName>
<gml:Box xmlns:gml="http://www.opengis.net/gml">
<gml:coordinates decimal="." cs="," ts=" ">1,2 3,4</gml:coordinates>
</gml:Box>
</ogc:BBOX>
</ogc:Filter>
</wfs:Query>

View File

@@ -1,11 +0,0 @@
<wfs:GetFeature service="WFS" version="1.1.0" resultType="hits" xmlns:topp="http://www.openplans.org/topp"
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://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">
<wfs:Query xmlns:wfs="http://www.opengis.net/wfs" typeName="topp:states" srsName="urn:ogc:def:crs:EPSG::4326" xmlns:topp="http://www.openplans.org/topp">
<wfs:PropertyName>STATE_NAME</wfs:PropertyName>
<wfs:PropertyName>STATE_FIPS</wfs:PropertyName>
<wfs:PropertyName>STATE_ABBR</wfs:PropertyName>
</wfs:Query>
</wfs:GetFeature>

View File

@@ -1,8 +0,0 @@
<wfs:GetFeature service="WFS" version="1.1.0" startIndex="20" count="10" xmlns:topp="http://www.openplans.org/topp"
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://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">
<wfs:Query xmlns:wfs="http://www.opengis.net/wfs" typeName="topp:states" srsName="urn:ogc:def:crs:EPSG::4326" xmlns:topp="http://www.openplans.org/topp">
</wfs:Query>
</wfs:GetFeature>

View File

@@ -1,11 +0,0 @@
<wfs:Query xmlns:wfs="http://www.opengis.net/wfs" typeName="topp:states" srsName="urn:ogc:def:crs:EPSG::4326" xmlns:topp="http://www.openplans.org/topp">
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
<ogc:BBOX>
<ogc:PropertyName>the_geom</ogc:PropertyName>
<gml:Envelope xmlns:gml="http://www.opengis.net/gml" srsName="urn:ogc:def:crs:EPSG::4326">
<gml:lowerCorner>1 2</gml:lowerCorner>
<gml:upperCorner>3 4</gml:upperCorner>
</gml:Envelope>
</ogc:BBOX>
</ogc:Filter>
</wfs:Query>