geo_concerns 0.0.10 → 0.1.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/.rubocop.yml +1 -0
- data/.travis.yml +8 -4
- data/README.md +23 -8
- data/app/controllers/concerns/geo_concerns/messenger_behavior.rb +29 -0
- data/app/jobs/delivery_job.rb +15 -2
- data/app/jobs/geoblacklight_job.rb +10 -0
- data/app/models/concerns/geo_concerns/file_set/derivatives.rb +11 -9
- data/app/models/concerns/geo_concerns/solr_document_behavior.rb +5 -0
- data/app/presenters/geo_concerns/geo_concerns_show_presenter.rb +1 -1
- data/app/processors/geo_concerns/processors/base_geo_processor.rb +9 -24
- data/app/processors/geo_concerns/processors/image.rb +59 -0
- data/app/processors/geo_concerns/processors/ogr.rb +1 -1
- data/app/processors/geo_concerns/processors/raster.rb +18 -3
- data/app/processors/geo_concerns/processors/raster/base.rb +1 -0
- data/app/processors/geo_concerns/processors/rendering.rb +79 -0
- data/app/processors/geo_concerns/processors/vector.rb +16 -3
- data/app/processors/geo_concerns/processors/vector/base.rb +3 -2
- data/app/processors/geo_concerns/processors/vector/info.rb +21 -3
- data/app/services/geo_concerns/delivery/geoserver.rb +43 -6
- data/app/services/geo_concerns/discovery/abstract_document.rb +2 -1
- data/app/services/geo_concerns/discovery/document_builder.rb +2 -3
- data/app/services/geo_concerns/discovery/document_builder/basic_metadata_builder.rb +13 -2
- data/app/services/geo_concerns/discovery/document_builder/date_builder.rb +2 -0
- data/app/services/geo_concerns/discovery/document_builder/document_path.rb +12 -7
- data/app/services/geo_concerns/discovery/document_builder/references_builder.rb +20 -1
- data/app/services/geo_concerns/discovery/document_builder/spatial_builder.rb +2 -0
- data/app/services/geo_concerns/discovery/document_builder/wxs.rb +81 -0
- data/app/services/geo_concerns/discovery/geoblacklight_document.rb +9 -3
- data/app/services/geo_concerns/events_generator.rb +25 -0
- data/app/services/geo_concerns/events_generator/base_events_generator.rb +22 -0
- data/app/services/geo_concerns/events_generator/composite_generator.rb +18 -0
- data/app/services/geo_concerns/events_generator/geoblacklight_event_generator.rb +44 -0
- data/app/services/geo_concerns/events_generator/geoserver_event_generator.rb +30 -0
- data/app/services/geo_concerns/local_messaging_client.rb +18 -0
- data/app/services/geo_concerns/rabbit_messaging_client.rb +38 -0
- data/app/values/geo_concerns/time_period.rb +4 -5
- data/app/views/geo_concerns/_attribute_rows.html.erb +1 -0
- data/app/views/geo_concerns/_form_additional_information.html.erb +1 -0
- data/app/views/geo_concerns/file_sets/actions/_default_actions.html.erb +1 -1
- data/app/views/geo_concerns/file_sets/actions/_image_actions.html.erb +1 -1
- data/app/views/geo_concerns/file_sets/actions/_metadata_actions.html.erb +1 -1
- data/app/views/geo_concerns/file_sets/actions/_raster_actions.html.erb +2 -2
- data/app/views/geo_concerns/file_sets/actions/_vector_actions.html.erb +2 -2
- data/app/views/geo_concerns/file_sets/media_display/_geo.html.erb +2 -1
- data/docker-compose-full.yml +30 -0
- data/docker-compose.yml +4 -5
- data/geo_concerns.gemspec +5 -4
- data/lib/generators/geo_concerns/install_generator.rb +19 -25
- data/lib/generators/geo_concerns/templates/config/geoblacklight.yml +12 -0
- data/lib/generators/geo_concerns/templates/config/geoserver.yml +2 -0
- data/lib/generators/geo_concerns/templates/config/initializers/geoblacklight_config.rb +13 -0
- data/lib/generators/geo_concerns/templates/config/initializers/messaging_config.rb +34 -0
- data/lib/generators/geo_concerns/templates/config/initializers/simpler_tiles.rb +65 -0
- data/lib/generators/geo_concerns/templates/config/messaging.yml +15 -0
- data/lib/generators/geo_concerns/templates/config/simpler_tiles.yml +24 -0
- data/lib/generators/geo_concerns/templates/controllers/curation_concerns/file_sets_controller.rb +1 -0
- data/lib/generators/geo_concerns/templates/controllers/curation_concerns/image_works_controller.rb +1 -0
- data/lib/generators/geo_concerns/templates/controllers/curation_concerns/raster_works_controller.rb +1 -0
- data/lib/generators/geo_concerns/templates/controllers/curation_concerns/vector_works_controller.rb +1 -0
- data/lib/geo_concerns/version.rb +1 -1
- data/run-docker.sh +11 -1
- data/spec/controllers/file_sets_controller_spec.rb +50 -0
- data/spec/jobs/delivery_job_spec.rb +30 -7
- data/spec/models/concerns/geo_concerns/file_set/derivatives_spec.rb +9 -3
- data/spec/models/solr_document_spec.rb +6 -0
- data/spec/processors/geo_concerns/processors/base_geo_processor_spec.rb +15 -22
- data/spec/processors/geo_concerns/processors/image_spec.rb +71 -0
- data/spec/processors/geo_concerns/processors/rendering_spec.rb +64 -0
- data/spec/processors/geo_concerns/processors/vector/base_spec.rb +1 -1
- data/spec/processors/geo_concerns/processors/vector/info_spec.rb +10 -1
- data/spec/services/geo_concerns/delivery/geoserver_spec.rb +30 -6
- data/spec/services/{derivative_path_spec.rb → geo_concerns/derivative_path_spec.rb} +0 -0
- data/spec/services/geo_concerns/discovery/document_builder/wxs_spec.rb +69 -0
- data/spec/services/geo_concerns/discovery/document_builder_spec.rb +48 -32
- data/spec/services/geo_concerns/discovery/geoblacklight_document_spec.rb +1 -0
- data/spec/services/geo_concerns/events_generator/geoblacklight_event_generator_spec.rb +87 -0
- data/spec/services/geo_concerns/events_generator/geoserver_event_generator_spec.rb +40 -0
- data/spec/services/geo_concerns/local_messaging_client_spec.rb +35 -0
- data/spec/services/geo_concerns/rabbit_messaging_client_spec.rb +35 -0
- data/spec/services/{raster_format_service_spec.rb → geo_concerns/raster_format_service_spec.rb} +0 -0
- data/template.rb +1 -1
- metadata +85 -31
- data/app/processors/geo_concerns/processors/mapnik.rb +0 -35
- data/app/processors/geo_concerns/processors/raster/processor.rb +0 -26
- data/app/processors/geo_concerns/processors/vector/processor.rb +0 -24
- data/lib/generators/geo_concerns/templates/config/locales/geo_concerns.en.yml +0 -4
- data/lib/generators/geo_concerns/templates/config/mapnik.yml +0 -24
- data/spec/processors/geo_concerns/processors/mapnik_spec.rb +0 -70
|
@@ -11,6 +11,8 @@ geoserver:
|
|
|
11
11
|
geowebcache_url: <%= ENV['PUBLIC_GEOSERVER_GWC_URL'] || "builtin" %>
|
|
12
12
|
# Name of the workspace to save your data in
|
|
13
13
|
workspace: <%= ENV['PUBLIC_GEOSERVER_WS'] || "public" %>
|
|
14
|
+
# Path on geoserver machine to mounted/mirrored derivates directory
|
|
15
|
+
derivatives_path: <%= ENV['PUBLIC_GEOSERVER_DERIVATIVES_PATH'] || "/opt/geoserver/data_dir/derivatives" %>
|
|
14
16
|
restclient:
|
|
15
17
|
# Set to false to disable or stdout, stderr, or filename
|
|
16
18
|
logfile: stderr
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module Geoblacklight
|
|
2
|
+
def config
|
|
3
|
+
@config ||= config_yaml.with_indifferent_access
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
private
|
|
7
|
+
|
|
8
|
+
def config_yaml
|
|
9
|
+
YAML.load(ERB.new(File.read("#{Rails.root}/config/geoblacklight.yml")).result)[Rails.env]
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
module_function :config, :config_yaml
|
|
13
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
module Messaging
|
|
2
|
+
def config
|
|
3
|
+
@config ||= config_yaml.with_indifferent_access
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
def messenger
|
|
7
|
+
GeoConcerns::EventsGenerator.new
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def geoblacklight_client
|
|
11
|
+
local_client
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def geoserver_client
|
|
15
|
+
local_client
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
private
|
|
19
|
+
|
|
20
|
+
def config_yaml
|
|
21
|
+
YAML.load(ERB.new(File.read("#{Rails.root}/config/messaging.yml")).result)[Rails.env]
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def local_client
|
|
25
|
+
GeoConcerns::LocalMessagingClient.new
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def rabbit_client
|
|
29
|
+
GeoConcerns::RabbitMessagingClient.new(Messaging.config['events']['server'])
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
module_function :config, :config_yaml, :messenger, :local_client,
|
|
33
|
+
:rabbit_client, :geoblacklight_client, :geoserver_client
|
|
34
|
+
end
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
module SimplerTiles
|
|
2
|
+
class << self
|
|
3
|
+
def config
|
|
4
|
+
@config ||= Configuration.new
|
|
5
|
+
end
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
class Configuration
|
|
9
|
+
attr_reader :settings
|
|
10
|
+
attr_writer :bg_color,
|
|
11
|
+
:fill,
|
|
12
|
+
:stroke,
|
|
13
|
+
:weight,
|
|
14
|
+
:line_cap,
|
|
15
|
+
:line_join,
|
|
16
|
+
:radius
|
|
17
|
+
|
|
18
|
+
def initialize
|
|
19
|
+
@settings ||= File.exist?(config_file) ? YAML.load_file(config_file) : {}
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def config_file
|
|
23
|
+
File.join(Rails.root, 'config/simpler_tiles.yml')
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def to_h
|
|
27
|
+
{
|
|
28
|
+
'stroke' => stroke,
|
|
29
|
+
'line-cap' => line_cap,
|
|
30
|
+
'line-join' => line_join,
|
|
31
|
+
'weight' => weight,
|
|
32
|
+
'fill' => fill,
|
|
33
|
+
'radius' => radius
|
|
34
|
+
}
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def bg_color
|
|
38
|
+
@bg_color ||= settings.fetch('bg_color', '#ffffff00')
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def fill
|
|
42
|
+
@fill ||= settings.fetch('fill', '#e4e3ea')
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def stroke
|
|
46
|
+
@stroke ||= settings.fetch('stroke', '#483d8b')
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def weight
|
|
50
|
+
@weight ||= settings.fetch('weight', '0.3')
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def line_cap
|
|
54
|
+
@line_cap ||= settings.fetch('line_cap', 'square')
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def line_join
|
|
58
|
+
@line_join ||= settings.fetch('line_join', 'miter')
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def radius
|
|
62
|
+
@radius ||= settings.fetch('radius', '2')
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
defaults: &defaults
|
|
2
|
+
events:
|
|
3
|
+
server: <%= ENV['RABBIT_SERVER'] || 'amqp://localhost:5672' %>
|
|
4
|
+
exchange:
|
|
5
|
+
geoblacklight: 'gbl_events'
|
|
6
|
+
geoserver: 'geoserver_events'
|
|
7
|
+
|
|
8
|
+
development:
|
|
9
|
+
<<: *defaults
|
|
10
|
+
|
|
11
|
+
test:
|
|
12
|
+
<<: *defaults
|
|
13
|
+
|
|
14
|
+
production:
|
|
15
|
+
<<: *defaults
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Background color
|
|
2
|
+
# Use '#ffffff' for a solid white background.
|
|
3
|
+
# Add two zeros to a six digit hex color code
|
|
4
|
+
# for a png (does not work with jpeg) image
|
|
5
|
+
# with a transparent background.
|
|
6
|
+
bg_color: '#ffffff00'
|
|
7
|
+
|
|
8
|
+
# The fill color for each shape
|
|
9
|
+
fill: '#e4e3ea'
|
|
10
|
+
|
|
11
|
+
# The stroke color for each line
|
|
12
|
+
stroke: '#483d8b'
|
|
13
|
+
|
|
14
|
+
# Width of line in pixels
|
|
15
|
+
weight: '0.3'
|
|
16
|
+
|
|
17
|
+
# How lines are ended, one of: "butt", "round", "square"
|
|
18
|
+
line_cap: 'square'
|
|
19
|
+
|
|
20
|
+
# How lines are joined together, one of: "miter", "round", "bevel"
|
|
21
|
+
line_join: 'miter'
|
|
22
|
+
|
|
23
|
+
# For point rendering only, the radius in pixels of the circle
|
|
24
|
+
radius: '2'
|
data/lib/generators/geo_concerns/templates/controllers/curation_concerns/image_works_controller.rb
CHANGED
|
@@ -2,5 +2,6 @@ class CurationConcerns::ImageWorksController < ApplicationController
|
|
|
2
2
|
include CurationConcerns::CurationConcernController
|
|
3
3
|
include GeoConcerns::ImageWorksControllerBehavior
|
|
4
4
|
include GeoConcerns::GeoblacklightControllerBehavior
|
|
5
|
+
include GeoConcerns::MessengerBehavior
|
|
5
6
|
self.curation_concern_type = ImageWork
|
|
6
7
|
end
|
data/lib/generators/geo_concerns/templates/controllers/curation_concerns/raster_works_controller.rb
CHANGED
|
@@ -3,5 +3,6 @@ class CurationConcerns::RasterWorksController < ApplicationController
|
|
|
3
3
|
include CurationConcerns::ParentContainer
|
|
4
4
|
include GeoConcerns::RasterWorksControllerBehavior
|
|
5
5
|
include GeoConcerns::GeoblacklightControllerBehavior
|
|
6
|
+
include GeoConcerns::MessengerBehavior
|
|
6
7
|
self.curation_concern_type = RasterWork
|
|
7
8
|
end
|
data/lib/generators/geo_concerns/templates/controllers/curation_concerns/vector_works_controller.rb
CHANGED
|
@@ -3,5 +3,6 @@ class CurationConcerns::VectorWorksController < ApplicationController
|
|
|
3
3
|
include CurationConcerns::ParentContainer
|
|
4
4
|
include GeoConcerns::VectorWorksControllerBehavior
|
|
5
5
|
include GeoConcerns::GeoblacklightControllerBehavior
|
|
6
|
+
include GeoConcerns::MessengerBehavior
|
|
6
7
|
self.curation_concern_type = VectorWork
|
|
7
8
|
end
|
data/lib/geo_concerns/version.rb
CHANGED
data/run-docker.sh
CHANGED
|
@@ -2,5 +2,15 @@
|
|
|
2
2
|
docker-machine start
|
|
3
3
|
eval $(docker-machine env)
|
|
4
4
|
docker-compose up -d
|
|
5
|
-
# forward geoserver
|
|
5
|
+
# forward geoserver docker port in the background
|
|
6
6
|
docker-machine ssh default -f -N -L 8181:localhost:8181
|
|
7
|
+
|
|
8
|
+
# redis
|
|
9
|
+
# docker-machine ssh default -f -N -L 6379:localhost:6379
|
|
10
|
+
|
|
11
|
+
# rabbitmq
|
|
12
|
+
# docker-machine ssh default -f -N -L 5672:localhost:5672
|
|
13
|
+
# docker-machine ssh default -f -N -L 15672:localhost:15672
|
|
14
|
+
|
|
15
|
+
# geoblacklight
|
|
16
|
+
# docker-machine ssh default -f -N -L 3001:localhost:3001
|
|
@@ -2,6 +2,7 @@ require 'spec_helper'
|
|
|
2
2
|
|
|
3
3
|
describe CurationConcerns::FileSetsController, type: :controller do
|
|
4
4
|
let(:user) { FactoryGirl.create(:user) }
|
|
5
|
+
let(:parent) { FactoryGirl.build(:public_vector_work) }
|
|
5
6
|
|
|
6
7
|
subject { described_class.new }
|
|
7
8
|
|
|
@@ -17,4 +18,53 @@ describe CurationConcerns::FileSetsController, type: :controller do
|
|
|
17
18
|
subject.new
|
|
18
19
|
end
|
|
19
20
|
end
|
|
21
|
+
|
|
22
|
+
describe 'messaging' do
|
|
23
|
+
let(:messenger) { instance_double(GeoConcerns::EventsGenerator) }
|
|
24
|
+
|
|
25
|
+
before do
|
|
26
|
+
sign_in user
|
|
27
|
+
allow(Messaging).to receive(:messenger).and_return(messenger)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
context 'after updating metadata' do
|
|
31
|
+
let!(:file_set) do
|
|
32
|
+
file_set = FileSet.create do |gf|
|
|
33
|
+
gf.apply_depositor_metadata(user)
|
|
34
|
+
gf.visibility = Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE
|
|
35
|
+
end
|
|
36
|
+
parent.ordered_members << file_set
|
|
37
|
+
parent.save
|
|
38
|
+
file_set
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
after do
|
|
42
|
+
file_set.destroy
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
it 'calls the record_updated messenger method' do
|
|
46
|
+
expect(messenger).to receive(:record_updated)
|
|
47
|
+
post :update, params: {
|
|
48
|
+
id: file_set,
|
|
49
|
+
file_set: { title: ['new_title'], keyword: [''], permissions_attributes: [{ type: 'person', name: 'archivist1', access: 'edit' }] }
|
|
50
|
+
}
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
context 'when destroying the file set' do
|
|
55
|
+
let(:file_set) do
|
|
56
|
+
file_set = FileSet.create! do |gf|
|
|
57
|
+
gf.apply_depositor_metadata(user)
|
|
58
|
+
end
|
|
59
|
+
parent.ordered_members << file_set
|
|
60
|
+
parent.save
|
|
61
|
+
file_set
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
it 'calls the record_deleted messenger method' do
|
|
65
|
+
expect(messenger).to receive(:record_deleted)
|
|
66
|
+
delete :destroy, params: { id: file_set }
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
20
70
|
end
|
|
@@ -2,16 +2,39 @@ require 'spec_helper'
|
|
|
2
2
|
require 'uri'
|
|
3
3
|
|
|
4
4
|
describe GeoConcerns::DeliveryJob do
|
|
5
|
-
let(:
|
|
5
|
+
let(:message) { { 'id' => 'abcdefg', 'event' => 'CREATED', "exchange" => :geoserver } }
|
|
6
|
+
let(:content_url) { 'file:/somewhere-to-display-copy' }
|
|
7
|
+
let(:file_format) { 'application/zip; ogr-format="ESRI Shapefile"' }
|
|
8
|
+
let(:file_set) { instance_double(FileSet, derivative_url: content_url, geo_mime_type: file_format) }
|
|
6
9
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
before do
|
|
11
|
+
allow(ActiveFedora::Base).to receive(:find).and_return(file_set)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
describe '#perform' do
|
|
15
|
+
let(:service) { instance_double('GeoConcerns::DeliveryService') }
|
|
16
|
+
context 'local vector file' do
|
|
11
17
|
it 'delegates to DeliveryService' do
|
|
12
18
|
expect(GeoConcerns::DeliveryService).to receive(:new).with(file_set, URI(content_url).path).and_return(service)
|
|
13
19
|
expect(service).to receive(:publish)
|
|
14
|
-
subject.perform(
|
|
20
|
+
subject.perform(message)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
context 'local raster file' do
|
|
25
|
+
let(:file_format) { 'image/tiff; gdal-format=GTiff' }
|
|
26
|
+
it 'delegates to DeliveryService' do
|
|
27
|
+
expect(GeoConcerns::DeliveryService).to receive(:new).with(file_set, URI(content_url).path).and_return(service)
|
|
28
|
+
expect(service).to receive(:publish)
|
|
29
|
+
subject.perform(message)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
context 'local image file' do
|
|
34
|
+
let(:file_format) { 'image/jpeg' }
|
|
35
|
+
it 'delegates to DeliveryService' do
|
|
36
|
+
expect(GeoConcerns::DeliveryService).not_to receive(:new)
|
|
37
|
+
expect { subject.perform(message) }.to raise_error(NotImplementedError, /Only supports vector/)
|
|
15
38
|
end
|
|
16
39
|
end
|
|
17
40
|
|
|
@@ -19,7 +42,7 @@ describe GeoConcerns::DeliveryJob do
|
|
|
19
42
|
let(:content_url) { 'http://somewhere/to-display-copy' }
|
|
20
43
|
it 'errors out' do
|
|
21
44
|
expect(GeoConcerns::DeliveryService).not_to receive(:new)
|
|
22
|
-
expect { subject.perform(
|
|
45
|
+
expect { subject.perform(message) }.to raise_error(NotImplementedError, /Only supports file URLs/)
|
|
23
46
|
end
|
|
24
47
|
end
|
|
25
48
|
end
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
shared_examples 'a set of raster derivatives' do
|
|
4
|
+
let(:messenger) { instance_double(GeoConcerns::EventsGenerator) }
|
|
4
5
|
before do
|
|
5
|
-
|
|
6
|
+
allow(Messaging).to receive(:messenger).and_return(messenger)
|
|
7
|
+
expect(messenger).to receive(:derivatives_created).with(file_set)
|
|
6
8
|
end
|
|
7
9
|
it 'makes a thumbnail' do
|
|
8
10
|
new_thumb = "#{Rails.root}/tmp/derivatives/#{file_set.id}/thumbnail.thumbnail"
|
|
@@ -22,8 +24,10 @@ shared_examples 'a set of raster derivatives' do
|
|
|
22
24
|
end
|
|
23
25
|
|
|
24
26
|
shared_examples 'a set of vector derivatives' do
|
|
27
|
+
let(:messenger) { instance_double(GeoConcerns::EventsGenerator) }
|
|
25
28
|
before do
|
|
26
|
-
|
|
29
|
+
allow(Messaging).to receive(:messenger).and_return(messenger)
|
|
30
|
+
expect(messenger).to receive(:derivatives_created).with(file_set)
|
|
27
31
|
end
|
|
28
32
|
it 'makes a thumbnail' do
|
|
29
33
|
new_thumb = "#{Rails.root}/tmp/derivatives/#{file_set.id}/thumbnail.thumbnail"
|
|
@@ -43,8 +47,10 @@ shared_examples 'a set of vector derivatives' do
|
|
|
43
47
|
end
|
|
44
48
|
|
|
45
49
|
shared_examples 'a set of image derivatives' do
|
|
50
|
+
let(:messenger) { instance_double(GeoConcerns::EventsGenerator) }
|
|
46
51
|
before do
|
|
47
|
-
|
|
52
|
+
allow(Messaging).to receive(:messenger).and_return(messenger)
|
|
53
|
+
expect(messenger).to receive(:derivatives_created).with(file_set)
|
|
48
54
|
end
|
|
49
55
|
it 'makes a thumbnail' do
|
|
50
56
|
new_thumb = "#{Rails.root}/tmp/derivatives/#{file_set.id}/thumbnail.thumbnail"
|
|
@@ -32,4 +32,10 @@ describe SolrDocument do
|
|
|
32
32
|
subject { document.provenance }
|
|
33
33
|
it { is_expected.to eq 'Your Institution' }
|
|
34
34
|
end
|
|
35
|
+
|
|
36
|
+
describe "identifier" do
|
|
37
|
+
let(:attributes) { { Solrizer.solr_name('identifier') => ['identifier'] } }
|
|
38
|
+
subject { document.identifier }
|
|
39
|
+
it { is_expected.to match_array ['identifier'] }
|
|
40
|
+
end
|
|
35
41
|
end
|
|
@@ -38,28 +38,6 @@ describe GeoConcerns::Processors::BaseGeoProcessor do
|
|
|
38
38
|
end
|
|
39
39
|
end
|
|
40
40
|
|
|
41
|
-
describe '#convert' do
|
|
42
|
-
let(:image) { double }
|
|
43
|
-
|
|
44
|
-
before do
|
|
45
|
-
allow(MiniMagick::Image).to receive(:open).and_return(image)
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
it 'transforms the image and saves it as a PNG' do
|
|
49
|
-
expect(image).to receive(:format).with('png')
|
|
50
|
-
expect(image).to receive(:combine_options)
|
|
51
|
-
expect(image).to receive(:write).with(output_file_png)
|
|
52
|
-
subject.class.convert(file_name, output_file_png, options)
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
it 'transforms the image and saves it as a JPG' do
|
|
56
|
-
expect(image).to receive(:format).with('jpg')
|
|
57
|
-
expect(image).to receive(:combine_options)
|
|
58
|
-
expect(image).to receive(:write).with(output_file_jpg)
|
|
59
|
-
subject.class.convert(file_name, output_file_jpg, options)
|
|
60
|
-
end
|
|
61
|
-
end
|
|
62
|
-
|
|
63
41
|
describe '#temp_path' do
|
|
64
42
|
it 'returns a path to a temporary file based on the input file' do
|
|
65
43
|
expect(subject.class.temp_path(output_file))
|
|
@@ -105,6 +83,21 @@ describe GeoConcerns::Processors::BaseGeoProcessor do
|
|
|
105
83
|
end
|
|
106
84
|
end
|
|
107
85
|
|
|
86
|
+
describe '#id' do
|
|
87
|
+
context 'when directives hash has an id value' do
|
|
88
|
+
let(:directives) { { id: '123456' } }
|
|
89
|
+
it 'returns that value' do
|
|
90
|
+
expect(subject.id).to eq('123456')
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
context 'when directives hash does not have an id value' do
|
|
95
|
+
it 'returns nil' do
|
|
96
|
+
expect(subject.id).to be_nil
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
|
|
108
101
|
describe '#basename' do
|
|
109
102
|
it 'returns the base file name of the source file' do
|
|
110
103
|
expect(subject.basename).to eq('geo')
|