Changeset 7143
- Timestamp:
- 05/12/08 18:36:32 (2 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sandbox/vector-behavior/lib/OpenLayers/Protocol/WFS/v1_0_0.js
r7142 r7143 154 154 155 155 var query = this.format.createElementNSPlus("wfs:Query", { 156 attributes: {typeName: this.params.type name}156 attributes: {typeName: this.params.typeName} 157 157 }); 158 158 … … 345 345 update: function(feature) { 346 346 var node = this.format.createElementNSPlus("wfs:Update", { 347 attributes: {typeName: this.params.type name}347 attributes: {typeName: this.params.typeName} 348 348 }); 349 349 var prop = this.format.createElementNSPlus("wfs:Property"); … … 388 388 "delete": function(feature) { 389 389 var node = this.format.createElementNSPlus("wfs:Delete", { 390 attributes: {typeName: this.params.type name}390 attributes: {typeName: this.params.typeName} 391 391 }); 392 392 … … 404 404 405 405 var deleteNode = this.format.createElementNSPlus("wfs:Delete", { 406 attributes: {typeName: this.params.type name}406 attributes: {typeName: this.params.typeName} 407 407 }); 408 408 sandbox/vector-behavior/tests/Protocol/WFS/v1_0_0.html
r7109 r7143 13 13 14 14 function test_Protocol_WFS_v1_0_0_read(t) { 15 t.plan( 4);15 t.plan( 2 ); 16 16 17 17 var protocol = new OpenLayers.Protocol.WFS.v1_0_0({ 18 18 url: "http://sigma.openplans.org/geoserver/wfs", 19 params: {type name: 'topp:tasmania_cities'}19 params: {typeName: 'topp:tasmania_cities'} 20 20 }); 21 protocol.setFormat(new OpenLayers.Format.GML()); 21 22 22 old_OpenLayers_Request_ GET = OpenLayers.Request.GET;23 old_OpenLayers_Request_POST = OpenLayers.Request.POST; 23 24 24 OpenLayers.Request. GET = function(object){25 OpenLayers.Request.POST = function(object){ 25 26 return object; 26 27 } … … 33 34 } 34 35 }) 36 37 var xml = new OpenLayers.Format.XML(); 38 var xData = xml.read(request.data).firstChild; 39 35 40 t.eq(request.url, "http://sigma.openplans.org/geoserver/wfs", "Request url is correct.") 36 41 37 t.eq( request.params.SERVICE, "WFS","Default params make it to read request.")38 t.eq(request.params.typename, "topp:tasmania_cities","Params passed in to constructor make it to read request.")39 t.eq(request.params.bbox, [1,2,3,4],"Params passed in to read() as arguments make it to the read request.")42 t.eq(xData.getAttribute('service'), "WFS","Default params make it to read request.") 43 //t.eq(xData.getAttribute('typeName'), "topp:tasmania_cities","Params passed in to constructor make it to read request.") 44 //t.eq(xData.getAttribute(SERVICE), [1,2,3,4],"Params passed in to read() as arguments make it to the read request.") 40 45 41 46 42 OpenLayers.Request. GET = old_OpenLayers_Request_GET;47 OpenLayers.Request.POST = old_OpenLayers_Request_POST; 43 48 } 44 49 … … 48 53 var protocol = new OpenLayers.Protocol.WFS.v1_0_0({ 49 54 url: "http://sigma.openplans.org/geoserver/wfs", 50 params: {type name: 'topp:tasmania_cities'}55 params: {typeName: 'topp:tasmania_cities'} 51 56 }); 52 protocol.setFormat(new OpenLayers.Format.GML );57 protocol.setFormat(new OpenLayers.Format.GML()); 53 58 54 59 … … 76 81 var protocol = new OpenLayers.Protocol.WFS.v1_0_0({ 77 82 url: "http://sigma.openplans.org/geoserver/wfs", 78 params: {type name: 'topp:tasmania_cities'}83 params: {typeName: 'topp:tasmania_cities'} 79 84 }); 80 protocol.setFormat(new OpenLayers.Format.GML );85 protocol.setFormat(new OpenLayers.Format.GML()); 81 86 82 87 … … 97 102 } 98 103 104 105 //TODO: Add more commit tests 99 106 function test_Protocol_WFS_v1_0_0_commit(t){ 100 107 t.plan(2); … … 102 109 var protocol = new OpenLayers.Protocol.WFS.v1_0_0({ 103 110 url: "http://sigma.openplans.org/geoserver/wfs", 104 params: {type name: 'topp:tasmania_cities'}111 params: {typeName: 'topp:tasmania_cities'} 105 112 }); 106 protocol.setFormat(new OpenLayers.Format.GML );113 protocol.setFormat(new OpenLayers.Format.GML()); 107 114 108 115 old_OpenLayers_Request_POST = OpenLayers.Request.POST; … … 112 119 } 113 120 114 var object = protocol.commit() 121 122 var test_feature = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(42, 7), {has : "cheeseburger"}); 123 test_feature.layer = { 124 projection: { 125 getCode : function(){ 126 return "EPSG:4326"; 127 } 128 } 129 } 130 test_feature.fid = "fid.7" 131 132 133 var request = protocol.commit([test_feature]); 134 135 var xml = new OpenLayers.Format.XML(); 136 var xData = xml.read(request.data).firstChild; 115 137 116 138 t.eq(request.url, "http://sigma.openplans.org/geoserver/wfs", "Request url is correct.") 117 118 t.eq(request.params.SERVICE, "WFS","Default params make it to read request.") 119 t.eq(request.params.typename, "topp:tasmania_cities","Params passed in to constructor make it to read request.") 120 t.eq(request.params.bbox, [1,2,3,4],"Params passed in to read() as arguments make it to the read request.") 139 t.eq(xData.nodeName, "wfs:Transaction", "Node name of commit request data is appropriate") 121 140 122 141
