OpenLayers OpenLayers

Changeset 7143

Show
Ignore:
Timestamp:
05/12/08 18:36:32 (2 months ago)
Author:
sbenthall
Message:

Updated tests. Changed WFS protocol to talk in properly cased typeName param

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sandbox/vector-behavior/lib/OpenLayers/Protocol/WFS/v1_0_0.js

    r7142 r7143  
    154154         
    155155        var query = this.format.createElementNSPlus("wfs:Query", { 
    156             attributes: {typeName: this.params.typename} 
     156            attributes: {typeName: this.params.typeName} 
    157157        }); 
    158158         
     
    345345    update: function(feature) { 
    346346        var node = this.format.createElementNSPlus("wfs:Update", { 
    347             attributes: {typeName: this.params.typename} 
     347            attributes: {typeName: this.params.typeName} 
    348348        }); 
    349349        var prop = this.format.createElementNSPlus("wfs:Property"); 
     
    388388    "delete": function(feature) { 
    389389        var node = this.format.createElementNSPlus("wfs:Delete", { 
    390             attributes: {typeName: this.params.typename} 
     390            attributes: {typeName: this.params.typeName} 
    391391        }); 
    392392               
     
    404404         
    405405        var deleteNode = this.format.createElementNSPlus("wfs:Delete", { 
    406             attributes: {typeName: this.params.typename} 
     406            attributes: {typeName: this.params.typeName} 
    407407        });        
    408408         
  • sandbox/vector-behavior/tests/Protocol/WFS/v1_0_0.html

    r7109 r7143  
    1313     
    1414    function test_Protocol_WFS_v1_0_0_read(t) { 
    15         t.plan( 4 ); 
     15        t.plan( 2 ); 
    1616 
    1717        var protocol = new OpenLayers.Protocol.WFS.v1_0_0({ 
    1818            url: "http://sigma.openplans.org/geoserver/wfs", 
    19             params: {typename: 'topp:tasmania_cities'} 
     19            params: {typeName: 'topp:tasmania_cities'} 
    2020        }); 
     21        protocol.setFormat(new OpenLayers.Format.GML()); 
    2122 
    22         old_OpenLayers_Request_GET = OpenLayers.Request.GET; 
     23        old_OpenLayers_Request_POST = OpenLayers.Request.POST; 
    2324         
    24         OpenLayers.Request.GET = function(object){ 
     25        OpenLayers.Request.POST = function(object){ 
    2526            return object; 
    2627        } 
     
    3334            } 
    3435        }) 
     36         
     37        var xml = new OpenLayers.Format.XML();         
     38        var xData = xml.read(request.data).firstChild; 
     39         
    3540        t.eq(request.url, "http://sigma.openplans.org/geoserver/wfs", "Request url is correct.") 
    3641         
    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.") 
    4045         
    4146         
    42         OpenLayers.Request.GET = old_OpenLayers_Request_GET; 
     47        OpenLayers.Request.POST = old_OpenLayers_Request_POST; 
    4348    } 
    4449     
     
    4853        var protocol = new OpenLayers.Protocol.WFS.v1_0_0({ 
    4954            url: "http://sigma.openplans.org/geoserver/wfs", 
    50             params: {typename: 'topp:tasmania_cities'} 
     55            params: {typeName: 'topp:tasmania_cities'} 
    5156        }); 
    52         protocol.setFormat(new OpenLayers.Format.GML); 
     57        protocol.setFormat(new OpenLayers.Format.GML()); 
    5358 
    5459 
     
    7681        var protocol = new OpenLayers.Protocol.WFS.v1_0_0({ 
    7782            url: "http://sigma.openplans.org/geoserver/wfs", 
    78             params: {typename: 'topp:tasmania_cities'} 
     83            params: {typeName: 'topp:tasmania_cities'} 
    7984        }); 
    80         protocol.setFormat(new OpenLayers.Format.GML); 
     85        protocol.setFormat(new OpenLayers.Format.GML()); 
    8186 
    8287 
     
    97102    } 
    98103     
     104     
     105    //TODO: Add more commit tests 
    99106    function test_Protocol_WFS_v1_0_0_commit(t){ 
    100107        t.plan(2); 
     
    102109          var protocol = new OpenLayers.Protocol.WFS.v1_0_0({ 
    103110            url: "http://sigma.openplans.org/geoserver/wfs", 
    104             params: {typename: 'topp:tasmania_cities'} 
     111            params: {typeName: 'topp:tasmania_cities'} 
    105112        }); 
    106         protocol.setFormat(new OpenLayers.Format.GML); 
     113        protocol.setFormat(new OpenLayers.Format.GML()); 
    107114         
    108115        old_OpenLayers_Request_POST = OpenLayers.Request.POST; 
     
    112119        } 
    113120         
    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; 
    115137         
    116138        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") 
    121140         
    122141