Merge pull request #763 from bartvde/insertresult

WFST 1.0.0 InsertResult not read correctly (r=@pgiraud) thanks Pierre for the quick review and thanks to @fgravin for the detailed bug report
This commit is contained in:
Bart van den Eijnden
2012-11-23 03:39:48 -08:00
3 changed files with 13 additions and 7 deletions

View File

@@ -103,7 +103,7 @@ OpenLayers.Format.WFST.v1_0_0 = OpenLayers.Class(
"InsertResult": function(node, container) { "InsertResult": function(node, container) {
var obj = {fids: []}; var obj = {fids: []};
this.readChildNodes(node, obj); this.readChildNodes(node, obj);
container.insertIds.push(obj.fids[0]); container.insertIds = container.insertIds.concat(obj.fids);
}, },
"TransactionResult": function(node, obj) { "TransactionResult": function(node, obj) {
this.readChildNodes(node, obj); this.readChildNodes(node, obj);

View File

@@ -11,7 +11,7 @@
} }
function test_read(t) { function test_read(t) {
t.plan(2); t.plan(3);
var data = readXML("Transaction_Response"); var data = readXML("Transaction_Response");
var format = new OpenLayers.Format.WFST.v1_0_0({ var format = new OpenLayers.Format.WFST.v1_0_0({
@@ -19,7 +19,8 @@
featureType: "states" featureType: "states"
}); });
var result = format.read(data); var result = format.read(data);
t.eq(result.insertIds[0], "none", "InsertIds read correctly"); t.eq(result.insertIds[0], "parcelle.40", "First InsertId read correctly");
t.eq(result.insertIds[1], "parcelle.41", "Second InsertId read correctly");
t.eq(result.success, true, "Success read correctly"); t.eq(result.success, true, "Success read correctly");
} }
@@ -91,7 +92,8 @@
<div id="Transaction_Response"><!-- <div id="Transaction_Response"><!--
<wfs:WFS_TransactionResponse version="1.0.0" xmlns:wfs="http://www.opengis.net/wfs" xmlns:ogc="http://www.opengis.net/ogc"> <wfs:WFS_TransactionResponse version="1.0.0" xmlns:wfs="http://www.opengis.net/wfs" xmlns:ogc="http://www.opengis.net/ogc">
<wfs:InsertResult> <wfs:InsertResult>
<ogc:FeatureId fid="none"/> <ogc:FeatureId fid="parcelle.40"/>
<ogc:FeatureId fid="parcelle.41"/>
</wfs:InsertResult> </wfs:InsertResult>
<wfs:TransactionResult> <wfs:TransactionResult>
<wfs:Status> <wfs:Status>

View File

@@ -11,7 +11,7 @@
} }
function test_read(t) { function test_read(t) {
t.plan(2); t.plan(3);
var data = readXML("TransactionResponse"); var data = readXML("TransactionResponse");
var format = new OpenLayers.Format.WFST.v1_1_0({ var format = new OpenLayers.Format.WFST.v1_1_0({
@@ -19,7 +19,8 @@
featureType: "states" featureType: "states"
}); });
var result = format.read(data); var result = format.read(data);
t.eq(result.insertIds[0], "none", "InsertIds read correctly"); t.eq(result.insertIds[0], "parcelle.40", "First InsertId read correctly");
t.eq(result.insertIds[1], "parcelle.41", "Second InsertId read correctly");
t.eq(result.success, true, "Success read correctly"); t.eq(result.success, true, "Success read correctly");
} }
@@ -137,7 +138,10 @@
<wfs:TransactionResults/> <wfs:TransactionResults/>
<wfs:InsertResults> <wfs:InsertResults>
<wfs:Feature> <wfs:Feature>
<ogc:FeatureId fid="none"/> <ogc:FeatureId fid="parcelle.40"/>
</wfs:Feature>
<wfs:Feature>
<ogc:FeatureId fid="parcelle.41"/>
</wfs:Feature> </wfs:Feature>
</wfs:InsertResults> </wfs:InsertResults>
</wfs:TransactionResponse> </wfs:TransactionResponse>