active-fedora 9.7.0 → 9.8.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.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +10 -9
  4. data/History.txt +18 -0
  5. data/README.md +12 -13
  6. data/Rakefile +1 -1
  7. data/active-fedora.gemspec +2 -1
  8. data/config/fedora.yml +2 -2
  9. data/config/solr.yml +5 -5
  10. data/lib/active_fedora/association_hash.rb +2 -2
  11. data/lib/active_fedora/associations/builder/collection_association.rb +1 -1
  12. data/lib/active_fedora/associations/builder/has_many.rb +1 -1
  13. data/lib/active_fedora/associations/collection_association.rb +1 -1
  14. data/lib/active_fedora/associations/collection_proxy.rb +4 -4
  15. data/lib/active_fedora/associations/directly_contains_one_association.rb +3 -7
  16. data/lib/active_fedora/associations/has_many_association.rb +22 -29
  17. data/lib/active_fedora/associations/indirectly_contains_association.rb +1 -1
  18. data/lib/active_fedora/autosave_association.rb +1 -1
  19. data/lib/active_fedora/base.rb +1 -1
  20. data/lib/active_fedora/callbacks.rb +1 -1
  21. data/lib/active_fedora/change_set.rb +1 -2
  22. data/lib/active_fedora/datastreams/nokogiri_datastreams.rb +6 -6
  23. data/lib/active_fedora/file.rb +5 -4
  24. data/lib/active_fedora/file_configurator.rb +6 -11
  25. data/lib/active_fedora/fixity_service.rb +1 -1
  26. data/lib/active_fedora/indexing/map.rb +2 -1
  27. data/lib/active_fedora/indexing_service.rb +3 -3
  28. data/lib/active_fedora/ldp_cache.rb +1 -1
  29. data/lib/active_fedora/model.rb +9 -10
  30. data/lib/active_fedora/nested_attributes.rb +1 -1
  31. data/lib/active_fedora/nom_datastream.rb +5 -5
  32. data/lib/active_fedora/om_datastream.rb +2 -2
  33. data/lib/active_fedora/persistence.rb +2 -2
  34. data/lib/active_fedora/qualified_dublin_core_datastream.rb +1 -1
  35. data/lib/active_fedora/rdf/fcrepo.rb +6 -0
  36. data/lib/active_fedora/rdf/field_map.rb +4 -2
  37. data/lib/active_fedora/rdf/persistence.rb +2 -2
  38. data/lib/active_fedora/rdf/rdf_datastream.rb +1 -1
  39. data/lib/active_fedora/reflection.rb +3 -3
  40. data/lib/active_fedora/relation.rb +2 -2
  41. data/lib/active_fedora/solr_query_builder.rb +93 -91
  42. data/lib/active_fedora/solr_service.rb +2 -2
  43. data/lib/active_fedora/version.rb +1 -1
  44. data/lib/active_fedora/versionable.rb +14 -12
  45. data/lib/active_fedora/versions_graph.rb +1 -1
  46. data/lib/active_fedora.rb +2 -2
  47. data/lib/generators/active_fedora/config/fedora/templates/fedora.yml +2 -2
  48. data/lib/generators/active_fedora/config/solr/solr_generator.rb +0 -1
  49. data/lib/generators/active_fedora/config/solr/templates/solr.yml +2 -2
  50. data/lib/tasks/active_fedora_dev.rake +13 -8
  51. data/solr/config/_rest_managed.json +3 -0
  52. data/solr/config/admin-extra.html +31 -0
  53. data/solr/config/elevate.xml +36 -0
  54. data/solr/config/mapping-ISOLatin1Accent.txt +246 -0
  55. data/solr/config/protwords.txt +21 -0
  56. data/solr/config/schema.xml +372 -0
  57. data/solr/config/scripts.conf +24 -0
  58. data/solr/config/solrconfig.xml +419 -0
  59. data/solr/config/spellings.txt +2 -0
  60. data/solr/config/stopwords.txt +58 -0
  61. data/solr/config/stopwords_en.txt +58 -0
  62. data/solr/config/synonyms.txt +31 -0
  63. data/solr/config/xslt/example.xsl +132 -0
  64. data/solr/config/xslt/example_atom.xsl +67 -0
  65. data/solr/config/xslt/example_rss.xsl +66 -0
  66. data/solr/config/xslt/luke.xsl +337 -0
  67. data/spec/integration/complex_rdf_datastream_spec.rb +8 -8
  68. data/spec/integration/full_featured_model_spec.rb +1 -1
  69. data/spec/integration/ntriples_datastream_spec.rb +12 -1
  70. data/spec/integration/rdf_nested_attributes_spec.rb +51 -20
  71. data/spec/integration/scoped_query_spec.rb +2 -2
  72. data/spec/integration/versionable_spec.rb +1 -3
  73. data/spec/unit/active_fedora_spec.rb +0 -3
  74. data/spec/unit/base_spec.rb +1 -1
  75. data/spec/unit/forbidden_attributes_protection_spec.rb +1 -1
  76. data/spec/unit/ntriples_datastream_spec.rb +21 -11
  77. data/spec/unit/persistence_spec.rb +1 -1
  78. data/spec/unit/predicates_spec.rb +1 -1
  79. data/spec/unit/qualified_dublin_core_datastream_spec.rb +1 -1
  80. data/spec/unit/solr_config_options_spec.rb +3 -3
  81. data/spec/unit/sparql_insert_spec.rb +1 -1
  82. metadata +38 -11
  83. data/config/solr_mappings_af_0.1.yml +0 -9
  84. data/config/solr_mappings_bl_2.4.yml +0 -17
  85. data/lib/generators/active_fedora/config/solr/templates/jetty.yml +0 -6
