rgeoserver 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +12 -0
- data/Gemfile +8 -0
- data/README.rdoc +80 -0
- data/Rakefile +51 -0
- data/VERSION +1 -0
- data/config/config_defaults.yml +9 -0
- data/lib/rgeoserver.rb +45 -0
- data/lib/rgeoserver/catalog.rb +169 -0
- data/lib/rgeoserver/config.rb +7 -0
- data/lib/rgeoserver/coverage.rb +84 -0
- data/lib/rgeoserver/coverages.rb +114 -0
- data/lib/rgeoserver/coveragestore.rb +111 -0
- data/lib/rgeoserver/datastore.rb +110 -0
- data/lib/rgeoserver/datastores.rb +97 -0
- data/lib/rgeoserver/featuretype.rb +136 -0
- data/lib/rgeoserver/geoserver_url_helpers.rb +17 -0
- data/lib/rgeoserver/resource.rb +140 -0
- data/lib/rgeoserver/rest_api_client.rb +103 -0
- data/lib/rgeoserver/version.rb +9 -0
- data/lib/rgeoserver/wmsstore.rb +100 -0
- data/lib/rgeoserver/workspace.rb +74 -0
- data/rgeoserver.gemspec +31 -0
- data/spec/lib/integration_test_spec.rb +122 -0
- data/spec/spec_helper.rb +6 -0
- metadata +210 -0
data/rgeoserver.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "lib/rgeoserver/version")
|
2
|
+
Gem::Specification.new do |s|
|
3
|
+
s.name = "rgeoserver"
|
4
|
+
s.version = RGeoServer::VERSION
|
5
|
+
s.platform = Gem::Platform::RUBY
|
6
|
+
s.authors = ["Renzo Sanchez-Silva"]
|
7
|
+
s.email = ["renzo.sanchez.silva@gmail.com"]
|
8
|
+
s.summary = %q{GeoServer REST API ruby library }
|
9
|
+
s.description = %q{GeoServer REST API Ruby library : Requires GeoServer 2.1.3+}
|
10
|
+
s.homepage = "http://github.com/rnz0/rgeoserver"
|
11
|
+
|
12
|
+
s.files = `git ls-files`.split("\n")
|
13
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
14
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
15
|
+
s.require_paths = ["lib"]
|
16
|
+
|
17
|
+
s.add_dependency "rest-client"
|
18
|
+
s.add_dependency "nokogiri"
|
19
|
+
s.add_dependency "mime-types"
|
20
|
+
s.add_dependency "activesupport"
|
21
|
+
s.add_dependency "activemodel"
|
22
|
+
s.add_dependency "confstruct"
|
23
|
+
|
24
|
+
s.add_development_dependency("rake")
|
25
|
+
s.add_development_dependency("shoulda")
|
26
|
+
s.add_development_dependency("bundler", ">= 1.0.14")
|
27
|
+
s.add_development_dependency("rspec")
|
28
|
+
s.add_development_dependency("yard")
|
29
|
+
s.add_development_dependency("jettywrapper")
|
30
|
+
end
|
31
|
+
|
@@ -0,0 +1,122 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Integration test against a GeoServer instance", :integration => true do
|
4
|
+
CONFIG = RGeoServer::Config
|
5
|
+
|
6
|
+
before(:all) do
|
7
|
+
@catalog = RGeoServer.catalog
|
8
|
+
end
|
9
|
+
|
10
|
+
context "Workspaces" do
|
11
|
+
it "should list workspaces" do
|
12
|
+
@catalog.get_workspaces.each{ |obj|
|
13
|
+
obj.profile.should_not be_nil
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should return workspace from catalog" do
|
18
|
+
obj = @catalog.get_workspace 'topp'
|
19
|
+
obj.profile.should_not be_empty
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should instantiate an existing worskpace object" do
|
23
|
+
obj = RGeoServer::Workspace.new @catalog, :name => 'topp'
|
24
|
+
obj.new?.should == false
|
25
|
+
obj.profile.should_not == {}
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should save new items" do
|
29
|
+
obj = RGeoServer::Workspace.new @catalog, :name => 'test_ws'
|
30
|
+
obj.delete(:purge=>true) if !obj.new?
|
31
|
+
obj.new?.should == true
|
32
|
+
obj.profile.should == {}
|
33
|
+
obj.save
|
34
|
+
obj.new?.should == false
|
35
|
+
obj.enabled.should == true
|
36
|
+
obj.delete :purge => true
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should fail trying to delete unsaved (new) workspace" do
|
40
|
+
obj = RGeoServer::Workspace.new @catalog, :name => 'test'
|
41
|
+
obj.delete(:purge=>true) if !obj.new?
|
42
|
+
obj.delete.should raise_error
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should fail trying to delete unexisting workspace names from catalog" do
|
46
|
+
lambda{ ["asdfdg", "test3", "test5", "test6"].each{ |w|
|
47
|
+
@catalog.purge({:workspaces => w}, {:purge => true})
|
48
|
+
}
|
49
|
+
}.should raise_error
|
50
|
+
end
|
51
|
+
|
52
|
+
context "Datastores of a Workspace" do
|
53
|
+
before :all do
|
54
|
+
@ws = RGeoServer::Workspace.new @catalog, :name => 'test_workspace_with_stores'
|
55
|
+
@ws.save
|
56
|
+
["s1", "s2","s3"].each{ |s|
|
57
|
+
ds = RGeoServer::DataStore.new @catalog, :workspace => @ws, :name => s
|
58
|
+
ds.save
|
59
|
+
}
|
60
|
+
end
|
61
|
+
|
62
|
+
after :all do
|
63
|
+
@ws.delete :recurse => true
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should list datastore objects that belong to it" do
|
67
|
+
|
68
|
+
@ws.data_stores.each{ |ds|
|
69
|
+
ds.should be_kind_of(RGeoServer::DataStore)
|
70
|
+
["s1", "s2", "s3"].should include ds.name
|
71
|
+
}
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
context "Stores" do
|
78
|
+
before :all do
|
79
|
+
@ws = RGeoServer::Workspace.new @catalog, :name => 'test_workspace_for_stores'
|
80
|
+
@ws.save
|
81
|
+
end
|
82
|
+
|
83
|
+
after :all do
|
84
|
+
@ws.delete :purge => true
|
85
|
+
end
|
86
|
+
|
87
|
+
context "DataStores" do
|
88
|
+
it "should instantiate a datastore" do
|
89
|
+
obj = RGeoServer::DataStore.new @catalog, :workspace => @ws, :name => 'test_shapefile'
|
90
|
+
obj.new?.should == true
|
91
|
+
obj.name.should == 'test_shapefile'
|
92
|
+
obj.workspace.name.should == @ws.name
|
93
|
+
end
|
94
|
+
|
95
|
+
it "should not create a datastore if workspace does not exit" do
|
96
|
+
new_ws = RGeoServer::Workspace.new @catalog, :name => SecureRandom.hex(5)
|
97
|
+
obj = RGeoServer::DataStore.new @catalog, :workspace => new_ws, :name => 'test_random_store'
|
98
|
+
obj.new?.should raise_error
|
99
|
+
end
|
100
|
+
|
101
|
+
it "should create a datastore under existing workspace and update it right after" do
|
102
|
+
ds = RGeoServer::DataStore.new @catalog, :workspace => @ws, :name => 'test', :connection_parameters => {"namespace"=>"http://test_workspace_for_stores", "url" => "file://tmp/geo.tif"}
|
103
|
+
ds.new?.should == true
|
104
|
+
ds.save
|
105
|
+
ds.new?.should == false
|
106
|
+
ds.delete
|
107
|
+
ds.new?.should == true
|
108
|
+
|
109
|
+
# Add new information
|
110
|
+
new_connection_parameters = {"namespace"=>"http://localhost/test_with_stores", "url" => 'file:data/taz_shapes'}
|
111
|
+
ds.connection_parameters = new_connection_parameters
|
112
|
+
ds.changed?.should == true
|
113
|
+
ds.save
|
114
|
+
ds.profile['connectionParameters'].should == new_connection_parameters
|
115
|
+
ds.delete
|
116
|
+
end
|
117
|
+
end
|
118
|
+
context "CoverageStores" do
|
119
|
+
pending "Finish CoverageStore spec"
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,210 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rgeoserver
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.5.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Renzo Sanchez-Silva
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-04-28 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rest-client
|
16
|
+
requirement: &2156162640 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *2156162640
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: nokogiri
|
27
|
+
requirement: &2156162000 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *2156162000
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: mime-types
|
38
|
+
requirement: &2156161400 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *2156161400
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: activesupport
|
49
|
+
requirement: &2156160860 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :runtime
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *2156160860
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: activemodel
|
60
|
+
requirement: &2156160220 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
type: :runtime
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *2156160220
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: confstruct
|
71
|
+
requirement: &2156159100 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :runtime
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *2156159100
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: rake
|
82
|
+
requirement: &2156157720 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *2156157720
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: shoulda
|
93
|
+
requirement: &2156157080 !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
type: :development
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: *2156157080
|
102
|
+
- !ruby/object:Gem::Dependency
|
103
|
+
name: bundler
|
104
|
+
requirement: &2156155880 !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 1.0.14
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: *2156155880
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: rspec
|
115
|
+
requirement: &2156155360 !ruby/object:Gem::Requirement
|
116
|
+
none: false
|
117
|
+
requirements:
|
118
|
+
- - ! '>='
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
type: :development
|
122
|
+
prerelease: false
|
123
|
+
version_requirements: *2156155360
|
124
|
+
- !ruby/object:Gem::Dependency
|
125
|
+
name: yard
|
126
|
+
requirement: &2156154800 !ruby/object:Gem::Requirement
|
127
|
+
none: false
|
128
|
+
requirements:
|
129
|
+
- - ! '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: *2156154800
|
135
|
+
- !ruby/object:Gem::Dependency
|
136
|
+
name: jettywrapper
|
137
|
+
requirement: &2164549300 !ruby/object:Gem::Requirement
|
138
|
+
none: false
|
139
|
+
requirements:
|
140
|
+
- - ! '>='
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
143
|
+
type: :development
|
144
|
+
prerelease: false
|
145
|
+
version_requirements: *2164549300
|
146
|
+
description: ! 'GeoServer REST API Ruby library : Requires GeoServer 2.1.3+'
|
147
|
+
email:
|
148
|
+
- renzo.sanchez.silva@gmail.com
|
149
|
+
executables: []
|
150
|
+
extensions: []
|
151
|
+
extra_rdoc_files: []
|
152
|
+
files:
|
153
|
+
- .gitignore
|
154
|
+
- Gemfile
|
155
|
+
- README.rdoc
|
156
|
+
- Rakefile
|
157
|
+
- VERSION
|
158
|
+
- config/config_defaults.yml
|
159
|
+
- lib/rgeoserver.rb
|
160
|
+
- lib/rgeoserver/catalog.rb
|
161
|
+
- lib/rgeoserver/config.rb
|
162
|
+
- lib/rgeoserver/coverage.rb
|
163
|
+
- lib/rgeoserver/coverages.rb
|
164
|
+
- lib/rgeoserver/coveragestore.rb
|
165
|
+
- lib/rgeoserver/datastore.rb
|
166
|
+
- lib/rgeoserver/datastores.rb
|
167
|
+
- lib/rgeoserver/featuretype.rb
|
168
|
+
- lib/rgeoserver/geoserver_url_helpers.rb
|
169
|
+
- lib/rgeoserver/resource.rb
|
170
|
+
- lib/rgeoserver/rest_api_client.rb
|
171
|
+
- lib/rgeoserver/version.rb
|
172
|
+
- lib/rgeoserver/wmsstore.rb
|
173
|
+
- lib/rgeoserver/workspace.rb
|
174
|
+
- rgeoserver.gemspec
|
175
|
+
- spec/lib/integration_test_spec.rb
|
176
|
+
- spec/spec_helper.rb
|
177
|
+
homepage: http://github.com/rnz0/rgeoserver
|
178
|
+
licenses: []
|
179
|
+
post_install_message:
|
180
|
+
rdoc_options: []
|
181
|
+
require_paths:
|
182
|
+
- lib
|
183
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
184
|
+
none: false
|
185
|
+
requirements:
|
186
|
+
- - ! '>='
|
187
|
+
- !ruby/object:Gem::Version
|
188
|
+
version: '0'
|
189
|
+
segments:
|
190
|
+
- 0
|
191
|
+
hash: -225529645352907802
|
192
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
193
|
+
none: false
|
194
|
+
requirements:
|
195
|
+
- - ! '>='
|
196
|
+
- !ruby/object:Gem::Version
|
197
|
+
version: '0'
|
198
|
+
segments:
|
199
|
+
- 0
|
200
|
+
hash: -225529645352907802
|
201
|
+
requirements: []
|
202
|
+
rubyforge_project:
|
203
|
+
rubygems_version: 1.8.10
|
204
|
+
signing_key:
|
205
|
+
specification_version: 3
|
206
|
+
summary: GeoServer REST API ruby library
|
207
|
+
test_files:
|
208
|
+
- spec/lib/integration_test_spec.rb
|
209
|
+
- spec/spec_helper.rb
|
210
|
+
has_rdoc:
|