3 <script src="../../../lib/OpenLayers.js"></script>
4 <script type="text/javascript">
6 function test_initialize(t) {
9 var format = new OpenLayers.Format.WFST.v1_1_0({});
10 t.ok(format instanceof OpenLayers.Format.WFST.v1_1_0, "constructor returns instance");
13 function test_read(t) {
16 var data = readXML("TransactionResponse");
17 var format = new OpenLayers.Format.WFST.v1_1_0({
18 featureNS: "http://www.openplans.org/topp",
21 var result = format.read(data);
22 t.eq(result.insertIds[0], "none", "InsertIds read correctly");
23 t.eq(result.success, true, "Success read correctly");
26 function test_write(t) {
28 var format = new OpenLayers.Format.WFST.v1_1_0({
29 featureNS: "http://www.openplans.org/topp",
30 featureType: "states",
31 featurePrefix: "topp",
32 geometryName: "the_geom"
39 filter: new OpenLayers.Filter.Spatial({
40 type: OpenLayers.Filter.Spatial.BBOX,
41 value: new OpenLayers.Bounds (1,2,3,4)
46 writer: "wfs:GetFeature",
48 propertyNames: ["STATE_NAME", "STATE_FIPS", "STATE_ABBR"]
55 for(var i=0; i<cases.length; ++i) {
57 exp = readXML(test.id);
58 got = format.writeNode(test.writer, test.arg);
59 t.xml_eq(got, exp, test.id + ": correct request");
63 var xmlFormat = new OpenLayers.Format.XML();
64 function readXML(id) {
65 var xml = document.getElementById(id).firstChild.nodeValue;
66 return xmlFormat.read(xml).documentElement;
72 <div id="map" style="width:512px; height:256px"> </div>
73 <div id="TransactionResponse"><!--
74 <wfs:TransactionResponse version="1.1.0" xmlns:ogc="http://www.opengis.net/ogc" xmlns:tiger="http://www.census.gov" xmlns:wfs="http://www.opengis.net/wfs" xmlns:topp="http://www.openplans.org/topp" xmlns:sf="http://www.openplans.org/spearfish" xmlns:ows="http://www.opengis.net/ows" xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink">
75 <wfs:TransactionSummary>
76 <wfs:totalInserted>0</wfs:totalInserted>
77 <wfs:totalUpdated>1</wfs:totalUpdated>
78 <wfs:totalDeleted>0</wfs:totalDeleted>
79 </wfs:TransactionSummary>
80 <wfs:TransactionResults/>
83 <ogc:FeatureId fid="none"/>
86 </wfs:TransactionResponse>
89 <wfs:Query xmlns:wfs="http://www.opengis.net/wfs" typeName="topp:states" xmlns:topp="http://www.openplans.org/topp">
90 <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
92 <ogc:PropertyName>the_geom</ogc:PropertyName>
93 <gml:Envelope xmlns:gml="http://www.opengis.net/gml">
94 <gml:lowerCorner>1 2</gml:lowerCorner>
95 <gml:upperCorner>3 4</gml:upperCorner>
101 <div id="getfeature0"><!--
102 <wfs:GetFeature service="WFS" version="1.1.0" xmlns:topp="http://www.openplans.org/topp"
103 xmlns:wfs="http://www.opengis.net/wfs"
104 xmlns:ogc="http://www.opengis.net/ogc"
105 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
106 xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">
107 <wfs:Query xmlns:wfs="http://www.opengis.net/wfs" typeName="topp:states" xmlns:topp="http://www.openplans.org/topp">
108 <wfs:PropertyName>STATE_NAME</wfs:PropertyName>
109 <wfs:PropertyName>STATE_FIPS</wfs:PropertyName>
110 <wfs:PropertyName>STATE_ABBR</wfs:PropertyName>