@@ -70,10 +70,12 @@ module ActiveFedora::RDF
70
70
  end
71
71
  end
72
72
 
73
- # Builds a FieldMap entry for a resource such as an ActiveFedora::Base object and returns the uri as the value.
73
+ # Builds a FieldMap entry for a resource such as an ActiveFedora::Base object and returns the uri as the value
74
+ # unless :using has been set as an option to the index.as block on the property in question. In that case, the
75
+ # symbol assigned to :using will used as the value.
74
76
  class ResourceBuilder < Builder
75
77
  def find_values
76
- object.send(name).map(&:uri)
78
+ object.send(name).map(&index_field_config.term.fetch(:using, :uri))
77
79
  end
78
80
  end
79
81
 
@@ -10,7 +10,7 @@ module ActiveFedora
10
10
  module Persistence
11
11
  extend ActiveSupport::Concern
12
12
 
13
- BASE_URI = 'info:fedora/'
13
+ BASE_URI = 'info:fedora/'.freeze
14
14
 
15
15
  included do
16
16
  configure base_uri: BASE_URI unless base_uri
@@ -25,7 +25,7 @@ module ActiveFedora
25
25
 
26
26
  # Overrides ActiveTriples::Resource
27
27
  def persisted?
28
- @persisted ||= (!datastream.new_record?)
28
+ @persisted ||= !datastream.new_record?
29
29
  end
30
30
  end
31
31
  end
@@ -122,7 +122,7 @@ module ActiveFedora
122
122
  end
123
123
  end
124
124
 
125
- alias_method :graph, :resource
125
+ alias graph resource
126
126
 
127
127
  def refresh_attributes
128
128
  @resource = nil
@@ -217,7 +217,7 @@ module ActiveFedora
217
217
  [self]
218
218
  end
219
219
 
220
- alias_method :source_macro, :macro
220
+ alias source_macro macro
221
221
 
222
222
  def has_inverse?
223
223
  inverse_name
@@ -265,8 +265,8 @@ module ActiveFedora
265
265
  end
266
266
  end
267
267
 
268
- VALID_AUTOMATIC_INVERSE_MACROS = [:has_many, :has_and_belongs_to_many, :belongs_to]
269
- INVALID_AUTOMATIC_INVERSE_OPTIONS = [:conditions, :through, :polymorphic, :foreign_key]
268
+ VALID_AUTOMATIC_INVERSE_MACROS = [:has_many, :has_and_belongs_to_many, :belongs_to].freeze
269
+ INVALID_AUTOMATIC_INVERSE_OPTIONS = [:conditions, :through, :polymorphic, :foreign_key].freeze
270
270
 
271
271
  private
272
272
 
@@ -5,7 +5,7 @@ module ActiveFedora
5
5
 
6
6
  attr_reader :loaded
7
7
  attr_accessor :default_scoped
8
- alias_method :loaded?, :loaded
8
+ alias loaded? loaded
9
9
 
