rgeoserver 0.5.6 → 0.5.7
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +27 -8
- data/VERSION +1 -1
- data/config/config_defaults.yml +1 -0
- data/examples/batch_example.rb +105 -0
- data/examples/cluster_demo.rb +30 -0
- data/lib/rgeoserver.rb +1 -0
- data/lib/rgeoserver/catalog.rb +24 -19
- data/lib/rgeoserver/coverage.rb +43 -6
- data/lib/rgeoserver/coveragestore.rb +5 -1
- data/lib/rgeoserver/datastore.rb +3 -3
- data/lib/rgeoserver/featuretype.rb +54 -4
- data/lib/rgeoserver/layer.rb +115 -5
- data/lib/rgeoserver/layergroup.rb +1 -1
- data/lib/rgeoserver/namespace.rb +63 -0
- data/lib/rgeoserver/resource.rb +23 -3
- data/lib/rgeoserver/rest_api_client.rb +33 -18
- data/rgeoserver.gemspec +1 -1
- data/spec/fixtures/datasets/raster/test.tif +0 -0
- data/spec/functional/resource_spec.rb +13 -0
- data/spec/{lib/integration_test_spec.rb → integration/geoserver_spec.rb} +149 -9
- metadata +37 -30
@@ -5,11 +5,70 @@ describe "Integration test against a GeoServer instance", :integration => true d
|
|
5
5
|
|
6
6
|
before(:all) do
|
7
7
|
@catalog = RGeoServer.catalog
|
8
|
-
@fixtures_dir = File.join(File.dirname(__FILE__), "/../fixtures/")
|
8
|
+
@fixtures_dir = File.expand_path File.join(File.dirname(__FILE__), "/../fixtures/")
|
9
|
+
@shapefile = File.expand_path File.join(@fixtures_dir, 'datasets/vector/granules.shp')
|
10
|
+
@raster = File.expand_path File.join(@fixtures_dir, 'datasets/raster/test.tif')
|
9
11
|
end
|
12
|
+
|
13
|
+
|
14
|
+
context "Namespaces" do
|
15
|
+
it "should instantiate a namespace resource" do
|
16
|
+
obj = RGeoServer::Namespace.new @catalog, :name => 'test_ns'
|
17
|
+
obj.new?.should == true
|
18
|
+
end
|
10
19
|
|
20
|
+
it "should get default namespace" do
|
21
|
+
obj = @catalog.get_default_namespace
|
22
|
+
obj.name.should_not be_empty
|
23
|
+
obj.uri.should_not be_empty
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should create a new namespace, update and delete it right after" do
|
27
|
+
obj = RGeoServer::Namespace.new @catalog, :name => 'test_ns', :uri => 'http://localhost'
|
28
|
+
obj.new?.should == true
|
29
|
+
obj.save
|
30
|
+
obj.new?.should == false
|
31
|
+
obj.uri = 'http://example.com'
|
32
|
+
obj.save
|
33
|
+
obj.uri.should_not == 'http://localhost'
|
34
|
+
ws = RGeoServer::Workspace.new @catalog, :name => 'test_ns'
|
35
|
+
ws.delete :recurse => true unless ws.new?
|
36
|
+
obj = RGeoServer::Namespace.new @catalog, :name => 'test_ns', :uri => 'http://localhost'
|
37
|
+
obj.new?.should == true
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should be in correspondence with workspaces" do
|
41
|
+
pending "Make sure this also works on update and delete"
|
42
|
+
end
|
43
|
+
end
|
11
44
|
|
12
45
|
context "Workspaces" do
|
46
|
+
|
47
|
+
it "should get default workspace" do
|
48
|
+
w = @catalog.get_default_workspace
|
49
|
+
w.name.should_not be_empty
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should set default workspace" do
|
53
|
+
w = @catalog.get_default_workspace
|
54
|
+
# Workspace name parameter is a string not a resource
|
55
|
+
expect{ @catalog.set_default_workspace w}.to raise_error(TypeError)
|
56
|
+
# Expect to not change the current default workspace name if pass its name
|
57
|
+
dws = @catalog.set_default_workspace w.name
|
58
|
+
dws.name.should == w.name
|
59
|
+
# Switch to a default namespace that does not exist (create it too)
|
60
|
+
nws = RGeoServer::Workspace.new @catalog, :name => 'test_new_default_workspace'
|
61
|
+
dws = @catalog.set_default_workspace 'test_new_default_workspace'
|
62
|
+
aws = @catalog.get_default_workspace
|
63
|
+
aws.name.should == nws.name
|
64
|
+
aws.delete
|
65
|
+
nws.new?.should == true # nws should not exist
|
66
|
+
# Switch to a default workspace that exists
|
67
|
+
ws = @catalog.get_workspaces.first
|
68
|
+
dws = @catalog.set_default_workspace ws.name
|
69
|
+
ws.name.should == dws.name
|
70
|
+
end
|
71
|
+
|
13
72
|
it "should list workspaces" do
|
14
73
|
@catalog.get_workspaces.each{ |obj|
|
15
74
|
obj.profile.should_not be_nil
|
@@ -91,11 +150,88 @@ describe "Integration test against a GeoServer instance", :integration => true d
|
|
91
150
|
expect{ lyr.save }.to raise_error
|
92
151
|
end
|
93
152
|
|
153
|
+
it "should be updated once created" do
|
154
|
+
lyr = @catalog.get_layers.first
|
155
|
+
original_name = lyr.name
|
156
|
+
original_attribution = lyr.attribution
|
157
|
+
|
158
|
+
lyr.attribution = {
|
159
|
+
'logo_height' => '10',
|
160
|
+
'logo_width' => '10',
|
161
|
+
'title' => 'New attribution title'
|
162
|
+
}
|
163
|
+
lyr.save
|
164
|
+
|
165
|
+
chklyr = RGeoServer::Layer.new @catalog, :name => original_name
|
166
|
+
lyr.eql? chklyr
|
167
|
+
|
168
|
+
# Undo changes
|
169
|
+
chklyr.attribution = original_attribution
|
170
|
+
chklyr.save
|
171
|
+
chklyr.attribution.eql? original_attribution
|
172
|
+
end
|
173
|
+
|
174
|
+
it "should be created from a store" do
|
175
|
+
# Create a Datastore and a feature type under the default workspace (set it up as nil)
|
176
|
+
ds = RGeoServer::DataStore.new @catalog, :workspace => nil, :name => 'test_shapefile2', :connection_parameters => {"url" => "file://#{@shapefile}"}
|
177
|
+
ds.enabled = true
|
178
|
+
ds.new?.should == true
|
179
|
+
ds.save
|
180
|
+
ft = RGeoServer::FeatureType.new @catalog, :workspace => nil, :data_store => ds, :name => 'granules'
|
181
|
+
ft.save
|
182
|
+
|
183
|
+
lyr = RGeoServer::Layer.new @catalog, :name => 'granules'
|
184
|
+
lyr.new?.should == false
|
185
|
+
lyr.resource.eql? ft
|
186
|
+
ds.delete :recurse => true
|
187
|
+
# Check layer does not exist anymore after deleting the base store
|
188
|
+
lyr = RGeoServer::Layer.new @catalog, :name => 'granules'
|
189
|
+
lyr.new?.should == true
|
190
|
+
end
|
191
|
+
|
94
192
|
it "should list layers" do
|
95
193
|
@catalog.get_layers.each { |l|
|
96
194
|
l.profile.should_not be_empty
|
97
195
|
}
|
98
196
|
end
|
197
|
+
it "should issue seed on an existing layer's cache" do
|
198
|
+
pending "This certainly passes. We are skipping it since it is a CPU intensive operation"
|
199
|
+
lyr = RGeoServer::Layer.new @catalog, :name => 'Arc_Sample'
|
200
|
+
options = {
|
201
|
+
:srs => {:number => 4326 },
|
202
|
+
:zoomStart => 1,
|
203
|
+
:zoomStop => 12,
|
204
|
+
:format => 'image/png',
|
205
|
+
:threadCount => 1
|
206
|
+
}
|
207
|
+
lyr.seed :issue, options
|
208
|
+
end
|
209
|
+
|
210
|
+
it "should truncate an existing layer's cache" do
|
211
|
+
lyr = RGeoServer::Layer.new @catalog, :name => 'states'
|
212
|
+
options = {
|
213
|
+
#:gridSetId => 'EPSG:2163', # this was not found in sample data
|
214
|
+
:srs => {:number => 4326 },
|
215
|
+
:zoomStart => 0,
|
216
|
+
:zoomStop => 2,
|
217
|
+
:format => 'image/png',
|
218
|
+
:threadCount => 1,
|
219
|
+
:bounds => {
|
220
|
+
:coords => [
|
221
|
+
-2495667.977678598,
|
222
|
+
-2223677.196231552,
|
223
|
+
3291070.6104286816,
|
224
|
+
959189.3312465074
|
225
|
+
]
|
226
|
+
},
|
227
|
+
:parameters => {
|
228
|
+
:STYLES => 'pophatch',
|
229
|
+
:CQL_FILTER => 'TOTPOP > 10000'
|
230
|
+
}
|
231
|
+
}
|
232
|
+
lyr.seed :truncate, options
|
233
|
+
end
|
234
|
+
|
99
235
|
end
|
100
236
|
|
101
237
|
context "LayerGroups" do
|
@@ -163,12 +299,10 @@ describe "Integration test against a GeoServer instance", :integration => true d
|
|
163
299
|
before :all do
|
164
300
|
@ws = RGeoServer::Workspace.new @catalog, :name => 'test_workspace_for_stores'
|
165
301
|
@ws.save
|
166
|
-
@shapefile = File.join(@fixtures_dir, 'datasets/vector/granules.shp')
|
167
|
-
@raster = File.join(@fixtures_dir, 'datasets/raster/test.tif')
|
168
302
|
end
|
169
303
|
|
170
304
|
after :all do
|
171
|
-
@ws.delete :recurse => true
|
305
|
+
@ws.delete :recurse => true
|
172
306
|
end
|
173
307
|
|
174
308
|
context "DataStores" do
|
@@ -192,7 +326,7 @@ describe "Integration test against a GeoServer instance", :integration => true d
|
|
192
326
|
end
|
193
327
|
|
194
328
|
it "should create a datastore under existing workspace, update and delete it right after" do
|
195
|
-
ds = RGeoServer::DataStore.new @catalog, :workspace => @ws, :name => '
|
329
|
+
ds = RGeoServer::DataStore.new @catalog, :workspace => @ws, :name => 'test_shapefile', :connection_parameters => {"namespace"=> "http://test_workspace_for_stores", "url" => "file://#{@shapefile}"}
|
196
330
|
ds.new?.should == true
|
197
331
|
ds.save
|
198
332
|
ds.new?.should == false
|
@@ -205,16 +339,17 @@ describe "Integration test against a GeoServer instance", :integration => true d
|
|
205
339
|
ds.changed?.should == true
|
206
340
|
ds.save
|
207
341
|
ds.profile['connectionParameters'].should == new_connection_parameters
|
208
|
-
ds.delete
|
209
342
|
end
|
210
343
|
|
211
344
|
it "should create a datastore under existing workspace and add a feature type that will also create a layer" do
|
212
|
-
ds = RGeoServer::DataStore.new @catalog, :workspace => @ws, :name => '
|
345
|
+
ds = RGeoServer::DataStore.new @catalog, :workspace => @ws, :name => 'test_shapefile2', :connection_parameters => {"url" => "file://#{@shapefile}", "namespace" => "http://test_workspace_for_stores"}
|
213
346
|
ds.new?.should == true
|
214
347
|
ds.save
|
215
348
|
ft = RGeoServer::FeatureType.new @catalog, :workspace => @ws, :data_store => ds, :name => 'granules'
|
216
349
|
ft.save
|
217
|
-
|
350
|
+
#ft.metadata_links = [{"type"=>"text/plain", "metadataType"=>"FGDC", "content"=>"http://example.com/geonetwork/srv/en/fgdc.xml?id=2"}]
|
351
|
+
#ft.save
|
352
|
+
#ft.metadata_links.first["metadataType"].should == "FGDC"
|
218
353
|
end
|
219
354
|
end
|
220
355
|
|
@@ -238,6 +373,7 @@ describe "Integration test against a GeoServer instance", :integration => true d
|
|
238
373
|
cs.save
|
239
374
|
cs.description.should == 'new description'
|
240
375
|
cs.new?.should == false
|
376
|
+
cs.delete
|
241
377
|
end
|
242
378
|
it "should create a coverage store under existing workspace and add a coverage to it. A layer must be created as a result of this operation" do
|
243
379
|
cs = RGeoServer::CoverageStore.new @catalog, :workspace => @ws, :name => 'raster'
|
@@ -246,9 +382,13 @@ describe "Integration test against a GeoServer instance", :integration => true d
|
|
246
382
|
cs.enabled = 'true'
|
247
383
|
cs.data_type = 'GeoTIFF'
|
248
384
|
cs.save
|
249
|
-
c = RGeoServer::Coverage.new @catalog, :workspace => @ws, :coverage_store => cs, :name => '
|
385
|
+
c = RGeoServer::Coverage.new @catalog, :workspace => @ws, :coverage_store => cs, :name => 'raster_coverage'
|
250
386
|
c.title = 'Test Raster Layer'
|
387
|
+
c.abstract = 'This is the abstract of the layer'
|
388
|
+
c.save
|
389
|
+
#c.metadata_links = [{"type"=>"text/plain", "metadataType"=>"FGDC", "content"=>"http://example.com/geonetwork/srv/en/fgdc.xml?id=1090"}]
|
251
390
|
#c.save
|
391
|
+
#c.metadata_links.first["metadataType"].should == "FGDC"
|
252
392
|
end
|
253
393
|
end
|
254
394
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rgeoserver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-
|
12
|
+
date: 2012-05-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|
16
|
-
requirement: &
|
16
|
+
requirement: &70326335633780 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70326335633780
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: nokogiri
|
27
|
-
requirement: &
|
27
|
+
requirement: &70326335632900 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70326335632900
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: mime-types
|
38
|
-
requirement: &
|
38
|
+
requirement: &70326335631460 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70326335631460
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: activesupport
|
49
|
-
requirement: &
|
49
|
+
requirement: &70326335630760 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70326335630760
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: activemodel
|
60
|
-
requirement: &
|
60
|
+
requirement: &70326335630180 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70326335630180
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: confstruct
|
71
|
-
requirement: &
|
71
|
+
requirement: &70326335629640 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70326335629640
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: rake
|
82
|
-
requirement: &
|
82
|
+
requirement: &70326335629140 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70326335629140
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: shoulda
|
93
|
-
requirement: &
|
93
|
+
requirement: &70326335628580 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: '0'
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *70326335628580
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: bundler
|
104
|
-
requirement: &
|
104
|
+
requirement: &70326335644200 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ! '>='
|
@@ -109,10 +109,10 @@ dependencies:
|
|
109
109
|
version: 1.0.14
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *70326335644200
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: rspec
|
115
|
-
requirement: &
|
115
|
+
requirement: &70326335643700 !ruby/object:Gem::Requirement
|
116
116
|
none: false
|
117
117
|
requirements:
|
118
118
|
- - ! '>='
|
@@ -120,10 +120,10 @@ dependencies:
|
|
120
120
|
version: '0'
|
121
121
|
type: :development
|
122
122
|
prerelease: false
|
123
|
-
version_requirements: *
|
123
|
+
version_requirements: *70326335643700
|
124
124
|
- !ruby/object:Gem::Dependency
|
125
125
|
name: yard
|
126
|
-
requirement: &
|
126
|
+
requirement: &70326335643020 !ruby/object:Gem::Requirement
|
127
127
|
none: false
|
128
128
|
requirements:
|
129
129
|
- - ! '>='
|
@@ -131,10 +131,10 @@ dependencies:
|
|
131
131
|
version: '0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
|
-
version_requirements: *
|
134
|
+
version_requirements: *70326335643020
|
135
135
|
- !ruby/object:Gem::Dependency
|
136
136
|
name: equivalent-xml
|
137
|
-
requirement: &
|
137
|
+
requirement: &70326335642480 !ruby/object:Gem::Requirement
|
138
138
|
none: false
|
139
139
|
requirements:
|
140
140
|
- - ! '>='
|
@@ -142,10 +142,10 @@ dependencies:
|
|
142
142
|
version: '0'
|
143
143
|
type: :development
|
144
144
|
prerelease: false
|
145
|
-
version_requirements: *
|
145
|
+
version_requirements: *70326335642480
|
146
146
|
- !ruby/object:Gem::Dependency
|
147
147
|
name: jettywrapper
|
148
|
-
requirement: &
|
148
|
+
requirement: &70326335642020 !ruby/object:Gem::Requirement
|
149
149
|
none: false
|
150
150
|
requirements:
|
151
151
|
- - ! '>='
|
@@ -153,7 +153,7 @@ dependencies:
|
|
153
153
|
version: '0'
|
154
154
|
type: :development
|
155
155
|
prerelease: false
|
156
|
-
version_requirements: *
|
156
|
+
version_requirements: *70326335642020
|
157
157
|
description: ! 'GeoServer REST API Ruby library : Requires GeoServer 2.1.3+'
|
158
158
|
email:
|
159
159
|
- renzo.sanchez.silva@gmail.com
|
@@ -167,6 +167,8 @@ files:
|
|
167
167
|
- Rakefile
|
168
168
|
- VERSION
|
169
169
|
- config/config_defaults.yml
|
170
|
+
- examples/batch_example.rb
|
171
|
+
- examples/cluster_demo.rb
|
170
172
|
- lib/rgeoserver.rb
|
171
173
|
- lib/rgeoserver/catalog.rb
|
172
174
|
- lib/rgeoserver/config.rb
|
@@ -177,6 +179,7 @@ files:
|
|
177
179
|
- lib/rgeoserver/geoserver_url_helpers.rb
|
178
180
|
- lib/rgeoserver/layer.rb
|
179
181
|
- lib/rgeoserver/layergroup.rb
|
182
|
+
- lib/rgeoserver/namespace.rb
|
180
183
|
- lib/rgeoserver/resource.rb
|
181
184
|
- lib/rgeoserver/rest_api_client.rb
|
182
185
|
- lib/rgeoserver/style.rb
|
@@ -192,7 +195,8 @@ files:
|
|
192
195
|
- spec/fixtures/datasets/vector/granules.shx
|
193
196
|
- spec/fixtures/styles/poptest.sld
|
194
197
|
- spec/fixtures/styles/test_style.sld
|
195
|
-
- spec/
|
198
|
+
- spec/functional/resource_spec.rb
|
199
|
+
- spec/integration/geoserver_spec.rb
|
196
200
|
- spec/spec_helper.rb
|
197
201
|
homepage: http://github.com/rnz0/rgeoserver
|
198
202
|
licenses: []
|
@@ -219,6 +223,8 @@ signing_key:
|
|
219
223
|
specification_version: 3
|
220
224
|
summary: GeoServer REST API ruby library
|
221
225
|
test_files:
|
226
|
+
- examples/batch_example.rb
|
227
|
+
- examples/cluster_demo.rb
|
222
228
|
- spec/fixtures/datasets/raster/test.tif
|
223
229
|
- spec/fixtures/datasets/vector/granules.dbf
|
224
230
|
- spec/fixtures/datasets/vector/granules.prj
|
@@ -227,6 +233,7 @@ test_files:
|
|
227
233
|
- spec/fixtures/datasets/vector/granules.shx
|
228
234
|
- spec/fixtures/styles/poptest.sld
|
229
235
|
- spec/fixtures/styles/test_style.sld
|
230
|
-
- spec/
|
236
|
+
- spec/functional/resource_spec.rb
|
237
|
+
- spec/integration/geoserver_spec.rb
|
231
238
|
- spec/spec_helper.rb
|
232
239
|
has_rdoc:
|