making Protocol.WFS work with just featureType and featurePrefix configured. r=bartvde (closes #3368)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@12129 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -78,6 +78,31 @@
|
||||
t.xml_eq(node, out, "bbox correctly written");
|
||||
}
|
||||
|
||||
function test_BBOX_noGeometryName(t) {
|
||||
t.plan(1);
|
||||
// WFS 1.0.0 does not allow BBOX filters without property, but
|
||||
// GeoServer accepts them.
|
||||
var filter = new OpenLayers.Filter.Spatial({
|
||||
type: OpenLayers.Filter.Spatial.BBOX,
|
||||
value: new OpenLayers.Bounds(-180, -90, 180, 90),
|
||||
projection: "EPSG:4326"
|
||||
});
|
||||
|
||||
var out =
|
||||
'<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">' +
|
||||
'<ogc:BBOX>' +
|
||||
'<gml:Box xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:4326">' +
|
||||
'<gml:coordinates decimal="." cs="," ts=" ">-180,-90 180,90</gml:coordinates>' +
|
||||
'</gml:Box>' +
|
||||
'</ogc:BBOX>' +
|
||||
'</ogc:Filter>';
|
||||
|
||||
var parser = new OpenLayers.Format.Filter.v1_0_0();
|
||||
var node = parser.write(filter);
|
||||
|
||||
t.xml_eq(node, out, "bbox correctly written");
|
||||
}
|
||||
|
||||
function test_DWithin(t) {
|
||||
|
||||
t.plan(6);
|
||||
|
||||
@@ -167,6 +167,31 @@
|
||||
t.xml_eq(node, out, "bbox correctly written");
|
||||
}
|
||||
|
||||
function test_BBOX_noGeometryName(t) {
|
||||
t.plan(1);
|
||||
var filter = new OpenLayers.Filter.Spatial({
|
||||
type: OpenLayers.Filter.Spatial.BBOX,
|
||||
value: new OpenLayers.Bounds(-180, -90, 180, 90),
|
||||
projection: "EPSG:4326"
|
||||
});
|
||||
|
||||
var out =
|
||||
'<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">' +
|
||||
'<ogc:BBOX>' +
|
||||
'<gml:Envelope xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:4326">' +
|
||||
'<gml:lowerCorner>-180 -90</gml:lowerCorner>' +
|
||||
'<gml:upperCorner>180 90</gml:upperCorner>' +
|
||||
'</gml:Envelope>' +
|
||||
'</ogc:BBOX>' +
|
||||
'</ogc:Filter>';
|
||||
|
||||
var parser = new OpenLayers.Format.Filter.v1_1_0();
|
||||
var node = parser.write(filter);
|
||||
|
||||
t.xml_eq(node, out, "bbox correctly written");
|
||||
}
|
||||
|
||||
|
||||
function test_Intersects(t) {
|
||||
|
||||
t.plan(4);
|
||||
|
||||
@@ -50,6 +50,19 @@
|
||||
|
||||
}
|
||||
|
||||
function test_read_setGeometryName(t) {
|
||||
t.plan(1);
|
||||
var doc = readXML("v3/topp-states-gml.xml");
|
||||
var format = new OpenLayers.Format.GML.v3({
|
||||
featureType: "states",
|
||||
featureNS: "http://www.openplans.org/topp",
|
||||
geometryName: null
|
||||
});
|
||||
var features = format.read(doc.documentElement);
|
||||
|
||||
t.eq(format.geometryName, "the_geom", "geometryName set when parsing features");
|
||||
}
|
||||
|
||||
function test_readNode_bounds(t) {
|
||||
var files = ["v3/envelope.xml"];
|
||||
|
||||
|
||||
@@ -67,6 +67,17 @@
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function test_write_poorconfig(t) {
|
||||
t.plan(1);
|
||||
var format = new OpenLayers.Format.WFST.v1_0_0({
|
||||
featureType: "states",
|
||||
featurePrefix: "topp"
|
||||
});
|
||||
var exp = "topp:states";
|
||||
var got = format.writeNode("wfs:Query").getAttribute("typeName");
|
||||
t.eq(got, exp, "Query without featureNS but with featurePrefix queries for the correct featureType");
|
||||
}
|
||||
|
||||
var xmlFormat = new OpenLayers.Format.XML();
|
||||
function readXML(id) {
|
||||
|
||||
@@ -95,6 +95,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
function test_write_poorconfig(t) {
|
||||
t.plan(1);
|
||||
var format = new OpenLayers.Format.WFST.v1_1_0({
|
||||
featureType: "states",
|
||||
featurePrefix: "topp"
|
||||
});
|
||||
var exp = "topp:states";
|
||||
var got = format.writeNode("wfs:Query").getAttribute("typeName");
|
||||
t.eq(got, exp, "Query without featureNS but with featurePrefix queries for the correct featureType");
|
||||
}
|
||||
|
||||
var xmlFormat = new OpenLayers.Format.XML();
|
||||
function readXML(id) {
|
||||
var xml = document.getElementById(id).firstChild.nodeValue;
|
||||
|
||||
Reference in New Issue
Block a user