10
10
  attr_accessor :values, :klass
11
11
 
@@ -129,7 +129,7 @@ module ActiveFedora
129
129
 
130
130
  private
131
131
 
132
- VALID_FIND_OPTIONS = [:order, :limit, :start, :conditions, :cast]
132
+ VALID_FIND_OPTIONS = [:order, :limit, :start, :conditions, :cast].freeze
133
133
 
134
134
  def apply_finder_options(options)
135
135
  relation = clone
@@ -2,114 +2,116 @@ module ActiveFedora
2
2
  module SolrQueryBuilder
3
3
  PARSED_SUFFIX = '_tesim'.freeze
4
4
 
5
- # Construct a solr query for a list of ids
6
- # This is used to get a solr response based on the list of ids in an object's RELS-EXT relationhsips
7
- # If the id_array is empty, defaults to a query of "id:NEVER_USE_THIS_ID", which will return an empty solr response
8
- # @param [Array] id_array the ids that you want included in the query
9
- def self.construct_query_for_ids(id_array)
10
- ids = id_array.reject(&:blank?)
11
- return "id:NEVER_USE_THIS_ID" if ids.empty?
12
- "{!terms f=#{SOLR_DOCUMENT_ID}}#{ids.join(',')}"
13
- end
5
+ class << self
6
+ # Construct a solr query for a list of ids
7
+ # This is used to get a solr response based on the list of ids in an object's RELS-EXT relationhsips
8
+ # If the id_array is empty, defaults to a query of "id:NEVER_USE_THIS_ID", which will return an empty solr response
9
+ # @param [Array] id_array the ids that you want included in the query
10
+ def construct_query_for_ids(id_array)
11
+ ids = id_array.reject(&:blank?)
12
+ return "id:NEVER_USE_THIS_ID" if ids.empty?
13
+ "{!terms f=#{SOLR_DOCUMENT_ID}}#{ids.join(',')}"
14
+ end
14
15
 
15
- # Create a raw query clause suitable for sending to solr as an fq element
16
- # @param [String] key
17
- # @param [String] value
18
- def self.raw_query(key, value)
19
- "_query_:\"{!raw f=#{key}}#{value.gsub('"', '\"')}\""
20
- end
16
+ # Create a raw query clause suitable for sending to solr as an fq element
17
+ # @param [String] key
18
+ # @param [String] value
19
+ def raw_query(key, value)
20
+ "_query_:\"{!raw f=#{key}}#{value.gsub('"', '\"')}\""
21
+ end
21
22
 
22
- def self.solr_name(*args)
23
- Solrizer.default_field_mapper.solr_name(*args)
24
- end
23
+ def solr_name(*args)
24
+ Solrizer.default_field_mapper.solr_name(*args)
25
+ end
25
26
 
26
- # Create a query with a clause for each key, value
27
- # @param [Hash, Array<Array<String>>] field_pairs key is the predicate, value is the target_uri
28
- # @param [String] join_with ('AND') the value we're joining the clauses with
29
- # @example
30
- # construct_query_for_rel [[:has_model, "info:fedora/afmodel:ComplexCollection"], [:has_model, "info:fedora/afmodel:ActiveFedora_Base"]], 'OR'
31
- # # => _query_:"{!raw f=has_model_ssim}info:fedora/afmodel:ComplexCollection" OR _query_:"{!raw f=has_model_ssim}info:fedora/afmodel:ActiveFedora_Base"
32
- #
33
- # construct_query_for_rel [[Book.reflect_on_association(:library), "foo/bar/baz"]]
34
- def self.construct_query_for_rel(field_pairs, join_with = ' AND ')
35
- field_pairs = field_pairs.to_a if field_pairs.is_a? Hash
36
- construct_query(property_values_to_solr(field_pairs), join_with)
37
- end
27
+ # Create a query with a clause for each key, value
28
+ # @param [Hash, Array<Array<String>>] field_pairs key is the predicate, value is the target_uri
29
+ # @param [String] join_with ('AND') the value we're joining the clauses with
30
+ # @example
31
+ # construct_query_for_rel [[:has_model, "info:fedora/afmodel:ComplexCollection"], [:has_model, "info:fedora/afmodel:ActiveFedora_Base"]], 'OR'
32
+ # # => _query_:"{!raw f=has_model_ssim}info:fedora/afmodel:ComplexCollection" OR _query_:"{!raw f=has_model_ssim}info:fedora/afmodel:ActiveFedora_Base"
33
+ #
34
+ # construct_query_for_rel [[Book.reflect_on_association(:library), "foo/bar/baz"]]
35
+ def construct_query_for_rel(field_pairs, join_with = ' AND ')
36
+ field_pairs = field_pairs.to_a if field_pairs.is_a? Hash
37
+ construct_query(property_values_to_solr(field_pairs), join_with)
38
+ end
38
39
 
