gi_cat_driver 0.1.12 → 0.2.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.
- data/Gemfile.lock +11 -5
- data/gi_cat_driver.gemspec +3 -2
- data/lib/gi_cat_driver/version.rb +1 -1
- data/lib/gi_cat_driver.rb +46 -40
- data/spec/fixtures/brokerConfigurations.xml +9 -0
- data/spec/fixtures/opensearchesip_lucene_disabled.xml +174 -0
- data/spec/fixtures/opensearchesip_lucene_enabled.xml +175 -0
- data/spec/gi_cat_driver_spec.rb +146 -41
- metadata +27 -5
data/Gemfile.lock
CHANGED
@@ -1,15 +1,19 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
gi_cat_driver (0.
|
4
|
+
gi_cat_driver (0.2.0)
|
5
|
+
faraday (~> 0.8.7)
|
5
6
|
nokogiri (~> 1.5.6)
|
6
|
-
rest-client (~> 1.6.7)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: http://rubygems.org/
|
10
10
|
specs:
|
11
|
+
addressable (2.3.3)
|
12
|
+
crack (0.3.2)
|
11
13
|
diff-lcs (1.2.3)
|
12
|
-
|
14
|
+
faraday (0.8.7)
|
15
|
+
multipart-post (~> 1.1)
|
16
|
+
multipart-post (1.2.0)
|
13
17
|
mustache (0.99.4)
|
14
18
|
nokogiri (1.5.9)
|
15
19
|
posix-spawn (0.3.6)
|
@@ -18,8 +22,6 @@ GEM
|
|
18
22
|
yajl-ruby (~> 1.1.0)
|
19
23
|
rake (10.0.4)
|
20
24
|
redcarpet (2.2.2)
|
21
|
-
rest-client (1.6.7)
|
22
|
-
mime-types (>= 1.16)
|
23
25
|
rocco (0.8.2)
|
24
26
|
mustache
|
25
27
|
pygments.rb
|
@@ -32,6 +34,9 @@ GEM
|
|
32
34
|
rspec-expectations (2.13.0)
|
33
35
|
diff-lcs (>= 1.1.3, < 2.0)
|
34
36
|
rspec-mocks (2.13.1)
|
37
|
+
webmock (1.11.0)
|
38
|
+
addressable (>= 2.2.7)
|
39
|
+
crack (>= 0.3.2)
|
35
40
|
yajl-ruby (1.1.0)
|
36
41
|
|
37
42
|
PLATFORMS
|
@@ -46,3 +51,4 @@ DEPENDENCIES
|
|
46
51
|
redcarpet (~> 2.2.2)
|
47
52
|
rocco (~> 0.8.2)
|
48
53
|
rspec (~> 2.13.0)
|
54
|
+
webmock (~> 1.11.0)
|
data/gi_cat_driver.gemspec
CHANGED
@@ -15,10 +15,10 @@ Gem::Specification.new do |spec|
|
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features|xml)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency "
|
21
|
+
spec.add_dependency "faraday", "~> 0.8.7"
|
22
22
|
spec.add_dependency "nokogiri", "~> 1.5.6"
|
23
23
|
|
24
24
|
spec.add_development_dependency "bundler", "~> 1.3"
|
@@ -28,4 +28,5 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.add_development_dependency "mustache", "~> 0.99.4"
|
29
29
|
spec.add_development_dependency "redcarpet", "~> 2.2.2"
|
30
30
|
spec.add_development_dependency "rocco", "~> 0.8.2"
|
31
|
+
spec.add_development_dependency "webmock", "~> 1.11.0"
|
31
32
|
end
|
data/lib/gi_cat_driver.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# The GI-Cat Driver controls GI-Cat configurations and actions using HTTP requests.
|
2
|
-
#
|
2
|
+
#
|
3
3
|
require "gi_cat_driver/version"
|
4
4
|
require "gi_cat_driver/esip_opensearch_query_builder"
|
5
5
|
require "open-uri"
|
6
|
-
require "
|
6
|
+
require "faraday"
|
7
7
|
require "base64"
|
8
8
|
require 'nokogiri'
|
9
9
|
require 'timeout'
|
@@ -25,7 +25,8 @@ module GiCatDriver
|
|
25
25
|
@admin_password = password
|
26
26
|
|
27
27
|
# Set up a constant containing the standard request headers
|
28
|
-
self.class.const_set("STANDARD_HEADERS",{ :content_type => "application/xml"
|
28
|
+
self.class.const_set("STANDARD_HEADERS", { :content_type => "application/xml" })
|
29
|
+
self.class.const_set("AUTHORIZATION_HEADERS", { :content_type => "*/*", :Accept => "application/xml", :Authorization => self.basic_auth_string })
|
29
30
|
end
|
30
31
|
|
31
32
|
# Basic Authorization used in the request headers
|
@@ -35,37 +36,39 @@ module GiCatDriver
|
|
35
36
|
|
36
37
|
# Check whether GI-Cat is accessible
|
37
38
|
def is_running?
|
38
|
-
|
39
|
+
Faraday.get(@base_url + "/").status == 200
|
39
40
|
end
|
40
41
|
|
41
42
|
# Retrieve the ID for a profile given the name
|
42
43
|
# Returns an integer ID reference to the profile
|
43
44
|
def find_profile_id( profile_name )
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
})
|
49
|
-
xml_doc = RestClient.get(get_profiles_request, modified_headers)
|
50
|
-
profile = parse_profile_element(profile_name, xml_doc)
|
51
|
-
|
52
|
-
return (profile.empty? ? nil : profile.attr('id').value)
|
53
|
-
end
|
45
|
+
response = Faraday.get do |req|
|
46
|
+
req.url @base_url + '/services/conf/brokerConfigurations', :nameRepository => 'gicat'
|
47
|
+
req.headers = AUTHORIZATION_HEADERS
|
48
|
+
end
|
54
49
|
|
55
|
-
|
56
|
-
def enable_profile( profile_name )
|
57
|
-
profile_id = find_profile_id(profile_name)
|
58
|
-
raise "The specified profile could not be found." if profile_id.nil?
|
59
|
-
activate_profile_request = "#{@base_url}/services/conf/brokerConfigurations/#{profile_id}?opts=active"
|
50
|
+
profile_id = parse_profile_element(profile_name, response.body)
|
60
51
|
|
61
|
-
|
52
|
+
return profile_id
|
62
53
|
end
|
63
54
|
|
64
55
|
# Returns an integer ID reference to the active profile
|
65
56
|
def get_active_profile_id
|
66
|
-
|
57
|
+
response = Faraday.get do |req|
|
58
|
+
req.url "#{@base_url}/services/conf/giconf/configuration"
|
59
|
+
req.headers = STANDARD_HEADERS
|
60
|
+
end
|
61
|
+
|
62
|
+
profile_id = response.body
|
63
|
+
return profile_id
|
64
|
+
end
|
67
65
|
|
68
|
-
|
66
|
+
# Enable a profile with the specified name
|
67
|
+
def enable_profile( profile_name )
|
68
|
+
Faraday.get do |req|
|
69
|
+
req.url "#{@base_url}/services/conf/brokerConfigurations/#{find_profile_id(profile_name)}?opts=active"
|
70
|
+
req.headers = AUTHORIZATION_HEADERS
|
71
|
+
end
|
69
72
|
end
|
70
73
|
|
71
74
|
# Enable Lucene indexes for GI-Cat search results
|
@@ -83,7 +86,7 @@ module GiCatDriver
|
|
83
86
|
# Instead, run a query and check that a 'relevance:score' element is present.
|
84
87
|
# Returns true if Lucene is turned on
|
85
88
|
def is_lucene_enabled?
|
86
|
-
query_string = EsipOpensearchQueryBuilder::get_query_string({ :st => "
|
89
|
+
query_string = EsipOpensearchQueryBuilder::get_query_string({ :st => "arctic%20alaskan%20shrubs" })
|
87
90
|
results = Nokogiri::XML(open("#{@base_url}/services/opensearchesip#{query_string}"))
|
88
91
|
|
89
92
|
result_scores = results.xpath('//atom:feed/atom:entry/relevance:score', ATOM_NAMESPACE.merge(RELEVANCE_NAMESPACE))
|
@@ -106,23 +109,18 @@ module GiCatDriver
|
|
106
109
|
|
107
110
|
private
|
108
111
|
|
109
|
-
# Toggle lucene indexes on when enabled is true, off when false
|
110
112
|
def set_lucene_enabled( enabled )
|
111
113
|
enable_lucene_request = "#{@base_url}/services/conf/brokerConfigurations/#{get_active_profile_id}/luceneEnabled"
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
STANDARD_HEADERS)
|
119
|
-
end
|
120
|
-
|
121
|
-
# Retrieve the profile element using the name
|
122
|
-
def parse_profile_element( profile_name, xml_doc )
|
123
|
-
configs = Nokogiri.XML(xml_doc)
|
114
|
+
Faraday.put do |req|
|
115
|
+
req.url enable_lucene_request
|
116
|
+
req.body = enabled.to_s
|
117
|
+
req.headers = AUTHORIZATION_HEADERS
|
118
|
+
req.options[:timeout] = 300
|
119
|
+
end
|
124
120
|
|
125
|
-
|
121
|
+
activate_profile_request = "#{@base_url}/services/conf/brokerConfigurations/#{get_active_profile_id}"
|
122
|
+
Faraday.get(activate_profile_request, { :opts => "active" },
|
123
|
+
AUTHORIZATION_HEADERS)
|
126
124
|
end
|
127
125
|
|
128
126
|
# Retrive the distributor id given a profile id
|
@@ -148,7 +146,7 @@ module GiCatDriver
|
|
148
146
|
|
149
147
|
# Harvest from specified resource
|
150
148
|
def harvest_resource_for_active_configuration(harvesterid, harvestername = "n/a")
|
151
|
-
|
149
|
+
Faraday.get(
|
152
150
|
"#{@base_url}/services/conf/brokerConfigurations/#{self.get_active_profile_id}/harvesters/#{harvesterid}/start",
|
153
151
|
STANDARD_HEADERS) do |response, request, result, &block|
|
154
152
|
case response.code
|
@@ -182,9 +180,9 @@ module GiCatDriver
|
|
182
180
|
|
183
181
|
rnum=rand
|
184
182
|
request = @base_url + "/services/conf/giconf/status?id=#{harvesterid}&rand=#{rnum}"
|
185
|
-
response = RestClient.get request
|
186
183
|
|
187
|
-
|
184
|
+
response = Faraday.get request
|
185
|
+
responsexml = Nokogiri::XML::Reader(response.body)
|
188
186
|
responsexml.each do |node|
|
189
187
|
if node.name == "status" && !node.inner_xml.empty?
|
190
188
|
status = harvest_status(node.inner_xml, harvestername)
|
@@ -213,5 +211,13 @@ module GiCatDriver
|
|
213
211
|
end
|
214
212
|
end
|
215
213
|
|
214
|
+
def parse_profile_element( profile_name, xml_doc )
|
215
|
+
configs = Nokogiri.XML(xml_doc)
|
216
|
+
profile = configs.css("brokerConfiguration[name=#{profile_name}]")
|
217
|
+
raise "The profile '" + profile_name + "' does not exist!" if profile.empty?
|
218
|
+
|
219
|
+
return profile.attr('id').value
|
220
|
+
end
|
221
|
+
|
216
222
|
end
|
217
223
|
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
2
|
+
<brokerConfigurations xmlns="http://imaa.cnr.it/sdi/services/7.0/configurationMessages/schema">
|
3
|
+
<brokerConfiguration id="1" name="some_profile">
|
4
|
+
<component>
|
5
|
+
<id>UUID-6c89ab7d-82aa-446c-902e-0b1f6e412a45</id>
|
6
|
+
<type>Distributor</type>
|
7
|
+
</component>
|
8
|
+
</brokerConfiguration>
|
9
|
+
</brokerConfigurations>
|
@@ -0,0 +1,174 @@
|
|
1
|
+
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
 http://www.w3.org/2005/Atom http://zeus.pin.unifi.it/schemas/geo-rss/atom_1.0_specification.xsd http://www.georss.org/georss http://zeus.pin.unifi.it/schemas/geo-rss/geo_rss_1.1_specification.xsd http://www.opengis.net/gml http://schemas.opengis.net/gml/3.1.1/base/gml.xsd
 ">
|
2
|
+
<title>Search results</title>
|
3
|
+
<id>urn:gi-cat:id:2%3F4075b4-c953-4375-ba4c-459fd35c43d2</id>
|
4
|
+
<updated>2013-04-18T10:44:41.928-06:00</updated>
|
5
|
+
<link href="http://nsidc.org:-1/api/gi-cat/services/opensearchesip?getdescriptiondocument" rel="search" title="Content Search" type="application/opensearchdescription+xml"/>
|
6
|
+
<link href="http://nsidc.org:-1/api/gi-cat/services/opensearchesip?si=&ct=&st=arctic%20alaskan%20shrubs&bbox=&rel=&loc=&ts=&te=&outputFormat=application/atom+xml" rel="self" type="application/rss+xml"/>
|
7
|
+
<totalResults xmlns="http://a9.com/-/spec/opensearch/1.1/">1</totalResults>
|
8
|
+
<startIndex xmlns="http://a9.com/-/spec/opensearch/1.1/">1</startIndex>
|
9
|
+
<itemsPerPage xmlns="http://a9.com/-/spec/opensearch/1.1/">10</itemsPerPage>
|
10
|
+
<entry>
|
11
|
+
<title>A Half-Century of Change in Arctic Alaskan Shrubs: A Photographic-Based Assessment</title>
|
12
|
+
<atom:link xmlns:atom="http://www.w3.org/2005/Atom" href="http://data.eol.ucar.edu/jedi/catalog/ucar.ncar.eol.dataset.106_ARCSS130.thredds.xml" rel="enclosure" type=""/>
|
13
|
+
<dm:genericLink xmlns:dm="http://floraresearch.eu/sdi/services/7.0/dataModel/schema">http://data.eol.ucar.edu/jedi/catalog/ucar.ncar.eol.dataset.106_ARCSS130.thredds.xml</dm:genericLink>
|
14
|
+
<id>urn:gi-cat:id:aHR0cDovL2RhdGEuZW9sLnVjYXIuZWR1L2plZGkvY2F0YWxvZy91Y2FyLm5jYXIuZW9sLmRhdGFzZXQuMTA2X0FSQ1NTMTMwLnRocmVkZHMueG1sIy8vdGhyOmRhdGFzZXRbQElEPSd1Y2FyLm5jYXIuZW9sLmRhdGFzZXQuMTA2X0FSQ1NTMTMwJ10=</id>
|
15
|
+
<updated/>
|
16
|
+
<link href="http://data.eol.ucar.edu/jedi/catalog/ucar.ncar.eol.dataset.106_ARCSS130.thredds.xml"/>
|
17
|
+
<link href="http://data.eol.ucar.edu/jedi/catalog/ucar.ncar.eol.dataset.106_ARCSS130.thredds.xml" rel="related"/>
|
18
|
+
<category label="dataset" term="hlevel"/>
|
19
|
+
<category label="dataSetDataBase" term="topic"/>
|
20
|
+
<category label="dataSetDataBase" term="geosscategory"/>
|
21
|
+
<author>
|
22
|
+
<name>unknown</name>
|
23
|
+
</author>
|
24
|
+
<box xmlns="http://www.georss.org/georss">-90.0 -180.0 90.0 180.0</box>
|
25
|
+
<multibox xmlns="http://iia.cnr.it">-90.0 -180.0 90.0 180.0#</multibox>
|
26
|
+
<parentID xmlns="http://eu.floraresearch">aHR0cDovL2RhdGEuZW9sLnVjYXIuZWR1L2plZGkvY2F0YWxvZy91Y2FyLm5jYXIuZW9sLnByb2plY3QuQVJDU1MudGhyZWRkcy54bWwjLy90aHI6ZGF0YXNldFtASUQ9J3VjYXIubmNhci5lb2wucHJvamVjdC5BUkNTUydd</parentID>
|
27
|
+
<harvested xmlns="http://eu.floraresearch">false</harvested>
|
28
|
+
<gmd:distributionInfo xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:csw="http://www.opengis.net/cat/csw/2.0.2" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dct="http://purl.org/dc/terms/" xmlns:dm="http://floraresearch.eu/sdi/services/7.0/dataModel/schema" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:gmi="http://www.isotc211.org/2005/gmi" xmlns:gml="http://www.opengis.net/gml" xmlns:gmx="http://www.opengis.net/gmx" xmlns:ns15="http://quakeml.org/xmlns/quakeml/1.2" xmlns:ns3="http://www.geoviqua.org/QualityInformationModel/3.1" xmlns:ns4="http://quakeml.org/xmlns/bed/1.2" xmlns:ogc="http://www.opengis.net/ogc" xmlns:ows="http://www.opengis.net/ows" xmlns:relevance="http://a9.com/-/opensearch/extensions/relevance/1.0/" xmlns:rim="urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0" xmlns:srv="http://www.isotc211.org/2005/srv" xmlns:wrs="http://www.opengis.net/cat/wrs/1.0" xmlns:xlink="http://www.w3.org/1999/xlink">
|
29
|
+
|
30
|
+
<gmd:MD_Distribution>
|
31
|
+
|
32
|
+
<gmd:transferOptions>
|
33
|
+
|
34
|
+
<gmd:MD_DigitalTransferOptions>
|
35
|
+
|
36
|
+
<gmd:onLine>
|
37
|
+
|
38
|
+
<gmd:CI_OnlineResource>
|
39
|
+
|
40
|
+
<gmd:linkage>
|
41
|
+
|
42
|
+
<gmd:URL>http://data.eol.ucar.edu/jedi/catalog/ucar.ncar.eol.dataset.106_ARCSS130.thredds.xml</gmd:URL>
|
43
|
+
|
44
|
+
</gmd:linkage>
|
45
|
+
|
46
|
+
<gmd:protocol>
|
47
|
+
|
48
|
+
<gco:CharacterString>HTTP</gco:CharacterString>
|
49
|
+
|
50
|
+
</gmd:protocol>
|
51
|
+
|
52
|
+
</gmd:CI_OnlineResource>
|
53
|
+
|
54
|
+
</gmd:onLine>
|
55
|
+
|
56
|
+
</gmd:MD_DigitalTransferOptions>
|
57
|
+
|
58
|
+
</gmd:transferOptions>
|
59
|
+
|
60
|
+
</gmd:MD_Distribution>
|
61
|
+
|
62
|
+
</gmd:distributionInfo>
|
63
|
+
<gmd:identificationInfo xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:csw="http://www.opengis.net/cat/csw/2.0.2" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dct="http://purl.org/dc/terms/" xmlns:dm="http://floraresearch.eu/sdi/services/7.0/dataModel/schema" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:gmi="http://www.isotc211.org/2005/gmi" xmlns:gml="http://www.opengis.net/gml" xmlns:gmx="http://www.opengis.net/gmx" xmlns:ns15="http://quakeml.org/xmlns/quakeml/1.2" xmlns:ns3="http://www.geoviqua.org/QualityInformationModel/3.1" xmlns:ns4="http://quakeml.org/xmlns/bed/1.2" xmlns:ogc="http://www.opengis.net/ogc" xmlns:ows="http://www.opengis.net/ows" xmlns:relevance="http://a9.com/-/opensearch/extensions/relevance/1.0/" xmlns:rim="urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0" xmlns:srv="http://www.isotc211.org/2005/srv" xmlns:wrs="http://www.opengis.net/cat/wrs/1.0" xmlns:xlink="http://www.w3.org/1999/xlink">
|
64
|
+
|
65
|
+
<gmd:MD_DataIdentification xsi:schemaLocation="http://www.isotc211.org/2005/gmd http://zeus.pin.unifi.it/schemas/mirrors/schemas.opengis.net/csw/2.0.2/profiles/apiso/1.0.0/apiso.xsd">
|
66
|
+
|
67
|
+
<gmd:topicCategory>
|
68
|
+
|
69
|
+
<gmd:MD_TopicCategoryCode>dataSetDataBase</gmd:MD_TopicCategoryCode>
|
70
|
+
|
71
|
+
</gmd:topicCategory>
|
72
|
+
|
73
|
+
<gmd:citation>
|
74
|
+
|
75
|
+
<gmd:CI_Citation>
|
76
|
+
|
77
|
+
<gmd:title>
|
78
|
+
|
79
|
+
<gco:CharacterString>A Half-Century of Change in Arctic Alaskan Shrubs: A Photographic-Based Assessment</gco:CharacterString>
|
80
|
+
|
81
|
+
</gmd:title>
|
82
|
+
|
83
|
+
<gmd:editionDate>
|
84
|
+
|
85
|
+
<gco:Date/>
|
86
|
+
|
87
|
+
</gmd:editionDate>
|
88
|
+
|
89
|
+
<gmd:date>
|
90
|
+
|
91
|
+
<gmd:CI_Date>
|
92
|
+
|
93
|
+
<gmd:date>
|
94
|
+
|
95
|
+
<gco:Date/>
|
96
|
+
|
97
|
+
</gmd:date>
|
98
|
+
|
99
|
+
</gmd:CI_Date>
|
100
|
+
|
101
|
+
</gmd:date>
|
102
|
+
|
103
|
+
</gmd:CI_Citation>
|
104
|
+
|
105
|
+
</gmd:citation>
|
106
|
+
|
107
|
+
<gmd:abstract/>
|
108
|
+
|
109
|
+
<gmd:language/>
|
110
|
+
|
111
|
+
<gmd:extent>
|
112
|
+
|
113
|
+
<gmd:EX_Extent>
|
114
|
+
|
115
|
+
<gmd:geographicElement>
|
116
|
+
|
117
|
+
<gmd:EX_GeographicBoundingBox>
|
118
|
+
|
119
|
+
<gmd:westBoundLongitude>
|
120
|
+
|
121
|
+
<gco:Decimal>-180.0</gco:Decimal>
|
122
|
+
|
123
|
+
</gmd:westBoundLongitude>
|
124
|
+
|
125
|
+
<gmd:eastBoundLongitude>
|
126
|
+
|
127
|
+
<gco:Decimal>180.0</gco:Decimal>
|
128
|
+
|
129
|
+
</gmd:eastBoundLongitude>
|
130
|
+
|
131
|
+
<gmd:southBoundLatitude>
|
132
|
+
|
133
|
+
<gco:Decimal>-90.0</gco:Decimal>
|
134
|
+
|
135
|
+
</gmd:southBoundLatitude>
|
136
|
+
|
137
|
+
<gmd:northBoundLatitude>
|
138
|
+
|
139
|
+
<gco:Decimal>90.0</gco:Decimal>
|
140
|
+
|
141
|
+
</gmd:northBoundLatitude>
|
142
|
+
|
143
|
+
</gmd:EX_GeographicBoundingBox>
|
144
|
+
|
145
|
+
</gmd:geographicElement>
|
146
|
+
|
147
|
+
</gmd:EX_Extent>
|
148
|
+
|
149
|
+
</gmd:extent>
|
150
|
+
|
151
|
+
</gmd:MD_DataIdentification>
|
152
|
+
|
153
|
+
</gmd:identificationInfo>
|
154
|
+
<gmd:identificationInfo xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:csw="http://www.opengis.net/cat/csw/2.0.2" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dct="http://purl.org/dc/terms/" xmlns:dm="http://floraresearch.eu/sdi/services/7.0/dataModel/schema" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:gmi="http://www.isotc211.org/2005/gmi" xmlns:gml="http://www.opengis.net/gml" xmlns:gmx="http://www.opengis.net/gmx" xmlns:ns15="http://quakeml.org/xmlns/quakeml/1.2" xmlns:ns3="http://www.geoviqua.org/QualityInformationModel/3.1" xmlns:ns4="http://quakeml.org/xmlns/bed/1.2" xmlns:ogc="http://www.opengis.net/ogc" xmlns:ows="http://www.opengis.net/ows" xmlns:relevance="http://a9.com/-/opensearch/extensions/relevance/1.0/" xmlns:rim="urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0" xmlns:srv="http://www.isotc211.org/2005/srv" xmlns:wrs="http://www.opengis.net/cat/wrs/1.0" xmlns:xlink="http://www.w3.org/1999/xlink">
|
155
|
+
|
156
|
+
<srv:SV_ServiceIdentification>
|
157
|
+
|
158
|
+
|
159
|
+
<gmd:citation/>
|
160
|
+
|
161
|
+
<gmd:abstract/>
|
162
|
+
|
163
|
+
<srv:serviceType/>
|
164
|
+
|
165
|
+
<srv:couplingType/>
|
166
|
+
|
167
|
+
<srv:containsOperations/>
|
168
|
+
|
169
|
+
|
170
|
+
</srv:SV_ServiceIdentification>
|
171
|
+
|
172
|
+
</gmd:identificationInfo>
|
173
|
+
</entry>
|
174
|
+
</feed>
|
@@ -0,0 +1,175 @@
|
|
1
|
+
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
 http://www.w3.org/2005/Atom http://zeus.pin.unifi.it/schemas/geo-rss/atom_1.0_specification.xsd http://www.georss.org/georss http://zeus.pin.unifi.it/schemas/geo-rss/geo_rss_1.1_specification.xsd http://www.opengis.net/gml http://schemas.opengis.net/gml/3.1.1/base/gml.xsd
 ">
|
2
|
+
<title>Search results</title>
|
3
|
+
<id>urn:gi-cat:id:2%3F4075b4-c953-4375-ba4c-459fd35c43d2</id>
|
4
|
+
<updated>2013-04-18T10:44:41.928-06:00</updated>
|
5
|
+
<link href="http://nsidc.org:-1/api/gi-cat/services/opensearchesip?getdescriptiondocument" rel="search" title="Content Search" type="application/opensearchdescription+xml"/>
|
6
|
+
<link href="http://nsidc.org:-1/api/gi-cat/services/opensearchesip?si=&ct=&st=arctic%20alaskan%20shrubs&bbox=&rel=&loc=&ts=&te=&outputFormat=application/atom+xml" rel="self" type="application/rss+xml"/>
|
7
|
+
<totalResults xmlns="http://a9.com/-/spec/opensearch/1.1/">1</totalResults>
|
8
|
+
<startIndex xmlns="http://a9.com/-/spec/opensearch/1.1/">1</startIndex>
|
9
|
+
<itemsPerPage xmlns="http://a9.com/-/spec/opensearch/1.1/">10</itemsPerPage>
|
10
|
+
<entry>
|
11
|
+
<title>A Half-Century of Change in Arctic Alaskan Shrubs: A Photographic-Based Assessment</title>
|
12
|
+
<atom:link xmlns:atom="http://www.w3.org/2005/Atom" href="http://data.eol.ucar.edu/jedi/catalog/ucar.ncar.eol.dataset.106_ARCSS130.thredds.xml" rel="enclosure" type=""/>
|
13
|
+
<dm:genericLink xmlns:dm="http://floraresearch.eu/sdi/services/7.0/dataModel/schema">http://data.eol.ucar.edu/jedi/catalog/ucar.ncar.eol.dataset.106_ARCSS130.thredds.xml</dm:genericLink>
|
14
|
+
<id>urn:gi-cat:id:aHR0cDovL2RhdGEuZW9sLnVjYXIuZWR1L2plZGkvY2F0YWxvZy91Y2FyLm5jYXIuZW9sLmRhdGFzZXQuMTA2X0FSQ1NTMTMwLnRocmVkZHMueG1sIy8vdGhyOmRhdGFzZXRbQElEPSd1Y2FyLm5jYXIuZW9sLmRhdGFzZXQuMTA2X0FSQ1NTMTMwJ10=</id>
|
15
|
+
<updated/>
|
16
|
+
<link href="http://data.eol.ucar.edu/jedi/catalog/ucar.ncar.eol.dataset.106_ARCSS130.thredds.xml"/>
|
17
|
+
<link href="http://data.eol.ucar.edu/jedi/catalog/ucar.ncar.eol.dataset.106_ARCSS130.thredds.xml" rel="related"/>
|
18
|
+
<category label="dataset" term="hlevel"/>
|
19
|
+
<category label="dataSetDataBase" term="topic"/>
|
20
|
+
<category label="dataSetDataBase" term="geosscategory"/>
|
21
|
+
<author>
|
22
|
+
<name>unknown</name>
|
23
|
+
</author>
|
24
|
+
<box xmlns="http://www.georss.org/georss">-90.0 -180.0 90.0 180.0</box>
|
25
|
+
<multibox xmlns="http://iia.cnr.it">-90.0 -180.0 90.0 180.0#</multibox>
|
26
|
+
<parentID xmlns="http://eu.floraresearch">aHR0cDovL2RhdGEuZW9sLnVjYXIuZWR1L2plZGkvY2F0YWxvZy91Y2FyLm5jYXIuZW9sLnByb2plY3QuQVJDU1MudGhyZWRkcy54bWwjLy90aHI6ZGF0YXNldFtASUQ9J3VjYXIubmNhci5lb2wucHJvamVjdC5BUkNTUydd</parentID>
|
27
|
+
<harvested xmlns="http://eu.floraresearch">false</harvested>
|
28
|
+
<gmd:distributionInfo xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:csw="http://www.opengis.net/cat/csw/2.0.2" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dct="http://purl.org/dc/terms/" xmlns:dm="http://floraresearch.eu/sdi/services/7.0/dataModel/schema" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:gmi="http://www.isotc211.org/2005/gmi" xmlns:gml="http://www.opengis.net/gml" xmlns:gmx="http://www.opengis.net/gmx" xmlns:ns15="http://quakeml.org/xmlns/quakeml/1.2" xmlns:ns3="http://www.geoviqua.org/QualityInformationModel/3.1" xmlns:ns4="http://quakeml.org/xmlns/bed/1.2" xmlns:ogc="http://www.opengis.net/ogc" xmlns:ows="http://www.opengis.net/ows" xmlns:relevance="http://a9.com/-/opensearch/extensions/relevance/1.0/" xmlns:rim="urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0" xmlns:srv="http://www.isotc211.org/2005/srv" xmlns:wrs="http://www.opengis.net/cat/wrs/1.0" xmlns:xlink="http://www.w3.org/1999/xlink">
|
29
|
+
|
30
|
+
<gmd:MD_Distribution>
|
31
|
+
|
32
|
+
<gmd:transferOptions>
|
33
|
+
|
34
|
+
<gmd:MD_DigitalTransferOptions>
|
35
|
+
|
36
|
+
<gmd:onLine>
|
37
|
+
|
38
|
+
<gmd:CI_OnlineResource>
|
39
|
+
|
40
|
+
<gmd:linkage>
|
41
|
+
|
42
|
+
<gmd:URL>http://data.eol.ucar.edu/jedi/catalog/ucar.ncar.eol.dataset.106_ARCSS130.thredds.xml</gmd:URL>
|
43
|
+
|
44
|
+
</gmd:linkage>
|
45
|
+
|
46
|
+
<gmd:protocol>
|
47
|
+
|
48
|
+
<gco:CharacterString>HTTP</gco:CharacterString>
|
49
|
+
|
50
|
+
</gmd:protocol>
|
51
|
+
|
52
|
+
</gmd:CI_OnlineResource>
|
53
|
+
|
54
|
+
</gmd:onLine>
|
55
|
+
|
56
|
+
</gmd:MD_DigitalTransferOptions>
|
57
|
+
|
58
|
+
</gmd:transferOptions>
|
59
|
+
|
60
|
+
</gmd:MD_Distribution>
|
61
|
+
|
62
|
+
</gmd:distributionInfo>
|
63
|
+
<gmd:identificationInfo xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:csw="http://www.opengis.net/cat/csw/2.0.2" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dct="http://purl.org/dc/terms/" xmlns:dm="http://floraresearch.eu/sdi/services/7.0/dataModel/schema" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:gmi="http://www.isotc211.org/2005/gmi" xmlns:gml="http://www.opengis.net/gml" xmlns:gmx="http://www.opengis.net/gmx" xmlns:ns15="http://quakeml.org/xmlns/quakeml/1.2" xmlns:ns3="http://www.geoviqua.org/QualityInformationModel/3.1" xmlns:ns4="http://quakeml.org/xmlns/bed/1.2" xmlns:ogc="http://www.opengis.net/ogc" xmlns:ows="http://www.opengis.net/ows" xmlns:relevance="http://a9.com/-/opensearch/extensions/relevance/1.0/" xmlns:rim="urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0" xmlns:srv="http://www.isotc211.org/2005/srv" xmlns:wrs="http://www.opengis.net/cat/wrs/1.0" xmlns:xlink="http://www.w3.org/1999/xlink">
|
64
|
+
|
65
|
+
<gmd:MD_DataIdentification xsi:schemaLocation="http://www.isotc211.org/2005/gmd http://zeus.pin.unifi.it/schemas/mirrors/schemas.opengis.net/csw/2.0.2/profiles/apiso/1.0.0/apiso.xsd">
|
66
|
+
|
67
|
+
<gmd:topicCategory>
|
68
|
+
|
69
|
+
<gmd:MD_TopicCategoryCode>dataSetDataBase</gmd:MD_TopicCategoryCode>
|
70
|
+
|
71
|
+
</gmd:topicCategory>
|
72
|
+
|
73
|
+
<gmd:citation>
|
74
|
+
|
75
|
+
<gmd:CI_Citation>
|
76
|
+
|
77
|
+
<gmd:title>
|
78
|
+
|
79
|
+
<gco:CharacterString>A Half-Century of Change in Arctic Alaskan Shrubs: A Photographic-Based Assessment</gco:CharacterString>
|
80
|
+
|
81
|
+
</gmd:title>
|
82
|
+
|
83
|
+
<gmd:editionDate>
|
84
|
+
|
85
|
+
<gco:Date/>
|
86
|
+
|
87
|
+
</gmd:editionDate>
|
88
|
+
|
89
|
+
<gmd:date>
|
90
|
+
|
91
|
+
<gmd:CI_Date>
|
92
|
+
|
93
|
+
<gmd:date>
|
94
|
+
|
95
|
+
<gco:Date/>
|
96
|
+
|
97
|
+
</gmd:date>
|
98
|
+
|
99
|
+
</gmd:CI_Date>
|
100
|
+
|
101
|
+
</gmd:date>
|
102
|
+
|
103
|
+
</gmd:CI_Citation>
|
104
|
+
|
105
|
+
</gmd:citation>
|
106
|
+
|
107
|
+
<gmd:abstract/>
|
108
|
+
|
109
|
+
<gmd:language/>
|
110
|
+
|
111
|
+
<gmd:extent>
|
112
|
+
|
113
|
+
<gmd:EX_Extent>
|
114
|
+
|
115
|
+
<gmd:geographicElement>
|
116
|
+
|
117
|
+
<gmd:EX_GeographicBoundingBox>
|
118
|
+
|
119
|
+
<gmd:westBoundLongitude>
|
120
|
+
|
121
|
+
<gco:Decimal>-180.0</gco:Decimal>
|
122
|
+
|
123
|
+
</gmd:westBoundLongitude>
|
124
|
+
|
125
|
+
<gmd:eastBoundLongitude>
|
126
|
+
|
127
|
+
<gco:Decimal>180.0</gco:Decimal>
|
128
|
+
|
129
|
+
</gmd:eastBoundLongitude>
|
130
|
+
|
131
|
+
<gmd:southBoundLatitude>
|
132
|
+
|
133
|
+
<gco:Decimal>-90.0</gco:Decimal>
|
134
|
+
|
135
|
+
</gmd:southBoundLatitude>
|
136
|
+
|
137
|
+
<gmd:northBoundLatitude>
|
138
|
+
|
139
|
+
<gco:Decimal>90.0</gco:Decimal>
|
140
|
+
|
141
|
+
</gmd:northBoundLatitude>
|
142
|
+
|
143
|
+
</gmd:EX_GeographicBoundingBox>
|
144
|
+
|
145
|
+
</gmd:geographicElement>
|
146
|
+
|
147
|
+
</gmd:EX_Extent>
|
148
|
+
|
149
|
+
</gmd:extent>
|
150
|
+
|
151
|
+
</gmd:MD_DataIdentification>
|
152
|
+
|
153
|
+
</gmd:identificationInfo>
|
154
|
+
<gmd:identificationInfo xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:csw="http://www.opengis.net/cat/csw/2.0.2" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dct="http://purl.org/dc/terms/" xmlns:dm="http://floraresearch.eu/sdi/services/7.0/dataModel/schema" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:gmi="http://www.isotc211.org/2005/gmi" xmlns:gml="http://www.opengis.net/gml" xmlns:gmx="http://www.opengis.net/gmx" xmlns:ns15="http://quakeml.org/xmlns/quakeml/1.2" xmlns:ns3="http://www.geoviqua.org/QualityInformationModel/3.1" xmlns:ns4="http://quakeml.org/xmlns/bed/1.2" xmlns:ogc="http://www.opengis.net/ogc" xmlns:ows="http://www.opengis.net/ows" xmlns:relevance="http://a9.com/-/opensearch/extensions/relevance/1.0/" xmlns:rim="urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0" xmlns:srv="http://www.isotc211.org/2005/srv" xmlns:wrs="http://www.opengis.net/cat/wrs/1.0" xmlns:xlink="http://www.w3.org/1999/xlink">
|
155
|
+
|
156
|
+
<srv:SV_ServiceIdentification>
|
157
|
+
|
158
|
+
|
159
|
+
<gmd:citation/>
|
160
|
+
|
161
|
+
<gmd:abstract/>
|
162
|
+
|
163
|
+
<srv:serviceType/>
|
164
|
+
|
165
|
+
<srv:couplingType/>
|
166
|
+
|
167
|
+
<srv:containsOperations/>
|
168
|
+
|
169
|
+
|
170
|
+
</srv:SV_ServiceIdentification>
|
171
|
+
|
172
|
+
</gmd:identificationInfo>
|
173
|
+
<relevance:score xmlns:relevance="http://a9.com/-/opensearch/extensions/relevance/1.0/">1.0</relevance:score>
|
174
|
+
</entry>
|
175
|
+
</feed>
|
data/spec/gi_cat_driver_spec.rb
CHANGED
@@ -1,49 +1,154 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'gi_cat_driver'
|
3
|
+
require 'webmock/rspec'
|
3
4
|
|
4
5
|
describe GiCatDriver do
|
5
|
-
before(:
|
6
|
+
before(:all) do
|
6
7
|
@base_url = "http://www.somecompany.com/"
|
7
|
-
@gi_cat = GiCatDriver::GiCat.new(@base_url, "admin", "
|
8
|
+
@gi_cat = GiCatDriver::GiCat.new(@base_url, "admin", "pass")
|
8
9
|
end
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
11
|
+
describe "requests" do
|
12
|
+
it "can check that GI-Cat is running" do
|
13
|
+
stub_request(:get, @base_url)
|
14
|
+
.with(:headers => {
|
15
|
+
'Accept'=>'*/*',
|
16
|
+
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
17
|
+
'User-Agent'=>'Faraday v0.8.7'
|
18
|
+
}).to_return(:status => 200, :body => "", :headers => {})
|
19
|
+
|
20
|
+
running = @gi_cat.is_running?
|
21
|
+
|
22
|
+
expect(running).to be_true
|
23
|
+
a_request(:get, @base_url).should have_been_made.once
|
24
|
+
end
|
25
|
+
|
26
|
+
it "can retrieve the active profile id" do
|
27
|
+
request_url = @base_url + "services/conf/giconf/configuration"
|
28
|
+
stub_request(:get, request_url)
|
29
|
+
.with(:headers => {
|
30
|
+
'Accept'=>'*/*',
|
31
|
+
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
32
|
+
'Content-Type'=>'application/xml',
|
33
|
+
'User-Agent'=>'Ruby'
|
34
|
+
}).to_return(:status => 200, :body => "1", :headers => {})
|
35
|
+
|
36
|
+
profile_id = @gi_cat.get_active_profile_id
|
37
|
+
|
38
|
+
a_request(:get, request_url).should have_been_made.once
|
39
|
+
expect(profile_id).to eq "1"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe "authorized requests" do
|
44
|
+
it "can retrieve a profile id given a profile name" do
|
45
|
+
request_url = "http://admin:pass@www.somecompany.com/services/conf/brokerConfigurations"
|
46
|
+
stub_request(:get,request_url)
|
47
|
+
.with(:headers => {
|
48
|
+
'Accept'=>'application/xml',
|
49
|
+
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
50
|
+
'User-Agent'=>'Ruby',
|
51
|
+
'Content-Type'=>'*/*'
|
52
|
+
}, :query => {:nameRepository => "gicat"})
|
53
|
+
.to_return(:status => 200, :body => File.new("spec/fixtures/brokerConfigurations.xml"), :headers => {})
|
54
|
+
|
55
|
+
# Find id for 'some_profile'
|
56
|
+
profile_id = @gi_cat.find_profile_id("some_profile")
|
57
|
+
|
58
|
+
a_request(:get, request_url).with(:query => {:nameRepository => "gicat"}).should have_been_made.once
|
59
|
+
expect(profile_id).to eq("1")
|
60
|
+
end
|
61
|
+
|
62
|
+
it "throws an error if the profile cannot be found" do
|
63
|
+
request_url = "http://admin:pass@www.somecompany.com/services/conf/brokerConfigurations"
|
64
|
+
stub_request(:get,request_url)
|
65
|
+
.with(:headers => {
|
66
|
+
'Accept'=>'application/xml',
|
67
|
+
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
68
|
+
'User-Agent'=>'Ruby',
|
69
|
+
'Content-Type'=>'*/*'
|
70
|
+
}, :query => {:nameRepository => "gicat"})
|
71
|
+
.to_return(:status => 200, :body => File.new("spec/fixtures/brokerConfigurations.xml"), :headers => {})
|
72
|
+
|
73
|
+
# Lambda hack to catch error http://stackoverflow.com/questions/2359439/expecting-errors-in-rspec-tests
|
74
|
+
lambda {@gi_cat.find_profile_id "bad_name"}.should raise_error(RuntimeError)
|
75
|
+
end
|
76
|
+
|
77
|
+
it "can enable a profile given the name" do
|
78
|
+
enable_conf_url = "http://admin:pass@www.somecompany.com/services/conf/brokerConfigurations/1"
|
79
|
+
stub_request(:get,enable_conf_url)
|
80
|
+
.with(:headers => {
|
81
|
+
'Accept'=>'application/xml',
|
82
|
+
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
83
|
+
'User-Agent'=>'Ruby',
|
84
|
+
'Content-Type'=>'*/*'
|
85
|
+
}, :query => {:opts => "active"})
|
86
|
+
.to_return(:status => 200, :body => File.new("spec/fixtures/brokerConfigurations.xml"), :headers => {})
|
87
|
+
|
88
|
+
active_conf_url = "http://admin:pass@www.somecompany.com/services/conf/brokerConfigurations"
|
89
|
+
stub_request(:get,active_conf_url)
|
90
|
+
.with(:headers => {
|
91
|
+
'Accept'=>'application/xml',
|
92
|
+
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
93
|
+
'User-Agent'=>'Ruby',
|
94
|
+
'Content-Type'=>'*/*'
|
95
|
+
}, :query => {:nameRepository => "gicat"})
|
96
|
+
.to_return(:status => 200, :body => File.new("spec/fixtures/brokerConfigurations.xml"), :headers => {})
|
97
|
+
|
98
|
+
conf_request_url = "http://www.somecompany.com/services/conf/giconf/configuration"
|
99
|
+
stub_request(:get,conf_request_url)
|
100
|
+
.with(:headers => {
|
101
|
+
'Accept'=>'*/*',
|
102
|
+
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
103
|
+
'User-Agent'=>'Ruby',
|
104
|
+
'Content-Type'=>'application/xml'
|
105
|
+
}).to_return(:status => 200, :body => "1", :headers => {})
|
106
|
+
|
107
|
+
@gi_cat.enable_profile "some_profile"
|
108
|
+
|
109
|
+
a_request(:get, active_conf_url).with(:query => {:nameRepository => "gicat"}).should have_been_made.once
|
110
|
+
expect(@gi_cat.get_active_profile_id).to eq "1"
|
111
|
+
end
|
112
|
+
|
113
|
+
it "enables Lucene for the active profile" do
|
114
|
+
enable_lucene_url = "http://admin:pass@www.somecompany.com/services/conf/brokerConfigurations/1/luceneEnabled"
|
115
|
+
stub_request(:put,enable_lucene_url)
|
116
|
+
.with(:headers => {
|
117
|
+
'Accept'=>'application/xml',
|
118
|
+
'User-Agent'=>'Ruby',
|
119
|
+
'Content-Type'=>'*/*'
|
120
|
+
}, :body => "true").to_return(:status => 200, :body => "", :headers => {})
|
121
|
+
|
122
|
+
conf_request_url = "http://www.somecompany.com/services/conf/giconf/configuration"
|
123
|
+
stub_request(:get,conf_request_url)
|
124
|
+
.with(:headers => {
|
125
|
+
'Accept'=>'*/*',
|
126
|
+
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
127
|
+
'User-Agent'=>'Ruby',
|
128
|
+
'Content-Type'=>'application/xml'
|
129
|
+
}).to_return(:status => 200, :body => "1", :headers => {})
|
130
|
+
|
131
|
+
enable_conf_url = "http://admin:pass@www.somecompany.com/services/conf/brokerConfigurations/1"
|
132
|
+
stub_request(:get,enable_conf_url)
|
133
|
+
.with(:headers => {
|
134
|
+
'Accept'=>'application/xml',
|
135
|
+
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
136
|
+
'User-Agent'=>'Faraday v0.8.7',
|
137
|
+
'Content-Type'=>'*/*'
|
138
|
+
}, :query => {:opts => "active"})
|
139
|
+
.to_return(:status => 200, :body => File.new("spec/fixtures/brokerConfigurations.xml"), :headers => {})
|
140
|
+
|
141
|
+
enable_conf_url = "http://www.somecompany.com/services/opensearchesip?bbox=&ct=&gdc=&lac=&loc=&luc=&outputFormat=&rel=&si=&st=arctic%20alaskan%20shrubs&te=&ts="
|
142
|
+
stub_request(:get,enable_conf_url)
|
143
|
+
.with(:headers => {
|
144
|
+
'Accept'=>'*/*',
|
145
|
+
'User-Agent'=>'Ruby'
|
146
|
+
}).to_return(:status => 200, :body => File.new("spec/fixtures/opensearchesip_lucene_enabled.xml"), :headers => {})
|
147
|
+
|
148
|
+
@gi_cat.enable_lucene
|
149
|
+
|
150
|
+
@gi_cat.is_lucene_enabled?.should be_true
|
151
|
+
end
|
152
|
+
|
153
|
+
end
|
49
154
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gi_cat_driver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,16 +10,16 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-04-
|
13
|
+
date: 2013-04-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
16
|
+
name: faraday
|
17
17
|
requirement: !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ~>
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
22
|
+
version: 0.8.7
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -27,7 +27,7 @@ dependencies:
|
|
27
27
|
requirements:
|
28
28
|
- - ~>
|
29
29
|
- !ruby/object:Gem::Version
|
30
|
-
version:
|
30
|
+
version: 0.8.7
|
31
31
|
- !ruby/object:Gem::Dependency
|
32
32
|
name: nokogiri
|
33
33
|
requirement: !ruby/object:Gem::Requirement
|
@@ -156,6 +156,22 @@ dependencies:
|
|
156
156
|
- - ~>
|
157
157
|
- !ruby/object:Gem::Version
|
158
158
|
version: 0.8.2
|
159
|
+
- !ruby/object:Gem::Dependency
|
160
|
+
name: webmock
|
161
|
+
requirement: !ruby/object:Gem::Requirement
|
162
|
+
none: false
|
163
|
+
requirements:
|
164
|
+
- - ~>
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: 1.11.0
|
167
|
+
type: :development
|
168
|
+
prerelease: false
|
169
|
+
version_requirements: !ruby/object:Gem::Requirement
|
170
|
+
none: false
|
171
|
+
requirements:
|
172
|
+
- - ~>
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: 1.11.0
|
159
175
|
description: Configure and control deployed instances of GI-Cat.
|
160
176
|
email:
|
161
177
|
- stuart.reed@nsidc.org
|
@@ -177,6 +193,9 @@ files:
|
|
177
193
|
- lib/gi_cat_driver/esip_opensearch_query_builder.rb
|
178
194
|
- lib/gi_cat_driver/version.rb
|
179
195
|
- spec/esip_opensearch_query_builder_spec.rb
|
196
|
+
- spec/fixtures/brokerConfigurations.xml
|
197
|
+
- spec/fixtures/opensearchesip_lucene_disabled.xml
|
198
|
+
- spec/fixtures/opensearchesip_lucene_enabled.xml
|
180
199
|
- spec/gi_cat_driver_spec.rb
|
181
200
|
- spec/spec_helper.rb
|
182
201
|
homepage: ''
|
@@ -206,5 +225,8 @@ specification_version: 3
|
|
206
225
|
summary: Configure and control deployed instances of GI-Cat.
|
207
226
|
test_files:
|
208
227
|
- spec/esip_opensearch_query_builder_spec.rb
|
228
|
+
- spec/fixtures/brokerConfigurations.xml
|
229
|
+
- spec/fixtures/opensearchesip_lucene_disabled.xml
|
230
|
+
- spec/fixtures/opensearchesip_lucene_enabled.xml
|
209
231
|
- spec/gi_cat_driver_spec.rb
|
210
232
|
- spec/spec_helper.rb
|