rgeoserver 0.5.8 → 0.5.8.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.8
1
+ 0.5.8.1
@@ -85,7 +85,15 @@ module RGeoServer
85
85
  'enabled' => doc.at_xpath('//enabled/text()').to_s,
86
86
  'description' => doc.at_xpath('//description/text()').to_s,
87
87
  'url' => doc.at_xpath('//url/text()').to_s
88
- }.freeze
88
+ }
89
+ doc.xpath('//coverages/atom:link/@href', "xmlns:atom"=>"http://www.w3.org/2005/Atom" ).each{ |l|
90
+ h['coverages'] = begin
91
+ response = @catalog.do_url l.text
92
+ Nokogiri::XML(response).xpath('//name/text()').collect{ |a| a.text.strip }
93
+ rescue RestClient::ResourceNotFound
94
+ []
95
+ end.freeze
96
+ }
89
97
  h
90
98
  end
91
99
 
@@ -0,0 +1,10 @@
1
+ <coverageStores>
2
+ <coverageStore>
3
+ <name>london_1843</name>
4
+ <atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate" href="http://geodata.example.com/geoserver/rest/workspaces/authorial_london/coveragestores/london_1843.xml" type="application/xml"/>
5
+ </coverageStore>
6
+ <coverageStore>
7
+ <name>London_17C</name>
8
+ <atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate" href="http://geodata.example.com/geoserver/rest/workspaces/authorial_london/coveragestores/London_17C.xml" type="application/xml"/>
9
+ </coverageStore>
10
+ </coverageStores>
@@ -0,0 +1,15 @@
1
+ <coverageStore>
2
+ <name>london_1843</name>
3
+ <description>London in 1843</description>
4
+ <type>GeoTIFF</type>
5
+ <enabled>true</enabled>
6
+ <workspace>
7
+ <name>authorial_london</name>
8
+ <atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate" href="http://geodata.example.com/geoserver/rest/workspaces/authorial_london.xml" type="application/xml"/>
9
+ </workspace>
10
+ <__default>false</__default>
11
+ <url>file:data/london/london_1843.tif</url>
12
+ <coverages>
13
+ <atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate" href="http://geodata.example.com/geoserver/rest/workspaces/authorial_london/coveragestores/london_1843/coverages.xml" type="application/xml"/>
14
+ </coverages>
15
+ </coverageStore>
@@ -0,0 +1,10 @@
1
+ <coverageStores>
2
+ <coverageStore>
3
+ <name>london_1843</name>
4
+ <atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate" href="http://geodata.example.com/geoserver/rest/workspaces/authorial_london/coveragestores/london_1843.xml" type="application/xml"/>
5
+ </coverageStore>
6
+ <coverageStore>
7
+ <name>London_17C</name>
8
+ <atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate" href="http://geodata.example.com/geoserver/rest/workspaces/authorial_london/coveragestores/London_17C.xml" type="application/xml"/>
9
+ </coverageStore>
10
+ </coverageStores>
@@ -3,4 +3,12 @@
3
3
  <name>o_sitesnew</name>
4
4
  <atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate" href="https://geodata.example.com/geoserver/rest/workspaces/test_ws/datastores/sites_shape/featuretypes/o_sitesnew.xml" type="application/xml"/>
5
5
  </featureType>
6
+ <featureType>
7
+ <name>o_sitesnew2</name>
8
+ <atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate" href="https://geodata.example.com/geoserver/rest/workspaces/test_ws/datastores/sites_shape/featuretypes/o_sitesnew2.xml" type="application/xml"/>
9
+ </featureType>
10
+ <featureType>
11
+ <name>o_sitesnew3</name>
12
+ <atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate" href="https://geodata.example.com/geoserver/rest/workspaces/test_ws/datastores/sites_shape/featuretypes/o_sitesnew3.xml" type="application/xml"/>
13
+ </featureType>
6
14
  </featureTypes>