39
- # Construct a solr query from a list of pairs (e.g. [field name, values])
40
- # @param [Array<Array>] field_pairs a list of pairs of property name and values
41
- # @param [String] join_with ('AND') the value we're joining the clauses with
42
- # @return [String] a solr query
43
- # @example
44
- # construct_query([['library_id_ssim', '123'], ['owner_ssim', 'Fred']])
45
- # # => "_query_:\"{!raw f=library_id_ssim}123\" AND _query_:\"{!raw f=owner_ssim}Fred\""
46
- def self.construct_query(field_pairs, join_with = ' AND ')
47
- pairs_to_clauses(field_pairs).join(join_with)
48
- end
40
+ # Construct a solr query from a list of pairs (e.g. [field name, values])
41
+ # @param [Array<Array>] field_pairs a list of pairs of property name and values
42
+ # @param [String] join_with ('AND') the value we're joining the clauses with
43
+ # @return [String] a solr query
44
+ # @example
45
+ # construct_query([['library_id_ssim', '123'], ['owner_ssim', 'Fred']])
46
+ # # => "_query_:\"{!raw f=library_id_ssim}123\" AND _query_:\"{!raw f=owner_ssim}Fred\""
47
+ def construct_query(field_pairs, join_with = ' AND ')
48
+ pairs_to_clauses(field_pairs).join(join_with)
49
+ end
49
50
 
50
- private
51
+ private
51
52
 
52
- # @param [Array<Array>] pairs a list of (key, value) pairs. The value itself may
53
- # @return [Array] a list of solr clauses
54
- def self.pairs_to_clauses(pairs)
55
- pairs.flat_map do |field, value|
56
- condition_to_clauses(field, value)
53
+ # @param [Array<Array>] pairs a list of (key, value) pairs. The value itself may
54
+ # @return [Array] a list of solr clauses
55
+ def pairs_to_clauses(pairs)
56
+ pairs.flat_map do |field, value|
57
+ condition_to_clauses(field, value)
58
+ end
57
59
  end
58
- end
59
60
 
60
- # @param [String] field
61
- # @param [String, Array<String>] values
62
- # @return [Array<String>]
63
- def self.condition_to_clauses(field, values)
64
- values = Array(values)
65
- values << nil if values.empty?
66
- values.map do |value|
67
- if value.present?
68
- if parsed?(field)
69
- # If you do a raw query on a parsed field you won't get the matches you expect.
70
- "#{field}:#{solr_escape(value)}"
61
+ # @param [String] field
62
+ # @param [String, Array<String>] values
63
+ # @return [Array<String>]
64
+ def condition_to_clauses(field, values)
65
+ values = Array(values)
66
+ values << nil if values.empty?
67
+ values.map do |value|
68
+ if value.present?
69
+ if parsed?(field)
70
+ # If you do a raw query on a parsed field you won't get the matches you expect.
71
+ "#{field}:#{solr_escape(value)}"
72
+ else
73
+ raw_query(field, value)
74
+ end
71
75
  else
72
- raw_query(field, value)
76
+ # Check that the field is not present. In SQL: "WHERE field IS NULL"
77
+ "-#{field}:[* TO *]"
73
78
  end
74
- else
75
- # Check that the field is not present. In SQL: "WHERE field IS NULL"
76
- "-#{field}:[* TO *]"
77
79
  end
78
80
  end
79
- end
80
81
 
81
- def self.parsed?(field)
82
- field.end_with?(PARSED_SUFFIX)
83
- end
82
+ def parsed?(field)
83
+ field.end_with?(PARSED_SUFFIX)
84
+ end
84
85
 
