rgeoserver 0.9.1 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +5 -5
- data/VERSION +1 -1
- data/lib/rgeoserver/coveragestore.rb +70 -27
- data/lib/rgeoserver/datastore.rb +17 -17
- data/lib/rgeoserver/utils/shapefile_info.rb +1 -1
- data/rgeoserver.gemspec +1 -0
- data/spec/functional/catalog_spec.rb +29 -31
- data/spec/functional/rest_api_client_spec.rb +58 -143
- data/spec/unit/coveragestore_spec.rb +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0da36aaf6183ee44e653ee9c11218849f5f51ffc
|
4
|
+
data.tar.gz: 8902f2072e8cf8620fe6c0fd5e0e0e735f968056
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37cb2f10c4c88aaa138138cf54f7c2771cd3f6a263f9a9351e4d136732bdc5fea89852cc35d1c2875273a78555b396e18bbf9241f2ba81f8f77bbbc2d41c8bfd
|
7
|
+
data.tar.gz: f8c8055cae5edd1fdba42fbb4666cf1ad415aac0dd775b7bd3e106d4db69c608982f780246038141cdcaa042c6548849377fc9ab2feed0ac9792cb4165dcfe42
|
data/Rakefile
CHANGED
@@ -19,7 +19,7 @@ begin
|
|
19
19
|
namespace :spec do
|
20
20
|
desc 'Run unit tests'
|
21
21
|
RSpec::Core::RakeTask.new(:unit) do |t|
|
22
|
-
t.pattern = 'spec/unit/**/*_spec.rb'
|
22
|
+
t.pattern = 'spec/{unit,utils}/**/*_spec.rb'
|
23
23
|
end
|
24
24
|
|
25
25
|
desc 'Run functional tests which requires GeoServer running'
|
@@ -33,17 +33,17 @@ begin
|
|
33
33
|
end
|
34
34
|
|
35
35
|
# desc 'Run integration tests which requires GeoServer running and preloaded'
|
36
|
-
# RSpec::Core::RakeTask.new(:integration, :jetty_home, :jetty_port, :java_opts) do |t, args|
|
36
|
+
# RSpec::Core::RakeTask.new(:integration, :jetty_home, :jetty_port, :java_opts) do |t, args|
|
37
37
|
# t.pattern = 'spec/integration/**/*_spec.rb'
|
38
38
|
# require 'jettywrapper'
|
39
39
|
# jetty_params = {
|
40
40
|
# :jetty_home => args.jetty_home,
|
41
|
-
# :java_opts => [args.java_opts],
|
42
|
-
# :jetty_port => args.jetty_port,
|
41
|
+
# :java_opts => [args.java_opts],
|
42
|
+
# :jetty_port => args.jetty_port,
|
43
43
|
# :quiet => true,
|
44
44
|
# :startup_wait => 20
|
45
45
|
# }
|
46
|
-
#
|
46
|
+
#
|
47
47
|
# fail if Jettywrapper.wrap(jetty_params) do
|
48
48
|
# Rake::Task['spec:integration'].invoke
|
49
49
|
# end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.10.0
|
@@ -1,26 +1,47 @@
|
|
1
1
|
|
2
|
+
require 'pathname'
|
3
|
+
|
2
4
|
module RGeoServer
|
3
5
|
# A coverage store is a source of spatial data that is raster based.
|
4
6
|
class CoverageStore < ResourceInfo
|
7
|
+
class CoverageStoreAlreadyExists < StandardError
|
8
|
+
def initialize(name)
|
9
|
+
@name = name
|
10
|
+
end
|
11
|
+
|
12
|
+
def message
|
13
|
+
"The CoverageStore '#{@name}' already exists and can not be replaced."
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class DataTypeNotExpected < StandardError
|
18
|
+
def initialize(data_type)
|
19
|
+
@data_type = data_type
|
20
|
+
end
|
21
|
+
|
22
|
+
def message
|
23
|
+
"The CoverageStore does not not accept the data type '#{@data_type}'."
|
24
|
+
end
|
25
|
+
end
|
5
26
|
|
6
27
|
OBJ_ATTRIBUTES = {
|
7
|
-
:catalog => 'catalog',
|
8
|
-
:workspace => 'workspace',
|
9
|
-
:url => 'url',
|
10
|
-
:data_type => 'type',
|
11
|
-
:name => 'name',
|
12
|
-
:enabled => 'enabled',
|
28
|
+
:catalog => 'catalog',
|
29
|
+
:workspace => 'workspace',
|
30
|
+
:url => 'url',
|
31
|
+
:data_type => 'type',
|
32
|
+
:name => 'name',
|
33
|
+
:enabled => 'enabled',
|
13
34
|
:description => 'description'
|
14
|
-
}
|
35
|
+
}
|
15
36
|
OBJ_DEFAULT_ATTRIBUTES = {
|
16
|
-
:catalog => nil,
|
17
|
-
:workspace => nil,
|
18
|
-
:url => '',
|
19
|
-
:data_type => 'GeoTIFF',
|
20
|
-
:name => nil,
|
21
|
-
:enabled => 'true',
|
37
|
+
:catalog => nil,
|
38
|
+
:workspace => nil,
|
39
|
+
:url => '',
|
40
|
+
:data_type => 'GeoTIFF',
|
41
|
+
:name => nil,
|
42
|
+
:enabled => 'true',
|
22
43
|
:description=>nil
|
23
|
-
}
|
44
|
+
}
|
24
45
|
define_attribute_methods OBJ_ATTRIBUTES.keys
|
25
46
|
update_attribute_accessors OBJ_ATTRIBUTES
|
26
47
|
|
@@ -45,33 +66,33 @@ module RGeoServer
|
|
45
66
|
end
|
46
67
|
|
47
68
|
def route
|
48
|
-
@@route % @workspace.name
|
69
|
+
@@route % @workspace.name
|
49
70
|
end
|
50
71
|
|
51
|
-
def update_params name_route = @name
|
72
|
+
def update_params name_route = @name
|
52
73
|
{ :name => name_route, :workspace => @workspace.name }
|
53
74
|
end
|
54
75
|
|
55
76
|
def message
|
56
77
|
builder = Nokogiri::XML::Builder.new do |xml|
|
57
78
|
xml.coverageStore {
|
58
|
-
xml.name @name
|
79
|
+
xml.name @name
|
59
80
|
xml.workspace {
|
60
81
|
xml.name @workspace.name
|
61
82
|
}
|
62
83
|
xml.enabled @enabled
|
63
84
|
xml.type_ @data_type if (data_type_changed? || new?)
|
64
85
|
xml.description @description if (description_changed? || new?)
|
65
|
-
xml.url @url if (url_changed? || new?)
|
86
|
+
xml.url @url if (url_changed? || new?) && !@url.nil
|
66
87
|
}
|
67
88
|
end
|
68
|
-
@message = builder.doc.to_xml
|
89
|
+
@message = builder.doc.to_xml
|
69
90
|
end
|
70
91
|
|
71
92
|
# @param [RGeoServer::Catalog] catalog
|
72
93
|
# @param [RGeoServer::Workspace|String] workspace
|
73
94
|
# @param [String] name
|
74
|
-
def initialize catalog, options
|
95
|
+
def initialize catalog, options
|
75
96
|
super(catalog)
|
76
97
|
_run_initialize_callbacks do
|
77
98
|
workspace = options[:workspace] || 'default'
|
@@ -84,11 +105,11 @@ module RGeoServer
|
|
84
105
|
end
|
85
106
|
@name = options[:name].strip
|
86
107
|
@route = route
|
87
|
-
end
|
108
|
+
end
|
88
109
|
end
|
89
110
|
|
90
|
-
def coverages
|
91
|
-
|
111
|
+
def coverages &block
|
112
|
+
self.class.list Coverage, @catalog, profile['coverages'] || [], {:workspace => @workspace, :coverage_store => self}, true, &block
|
92
113
|
end
|
93
114
|
|
94
115
|
# <coverageStore>
|
@@ -113,15 +134,15 @@ module RGeoServer
|
|
113
134
|
def profile_xml_to_hash profile_xml
|
114
135
|
doc = profile_xml_to_ng profile_xml
|
115
136
|
h = {
|
116
|
-
'name' => doc.at_xpath('//name').text.strip,
|
137
|
+
'name' => doc.at_xpath('//name').text.strip,
|
117
138
|
'description' => doc.at_xpath('//description/text()').to_s,
|
118
139
|
'type' => doc.at_xpath('//type/text()').to_s,
|
119
140
|
'enabled' => doc.at_xpath('//enabled/text()').to_s,
|
120
141
|
'url' => doc.at_xpath('//url/text()').to_s,
|
121
142
|
'workspace' => @workspace.name # Assume correct workspace
|
122
143
|
}
|
123
|
-
doc.xpath('//coverages/atom:link[@rel="alternate"]/@href',
|
124
|
-
"xmlns:atom"=>"http://www.w3.org/2005/Atom" ).each{ |l|
|
144
|
+
doc.xpath('//coverages/atom:link[@rel="alternate"]/@href',
|
145
|
+
"xmlns:atom"=>"http://www.w3.org/2005/Atom" ).each{ |l|
|
125
146
|
h['coverages'] = begin
|
126
147
|
response = @catalog.do_url l.text
|
127
148
|
Nokogiri::XML(response).xpath('//name/text()').collect{ |a| a.text.strip }
|
@@ -132,5 +153,27 @@ module RGeoServer
|
|
132
153
|
h
|
133
154
|
end
|
134
155
|
|
156
|
+
# @param [String] path - location of upload data
|
157
|
+
# @param [Symbol] upload_method -- only valid for :file
|
158
|
+
# @param [Symbol] data_type -- currently only supported for :geotiff
|
159
|
+
def upload path, upload_method = :file, data_type = :geotiff
|
160
|
+
raise CoverageStoreAlreadyExists, @name unless new?
|
161
|
+
raise DataTypeNotExpected, data_type unless [:geotiff].include? data_type
|
162
|
+
|
163
|
+
case upload_method
|
164
|
+
when :file then # local file that we post
|
165
|
+
local_file = Pathname.new(File.expand_path(path))
|
166
|
+
unless local_file.extname == '.tif' && local_file.exist?
|
167
|
+
raise ArgumentError, "GeoTIFF upload must be .tif file: #{local_file}"
|
168
|
+
end
|
169
|
+
puts "Uploading #{local_file.size} bytes from file #{local_file}..."
|
170
|
+
|
171
|
+
catalog.client["#{route}/#{name}/file.geotiff"].put local_file.read, :content_type => 'image/tiff'
|
172
|
+
refresh
|
173
|
+
else
|
174
|
+
raise NotImplementedError, "Unsupported upload method #{upload_method}"
|
175
|
+
end
|
176
|
+
self
|
177
|
+
end
|
135
178
|
end
|
136
|
-
end
|
179
|
+
end
|
data/lib/rgeoserver/datastore.rb
CHANGED
@@ -24,22 +24,22 @@ module RGeoServer
|
|
24
24
|
end
|
25
25
|
|
26
26
|
OBJ_ATTRIBUTES = {
|
27
|
-
:workspace => 'workspace',
|
27
|
+
:workspace => 'workspace',
|
28
28
|
:connection_parameters => "connection_parameters",
|
29
|
-
:name => 'name',
|
30
|
-
:data_type => 'type',
|
31
|
-
:enabled => 'enabled',
|
29
|
+
:name => 'name',
|
30
|
+
:data_type => 'type',
|
31
|
+
:enabled => 'enabled',
|
32
32
|
:description => 'description'
|
33
|
-
}
|
33
|
+
}
|
34
34
|
OBJ_DEFAULT_ATTRIBUTES = {
|
35
|
-
:workspace => nil,
|
36
|
-
:connection_parameters => {},
|
37
|
-
:name => nil,
|
35
|
+
:workspace => nil,
|
36
|
+
:connection_parameters => {},
|
37
|
+
:name => nil,
|
38
38
|
:data_type => :shapefile,
|
39
|
-
:enabled => true,
|
39
|
+
:enabled => true,
|
40
40
|
:description => nil
|
41
|
-
}
|
42
|
-
|
41
|
+
}
|
42
|
+
|
43
43
|
define_attribute_methods OBJ_ATTRIBUTES.keys
|
44
44
|
update_attribute_accessors OBJ_ATTRIBUTES
|
45
45
|
|
@@ -115,7 +115,7 @@ module RGeoServer
|
|
115
115
|
end
|
116
116
|
|
117
117
|
def featuretypes &block
|
118
|
-
self.class.list FeatureType, catalog, profile['featureTypes'], {:workspace => @workspace, :data_store => self}, true, &block
|
118
|
+
self.class.list FeatureType, catalog, profile['featureTypes'] || [], {:workspace => @workspace, :data_store => self}, true, &block
|
119
119
|
end
|
120
120
|
|
121
121
|
def upload_file local_file, publish = {}
|
@@ -128,11 +128,11 @@ module RGeoServer
|
|
128
128
|
def upload_url url, publish = {}
|
129
129
|
upload url, :url, data_type, publish
|
130
130
|
end
|
131
|
-
|
131
|
+
|
132
132
|
# @param [String] path - location of upload data
|
133
133
|
# @param [Symbol] upload_method -- flag for :file, :url, or :external
|
134
134
|
# @param [Symbol] data_type -- currently only :shapefile
|
135
|
-
# @param [Boolean] publish -- only valid for :file
|
135
|
+
# @param [Boolean] publish -- only valid for :file
|
136
136
|
def upload path, upload_method = :file, data_type = :shapefile, publish = false
|
137
137
|
ap({ :path => path, :upload_method => upload_method, :data_type => data_type, :publish => publish, :self => self}) if $DEBUG
|
138
138
|
|
@@ -144,10 +144,10 @@ module RGeoServer
|
|
144
144
|
when :file then # local file that we post
|
145
145
|
local_file = File.expand_path(path)
|
146
146
|
unless local_file =~ %r{\.zip$} and File.exist? local_file
|
147
|
-
raise ArgumentError, "Shapefile upload must be ZIP file: #{local_file}"
|
147
|
+
raise ArgumentError, "Shapefile upload must be ZIP file: #{local_file}"
|
148
148
|
end
|
149
149
|
puts "Uploading #{File.size(local_file)} bytes from file #{local_file}..."
|
150
|
-
|
150
|
+
|
151
151
|
catalog.client["#{route}/#{name}/file.#{ext}"].put File.read(local_file), :content_type => 'application/zip'
|
152
152
|
refresh
|
153
153
|
when :external then # remote file that we reference
|
@@ -170,7 +170,7 @@ module RGeoServer
|
|
170
170
|
"connection_parameters" => doc.xpath('//connectionParameters/entry').inject({}){ |x, e| x.merge(e['key']=> e.text.to_s) }
|
171
171
|
}
|
172
172
|
# XXX: assume that we know the workspace for <workspace>...</workspace>
|
173
|
-
doc.xpath('//featureTypes/atom:link[@rel="alternate"]/@href',
|
173
|
+
doc.xpath('//featureTypes/atom:link[@rel="alternate"]/@href',
|
174
174
|
"xmlns:atom"=>"http://www.w3.org/2005/Atom" ).each do |l|
|
175
175
|
h["featureTypes"] = begin
|
176
176
|
response = catalog.do_url l.text
|
data/rgeoserver.gemspec
CHANGED
@@ -26,6 +26,7 @@ Gem::Specification.new do |s|
|
|
26
26
|
s.add_dependency 'rgeo-shapefile', '~> 0.4.1'
|
27
27
|
s.add_dependency 'rubyzip'
|
28
28
|
|
29
|
+
s.add_development_dependency 'awesome_print'
|
29
30
|
s.add_development_dependency 'bundler'
|
30
31
|
s.add_development_dependency 'equivalent-xml'
|
31
32
|
s.add_development_dependency 'jettywrapper'
|
@@ -1,71 +1,69 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'awesome_print'
|
3
3
|
|
4
|
-
describe RGeoServer::
|
5
|
-
|
6
|
-
before(:each) do
|
7
|
-
@c = RGeoServer::Catalog.new
|
8
|
-
@w = @c.get_workspace 'druid'
|
9
|
-
@w_default = @c.get_default_workspace
|
10
|
-
ap({ :catalog => @c, :workspace_druid => @w, :workspace_default => @w_default }) if $DEBUG
|
11
|
-
end
|
12
|
-
|
4
|
+
describe RGeoServer::Catalog do
|
13
5
|
describe "Init" do
|
14
6
|
it "catalog" do
|
15
|
-
|
16
|
-
|
17
|
-
end
|
18
|
-
|
19
|
-
it "workspace" do
|
20
|
-
@w.name.should == 'druid'
|
21
|
-
@w_default.name.should == @w.name
|
7
|
+
subject.config.include?(:url).should == true
|
8
|
+
subject.headers.include?(:content_type).should == true
|
22
9
|
end
|
23
10
|
end
|
24
|
-
|
11
|
+
|
25
12
|
describe "#url_for" do
|
26
13
|
it "simple" do
|
27
|
-
|
14
|
+
subject.respond_to?('url_for').should == true
|
28
15
|
end
|
29
16
|
end
|
30
|
-
|
17
|
+
|
31
18
|
describe "Workspace" do
|
19
|
+
before(:each) do
|
20
|
+
@w = subject.get_workspace 'druid'
|
21
|
+
@w_default = subject.get_default_workspace
|
22
|
+
ap({ :catalog => subject, :workspace_druid => @w, :workspace_default => @w_default }) if $DEBUG
|
23
|
+
end
|
24
|
+
|
25
|
+
it "workspace" do
|
26
|
+
@w.name.should == 'druid'
|
27
|
+
@w_default.name.should == @w.name
|
28
|
+
end
|
29
|
+
|
32
30
|
it "#get_workspaces as array" do
|
33
|
-
@w_all =
|
31
|
+
@w_all = subject.get_workspaces
|
34
32
|
@w_all.size.should > 0
|
35
33
|
end
|
36
|
-
|
34
|
+
|
37
35
|
it "#get_workspaces as block" do
|
38
|
-
|
36
|
+
subject.get_workspaces do |w|
|
39
37
|
w.name.length.should > 0
|
40
38
|
end
|
41
39
|
end
|
42
40
|
end
|
43
41
|
|
44
42
|
describe "Layers" do
|
45
|
-
it "#
|
46
|
-
|
47
|
-
|
43
|
+
it "#each_layer" do
|
44
|
+
subject.each_layer.to_a.size.should > 0
|
45
|
+
subject.each_layer do |l|
|
48
46
|
# ap l.resource
|
49
47
|
end
|
50
48
|
end
|
51
49
|
end
|
52
|
-
|
50
|
+
|
53
51
|
describe "DataStore" do
|
54
52
|
it "#get_data_stores" do
|
55
|
-
|
53
|
+
subject.get_data_stores.size.should > 0
|
56
54
|
end
|
57
55
|
end
|
58
56
|
|
59
57
|
describe "CoverageStore" do
|
60
58
|
it "#get_coverage_stores" do
|
61
|
-
|
59
|
+
subject.get_coverage_stores.size.should > 0
|
62
60
|
end
|
63
61
|
end
|
64
62
|
|
65
63
|
describe "WMSStore" do
|
66
64
|
it "#get_wms_stores" do
|
67
|
-
|
65
|
+
subject.get_wms_stores.size.should > 0
|
68
66
|
end
|
69
67
|
end
|
70
|
-
|
71
|
-
end
|
68
|
+
|
69
|
+
end
|
@@ -2,214 +2,129 @@ require 'spec_helper'
|
|
2
2
|
require 'awesome_print'
|
3
3
|
|
4
4
|
describe RGeoServer::RestApiClient do
|
5
|
-
|
6
|
-
|
7
|
-
end
|
8
|
-
|
5
|
+
subject { RGeoServer::Catalog.new }
|
6
|
+
|
9
7
|
describe "REST API sequences" do
|
10
|
-
|
8
|
+
|
11
9
|
describe "basic" do
|
12
10
|
it "main" do
|
13
11
|
RGeoServer::RestApiClient::URI_SEQUENCES.each do |seq|
|
14
12
|
if not [[:about], [:layers, :styles]].include? seq
|
15
|
-
|
13
|
+
subject.url_for(Hash[seq.map {|k| [k, 'abc']}]).is_a?(String).should == true
|
16
14
|
end
|
17
15
|
end
|
18
16
|
end
|
19
|
-
|
17
|
+
|
20
18
|
it "exceptions" do
|
21
|
-
expect {
|
22
|
-
@client.url_for(:abc => "abc")
|
23
|
-
}.to raise_error ArgumentError
|
24
19
|
expect {
|
25
|
-
|
26
|
-
}.to raise_error
|
27
|
-
|
28
|
-
RGeoServer::RestApiClient::URI_SEQUENCES.each do |seq|
|
29
|
-
if seq.size > 1
|
30
|
-
expect {
|
31
|
-
@client.url_for(Hash[seq.map {|k| [k, nil]}])
|
32
|
-
}.to raise_error ArgumentError
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
20
|
+
subject.url_for(:abc => "abc")
|
21
|
+
}.to raise_error RGeoServer::GeoServerArgumentError
|
36
22
|
end
|
37
|
-
|
23
|
+
|
38
24
|
it "formats" do
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
25
|
+
subject.url_for(:workspaces => nil).should == "workspaces.xml"
|
26
|
+
subject.url_for('workspaces', {:format => :xml}).should == "workspaces.xml"
|
27
|
+
subject.url_for('workspaces', {:format => :html}).should == "workspaces.html"
|
28
|
+
subject.url_for('workspaces', {:format => :json}).should == "workspaces.json"
|
43
29
|
end
|
44
30
|
end
|
45
|
-
|
46
|
-
|
31
|
+
|
32
|
+
|
47
33
|
describe "workspaces" do
|
48
34
|
it "main" do
|
49
|
-
|
50
|
-
|
51
|
-
|
35
|
+
subject.url_for(:workspaces => nil).should == "workspaces.xml"
|
36
|
+
subject.url_for(:workspaces => "druid").should == "workspaces/druid.xml"
|
37
|
+
subject.url_for(:workspaces => "default").should == "workspaces/default.xml"
|
52
38
|
end
|
53
|
-
|
54
|
-
it "exceptions" do
|
55
|
-
true.should == true
|
56
|
-
end
|
57
39
|
end
|
58
40
|
|
59
41
|
describe "datastores" do
|
60
42
|
it "main" do
|
61
43
|
what = {:workspaces => "druid", :datastores => nil}
|
62
44
|
base = "workspaces/druid/datastores"
|
63
|
-
|
45
|
+
subject.url_for(what).should == base + ".xml"
|
64
46
|
what[:datastores] = "abc"
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
47
|
+
subject.url_for(what).should == base + "/abc.xml"
|
48
|
+
subject.url_for(what.merge({:file => nil})).should == base + "/abc/file.xml"
|
49
|
+
subject.url_for(what.merge({:external => nil})).should == base + "/abc/external.xml"
|
50
|
+
subject.url_for(what.merge({:url => nil})).should == base + "/abc/url.xml"
|
69
51
|
end
|
70
52
|
|
71
53
|
it "exceptions" do
|
72
|
-
expect {
|
73
|
-
|
74
|
-
}.to raise_error
|
75
|
-
expect {
|
76
|
-
|
77
|
-
}.to raise_error
|
78
|
-
expect {
|
79
|
-
@client.url_for(:workspaces => nil, :datastores => "abc")
|
80
|
-
}.to raise_error ArgumentError
|
81
|
-
expect {
|
82
|
-
@client.url_for(:workspaces => nil, :datastores => "abc", :file => 'abc')
|
83
|
-
}.to raise_error ArgumentError
|
54
|
+
expect {
|
55
|
+
subject.url_for(:datastores => nil)
|
56
|
+
}.to raise_error RGeoServer::GeoServerArgumentError
|
57
|
+
expect {
|
58
|
+
subject.url_for(:datastores => "abc")
|
59
|
+
}.to raise_error RGeoServer::GeoServerArgumentError
|
84
60
|
end
|
85
61
|
end
|
86
|
-
|
62
|
+
|
87
63
|
describe "featuretypes" do
|
88
64
|
it "main" do
|
89
65
|
what = {:workspaces => "druid", :datastores => "abc", :featuretypes => nil}
|
90
66
|
base = "workspaces/druid/datastores/abc/featuretypes"
|
91
|
-
|
67
|
+
subject.url_for(what).should == base + ".xml"
|
92
68
|
what[:featuretypes] = "xyz"
|
93
|
-
|
94
|
-
end
|
95
|
-
|
96
|
-
it "exceptions" do
|
97
|
-
expect {
|
98
|
-
@client.url_for(:featuretypes => 'abc')
|
99
|
-
}.to raise_error ArgumentError
|
100
|
-
expect {
|
101
|
-
@client.url_for(:workspaces => nil, :featuretypes => 'abc')
|
102
|
-
}.to raise_error ArgumentError
|
103
|
-
expect {
|
104
|
-
@client.url_for(:datastores => nil, :featuretypes => 'abc')
|
105
|
-
}.to raise_error ArgumentError
|
106
|
-
expect {
|
107
|
-
@client.url_for(:workspaces => nil, :datastores => nil, :featuretypes => 'abc')
|
108
|
-
}.to raise_error ArgumentError
|
109
|
-
expect {
|
110
|
-
@client.url_for(:workspaces => 'abc', :datastores => nil, :featuretypes => 'abc')
|
111
|
-
}.to raise_error ArgumentError
|
112
|
-
expect {
|
113
|
-
@client.url_for(:workspaces => nil, :datastores => "abc", :featuretypes => 'abc')
|
114
|
-
}.to raise_error ArgumentError
|
69
|
+
subject.url_for(what).should == base + "/xyz.xml"
|
115
70
|
end
|
116
|
-
|
117
71
|
end
|
118
|
-
|
72
|
+
|
119
73
|
describe "layers" do
|
120
74
|
it "main" do
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
end
|
125
|
-
|
126
|
-
it "exceptions" do
|
127
|
-
expect {
|
128
|
-
@client.url_for(:layers => "abc", :styles => 'xyz')
|
129
|
-
}.to raise_error ArgumentError
|
130
|
-
expect {
|
131
|
-
@client.url_for(:workspaces => "druid", :layers => "abc")
|
132
|
-
}.to raise_error ArgumentError
|
133
|
-
expect {
|
134
|
-
@client.url_for(:workspaces => nil, :layers => "abc")
|
135
|
-
}.to raise_error ArgumentError
|
136
|
-
expect {
|
137
|
-
@client.url_for(:workspaces => "druid", :layers => "abc")
|
138
|
-
}.to raise_error ArgumentError
|
75
|
+
subject.url_for(:layers => nil).should == "layers.xml"
|
76
|
+
subject.url_for(:layers => "abc").should == "layers/abc.xml"
|
77
|
+
subject.url_for(:layers => "abc", :styles => nil).should == "layers/abc/styles.xml"
|
139
78
|
end
|
140
|
-
|
141
79
|
end
|
142
|
-
|
80
|
+
|
143
81
|
describe "layergroups" do
|
144
82
|
it "main" do
|
145
83
|
base = "layergroups"
|
146
|
-
|
147
|
-
|
84
|
+
subject.url_for({:layergroups => nil}).should == base + ".xml"
|
85
|
+
subject.url_for({:layergroups => "abc"}).should == base + "/abc.xml"
|
148
86
|
end
|
149
87
|
|
150
|
-
it "workspace" do
|
88
|
+
it "workspace" do
|
151
89
|
what = {:workspaces => "druid", :layergroups => nil}
|
152
90
|
base = "workspaces/druid/layergroups"
|
153
|
-
|
91
|
+
subject.url_for(what).should == base + ".xml"
|
154
92
|
what[:layergroups] = "abc"
|
155
|
-
|
156
|
-
end
|
93
|
+
subject.url_for(what).should == base + "/abc.xml"
|
94
|
+
end
|
157
95
|
end
|
158
|
-
|
96
|
+
|
159
97
|
describe "namespaces" do
|
160
98
|
it "main" do
|
161
|
-
|
162
|
-
|
163
|
-
|
99
|
+
subject.url_for(:namespaces => nil).should == "namespaces.xml"
|
100
|
+
subject.url_for(:namespaces => "abc").should == "namespaces/abc.xml"
|
101
|
+
subject.url_for(:namespaces => "default").should == "namespaces/default.xml"
|
164
102
|
end
|
165
|
-
|
103
|
+
|
166
104
|
end
|
167
|
-
|
105
|
+
|
168
106
|
describe "coverages" do
|
169
107
|
it "main" do
|
170
108
|
what = {:workspaces => "druid", :coveragestores => "abc", :coverages => nil}
|
171
109
|
base = "workspaces/druid/coveragestores/abc/coverages"
|
172
|
-
|
110
|
+
subject.url_for(what).should == base + ".xml"
|
173
111
|
what[:coverages] = "xyz"
|
174
|
-
|
112
|
+
subject.url_for(what).should == base + "/xyz.xml"
|
175
113
|
end
|
176
114
|
|
177
115
|
it "exceptions" do
|
178
|
-
expect {
|
179
|
-
|
180
|
-
}.to raise_error
|
181
|
-
expect {
|
182
|
-
@client.url_for(:workspaces => "druid", :coverages => nil)
|
183
|
-
}.to raise_error ArgumentError
|
184
|
-
expect {
|
185
|
-
@client.url_for(:workspaces => "druid", :coverages => "abc")
|
186
|
-
}.to raise_error ArgumentError
|
187
|
-
expect {
|
188
|
-
@client.url_for(:workspaces => "druid", :coveragestores => nil, :coverages => "abc")
|
189
|
-
}.to raise_error ArgumentError
|
116
|
+
expect {
|
117
|
+
subject.url_for(:coverages => nil)
|
118
|
+
}.to raise_error RGeoServer::GeoServerArgumentError
|
190
119
|
end
|
191
|
-
|
192
120
|
end
|
193
|
-
|
121
|
+
|
194
122
|
describe "about" do
|
195
123
|
it "main" do
|
196
|
-
|
197
|
-
|
124
|
+
subject.url_for(:about => :version).should == "about/version.xml"
|
125
|
+
subject.url_for(:about => :manifest).should == "about/manifest.xml"
|
198
126
|
end
|
199
|
-
|
200
|
-
it "exceptions" do
|
201
|
-
expect {
|
202
|
-
@client.url_for(:about => nil)
|
203
|
-
}.to raise_error ArgumentError
|
204
|
-
expect {
|
205
|
-
@client.url_for(:about => 'abc')
|
206
|
-
}.to raise_error ArgumentError
|
207
|
-
expect {
|
208
|
-
@client.url_for(:about => 'version')
|
209
|
-
}.to raise_error ArgumentError
|
210
|
-
end
|
211
|
-
|
212
127
|
end
|
213
128
|
end
|
214
|
-
|
215
|
-
end
|
129
|
+
|
130
|
+
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.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Renzo Sanchez-Silva
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-09-
|
13
|
+
date: 2016-09-16 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activemodel
|
@@ -124,6 +124,20 @@ dependencies:
|
|
124
124
|
- - ">="
|
125
125
|
- !ruby/object:Gem::Version
|
126
126
|
version: '0'
|
127
|
+
- !ruby/object:Gem::Dependency
|
128
|
+
name: awesome_print
|
129
|
+
requirement: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - ">="
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
requirements:
|
138
|
+
- - ">="
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: '0'
|
127
141
|
- !ruby/object:Gem::Dependency
|
128
142
|
name: bundler
|
129
143
|
requirement: !ruby/object:Gem::Requirement
|