geo_works 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.codeclimate.yml +34 -0
- data/.csslintrc +2 -0
- data/.engine_cart.yml +1 -0
- data/.eslintignore +1 -0
- data/.eslintrc +8 -0
- data/.fcrepo_wrapper +3 -0
- data/.gitignore +14 -0
- data/.rubocop.yml +105 -0
- data/.solr_wrapper +7 -0
- data/.travis.yml +33 -0
- data/CONTRIBUTING.md +159 -0
- data/Gemfile +48 -0
- data/LICENSE +202 -0
- data/README.md +143 -0
- data/Rakefile +25 -0
- data/app/assets/images/geo_works/.keep +0 -0
- data/app/assets/images/geo_works/images/geocoder.png +0 -0
- data/app/assets/images/geo_works/images/move-handle.png +0 -0
- data/app/assets/images/geo_works/images/resize-handle.png +0 -0
- data/app/assets/images/geo_works/images/throbber.gif +0 -0
- data/app/assets/javascripts/geo_works/Control.Geocoder.js +1056 -0
- data/app/assets/javascripts/geo_works/application.js +4 -0
- data/app/assets/javascripts/geo_works/bounding_box_selector.js +107 -0
- data/app/assets/javascripts/geo_works/es6-modules.js +7 -0
- data/app/assets/javascripts/geo_works/geo_works_boot.es6 +8 -0
- data/app/assets/javascripts/geo_works/leaflet-boundingbox.js +467 -0
- data/app/assets/javascripts/geo_works/relationships.js +3 -0
- data/app/assets/javascripts/geo_works/relationships/child_works.es6 +20 -0
- data/app/assets/javascripts/geo_works/relationships/parent_works.es6 +20 -0
- data/app/assets/javascripts/geo_works/relationships/related_works.es6 +187 -0
- data/app/assets/stylesheets/geo_works/Control.Geocoder.scss +104 -0
- data/app/assets/stylesheets/geo_works/application.css +18 -0
- data/app/assets/stylesheets/geo_works/bounding_box.scss +15 -0
- data/app/assets/stylesheets/geo_works/leaflet-boundingbox.scss +17 -0
- data/app/assets/stylesheets/geo_works/related_works.scss +29 -0
- data/app/assets/stylesheets/geo_works/thumbnails.scss +13 -0
- data/app/controllers/concerns/geo_works/events_behavior.rb +29 -0
- data/app/controllers/concerns/geo_works/file_sets_controller_behavior.rb +31 -0
- data/app/controllers/concerns/geo_works/geoblacklight_controller_behavior.rb +29 -0
- data/app/controllers/concerns/geo_works/image_works_controller_behavior.rb +9 -0
- data/app/controllers/concerns/geo_works/raster_works_controller_behavior.rb +9 -0
- data/app/controllers/concerns/geo_works/vector_works_controller_behavior.rb +9 -0
- data/app/forms/geo_works/basic_geo_metadata_form.rb +9 -0
- data/app/forms/geo_works/external_metadata_file_form.rb +8 -0
- data/app/forms/geo_works/georeferenced_form.rb +9 -0
- data/app/forms/hyrax/image_work_form.rb +7 -0
- data/app/forms/hyrax/raster_work_form.rb +8 -0
- data/app/forms/hyrax/vector_work_form.rb +8 -0
- data/app/helpers/geo_works/application_helper.rb +4 -0
- data/app/helpers/geo_works/bounding_box_helper.rb +73 -0
- data/app/helpers/geo_works/file_set_actions_helper.rb +31 -0
- data/app/helpers/geo_works/geo_works_helper.rb +22 -0
- data/app/helpers/geo_works/populate_metadata_helper.rb +7 -0
- data/app/jobs/geoblacklight_job.rb +10 -0
- data/app/jobs/geoserver_delivery_job.rb +36 -0
- data/app/models/concerns/geo_works/ability.rb +12 -0
- data/app/models/concerns/geo_works/basic_geo_metadata.rb +21 -0
- data/app/models/concerns/geo_works/external_metadata_file_behavior.rb +31 -0
- data/app/models/concerns/geo_works/extractors/fgdc_helper.rb +9 -0
- data/app/models/concerns/geo_works/extractors/fgdc_metadata_extractor.rb +114 -0
- data/app/models/concerns/geo_works/extractors/iso19139_helper.rb +50 -0
- data/app/models/concerns/geo_works/extractors/mods_helper.rb +15 -0
- data/app/models/concerns/geo_works/file_set_metadata.rb +15 -0
- data/app/models/concerns/geo_works/file_set_presenter_behavior.rb +7 -0
- data/app/models/concerns/geo_works/geo_file_format_behavior.rb +37 -0
- data/app/models/concerns/geo_works/geo_file_set_behavior.rb +11 -0
- data/app/models/concerns/geo_works/georeferenced_behavior.rb +18 -0
- data/app/models/concerns/geo_works/image_file_behavior.rb +14 -0
- data/app/models/concerns/geo_works/image_work_behavior.rb +69 -0
- data/app/models/concerns/geo_works/metadata_extraction_helper.rb +27 -0
- data/app/models/concerns/geo_works/raster_file_behavior.rb +14 -0
- data/app/models/concerns/geo_works/raster_work_behavior.rb +82 -0
- data/app/models/concerns/geo_works/solr_document_behavior.rb +46 -0
- data/app/models/concerns/geo_works/vector_file_behavior.rb +14 -0
- data/app/models/concerns/geo_works/vector_work_behavior.rb +78 -0
- data/app/presenters/geo_works/geo_works_show_presenter.rb +48 -0
- data/app/presenters/geo_works/image_work_show_presenter.rb +5 -0
- data/app/presenters/geo_works/raster_work_show_presenter.rb +5 -0
- data/app/presenters/geo_works/vector_work_show_presenter.rb +5 -0
- data/app/processors/geo_works/geoblacklight_event_processor.rb +29 -0
- data/app/processors/geo_works/geoblacklight_event_processor/delete_processor.rb +13 -0
- data/app/processors/geo_works/geoblacklight_event_processor/processor.rb +28 -0
- data/app/processors/geo_works/geoblacklight_event_processor/unknown_event.rb +15 -0
- data/app/processors/geo_works/geoblacklight_event_processor/update_processor.rb +15 -0
- data/app/processors/geo_works/processors/base_geo_processor.rb +81 -0
- data/app/processors/geo_works/processors/gdal.rb +49 -0
- data/app/processors/geo_works/processors/image.rb +66 -0
- data/app/processors/geo_works/processors/ogr.rb +19 -0
- data/app/processors/geo_works/processors/raster.rb +26 -0
- data/app/processors/geo_works/processors/raster/aig.rb +40 -0
- data/app/processors/geo_works/processors/raster/base.rb +41 -0
- data/app/processors/geo_works/processors/raster/dem.rb +29 -0
- data/app/processors/geo_works/processors/raster/info.rb +52 -0
- data/app/processors/geo_works/processors/rendering.rb +79 -0
- data/app/processors/geo_works/processors/vector.rb +24 -0
- data/app/processors/geo_works/processors/vector/base.rb +44 -0
- data/app/processors/geo_works/processors/vector/info.rb +84 -0
- data/app/processors/geo_works/processors/vector/shapefile.rb +20 -0
- data/app/processors/geo_works/processors/zip.rb +29 -0
- data/app/renderers/geo_works/coverage_renderer.rb +39 -0
- data/app/runners/geo_works/runners/raster_derivatives.rb +9 -0
- data/app/runners/geo_works/runners/vector_derivatives.rb +9 -0
- data/app/schemas/geo_works/basic_geo_metadata_optional.rb +40 -0
- data/app/schemas/geo_works/basic_geo_metadata_required.rb +25 -0
- data/app/schemas/geo_works/file_set_metadata_required.rb +5 -0
- data/app/services/geo_works/authority_service.rb +29 -0
- data/app/services/geo_works/delivery/geoserver.rb +118 -0
- data/app/services/geo_works/delivery_service.rb +11 -0
- data/app/services/geo_works/discovery.rb +4 -0
- data/app/services/geo_works/discovery/abstract_document.rb +37 -0
- data/app/services/geo_works/discovery/document_builder.rb +46 -0
- data/app/services/geo_works/discovery/document_builder/basic_metadata_builder.rb +71 -0
- data/app/services/geo_works/discovery/document_builder/composite_builder.rb +21 -0
- data/app/services/geo_works/discovery/document_builder/date_builder.rb +53 -0
- data/app/services/geo_works/discovery/document_builder/document_helper.rb +10 -0
- data/app/services/geo_works/discovery/document_builder/document_path.rb +91 -0
- data/app/services/geo_works/discovery/document_builder/layer_info_builder.rb +65 -0
- data/app/services/geo_works/discovery/document_builder/references_builder.rb +101 -0
- data/app/services/geo_works/discovery/document_builder/slug_builder.rb +24 -0
- data/app/services/geo_works/discovery/document_builder/spatial_builder.rb +37 -0
- data/app/services/geo_works/discovery/document_builder/wxs.rb +76 -0
- data/app/services/geo_works/discovery/geoblacklight_document.rb +152 -0
- data/app/services/geo_works/events_generator.rb +24 -0
- data/app/services/geo_works/events_generator/composite_generator.rb +18 -0
- data/app/services/geo_works/events_generator/geoblacklight_event_generator.rb +53 -0
- data/app/services/geo_works/events_generator/geoserver_event_generator.rb +33 -0
- data/app/services/geo_works/file_set_derivatives_service.rb +67 -0
- data/app/services/geo_works/image_format_service.rb +6 -0
- data/app/services/geo_works/metadata_format_service.rb +6 -0
- data/app/services/geo_works/raster_format_service.rb +6 -0
- data/app/services/geo_works/vector_format_service.rb +6 -0
- data/app/services/hyrax/curation_concern.rb +18 -0
- data/app/values/geo_works/coverage.rb +36 -0
- data/app/values/geo_works/time_period.rb +30 -0
- data/app/views/geo_works/_attribute_rows.html.erb +4 -0
- data/app/views/geo_works/_form_progress.html.erb +50 -0
- data/app/views/geo_works/_guts4form.html.erb +47 -0
- data/app/views/geo_works/_member.html.erb +11 -0
- data/app/views/geo_works/_metadata.html.erb +13 -0
- data/app/views/geo_works/_relationships.html.erb +12 -0
- data/app/views/geo_works/_representative_media.html.erb +5 -0
- data/app/views/geo_works/file_sets/_form.html.erb +48 -0
- data/app/views/geo_works/file_sets/actions/_default_actions.html.erb +16 -0
- data/app/views/geo_works/file_sets/actions/_image_actions.html.erb +22 -0
- data/app/views/geo_works/file_sets/actions/_metadata_actions.html.erb +16 -0
- data/app/views/geo_works/file_sets/actions/_raster_actions.html.erb +25 -0
- data/app/views/geo_works/file_sets/actions/_vector_actions.html.erb +25 -0
- data/app/views/geo_works/file_sets/media_display/_geo.html.erb +16 -0
- data/app/views/geo_works/file_sets/new.html.erb +12 -0
- data/app/views/geo_works/related/_child_member.html.erb +13 -0
- data/app/views/geo_works/related/_child_works.html.erb +24 -0
- data/app/views/geo_works/related/_external_metadata_file_member.html.erb +11 -0
- data/app/views/geo_works/related/_external_metadata_files.html.erb +24 -0
- data/app/views/geo_works/related/_geo_files.html.erb +24 -0
- data/app/views/geo_works/related/_new_child_member.html.erb +22 -0
- data/app/views/geo_works/related/_new_parent_member.html.erb +13 -0
- data/app/views/geo_works/related/_parent_member.html.erb +13 -0
- data/app/views/geo_works/related/_parent_works.html.erb +22 -0
- data/app/views/hyrax/image_works/_file_actions.html.erb +8 -0
- data/app/views/hyrax/image_works/_form.html.erb +16 -0
- data/app/views/hyrax/image_works/_image_actions.html.erb +11 -0
- data/app/views/hyrax/image_works/_image_work.html.erb +2 -0
- data/app/views/hyrax/image_works/_show_actions.html.erb +22 -0
- data/app/views/hyrax/image_works/show.html.erb +31 -0
- data/app/views/hyrax/raster_works/_file_actions.html.erb +8 -0
- data/app/views/hyrax/raster_works/_form.html.erb +16 -0
- data/app/views/hyrax/raster_works/_raster_actions.html.erb +11 -0
- data/app/views/hyrax/raster_works/_raster_work.html.erb +2 -0
- data/app/views/hyrax/raster_works/_show_actions.html.erb +22 -0
- data/app/views/hyrax/raster_works/show.html.erb +31 -0
- data/app/views/hyrax/vector_works/_file_actions.html.erb +8 -0
- data/app/views/hyrax/vector_works/_form.html.erb +16 -0
- data/app/views/hyrax/vector_works/_show_actions.html.erb +22 -0
- data/app/views/hyrax/vector_works/_vector_actions.html.erb +11 -0
- data/app/views/hyrax/vector_works/_vector_work.html.erb +2 -0
- data/app/views/hyrax/vector_works/show.html.erb +31 -0
- data/app/views/records/edit_fields/_coverage.html.erb +3 -0
- data/app/views/records/edit_fields/_should_populate_metadata.html.erb +10 -0
- data/app/vocabs/geo_works/geo_terms.rb +12 -0
- data/config/discovery/geoblacklight-schema.json +214 -0
- data/config/fcrepo_wrapper_test.yml +3 -0
- data/config/geoblacklight.yml +12 -0
- data/config/geoserver.yml +27 -0
- data/config/initializers/geo_server.rb +17 -0
- data/config/initializers/geoblacklight_config.rb +18 -0
- data/config/initializers/simpler_tiles.rb +65 -0
- data/config/locales/image_work.en.yml +8 -0
- data/config/locales/raster_work.en.yml +8 -0
- data/config/locales/vector_work.en.yml +8 -0
- data/config/routes.rb +24 -0
- data/config/simpler_tiles.yml +24 -0
- data/config/solr_wrapper_test.yml +7 -0
- data/docker-compose-full.yml +30 -0
- data/docker-compose.yml +9 -0
- data/geo_works.gemspec +44 -0
- data/lib/generators/geo_works/install_generator.rb +152 -0
- data/lib/generators/geo_works/templates/actors/hyrax/actors/image_work_actor.rb +6 -0
- data/lib/generators/geo_works/templates/actors/hyrax/actors/raster_work_actor.rb +6 -0
- data/lib/generators/geo_works/templates/actors/hyrax/actors/vector_work_actor.rb +6 -0
- data/lib/generators/geo_works/templates/config/authorities/image_formats.yml +7 -0
- data/lib/generators/geo_works/templates/config/authorities/metadata_formats.yml +7 -0
- data/lib/generators/geo_works/templates/config/authorities/raster_formats.yml +13 -0
- data/lib/generators/geo_works/templates/config/authorities/vector_formats.yml +7 -0
- data/lib/generators/geo_works/templates/config/initializers/hyrax_derivative_path_monkey_patch.rb +18 -0
- data/lib/generators/geo_works/templates/controllers/hyrax/file_sets_controller.rb +7 -0
- data/lib/generators/geo_works/templates/controllers/hyrax/image_works_controller.rb +7 -0
- data/lib/generators/geo_works/templates/controllers/hyrax/raster_works_controller.rb +8 -0
- data/lib/generators/geo_works/templates/controllers/hyrax/vector_works_controller.rb +8 -0
- data/lib/generators/geo_works/templates/geo_works.js +1 -0
- data/lib/generators/geo_works/templates/geo_works.scss +3 -0
- data/lib/generators/geo_works/templates/models/file_set.rb +4 -0
- data/lib/generators/geo_works/templates/models/image_work.rb +7 -0
- data/lib/generators/geo_works/templates/models/raster_work.rb +8 -0
- data/lib/generators/geo_works/templates/models/vector_work.rb +8 -0
- data/lib/generators/geo_works/templates/presenters/file_set_presenter.rb +3 -0
- data/lib/generators/geo_works/templates/spec/actor_spec.rb.erb +9 -0
- data/lib/generators/geo_works/templates/spec/controller_spec.rb.erb +9 -0
- data/lib/generators/geo_works/templates/spec/model_spec.rb.erb +9 -0
- data/lib/geo_works.rb +9 -0
- data/lib/geo_works/engine.rb +4 -0
- data/lib/geo_works/version.rb +3 -0
- data/lib/tasks/geo_works_tasks.rake +4 -0
- data/run-docker.sh +16 -0
- data/solr/config/_rest_managed.json +3 -0
- data/solr/config/admin-extra.html +31 -0
- data/solr/config/elevate.xml +36 -0
- data/solr/config/mapping-ISOLatin1Accent.txt +246 -0
- data/solr/config/protwords.txt +21 -0
- data/solr/config/schema.xml +372 -0
- data/solr/config/scripts.conf +24 -0
- data/solr/config/solrconfig.xml +321 -0
- data/solr/config/spellings.txt +2 -0
- data/solr/config/stopwords.txt +58 -0
- data/solr/config/stopwords_en.txt +58 -0
- data/solr/config/synonyms.txt +31 -0
- data/solr/config/xslt/example.xsl +132 -0
- data/solr/config/xslt/example_atom.xsl +67 -0
- data/solr/config/xslt/example_rss.xsl +66 -0
- data/solr/config/xslt/luke.xsl +337 -0
- data/spec/controllers/file_sets_controller_spec.rb +70 -0
- data/spec/controllers/image_works_controller_spec.rb +40 -0
- data/spec/controllers/raster_works_controller_spec.rb +36 -0
- data/spec/controllers/vector_works_controller_spec.rb +69 -0
- data/spec/factories/collections.rb +17 -0
- data/spec/factories/external_metadata_files.rb +20 -0
- data/spec/factories/image_files.rb +32 -0
- data/spec/factories/image_works.rb +69 -0
- data/spec/factories/permission_templates.rb +41 -0
- data/spec/factories/raster_files.rb +35 -0
- data/spec/factories/raster_works.rb +88 -0
- data/spec/factories/sipity_entities.rb +7 -0
- data/spec/factories/users.rb +26 -0
- data/spec/factories/vector_files.rb +31 -0
- data/spec/factories/vector_works.rb +84 -0
- data/spec/factories/workflow_states.rb +6 -0
- data/spec/factories/workflows.rb +6 -0
- data/spec/features/create_image_work_spec.rb +34 -0
- data/spec/features/create_raster_work_spec.rb +35 -0
- data/spec/features/create_vector_work_spec.rb +34 -0
- data/spec/features/image_work_show_spec.rb +62 -0
- data/spec/features/raster_work_show_spec.rb +62 -0
- data/spec/features/vector_work_show_spec.rb +61 -0
- data/spec/forms/geo_works/basic_geo_metadata_form_spec.rb +31 -0
- data/spec/forms/geo_works/external_metadata_file_form_spec.rb +30 -0
- data/spec/forms/geo_works/georeferenced_form_spec.rb +33 -0
- data/spec/forms/hyrax/image_work_form_spec.rb +11 -0
- data/spec/forms/hyrax/raster_work_form_spec.rb +17 -0
- data/spec/forms/hyrax/vector_work_form_spec.rb +17 -0
- data/spec/helpers/bounding_box_helper_spec.rb +39 -0
- data/spec/helpers/geo_works/file_set_actions_helper_spec.rb +70 -0
- data/spec/helpers/geo_works/populate_metadata_helper_spec.rb +31 -0
- data/spec/helpers/geo_works_helper_spec.rb +30 -0
- data/spec/jobs/geoblacklight_job_spec.rb +18 -0
- data/spec/jobs/geoserver_delivery_job_spec.rb +45 -0
- data/spec/models/concerns/basic_geo_metadata_spec.rb +21 -0
- data/spec/models/concerns/geo_works/file_set/derivatives_spec.rb +102 -0
- data/spec/models/concerns/geo_works/file_set/geo_file_format_behavior_spec.rb +56 -0
- data/spec/models/external_metadata_file_spec.rb +118 -0
- data/spec/models/file_set_spec.rb +9 -0
- data/spec/models/image_file_spec.rb +48 -0
- data/spec/models/image_work_spec.rb +71 -0
- data/spec/models/raster_file_spec.rb +48 -0
- data/spec/models/raster_work_spec.rb +122 -0
- data/spec/models/solr_document_spec.rb +41 -0
- data/spec/models/vector_file_spec.rb +48 -0
- data/spec/models/vector_work_spec.rb +109 -0
- data/spec/presenters/file_set_presenter_spec.rb +13 -0
- data/spec/presenters/geo_works_show_presenter_spec.rb +46 -0
- data/spec/presenters/image_work_show_presenter_spec.rb +51 -0
- data/spec/presenters/raster_work_show_presenter_spec.rb +74 -0
- data/spec/presenters/vector_work_show_presenter_spec.rb +41 -0
- data/spec/processors/geo_works/geoblacklight_event_processor_spec.rb +80 -0
- data/spec/processors/geo_works/processors/base_geo_processor_spec.rb +115 -0
- data/spec/processors/geo_works/processors/gdal_spec.rb +59 -0
- data/spec/processors/geo_works/processors/image_spec.rb +64 -0
- data/spec/processors/geo_works/processors/ogr_spec.rb +36 -0
- data/spec/processors/geo_works/processors/raster/aig_spec.rb +35 -0
- data/spec/processors/geo_works/processors/raster/base_spec.rb +54 -0
- data/spec/processors/geo_works/processors/raster/dem_spec.rb +30 -0
- data/spec/processors/geo_works/processors/raster/info_spec.rb +35 -0
- data/spec/processors/geo_works/processors/raster/processor_spec.rb +39 -0
- data/spec/processors/geo_works/processors/rendering_spec.rb +64 -0
- data/spec/processors/geo_works/processors/vector/base_spec.rb +54 -0
- data/spec/processors/geo_works/processors/vector/info_spec.rb +50 -0
- data/spec/processors/geo_works/processors/vector/processor_spec.rb +28 -0
- data/spec/processors/geo_works/processors/vector/shapefile_spec.rb +17 -0
- data/spec/processors/geo_works/processors/zip_spec.rb +39 -0
- data/spec/renderers/geo_works/coverage_renderer_spec.rb +21 -0
- data/spec/services/geo_works/delivery/geoserver_spec.rb +117 -0
- data/spec/services/geo_works/delivery_service_spec.rb +24 -0
- data/spec/services/geo_works/discovery/abstract_document_spec.rb +23 -0
- data/spec/services/geo_works/discovery/document_builder/basic_metadata_builder_spec.rb +35 -0
- data/spec/services/geo_works/discovery/document_builder/wxs_spec.rb +71 -0
- data/spec/services/geo_works/discovery/document_builder_spec.rb +220 -0
- data/spec/services/geo_works/discovery/geoblacklight_document_spec.rb +20 -0
- data/spec/services/geo_works/event_generator_spec.rb +18 -0
- data/spec/services/geo_works/events_generator/geoblacklight_event_generator_spec.rb +84 -0
- data/spec/services/geo_works/events_generator/geoserver_event_generator_spec.rb +22 -0
- data/spec/services/geo_works/raster_format_service_spec.rb +13 -0
- data/spec/services/hyrax/derivative_path_spec.rb +26 -0
- data/spec/spec_helper.rb +77 -0
- data/spec/support/backport_test.rb +14 -0
- data/spec/support/controllers/engine_helpers.rb +7 -0
- data/spec/support/database_cleaner.rb +18 -0
- data/spec/support/factory_girl.rb +3 -0
- data/spec/support/features.rb +14 -0
- data/spec/support/features/session_helpers.rb +40 -0
- data/spec/support/fixture_reader.rb +7 -0
- data/spec/support/helpers/controller_level_helpers.rb +27 -0
- data/spec/support/views/test_view_helpers.rb +10 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +24 -0
- data/spec/values/coverage_spec.rb +40 -0
- data/tasks/geo_works.rake +39 -0
- data/template.rb +10 -0
- metadata +789 -0
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GeoWorks::GeoFileFormatBehavior do
|
4
|
+
subject { FileSet.new }
|
5
|
+
|
6
|
+
describe '#image_file?' do
|
7
|
+
before do
|
8
|
+
allow(subject).to receive(:geo_mime_type).and_return('image/tiff')
|
9
|
+
end
|
10
|
+
it 'is true' do
|
11
|
+
expect(subject.image_file?).to be true
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe '#raster_file?' do
|
16
|
+
before do
|
17
|
+
allow(subject).to receive(:geo_mime_type).and_return('image/tiff; gdal-format=GTiff')
|
18
|
+
end
|
19
|
+
it 'is true' do
|
20
|
+
expect(subject.raster_file?).to be true
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '#vector_file?' do
|
25
|
+
before do
|
26
|
+
allow(subject).to receive(:geo_mime_type).and_return('application/zip; ogr-format="ESRI Shapefile"')
|
27
|
+
end
|
28
|
+
it 'is true' do
|
29
|
+
expect(subject.vector_file?).to be true
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe '#external_metadata_file?' do
|
34
|
+
before do
|
35
|
+
allow(subject).to receive(:geo_mime_type).and_return('application/xml; schema=iso19139')
|
36
|
+
end
|
37
|
+
it 'is true' do
|
38
|
+
expect(subject.external_metadata_file?).to be true
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe '#geo_file_format?' do
|
43
|
+
before do
|
44
|
+
allow(subject).to receive(:geo_mime_type).and_return('image/tiff; gdal-format=GTiff')
|
45
|
+
end
|
46
|
+
it 'is true' do
|
47
|
+
expect(subject.geo_file_format?).to be true
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe '#image_work?' do
|
52
|
+
it 'is false' do
|
53
|
+
expect(subject.image_work?).to be false
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,118 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe FileSet do
|
4
|
+
let(:user) { create(:user) }
|
5
|
+
subject { described_class.new(geo_mime_type: 'application/xml; schema=iso19139') }
|
6
|
+
|
7
|
+
context "when geo_mime_type is a metadata format" do
|
8
|
+
it "responds as a metadata file" do
|
9
|
+
expect(subject.external_metadata_file?).to be_truthy
|
10
|
+
end
|
11
|
+
it "doesn't respond as a vector file" do
|
12
|
+
expect(subject.vector_file?).to be_falsey
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "to_solr" do
|
17
|
+
let(:solr_doc) { FactoryGirl.build(:external_metadata_file,
|
18
|
+
date_uploaded: Time.zone.today,
|
19
|
+
geo_mime_type: 'application/xml; schema=iso19139').to_solr
|
20
|
+
}
|
21
|
+
|
22
|
+
it "does not index bbox field" do
|
23
|
+
expect(solr_doc.keys).not_to include 'coverage_tesim'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe 'metadata' do
|
28
|
+
it 'has standard' do
|
29
|
+
expect(subject).to respond_to(:geo_mime_type)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'will read the PCDM::File for its XML' do
|
34
|
+
expect(subject).to receive(:original_file) { Hydra::PCDM::File.new }
|
35
|
+
expect(subject.metadata_xml).to be_kind_of Nokogiri::XML::Document
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'will route the extraction request for ISO' do
|
39
|
+
expect(subject).to receive(:original_file) { Hydra::PCDM::File.new }
|
40
|
+
expect(subject).to receive(:extract_iso19139_metadata)
|
41
|
+
subject.geo_mime_type = 'application/xml; schema=iso19139'
|
42
|
+
expect(subject.extract_metadata).to be_nil
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'will route the extraction request for FGDC' do
|
46
|
+
expect(subject).to receive(:original_file) { Hydra::PCDM::File.new }
|
47
|
+
expect(subject).to receive(:extract_fgdc_metadata)
|
48
|
+
subject.geo_mime_type = 'application/xml; schema=fgdc'
|
49
|
+
expect(subject.extract_metadata).to be_nil
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'will route the extraction request for MODS' do
|
53
|
+
expect(subject).to receive(:original_file) { Hydra::PCDM::File.new }
|
54
|
+
expect(subject).to receive(:extract_mods_metadata)
|
55
|
+
subject.geo_mime_type = 'application/mods+xml'
|
56
|
+
expect(subject.extract_metadata).to be_nil
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'will not route the extraction request for bogus standard' do
|
60
|
+
subject.geo_mime_type = 'bogus'
|
61
|
+
expect { subject.extract_metadata }.to raise_error(ArgumentError)
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'can extract ISO 19139 metadata - example 1' do
|
65
|
+
doc = Nokogiri::XML(read_test_data_fixture('McKay/S_566_1914_clip_iso.xml'))
|
66
|
+
expect(subject.extract_iso19139_metadata(doc)).to include(title: ['S_566_1914_clip.tif'],
|
67
|
+
coverage: GeoWorks::Coverage.new(57.595712, -109.860605, 56.407644, -112.469675).to_s,
|
68
|
+
description: ['This raster file is the result of georeferencing using esri\'s ArcScan of Sheet 566: McKay, Alberta, 1st ed. 1st of July, 1914. This sheet is part of the 3-mile to 1-inch sectional maps of Western Canada. vectorization was undertaken to extract a measure of line work density in order to measure Cartographic Intactness. The map series is described in Dubreuil, Lorraine. 1989. Sectional maps of western Canada, 1871-1955: An early Canadian topographic map series. Occasional paper no. 2, Association of Canadian Map Libraries and Archives.'],
|
69
|
+
source: ['University of Alberta'])
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'can extract ISO 19139 metadata - example 2' do
|
73
|
+
doc = Nokogiri::XML(read_test_data_fixture('McKay/S_566_1914_lines_iso.xml'))
|
74
|
+
expect(subject.extract_iso19139_metadata(doc)).to include(title: ['S_566_1914_lines'],
|
75
|
+
coverage: GeoWorks::Coverage.new(57.450728, -109.898613, 56.600872, -112.1975).to_s,
|
76
|
+
description: ['This .shp file (lines) is the result of georeferencing and performing a raster to vector conversion using esri\'s ArcScan of Sheet 566: McKay, Alberta, 1st ed. 1st of July, 1914. This sheet is part of the 3-mile to 1-inch sectional maps of Western Canada. vectorization was undertaken to extract a measure of line work density in order to measure Cartographic Intactness. The map series is described in Dubreuil, Lorraine. 1989. Sectional maps of western Canada, 1871-1955: An early Canadian topographic map series. Occasional paper no. 2, Association of Canadian Map Libraries and Archives.'],
|
77
|
+
source: ['Larry Laliberte'])
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'can extract FGDC metadata - example 1' do
|
81
|
+
doc = Nokogiri::XML(read_test_data_fixture('zipcodes_fgdc.xml'))
|
82
|
+
expect(subject.extract_fgdc_metadata(doc)).to include(title: ['Louisiana ZIP Code Areas 2002'],
|
83
|
+
coverage: GeoWorks::Coverage.new(33.019481, -88.817478, 28.926478, -94.043286).to_s,
|
84
|
+
creator: ['Geographic Data Technology, Inc. (GDT)', 'Environmental Systems Research Institute, Inc. (ESRI)'],
|
85
|
+
description: ['Louisiana ZIP Code Areas represents five-digit ZIP Code areas used by the U.S. Postal Service to deliver mail more effectively. The first digit of a five-digit ZIP Code divides the country into 10 large groups of states numbered from 0 in the Northeast to 9 in the far West. Within these areas, each state is divided into an average of 10 smaller geographical areas, identified by the 2nd and 3rd digits. These digits, in conjunction with the first digit, represent a sectional center facility or a mail processing facility area. The 4th and 5th digits identify a post office, station, branch or local delivery area.'],
|
86
|
+
issued: 2002,
|
87
|
+
subject: ["polygon", "zip codes", "areas", "five-digit zip codes", "post offices", "population", "Location", "Society"],
|
88
|
+
publisher: ['Environmental Systems Research Institute, Inc. (ESRI)'],
|
89
|
+
spatial: ["United States", "Louisiana"],
|
90
|
+
temporal: ["2001", "2000"])
|
91
|
+
end
|
92
|
+
|
93
|
+
it 'can extract FGDC metadata - example 2' do
|
94
|
+
doc = Nokogiri::XML(read_test_data_fixture('McKay/S_566_1914_clip_fgdc.xml'))
|
95
|
+
expect(subject.extract_fgdc_metadata(doc)).to include(title: ['S_566_1914_clip.tif'],
|
96
|
+
coverage: GeoWorks::Coverage.new(57.465375, -109.622454, 56.580532, -112.47033).to_s,
|
97
|
+
description: ['This raster file is the result of georeferencing using esri\'s ArcScan of Sheet 566: McKay, Alberta, 1st ed. 1st of July, 1914. This sheet is part of the 3-mile to 1-inch sectional maps of Western Canada. vectorization was undertaken to extract a measure of line work density in order to measure Cartographic Intactness. The map series is described in Dubreuil, Lorraine. 1989. Sectional maps of western Canada, 1871-1955: An early Canadian topographic map series. Occasional paper no. 2, Association of Canadian Map Libraries and Archives.'],
|
98
|
+
issued: 2014,
|
99
|
+
subject: ["Land cover", "Land use, rural", "Society", "Imagery and Base Maps", "Biology and Ecology"])
|
100
|
+
end
|
101
|
+
|
102
|
+
it 'can extract FGDC metadata - example 3' do
|
103
|
+
doc = Nokogiri::XML(read_test_data_fixture('McKay/S_566_1914_lines_fgdc.xml'))
|
104
|
+
expect(subject.extract_fgdc_metadata(doc)).to include(title: ['S_566_1914_lines'],
|
105
|
+
coverage: GeoWorks::Coverage.new(57.450728, -109.898613, 56.600872, -112.1975).to_s,
|
106
|
+
description: ['This .shp file (lines) is the result of georeferencing and performing a raster to vector conversion using esri\'s ArcScan of Sheet 566: McKay, Alberta, 1st ed. 1st of July, 1914. This sheet is part of the 3-mile to 1-inch sectional maps of Western Canada. vectorization was undertaken to extract a measure of line work density in order to measure Cartographic Intactness. The map series is described in Dubreuil, Lorraine. 1989. Sectional maps of western Canada, 1871-1955: An early Canadian topographic map series. Occasional paper no. 2, Association of Canadian Map Libraries and Archives.'],
|
107
|
+
issued: 2014,
|
108
|
+
temporal: ['1914'],
|
109
|
+
spatial: ['McKay (Alta.)', 'Fort McMurray (Alta.)', 'Alberta', 'Western Canada'],
|
110
|
+
subject: ["Land cover", "Land use, rural", "Biology and Ecology", "Environment", "Imagery and Base Maps", "Society"])
|
111
|
+
end
|
112
|
+
|
113
|
+
it 'can extract MODS metadata' do
|
114
|
+
doc = Nokogiri::XML(read_test_data_fixture('bb099zb1450_mods.xml'))
|
115
|
+
expect(subject.extract_mods_metadata(doc)).to include(title: ['Department Boundary: Haute-Garonne, France, 2010 '],
|
116
|
+
description: ['This polygon shapefile represents the Department Boundary for the Haute-Garonne department of France for 2010. These are the level 2 administrative divisions (ADM2) of Haute-Garonne. Department is one of the three levels of government below the national level ("territorial collectivities"), between the region and the commune. There are 96 departments in metropolitan France and 5 overseas departments, which also are classified as regions. Departments are further subdivided into 342 arrondissements, themselves divided into cantons; the latter two have no autonomy and are used for the organisation of public services and sometimes elections.'])
|
117
|
+
end
|
118
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe FileSet do
|
4
|
+
let(:user) { create(:user) }
|
5
|
+
subject { described_class.new(geo_mime_type: 'image/jpeg') }
|
6
|
+
|
7
|
+
context "when geo_mime_type is an image format" do
|
8
|
+
it "responds as an image file" do
|
9
|
+
expect(subject.image_file?).to be_truthy
|
10
|
+
end
|
11
|
+
it "doesn't respond as a vector file" do
|
12
|
+
expect(subject.vector_file?).to be_falsey
|
13
|
+
end
|
14
|
+
it 'does not have an authoritative cartographic projection' do
|
15
|
+
# expect(subject).not_to respond_to(:cartographic_projection)
|
16
|
+
skip 'Our models for FileSet always include cartographic_projection'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe 'image work association' do
|
21
|
+
let(:work) { FactoryGirl.create(:image_work_with_one_file) }
|
22
|
+
subject { work.file_sets.first.reload }
|
23
|
+
it 'belongs to image work' do
|
24
|
+
expect(subject.image_work).to match_array [work]
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "to_solr" do
|
29
|
+
let(:solr_doc) { FactoryGirl.build(:vector_file,
|
30
|
+
date_uploaded: Time.zone.today,
|
31
|
+
cartographic_projection: 'urn:ogc:def:crs:EPSG::6326').to_solr
|
32
|
+
}
|
33
|
+
|
34
|
+
it "indexes the coordinate reference system" do
|
35
|
+
expect(solr_doc.keys).to include 'cartographic_projection_tesim'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe 'metadata' do
|
40
|
+
it 'has descriptive metadata' do
|
41
|
+
expect(subject).to respond_to(:title)
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'has standard' do
|
45
|
+
expect(subject).to respond_to(:geo_mime_type)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ImageWork do
|
4
|
+
let(:user) { FactoryGirl.find_or_create(:jill) }
|
5
|
+
let(:image_file1) { FileSet.new(geo_mime_type: 'image/jpeg') }
|
6
|
+
let(:ext_metadata_file1) { FileSet.new(geo_mime_type: 'application/xml; schema=iso19139') }
|
7
|
+
let(:ext_metadata_file2) { FileSet.new(geo_mime_type: 'application/xml; schema=iso19139') }
|
8
|
+
let(:raster1) { RasterWork.new }
|
9
|
+
let(:raster2) { RasterWork.new }
|
10
|
+
let(:coverage) { GeoWorks::Coverage.new(43.039, -69.856, 42.943, -71.032) }
|
11
|
+
|
12
|
+
it 'updates the title' do
|
13
|
+
subject.attributes = { title: ['An image work'] }
|
14
|
+
expect(subject.title).to eq(['An image work'])
|
15
|
+
end
|
16
|
+
|
17
|
+
describe 'metadata' do
|
18
|
+
it 'has descriptive metadata' do
|
19
|
+
expect(subject).to respond_to(:title)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe 'with acceptable inputs' do
|
24
|
+
subject { described_class.new }
|
25
|
+
it 'adds image file set, metadata file set, and raster work' do
|
26
|
+
subject.members << image_file1
|
27
|
+
subject.members << ext_metadata_file1
|
28
|
+
subject.members << ext_metadata_file2
|
29
|
+
subject.members << raster1
|
30
|
+
subject.members << raster2
|
31
|
+
expect(subject.image_file).to eq image_file1
|
32
|
+
expect(subject.metadata_files).to match_array [ext_metadata_file1, ext_metadata_file2]
|
33
|
+
expect(subject.raster_works).to match_array [raster1, raster2]
|
34
|
+
end
|
35
|
+
it 'defines what type of object it is' do
|
36
|
+
expect(subject.image_work?).to be_truthy
|
37
|
+
expect(subject.image_file?).to be_falsey
|
38
|
+
expect(subject.raster_work?).to be_falsey
|
39
|
+
expect(subject.raster_file?).to be_falsey
|
40
|
+
expect(subject.vector_work?).to be_falsey
|
41
|
+
expect(subject.vector_file?).to be_falsey
|
42
|
+
expect(subject.external_metadata_file?).to be_falsey
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
context 'georeferenced to a raster' do
|
47
|
+
subject { FactoryGirl.create(:image_work_with_raster_works, title: ['Test title 4'], coverage: coverage.to_s) }
|
48
|
+
|
49
|
+
it 'aggregates by raster resources' do
|
50
|
+
expect(subject.raster_works.size).to eq 1
|
51
|
+
expect(subject.raster_works.first).to be_kind_of RasterWork
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
describe 'populate_metadata' do
|
56
|
+
subject { FactoryGirl.create(:image_work_with_one_metadata_file) }
|
57
|
+
let(:doc) { Nokogiri::XML(read_test_data_fixture('McKay/S_566_1914_clip_iso.xml')) }
|
58
|
+
|
59
|
+
it 'has an extraction method' do
|
60
|
+
expect(subject).to respond_to(:extract_metadata)
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'can perform extraction and set properties for ISO 19139' do
|
64
|
+
external_metadata_file = subject.metadata_files.first
|
65
|
+
allow(external_metadata_file).to receive(:metadata_xml) { doc }
|
66
|
+
allow(external_metadata_file).to receive(:geo_mime_type) { 'application/xml; schema=iso19139' }
|
67
|
+
subject.populate_metadata(external_metadata_file.id)
|
68
|
+
expect(subject.title).to eq(['S_566_1914_clip.tif'])
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe FileSet do
|
4
|
+
let(:user) { create(:user) }
|
5
|
+
subject { described_class.new(geo_mime_type: 'image/tiff; gdal-format=GTiff') }
|
6
|
+
|
7
|
+
context "when geo_mime_type is a raster format" do
|
8
|
+
it "responds as a raster file" do
|
9
|
+
expect(subject.raster_file?).to be_truthy
|
10
|
+
end
|
11
|
+
it "doesn't respond as a vector file" do
|
12
|
+
expect(subject.vector_file?).to be_falsey
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe 'raster work association' do
|
17
|
+
let(:work) { FactoryGirl.create(:raster_work_with_one_file) }
|
18
|
+
subject { work.file_sets.first.reload }
|
19
|
+
it 'belongs to raster work' do
|
20
|
+
expect(subject.raster_work).to match_array [work]
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "to_solr" do
|
25
|
+
let(:solr_doc) { FactoryGirl.build(:vector_file,
|
26
|
+
date_uploaded: Time.zone.today,
|
27
|
+
cartographic_projection: 'urn:ogc:def:crs:EPSG::6326').to_solr
|
28
|
+
}
|
29
|
+
|
30
|
+
it "indexes the coordinate reference system" do
|
31
|
+
expect(solr_doc.keys).to include 'cartographic_projection_tesim'
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe 'metadata' do
|
36
|
+
it 'has descriptive metadata' do
|
37
|
+
expect(subject).to respond_to(:title)
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'has an authoritative cartographic projection' do
|
41
|
+
expect(subject).to respond_to(:cartographic_projection)
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'has standard' do
|
45
|
+
expect(subject).to respond_to(:geo_mime_type)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,122 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe RasterWork do
|
4
|
+
let(:user) { FactoryGirl.find_or_create(:jill) }
|
5
|
+
let(:raster_file1) { FileSet.new(geo_mime_type: 'image/tiff; gdal-format=GTiff') }
|
6
|
+
let(:raster_file2) { FileSet.new(geo_mime_type: 'image/tiff; gdal-format=GTiff') }
|
7
|
+
let(:ext_metadata_file1) { FileSet.new(geo_mime_type: 'application/xml; schema=iso19139') }
|
8
|
+
let(:ext_metadata_file2) { FileSet.new(geo_mime_type: 'application/xml; schema=iso19139') }
|
9
|
+
let(:vector1) { VectorWork.new }
|
10
|
+
let(:vector2) { VectorWork.new }
|
11
|
+
let(:coverage) { GeoWorks::Coverage.new(43.039, -69.856, 42.943, -71.032) }
|
12
|
+
|
13
|
+
it 'updates the title' do
|
14
|
+
subject.attributes = { title: ['A raster work'] }
|
15
|
+
expect(subject.title).to eq(['A raster work'])
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'updates the bounding box' do
|
19
|
+
subject.attributes = { coverage: coverage.to_s }
|
20
|
+
expect(subject.coverage).to eq(coverage.to_s)
|
21
|
+
end
|
22
|
+
|
23
|
+
describe 'metadata' do
|
24
|
+
it 'has descriptive metadata' do
|
25
|
+
expect(subject).to respond_to(:title)
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'has geospatial metadata' do
|
29
|
+
expect(subject).to respond_to(:coverage)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe 'with acceptable inputs' do
|
34
|
+
subject { described_class.new }
|
35
|
+
it 'adds raster file set, metadata file set, vector work to file' do
|
36
|
+
subject.members << raster_file1
|
37
|
+
subject.members << raster_file2
|
38
|
+
subject.members << ext_metadata_file1
|
39
|
+
subject.members << ext_metadata_file2
|
40
|
+
subject.members << vector1
|
41
|
+
subject.members << vector2
|
42
|
+
expect(subject.raster_files).to match_array [raster_file1, raster_file2]
|
43
|
+
expect(subject.metadata_files).to match_array [ext_metadata_file1, ext_metadata_file2]
|
44
|
+
expect(subject.vector_works).to match_array [vector1, vector2]
|
45
|
+
end
|
46
|
+
it 'defines what type of object it is' do
|
47
|
+
expect(subject.raster_work?).to be_truthy
|
48
|
+
expect(subject.raster_file?).to be_falsey
|
49
|
+
expect(subject.image_work?).to be_falsey
|
50
|
+
expect(subject.image_file?).to be_falsey
|
51
|
+
expect(subject.vector_work?).to be_falsey
|
52
|
+
expect(subject.vector_file?).to be_falsey
|
53
|
+
expect(subject.external_metadata_file?).to be_falsey
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
context 'with raster files' do
|
58
|
+
subject { FactoryGirl.create(:raster_work_with_files, title: ['Test title 4'], coverage: coverage.to_s) }
|
59
|
+
|
60
|
+
it 'has two files' do
|
61
|
+
expect(subject.raster_files.size).to eq 2
|
62
|
+
expect(subject.raster_files.first.geo_mime_type).to eq 'image/tiff; gdal-format=GTiff'
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
context 'with vector feature extractions' do
|
67
|
+
subject { FactoryGirl.create(:raster_work_with_vector_work) }
|
68
|
+
|
69
|
+
it 'aggregates vector data set resources' do
|
70
|
+
expect(subject.vector_works.size).to eq 1
|
71
|
+
expect(subject.vector_works.first).to be_kind_of VectorWork
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
context 'with metadata files' do
|
76
|
+
subject { FactoryGirl.create(:raster_work_with_metadata_files) }
|
77
|
+
|
78
|
+
it 'aggregates external metadata files' do
|
79
|
+
expect(subject.metadata_files.size).to eq 2
|
80
|
+
expect(subject.metadata_files.first.geo_mime_type).to eq 'application/xml; schema=iso19139'
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
describe '#image_work' do
|
85
|
+
let(:raster_work) { FactoryGirl.create(:raster_work, title: ['Raster'], coverage: coverage.to_s) }
|
86
|
+
let(:image_work) { FactoryGirl.create(:image_work, title: ['Image'], coverage: coverage.to_s) }
|
87
|
+
|
88
|
+
before do
|
89
|
+
image_work.ordered_members << raster_work
|
90
|
+
raster_work.save
|
91
|
+
image_work.save
|
92
|
+
end
|
93
|
+
|
94
|
+
it 'has a parent image work' do
|
95
|
+
expect(raster_work.image_work).to be_a ImageWork
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
describe "to_solr" do
|
100
|
+
subject { FactoryGirl.build(:raster_work, date_uploaded: Time.zone.today, coverage: coverage.to_s).to_solr }
|
101
|
+
it "indexes ordered_by_ssim field" do
|
102
|
+
expect(subject.keys).to include 'ordered_by_ssim'
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
describe 'populate_metadata' do
|
107
|
+
subject { FactoryGirl.create(:raster_work_with_one_metadata_file) }
|
108
|
+
let(:doc) { Nokogiri::XML(read_test_data_fixture('McKay/S_566_1914_clip_iso.xml')) }
|
109
|
+
|
110
|
+
it 'has an extraction method' do
|
111
|
+
expect(subject).to respond_to(:extract_metadata)
|
112
|
+
end
|
113
|
+
|
114
|
+
it 'can perform extraction and set properties for ISO 19139' do
|
115
|
+
external_metadata_file = subject.metadata_files.first
|
116
|
+
allow(external_metadata_file).to receive(:metadata_xml).and_return(doc)
|
117
|
+
allow(external_metadata_file).to receive(:geo_mime_type).and_return('application/xml; schema=iso19139')
|
118
|
+
subject.should_populate_metadata = external_metadata_file.id
|
119
|
+
expect(subject.title).to eq(['S_566_1914_clip.tif'])
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|