85
- # Adds esaping for spaces which are not handled by RSolr.solr_escape
86
- # See rsolr/rsolr#101
87
- def self.solr_escape(terms)
88
- RSolr.solr_escape(terms).gsub(/\s+/, "\\ ")
89
- end
86
+ # Adds esaping for spaces which are not handled by RSolr.solr_escape
87
+ # See rsolr/rsolr#101
88
+ def solr_escape(terms)
89
+ RSolr.solr_escape(terms).gsub(/\s+/, "\\ ")
90
+ end
90
91
 
91
- # Given a list of pairs (e.g. [field name, values]), convert the field names
92
- # to solr names
93
- # @param [Array<Array>] pairs a list of pairs of property name and values
94
- # @return [Hash] map of solr fields to values
95
- # @example
96
- # property_values_to_solr([['library_id', '123'], ['owner', 'Fred']])
97
- # # => [['library_id_ssim', '123'], ['owner_ssim', 'Fred']]
98
- def self.property_values_to_solr(pairs)
99
- pairs.each_with_object([]) do |(property, value), list|
100
- list << [solr_field(property), value]
92
+ # Given a list of pairs (e.g. [field name, values]), convert the field names
93
+ # to solr names
94
+ # @param [Array<Array>] pairs a list of pairs of property name and values
95
+ # @return [Hash] map of solr fields to values
96
+ # @example
97
+ # property_values_to_solr([['library_id', '123'], ['owner', 'Fred']])
98
+ # # => [['library_id_ssim', '123'], ['owner_ssim', 'Fred']]
99
+ def property_values_to_solr(pairs)
100
+ pairs.each_with_object([]) do |(property, value), list|
101
+ list << [solr_field(property), value]
102
+ end
101
103
  end
102
- end
103
104
 
104
- # @param [String, ActiveFedora::Relation] field
105
- # @return [String] the corresponding solr field for the string
106
- def self.solr_field(field)
107
- case field
108
- when ActiveFedora::Reflection::AssociationReflection
109
- field.solr_key
110
- else
111
- solr_name(field, :symbol)
105
+ # @param [String, ActiveFedora::Relation] field
106
+ # @return [String] the corresponding solr field for the string
107
+ def solr_field(field)
108
+ case field
109
+ when ActiveFedora::Reflection::AssociationReflection
110
+ field.solr_key
111
+ else
112
+ solr_name(field, :symbol)
113
+ end
112
114
  end
113
- end
115
+ end
114
116
  end
115
117
  end
@@ -10,7 +10,7 @@ module ActiveFedora
10
10
  def initialize(host, args)
11
11
  host = 'http://localhost:8080/solr' unless host
12
12
  args = { read_timeout: 120, open_timeout: 120 }.merge(args.dup)
13
- args.merge!(url: host)
13
+ args[:url] = host
14
14
  @conn = RSolr.connect args
15
15
  end
16
16
 
@@ -71,7 +71,7 @@ module ActiveFedora
71
71
  end
72
72
 
73
73
  def construct_query_for_pids(id_array)
74
- Deprecation.warn SolrService, "construct_query_for_pids is deprecated and will be removed in active-fedora 10.0"
74
+ Deprecation.warn SolrService, "SolrService.construct_query_for_pids is deprecated. Use SolrQueryBuilder.construct_query_for_ids instead. This will be removed in active-fedora 10.0"
75
75
  SolrQueryBuilder.construct_query_for_ids(id_array)
76
76
  end
77
77
 
@@ -1,3 +1,3 @@
1
1
  module ActiveFedora
2
- VERSION = "9.7.0"
2
+ VERSION = "9.8.0".freeze
3
3
  end
@@ -15,7 +15,7 @@ module ActiveFedora
15
15
  end
16
16
 
17
17
  def model_type
18
- if self.respond_to?(:metadata)
18
+ if respond_to?(:metadata)
19
19
  metadata.ldp_source.graph.query(predicate: ::RDF.type).objects
20
20
  else
21
21
  resource.query(subject: resource.rdf_subject, predicate: ::RDF.type).objects
@@ -50,23 +50,17 @@ module ActiveFedora
50
50
  resp = ActiveFedora.fedora.connection.patch(versions.with_label(label).uri, nil)
51
51
  @versions = nil
52
52
  reload
53
- refresh_attributes if self.respond_to?("refresh_attributes")
53
+ refresh_attributes if respond_to?("refresh_attributes")
54
54
  resp.success?
55
55
  end
56
56
 
57
57
  private
