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_0_0({});
10 t.ok(format instanceof OpenLayers.Format.WFST.v1_0_0, "constructor returns instance");
13 function test_read(t) {
16 var data = readXML("Transaction_Response");
17 var format = new OpenLayers.Format.WFST.v1_0_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_0_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");
64 var xmlFormat = new OpenLayers.Format.XML();
65 function readXML(id) {
66 var xml = document.getElementById(id).firstChild.nodeValue;
67 return xmlFormat.read(xml).documentElement;
73 <div id="Transaction_Response"><!--
74 <wfs:WFS_TransactionResponse version="1.0.0" xmlns:wfs="http://www.opengis.net/wfs" xmlns:ogc="http://www.opengis.net/ogc">
76 <ogc:FeatureId fid="none"/>
78 <wfs:TransactionResult>
82 </wfs:TransactionResult>
83 </wfs:WFS_TransactionResponse>
86 <wfs:Query xmlns:wfs="http://www.opengis.net/wfs" typeName="topp:states" xmlns:topp="http://www.openplans.org/topp">
87 <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
89 <ogc:PropertyName>the_geom</ogc:PropertyName>
90 <gml:Box xmlns:gml="http://www.opengis.net/gml">
91 <gml:coordinates decimal="." cs="," ts=" ">1,2 3,4</gml:coordinates>
97 <div id="getfeature0"><!--
98 <wfs:GetFeature service="WFS" version="1.0.0" xmlns:topp="http://www.openplans.org/topp"
99 xmlns:wfs="http://www.opengis.net/wfs"
100 xmlns:ogc="http://www.opengis.net/ogc"
101 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
102 xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd">
103 <wfs:Query xmlns:wfs="http://www.opengis.net/wfs" typeName="topp:states" xmlns:topp="http://www.openplans.org/topp">
104 <ogc:PropertyName>STATE_NAME</ogc:PropertyName>
105 <ogc:PropertyName>STATE_FIPS</ogc:PropertyName>
106 <ogc:PropertyName>STATE_ABBR</ogc:PropertyName>