@@ -0,0 +1,68 @@
1
+ require 'spec_helper'
2
+
3
+ describe RGeoServer::CoverageStore do
4
+ let(:old_cs_xml){
5
+ File.read(File.expand_path('../fixtures/resources/coveragestore/old.xml', File.dirname(__FILE__)))
6
+ }
7
+ let(:old_cs_coverages_xml){
8
+ File.read(File.expand_path('../fixtures/resources/coveragestore/old_coverages.xml', File.dirname(__FILE__)))
9
+ }
10
+ let(:catalog) {
11
+ c = double('Catalog')
12
+ # Stub profile responses
13
+ # For a new coveragestore
14
+ c.stub(:search).with({"workspaces/authorial_london/coveragestores"=>"new_test_cs"}).and_raise(RestClient::ResourceNotFound)
15
+ # For a supposed existing datastore
16
+ c.stub(:search).with({"workspaces/authorial_london/coveragestores"=>"old_cs"}).and_return(old_cs_xml)
17
+ # Fake coverages response for a new datastore
18
+ c.stub(:do_url).with("http://geodata.example.com/geoserver/rest/workspaces/authorial_london/coveragestores/sites_shape/coverages.xml").and_raise(
19
+ RestClient::ResourceNotFound
20
+ )
21
+ # Fake coverages response for an existing (old) datastore
22
+ c.stub(:do_url).with("http://geodata.example.com/geoserver/rest/workspaces/authorial_london/coveragestores/london_1843/coverages.xml").and_return(
23
+ old_cs_coverages_xml
24
+ )
25
+ c
26
+ }
27
+ let(:workspace) {
28
+ w = double('Workspace')
29
+ w.stub(:instance_of?).with(String).and_return(false)
30
+ w.stub(:instance_of?).with(RGeoServer::Workspace).and_return(true)
31
+ w.stub(:name).and_return('authorial_london')
32
+ w
33
+ }
34
+
35
+ describe "#new" do
36
+ it 'should not allow empty parameters' do
37
+ expect{ RGeoServer::CoverageStore.new }.to raise_error ArgumentError
38
+ end
39
+ it 'should not allow null name' do
40
+ expect { RGeoServer::CoverageStore.new catalog, :workspace => workspace }.to raise_error
41
+ end
42
+
43
+ it 'should not allow empty workspace' do
44
+ expect { RGeoServer::CoverageStore.new catalog, :name => 'test_cs' }.to raise_error
45
+ end
46
+
47
+ it 'should allow non null catalog, workspace and name' do
48
+ cs = RGeoServer::CoverageStore.new catalog, :workspace => workspace, :name => 'test_cs'
49
+ end
50
+
51
+ end
52
+
53
+ describe "#coverages" do
54
+ it 'should list coverages in coveragestore' do
55
+ cs = RGeoServer::CoverageStore.new catalog, :workspace => workspace, :name => 'old_cs'
56
+ cs.coverages.size.should == 2
57
+ c = cs.coverages.first
58
+ c.should be_an_instance_of(RGeoServer::Coverage)
59
+ ['london_1843', 'London_17C'].should include c.name
60
+ end
61
+
62
+ it 'should return an empty array of coveragestores if new or has no feature type resources' do
63
+ ds = RGeoServer::CoverageStore.new catalog, :workspace => workspace, :name => 'new_test_cs'
64
+ ds.coverages.should be_empty
65
+ end
66
+ end
67
+
68
+ end
@@ -74,14 +74,13 @@ describe RGeoServer::DataStore do
74
74
  describe "#featuretypes" do
75
75
  it 'should list feature types in datastore' do
76
76
  ds = RGeoServer::DataStore.new catalog, :workspace => workspace, :name => 'old_test_ds'
77
- # there is only one feature type in fixture response old_featuretypes.xml
78
- ds.featuretypes.size.should == 1
77
+ ds.featuretypes.size.should == 3
79
78
  ft = ds.featuretypes.first
80
79
  ft.should be_an_instance_of(RGeoServer::FeatureType)
81
- ft.name.should == 'o_sitesnew'
80
+ ['o_sitesnew','o_sitesnew2','o_sitesnew3'].should include ft.name
82
81
  end
83
82
 
84
- it 'should return an empty array of datastore is new or has no feature type resources' do
83
+ it 'should return an empty array of datastore if or has no feature type resources' do
85
84
  ds = RGeoServer::DataStore.new catalog, :workspace => workspace, :name => 'new_test_ds'
86
85
  ds.featuretypes.should be_empty