58
58
 
59
59
  def versions_request
60
- resp = begin
61
- ActiveFedora.fedora.connection.get(versions_uri)
62
- rescue Ldp::NotFound
63
- return ''
64
- end
65
- if !resp.success?
66
- raise "unexpected return value #{resp.status} for when getting datastream content at #{uri}\n\t#{resp.body}"
67
- elsif resp.headers['content-type'] != 'text/turtle'
68
- raise "unknown response format. got '#{resp.headers['content-type']}', but was expecting 'text/turtle'"
69
- end
60
+ return '' unless has_versions?
61
+ resp = ActiveFedora.fedora.connection.get(versions_uri)
62
+ raise ActiveFedoraError, status_message(resp) unless resp.success?
63
+ raise ActiveFedoraError, bad_headers(resp) unless resp.headers['content-type'] == 'text/turtle'
70
64
  resp.body
71
65
  end
72
66
 
@@ -81,5 +75,13 @@ module ActiveFedora
81
75
  "version" + (versions.all.count + 1).to_s
82
76
  end
83
77
  end
78
+
79
+ def status_message(response)
80
+ "Unexpected return value #{response.status} when retrieving datastream content at #{uri}\n\t#{response.body}"
81
+ end
82
+
83
+ def bad_headers(response)
84
+ "Unknown response format. Got '#{response.headers['content-type']}', but was expecting 'text/turtle'"
85
+ end
84
86
  end
85
87
  end
@@ -3,7 +3,7 @@ module ActiveFedora
3
3
  def all(opts = {})
4
4
  versions = fedora_versions
5
5
  unless opts[:include_auto_save]
6
- versions.reject! { |version| version.label.match("auto") }
6
+ versions.reject! { |version| version.label =~ /auto/ }
7
7
  end
8
8
  versions.sort_by { |version| DateTime.parse(version.created) }
9
9
  rescue ArgumentError, NoMethodError
data/lib/active_fedora.rb CHANGED
@@ -209,9 +209,9 @@ module ActiveFedora #:nodoc:
209
209
  return config_options[:environment]
210
210
  elsif defined?(Rails.env) && !Rails.env.nil?
211
211
  return Rails.env.to_s
212
- elsif defined?(ENV['environment']) && !(ENV['environment'].nil?)
212
+ elsif defined?(ENV['environment']) && !ENV['environment'].nil?
213
213
  return ENV['environment']
214
- elsif defined?(ENV['RAILS_ENV']) && !(ENV['RAILS_ENV'].nil?)
214
+ elsif defined?(ENV['RAILS_ENV']) && !ENV['RAILS_ENV'].nil?
215
215
  raise "You're depending on RAILS_ENV for setting your environment. Please use ENV['environment'] for non-rails environment setting: 'rake foo:bar environment=test'"
216
216
  else
217
217
  ENV['environment'] = 'development'
@@ -1,12 +1,12 @@
1
1
  development:
2
2
  user: fedoraAdmin
3
3
  password: fedoraAdmin
4
- url: http://127.0.0.1:8983/fedora/rest
4
+ url: http://127.0.0.1:8984/rest
5
5
  base_path: /dev
6
6
  test:
7
7
  user: fedoraAdmin
8
8
  password: fedoraAdmin
9
- url: http://localhost:8983/fedora/rest
9
+ url: http://localhost:8984/rest
10
10
  base_path: /test
11
11
  production:
12
12
  user: fedoraAdmin
@@ -6,7 +6,6 @@ module ActiveFedora
6
6
 
7
7
  def generate
8
8
  # Overwrite the configuration files that Blacklight has installed
9
- copy_file 'jetty.yml', 'config/jetty.yml', force: true
10
9
  copy_file 'solr.yml', 'config/solr.yml', force: true
11
10
  directory 'solr_conf', 'solr_conf'
12
11
  end
@@ -1,7 +1,7 @@
1
1
  # This is a sample config file that points to a solr server for each environment
2
2
  development:
3
- url: http://localhost:8983/solr/development
3
+ url: http://localhost:8983/solr/hydra-dev
4
4
  test:
5
- url: <%= "http://127.0.0.1:#{ENV['TEST_JETTY_PORT'] || 8983}/solr/test" %>
5
+ url: <%= "http://127.0.0.1:#{ENV['TEST_JETTY_PORT'] || 8983}/solr/hydra-test" %>
6
6
  production:
7
7
  url: http://your.production.server:8080/bl_solr/core0
@@ -1,6 +1,7 @@
1
1
  APP_ROOT = File.expand_path("#{File.dirname(__FILE__)}/../../")
2
2
 
3
- require 'jettywrapper'
3
+ require 'solr_wrapper'
4
+ require 'fcrepo_wrapper'
4
5
 
5
6
  namespace :active_fedora do
6
7
  # Use yard to build docs
@@ -50,14 +51,18 @@ namespace :active_fedora do
50
51
  desc "CI build"
51
52
  task :ci do
52
53
  ENV['environment'] = "test"
53
- Rake::Task["active_fedora:configure_jetty"].invoke
54
- jetty_params = Jettywrapper.load_config
55
- error = Jettywrapper.wrap(jetty_params) do
56
- Rake::Task['active_fedora:coverage'].invoke
54
+ # Rake::Task["active_fedora:configure_jetty"].invoke
55
+ # jetty_params = Jettywrapper.load_config
56
+ solr_params = { port: 8983, verbose: true, managed: true }
57
+ fcrepo_params = { port: 8984, verbose: true, managed: true }
58
+ error = nil
59
+ SolrWrapper.wrap(solr_params) do |solr|
60
+ solr.with_collection(name: 'hydra-test', dir: File.join(File.expand_path("../..", File.dirname(__FILE__)), "solr", "config")) do
61
+ FcrepoWrapper.wrap(fcrepo_params) do
62
+ Rake::Task['active_fedora:coverage'].invoke
63
+ end
64
+ end
57
65
  end
58
- raise "test failures: #{error}" if error
59
- # Only create documentation if the tests have passed
60
- Rake::Task["active_fedora:doc"].invoke
61
66
  end
62
67
 
63
68
  desc "Execute specs with coverage"
@@ -0,0 +1,3 @@
1
+ {
2
+ "initArgs":{},
3
+ "managedList":[]}
@@ -0,0 +1,31 @@
1
+ <!--
2
+ Licensed to the Apache Software Foundation (ASF) under one or more
3
+ contributor license agreements. See the NOTICE file distributed with
4
+ this work for additional information regarding copyright ownership.
5
+ The ASF licenses this file to You under the Apache License, Version 2.0
6
+ (the "License"); you may not use this file except in compliance with
7
+ the License. You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
16
+ -->
17
+
18
+ <!-- The content of this page will be statically included into the top
19
+ of the admin page. Uncomment this as an example to see there the content
20
+ will show up.
21
+
22
+ <hr>
23
+ <i>This line will appear before the first table</i>
24
+ <tr>
25
+ <td colspan="2">
26
+ This row will be appended to the end of the first table
27
+ </td>
28
+ </tr>
29
+ <hr>
30
+
31
+ -->
@@ -0,0 +1,36 @@
1
+ <?xml version="1.0" encoding="UTF-8" ?>
2
+ <!--
3
+ Licensed to the Apache Software Foundation (ASF) under one or more
4
+ contributor license agreements. See the NOTICE file distributed with
5
+ this work for additional information regarding copyright ownership.
6
+ The ASF licenses this file to You under the Apache License, Version 2.0
7
+ (the "License"); you may not use this file except in compliance with
8
+ the License. You may obtain a copy of the License at
9
+
10
+ http://www.apache.org/licenses/LICENSE-2.0
11
+
12
+ Unless required by applicable law or agreed to in writing, software
13
+ distributed under the License is distributed on an "AS IS" BASIS,
14
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ See the License for the specific language governing permissions and
16
+ limitations under the License.
17
+ -->
18
+
19
+ <!-- If this file is found in the config directory, it will only be
20
+ loaded once at startup. If it is found in Solr's data
21
+ directory, it will be re-loaded every commit.
22
+ -->
23
+
24
+ <elevate>
25
+ <query text="foo bar">
26
+ <doc id="1" />
27
+ <doc id="2" />
28
+ <doc id="3" />
29
+ </query>
30
+
31
+ <query text="ipod">
32
+ <doc id="MA147LL/A" /> <!-- put the actual ipod at the top -->
33
+ <doc id="IW-02" exclude="true" /> <!-- exclude this cable -->
34
+ </query>
35
+
36
+ </elevate>