87
86
  end
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.8
4
+ version: 0.5.8.1
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-06-13 00:00:00.000000000 Z
12
+ date: 2012-06-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client
16
- requirement: &2151853540 !ruby/object:Gem::Requirement
16
+ requirement: &2151936520 !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: *2151853540
24
+ version_requirements: *2151936520
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: nokogiri
27
- requirement: &2151852340 !ruby/object:Gem::Requirement
27
+ requirement: &2155991260 !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: *2151852340
35
+ version_requirements: *2155991260
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: mime-types
38
- requirement: &2151850840 !ruby/object:Gem::Requirement
38
+ requirement: &2155988260 !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: *2151850840
46
+ version_requirements: *2155988260
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: activesupport
49
- requirement: &2151849240 !ruby/object:Gem::Requirement
49
+ requirement: &2155986300 !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: *2151849240
57
+ version_requirements: *2155986300
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: activemodel
60
- requirement: &2151848360 !ruby/object:Gem::Requirement
60
+ requirement: &2155984220 !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: *2151848360
68
+ version_requirements: *2155984220
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: confstruct
71
- requirement: &2151847220 !ruby/object:Gem::Requirement
71
+ requirement: &2155993900 !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: *2151847220
79
+ version_requirements: *2155993900
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: rake
82
- requirement: &2151846340 !ruby/object:Gem::Requirement
82
+ requirement: &2155992460 !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: *2151846340
90
+ version_requirements: *2155992460
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: shoulda
93
- requirement: &2151856020 !ruby/object:Gem::Requirement
93
+ requirement: &2156006540 !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: *2151856020
101
+ version_requirements: *2156006540
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: bundler
104
- requirement: &2151854640 !ruby/object:Gem::Requirement
104
+ requirement: &2156005180 !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: *2151854640
112
+ version_requirements: *2156005180
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: rspec
115
- requirement: &2151868580 !ruby/object:Gem::Requirement
115
+ requirement: &2156003480 !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: *2151868580
123
+ version_requirements: *2156003480
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: yard
126
- requirement: &2151867020 !ruby/object:Gem::Requirement
126
+ requirement: &2156001180 !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: *2151867020
134
+ version_requirements: *2156001180
135
135
  - !ruby/object:Gem::Dependency
136
136
  name: equivalent-xml
137
- requirement: &2151865340 !ruby/object:Gem::Requirement
137
+ requirement: &2156015680 !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: *2151865340
145
+ version_requirements: *2156015680
146
146
  - !ruby/object:Gem::Dependency
147
147
  name: jettywrapper
148
- requirement: &2151863900 !ruby/object:Gem::Requirement
148
+ requirement: &2156013180 !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: *2151863900
156
+ version_requirements: *2156013180
157
157
  description: ! 'GeoServer REST API Ruby library : Requires GeoServer 2.1.3+'
158
158
  email:
159
159
  - renzo.sanchez.silva@gmail.com
@@ -194,10 +194,14 @@ files:
194
194
  - spec/fixtures/datasets/vector/granules.qix
195
195
  - spec/fixtures/datasets/vector/granules.shp
196
196
  - spec/fixtures/datasets/vector/granules.shx
197
+ - spec/fixtures/resources/coveragestore/coveragestores.xml
198
+ - spec/fixtures/resources/coveragestore/old.xml
199
+ - spec/fixtures/resources/coveragestore/old_coverages.xml
197
200
  - spec/fixtures/resources/datastore/old.xml
198
201
  - spec/fixtures/resources/datastore/old_featuretypes.xml
199
202
  - spec/fixtures/styles/poptest.sld
200
203
  - spec/fixtures/styles/test_style.sld
204
+ - spec/functional/coveragestore_spec.rb
201
205
  - spec/functional/datastore_spec.rb
202
206
  - spec/functional/resource_spec.rb
203
207
  - spec/integration/geoserver_spec.rb
@@ -235,10 +239,14 @@ test_files:
235
239
  - spec/fixtures/datasets/vector/granules.qix
236
240
  - spec/fixtures/datasets/vector/granules.shp
237
241
  - spec/fixtures/datasets/vector/granules.shx
242
+ - spec/fixtures/resources/coveragestore/coveragestores.xml
243
+ - spec/fixtures/resources/coveragestore/old.xml
244
+ - spec/fixtures/resources/coveragestore/old_coverages.xml
238
245
  - spec/fixtures/resources/datastore/old.xml
239
246
  - spec/fixtures/resources/datastore/old_featuretypes.xml
240
247
  - spec/fixtures/styles/poptest.sld
241
248
  - spec/fixtures/styles/test_style.sld
249
+ - spec/functional/coveragestore_spec.rb
242
250
  - spec/functional/datastore_spec.rb
243
251
  - spec/functional/resource_spec.rb
244
252
  - spec/integration/geoserver_spec.rb