active-fedora 10.0.0 → 10.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.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/active-fedora.gemspec +0 -1
  3. data/lib/active_fedora/associations/has_subresource_association.rb +2 -2
  4. data/lib/active_fedora/containers/container.rb +1 -1
  5. data/lib/active_fedora/core.rb +2 -0
  6. data/lib/active_fedora/file.rb +1 -9
  7. data/lib/active_fedora/indexing.rb +2 -0
  8. data/lib/active_fedora/nom_datastream.rb +6 -0
  9. data/lib/active_fedora/om_datastream.rb +14 -22
  10. data/lib/active_fedora/rdf/datastream_indexing.rb +6 -0
  11. data/lib/active_fedora/rdf/ntriples_rdf_datastream.rb +4 -0
  12. data/lib/active_fedora/rdf/rdf_datastream.rb +9 -0
  13. data/lib/active_fedora/rdf.rb +0 -1
  14. data/lib/active_fedora/relation/finder_methods.rb +3 -3
  15. data/lib/active_fedora/scoping/named.rb +1 -0
  16. data/lib/active_fedora/solr_query_builder.rb +10 -3
  17. data/lib/active_fedora/version.rb +1 -1
  18. data/lib/tasks/active_fedora_dev.rake +0 -8
  19. data/solr/config/solrconfig.xml +22 -13
  20. data/spec/integration/date_time_properties_spec.rb +1 -0
  21. data/spec/integration/eradicate_spec.rb +1 -1
  22. data/spec/integration/ntriples_datastream_spec.rb +1 -1
  23. data/spec/integration/scoped_query_spec.rb +1 -0
  24. data/spec/integration/solr_instance_loader_spec.rb +1 -0
  25. data/spec/spec_helper.rb +6 -0
  26. data/spec/unit/base_spec.rb +1 -0
  27. data/spec/unit/finder_methods_spec.rb +2 -2
  28. data/spec/unit/has_and_belongs_to_many_association_spec.rb +1 -1
  29. data/spec/unit/has_many_association_spec.rb +2 -2
  30. data/spec/unit/om_datastream_spec.rb +0 -31
  31. data/spec/unit/ordered_spec.rb +1 -0
  32. data/spec/unit/orders/list_node_spec.rb +1 -1
  33. data/spec/unit/query_spec.rb +14 -14
  34. metadata +2 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1467d74478a1ea4aa80bcb17add4c7f34b798af7
4
- data.tar.gz: 5e15c3f279e391f4acf2fd0c87a5554e0df65c7d
3
+ metadata.gz: edd51836aa6c45e18a108d020753474a74b39a8a
4
+ data.tar.gz: 467181b690984218af00de00f2d0644e6d059601
5
5
  SHA512:
6
- metadata.gz: c65e10a31bc1b766e4837eabfa198a3fe873b3ba93963d46edaaf0efb16c509f7091752336bf4608ea7e2fbccab5f899644777bb187585f1f197560b963b52b3
7
- data.tar.gz: 03dcfbf9f6c33829ac0235a5108985b29a62cbbe8b9782a24cee195f7962749010c4d75559f2f7e9ffade94f5acaeb58474465a021c43c25e2b370e1ba7d80cd
6
+ metadata.gz: 9b8c013c28881485042b14d79d37ec2123fcc8e2647ede3fe9c99875afc3d02dbc1e797405c1b355f271c480e3303f6790df3f8f494cafc068aa25d19a59f46b
7
+ data.tar.gz: 8e8ea6f566fcc5f4067be91e28f5d4e594a711a623dae5364445cc52f3fdc017063e8f568f2d53a62e740f2856633fabf52b50a09df1ca3b7f8439d44d844b8c
@@ -22,7 +22,6 @@ Gem::Specification.new do |s|
22
22
  s.add_dependency "activemodel", '>= 4.2', '< 6'
23
23
  s.add_dependency "active-triples", '~> 0.7.1'
24
24
  s.add_dependency "rdf-rdfxml", '~> 1.1'
25
- s.add_dependency "linkeddata"
26
25
  s.add_dependency "deprecation"
27
26
  s.add_dependency "ldp", '~> 0.5.0'
28
27
 
@@ -25,12 +25,12 @@ module ActiveFedora
25
25
 
26
26
  def find_or_initialize_target(&block)
27
27
  if reflection.klass < ActiveFedora::File
28
- reflection.build_association(target_uri, &block)
28
+ reflection.build_association(id: target_uri, &block)
29
29
  else
30
30
  reflection.klass.find(target_uri)
31
31
  end
32
32
  rescue ActiveFedora::ObjectNotFoundError
33
- reflection.build_association(target_uri, &block)
33
+ reflection.build_association(id: target_uri, &block)
34
34
  end
35
35
 
36
36
  def replace(record)
@@ -22,7 +22,7 @@ module ActiveFedora
22
22
  def self.find_or_initialize(id)
23
23
  find(id)
24
24
  rescue ActiveFedora::ObjectNotFoundError
25
- new(id)
25
+ new(id: id)
26
26
  end
27
27
 
28
28
  private
@@ -2,6 +2,7 @@ module ActiveFedora
2
2
  module Core
3
3
  extend ActiveSupport::Autoload
4
4
  extend ActiveSupport::Concern
5
+ extend Deprecation
5
6
  include ActiveFedora::Common
6
7
 
7
8
  autoload :FedoraIdTranslator
@@ -148,6 +149,7 @@ module ActiveFedora
148
149
  def initialize_attributes(attributes_or_id)
149
150
  case attributes_or_id
150
151
  when String
152
+ Deprecation.warn(Core, "calling #{self.class}.new with a string is deprecated. Pass a hash with id instead.")
151
153
  attributes = { id: attributes_or_id }.with_indifferent_access
152
154
  when Hash
153
155
  attributes = attributes_or_id.with_indifferent_access
@@ -30,7 +30,7 @@ module ActiveFedora
30
30
  # @yield [self] Yields self
31
31
  # @yieldparam [File] self the newly created file
32
32
  def initialize(identifier = nil, &_block)
33
- identifier = nil if identifier.is_a? Hash
33
+ identifier = identifier.delete(:id) if identifier.is_a? Hash
34
34
  run_callbacks(:initialize) do
35
35
  case identifier
36
36
  when nil, ::RDF::URI
@@ -160,14 +160,6 @@ module ActiveFedora
160
160
  end
161
161
  private_class_method :relation
162
162
 
163
- protected
164
-
165
- # The string to prefix all solr fields with. Override this method if you want
166
- # a prefix other than the default
167
- def prefix(path)
168
- path ? "#{path.underscore}__" : ''
169
- end
170
-
171
163
  private
172
164
 
173
165
  def create_or_update(*options)
@@ -10,6 +10,7 @@ module ActiveFedora
10
10
  module Indexing
11
11
  extend ActiveSupport::Concern
12
12
  extend ActiveSupport::Autoload
13
+ extend Deprecation
13
14
 
14
15
  eager_autoload do
15
16
  autoload :Map
@@ -105,6 +106,7 @@ module ActiveFedora
105
106
  def load_instance_from_solr(id, solr_doc = nil)
106
107
  SolrInstanceLoader.new(self, id, solr_doc).object
107
108
  end
109
+ deprecation_deprecate :load_instance_from_solr
108
110
 
109
111
  def descendant_uris(uri)
110
112
  resource = Ldp::Resource::RdfSource.new(ActiveFedora.fedora.connection, uri)
@@ -3,12 +3,18 @@ require "nom"
3
3
  module ActiveFedora
4
4
  class NomDatastream < File
5
5
  include Datastreams::NokogiriDatastreams
6
+ extend Deprecation
6
7
 
7
8
  def self.set_terminology(options = {}, &block)
8
9
  @terminology_options = options || {}
9
10
  @terminology = block
10
11
  end
11
12
 
13
+ def initialize(*args)
14
+ super
15
+ Deprecation.warn(NomDatastream, "NomDatastream is deprecated and will be removed in ActiveFedora 11")
16
+ end
17
+
12
18
  class << self
13
19
  attr_reader :terminology_options
14
20
  end
@@ -12,10 +12,16 @@ module ActiveFedora
12
12
  include OM::XML::Document
13
13
  include OM::XML::TerminologyBasedSolrizer # this adds support for calling .to_solr
14
14
  include Datastreams::NokogiriDatastreams
15
+ extend Deprecation
15
16
 
16
17
  alias om_term_values term_values unless method_defined?(:om_term_values)
17
18
  alias om_update_values update_values unless method_defined?(:om_update_values)
18
19
 
20
+ def initialize(*args)
21
+ super
22
+ Deprecation.warn(OmDatastream, "OmDatastream is deprecated and will be removed in ActiveFedora 11")
23
+ end
24
+
19
25
  def default_mime_type
20
26
  'text/xml'
21
27
  end
@@ -33,28 +39,6 @@ module ActiveFedora
33
39
  solr_doc.merge super({}).each_with_object({}) { |(key, value), new| new[[prefix, key].join] = value }
34
40
  end
35
41
 
36
- # ** Experimental **
37
- # @return [Boolean] true if either the key for name exists in solr or if its string value exists
38
- # @param [String] name Name of key to look for
39
- # @param [Solr::Document] solr_doc Solr doc to query
40
- def has_solr_name?(name, solr_doc = {})
41
- !solr_doc[name].nil? || !solr_doc[name.to_s].nil?
42
- end
43
-
44
- # ** Experimental **
45
- # @return true if the term_pointer contains an index
46
- # ====Example:
47
- # [:image, {:title_set=>1}, :title] return true
48
- # [:image, :title_set, :title] return false
49
- def is_hierarchical_term_pointer?(*term_pointer)
50
- if term_pointer.length > 1
51
- term_pointer.each do |pointer|
52
- return true if pointer.is_a?(Hash)
53
- end
54
- end
55
- false
56
- end
57
-
58
42
  # Update field values within the current datastream using {#update_values}, which is a wrapper for {http://rdoc.info/gems/om/1.2.4/OM/XML/TermValueOperators#update_values-instance_method OM::TermValueOperators#update_values}
59
43
  # Ignores any fields from params that this datastream's Terminology doesn't recognize
60
44
  #
@@ -122,5 +106,13 @@ module ActiveFedora
122
106
  result = om_update_values(params)
123
107
  result
124
108
  end
109
+
110
+ protected
111
+
112
+ # The string to prefix all solr fields with. Override this method if you want
113
+ # a prefix other than the default
114
+ def prefix(path)
115
+ path ? "#{path.underscore}__" : ''
116
+ end
125
117
  end
126
118
  end
@@ -39,5 +39,11 @@ module ActiveFedora::RDF
39
39
  def apply_prefix(name, file_path)
40
40
  prefix(file_path) + name.to_s
41
41
  end
42
+
43
+ # The string to prefix all solr fields with. Override this method if you want
44
+ # a prefix other than the default
45
+ def prefix(path)
46
+ path ? "#{path.underscore}__" : ''
47
+ end
42
48
  end
43
49
  end
@@ -5,5 +5,9 @@ module ActiveFedora
5
5
  def serialization_format
6
6
  :ntriples
7
7
  end
8
+
9
+ def deprecation_warning
10
+ Deprecation.warn(NtriplesRDFDatastream, "NtriplesRDFDatastream is deprecated and will be removed in ActiveFedora 11", caller(2))
11
+ end
8
12
  end
9
13
  end
@@ -4,8 +4,17 @@ module ActiveFedora
4
4
  include RDF::DatastreamIndexing
5
5
  include ActiveTriples::Properties
6
6
  include ActiveTriples::Reflection
7
+ extend Deprecation
7
8
 
8
9
  delegate :rdf_subject, :set_value, :get_values, :attributes=, to: :resource
10
+ def initialize(*args)
11
+ super
12
+ deprecation_warning
13
+ end
14
+
15
+ def deprecation_warning
16
+ Deprecation.warn(RDFDatastream, "RDFDatastream is deprecated and will be removed in ActiveFedora 11", caller(2))
17
+ end
9
18
 
10
19
  class << self
11
20
  def rdf_subject(&block)
@@ -4,7 +4,6 @@ module ActiveFedora
4
4
  autoload :DatastreamIndexing
5
5
  autoload :Fcrepo
6
6
  autoload :IndexingService
7
- autoload :Identifiable
8
7
  autoload :Persistence
9
8
  autoload :ProjectHydra
10
9
  autoload :FieldMap
@@ -255,13 +255,13 @@ module ActiveFedora
255
255
  # @param [Hash<Symbol,String>] conditions
256
256
  # @return [Array<String>]
257
257
  def create_query_from_hash(conditions)
258
- conditions.map { |key, value| condition_to_clauses(key, value) }.compact
258
+ conditions.map { |key, value| condition_to_clauses(key, value, ' OR ') }.compact
259
259
  end
260
260
 
261
261
  # @param [Symbol] key
262
262
  # @param [String] value
263
- def condition_to_clauses(key, value)
264
- SolrQueryBuilder.construct_query([[field_name_for(key), value]])
263
+ def condition_to_clauses(key, value, join_with = SolrQueryBuilder.default_join_with)
264
+ SolrQueryBuilder.construct_query([[field_name_for(key), value]], join_with)
265
265
  end
266
266
 
267
267
  # If the key is a property name, turn it into a solr field
@@ -13,6 +13,7 @@ module ActiveFedora
13
13
  #
14
14
  # fruits = Fruit.all
15
15
  # fruits = fruits.where(color: 'red') if options[:red_only]
16
+ # fruits = fruits.where(size: ['big', 'little']) # gets big or little fruit
16
17
  # fruits = fruits.limit(10) if limited?
17
18
  #
18
19
  # You can define a scope that applies to all finders using
@@ -19,7 +19,7 @@ module ActiveFedora
19
19
  # # => _query_:"{!field f=has_model_ssim}info:fedora/afmodel:ComplexCollection" OR _query_:"{!field f=has_model_ssim}info:fedora/afmodel:ActiveFedora_Base"
20
20
  #
21
21
  # construct_query_for_rel [[Book._reflect_on_association(:library), "foo/bar/baz"]]
22
- def construct_query_for_rel(field_pairs, join_with = ' AND ')
22
+ def construct_query_for_rel(field_pairs, join_with = default_join_with)
23
23
  field_pairs = field_pairs.to_a if field_pairs.is_a? Hash
24
24
  construct_query(property_values_to_solr(field_pairs), join_with)
25
25
  end
@@ -31,8 +31,15 @@ module ActiveFedora
31
31
  # @example
32
32
  # construct_query([['library_id_ssim', '123'], ['owner_ssim', 'Fred']])
33
33
  # # => "_query_:\"{!field f=library_id_ssim}123\" AND _query_:\"{!field f=owner_ssim}Fred\""
34
- def construct_query(field_pairs, join_with = ' AND ')
35
- pairs_to_clauses(field_pairs).join(join_with)
34
+ def construct_query(field_pairs, join_with = default_join_with)
35
+ clauses = pairs_to_clauses(field_pairs)
36
+ return "" if clauses.count == 0
37
+ return clauses.first if clauses.count == 1
38
+ "(#{clauses.join(join_with)})"
39
+ end
40
+
41
+ def default_join_with
42
+ ' AND '
36
43
  end
37
44
 
38
45
  private
@@ -1,3 +1,3 @@
1
1
  module ActiveFedora
2
- VERSION = "10.0.0".freeze
2
+ VERSION = "10.2.0".freeze
3
3
  end
@@ -41,14 +41,6 @@ namespace :active_fedora do
41
41
  spec.rcov = true
42
42
  end
43
43
 
44
- desc "Copies the default SOLR config for the bundled Testing Server"
45
- task :configure_jetty do
46
- FileList['lib/generators/active_fedora/config/solr/templates/solr_conf/conf/*'].each do |f|
47
- cp("#{f}", 'jetty/solr/development-core/conf/', :verbose => true)
48
- cp("#{f}", 'jetty/solr/test-core/conf/', :verbose => true)
49
- end
50
- end
51
-
52
44
  desc "CI build"
53
45
  task :ci do
54
46
  ENV['environment'] = "test"
@@ -17,11 +17,11 @@
17
17
  -->
18
18
 
19
19
  <!--
20
- This is a stripped down config file used for a simple example...
21
- It is *not* a good example to work from.
20
+ This is a stripped down config file used for a simple example...
21
+ It is *not* a good example to work from.
22
22
  -->
23
23
  <config>
24
-
24
+
25
25
  <!-- Controls what version of Lucene various components of Solr
26
26
  adhere to. Generally, you want to use the latest version to
27
27
  get all bug fixes and improvements. It is highly recommended
@@ -29,30 +29,29 @@
29
29
  affect both how text is indexed and queried.
30
30
  -->
31
31
  <luceneMatchVersion>5.0.0</luceneMatchVersion>
32
-
32
+
33
33
  <lib dir="${solr.install.dir:../../../..}/contrib/analysis-extras/lib" />
34
34
  <lib dir="${solr.install.dir:../../../..}/contrib/analysis-extras/lucene-libs" />
35
35
  <lib dir="${solr.install.dir:../../../..}/contrib/extraction/lib" regex=".*\.jar" />
36
36
  <lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-cell-\d.*\.jar" />
37
37
 
38
- <directoryFactory name="DirectoryFactory"
38
+ <directoryFactory name="DirectoryFactory"
39
39
  class="${solr.directoryFactory:solr.NRTCachingDirectoryFactory}">
40
- </directoryFactory>
40
+ </directoryFactory>
41
41
 
42
42
  <codecFactory class="solr.SchemaCodecFactory"/>
43
43
 
44
44
  <schemaFactory class="ClassicIndexSchemaFactory"/>
45
45
 
46
-
47
46
  <dataDir>${solr.blacklight-core.data.dir:}</dataDir>
48
-
47
+
49
48
  <requestDispatcher handleSelect="true" >
50
49
  <requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048000" />
51
50
  </requestDispatcher>
52
-
51
+
53
52
  <requestHandler name="/analysis/field" startup="lazy" class="solr.FieldAnalysisRequestHandler" />
54
53
 
55
- <!-- config for the admin interface -->
54
+ <!-- config for the admin interface -->
56
55
  <admin>
57
56
  <defaultQuery>*:*</defaultQuery>
58
57
  </admin>
@@ -187,10 +186,21 @@
187
186
  </lst>
188
187
  </requestHandler>
189
188
 
189
+ <searchComponent name="termsComponent" class="solr.TermsComponent" />
190
+
191
+ <requestHandler name="/terms" class="solr.SearchHandler">
192
+ <lst name="defaults">
193
+ <bool name="terms">true</bool>
194
+ </lst>
195
+ <arr name="components">
196
+ <str>termsComponent</str>
197
+ </arr>
198
+ </requestHandler>
199
+
190
200
  <!-- Spell Check
191
201
 
192
202
  The spell check component can return a list of alternative spelling
193
- suggestions.
203
+ suggestions.
194
204
 
195
205
  http://wiki.apache.org/solr/SpellCheckComponent
196
206
  -->
@@ -245,7 +255,7 @@
245
255
  </lst>
246
256
  -->
247
257
 
248
- <!-- a spellchecker that use an alternate comparator
258
+ <!-- a spellchecker that use an alternate comparator
249
259
 
250
260
  comparatorClass be one of:
251
261
  1. score (default)
@@ -308,4 +318,3 @@
308
318
  <!-- </lst> -->
309
319
  </requestHandler>
310
320
  </config>
311
-
@@ -42,6 +42,7 @@ describe ActiveFedora::Base do
42
42
 
43
43
  describe "saving and loading in Solr" do
44
44
  let(:object) { Foo.create!(date: [date], single_date: date2, empty_date: '', integer: 1) }
45
+ before { allow(Deprecation).to receive(:warn) }
45
46
 
46
47
  let(:subject_solr) { object.class.load_instance_from_solr(object.id) }
47
48
  it "uses DateTime objects" do
@@ -19,7 +19,7 @@ describe ActiveFedora::Base do
19
19
  end
20
20
  context "in a typical sitation" do
21
21
  specify "it cannot be reused" do
22
- expect { described_class.create(ghost) }.to raise_error(Ldp::Gone)
22
+ expect { described_class.create(id: ghost) }.to raise_error(Ldp::Gone)
23
23
  end
24
24
  end
25
25
  specify "remove its tombstone" do
@@ -123,7 +123,7 @@ EOF
123
123
  subject.destroy
124
124
  end
125
125
 
126
- subject { RdfTest.new('/test:99') }
126
+ subject { RdfTest.new(id: '/test:99') }
127
127
 
128
128
  it "writes rdf with proper subjects" do
129
129
  subject.reload
@@ -65,6 +65,7 @@ describe ActiveFedora::Querying do
65
65
  field = ActiveFedora.index_field_mapper.solr_name('foo', type: :string)
66
66
  expect(ModelIntegrationSpec::Basic.where(field => 'Beta')).to eq [test_instance1]
67
67
  expect(ModelIntegrationSpec::Basic.where('foo' => 'Beta')).to eq [test_instance1]
68
+ expect(ModelIntegrationSpec::Basic.where('foo' => ['Beta', 'Alpha'])).to eq [test_instance1, test_instance2]
68
69
  end
69
70
  it "orders" do
70
71
  expect(ModelIntegrationSpec::Basic.order(ActiveFedora.index_field_mapper.solr_name('foo', :sortable) + ' asc')).to eq [test_instance2, test_instance1, test_instance3]
@@ -139,6 +139,7 @@ describe ActiveFedora::SolrInstanceLoader do
139
139
  end
140
140
 
141
141
  describe "loading system properties" do
142
+ before { allow(Deprecation).to receive(:warn) }
142
143
  let(:obj_solr) { Foo.load_instance_from_solr(obj.id) }
143
144
  it "loads create_date from solr" do
144
145
  expect(obj.create_date).to be_present
data/spec/spec_helper.rb CHANGED
@@ -37,6 +37,12 @@ restore_spec_configuration
37
37
 
38
38
  require 'active_fedora/cleaner'
39
39
  RSpec.configure do |config|
40
+ config.before(:suite) do
41
+ ActiveFedora::RDFDatastream.deprecation_behavior = :silence
42
+ ActiveFedora::NtriplesRDFDatastream.deprecation_behavior = :silence
43
+ ActiveFedora::OmDatastream.deprecation_behavior = :silence
44
+ ActiveFedora::NomDatastream.deprecation_behavior = :silence
45
+ end
40
46
  # Stub out test stuff.
41
47
  config.before(:each) do
42
48
  begin
@@ -141,6 +141,7 @@ describe ActiveFedora::Base do
141
141
 
142
142
  context "with an id argument" do
143
143
  it "is able to create with a custom id" do
144
+ expect(Deprecation).to receive(:warn)
144
145
  expect(FooHistory).to receive(:id_to_uri).and_call_original
145
146
  f = FooHistory.new('baz_1')
146
147
  expect(f.id).to eq 'baz_1'
@@ -51,8 +51,8 @@ describe ActiveFedora::FinderMethods do
51
51
 
52
52
  context "when value is an array" do
53
53
  let(:value) { ['one', 'four'] }
54
- it { is_expected.to eq "_query_:\"{!field f=library_id}one\" AND " \
55
- "_query_:\"{!field f=library_id}four\"" }
54
+ it { is_expected.to eq "(_query_:\"{!field f=library_id}one\" AND " \
55
+ "_query_:\"{!field f=library_id}four\")" }
56
56
  end
57
57
  end
58
58
 
@@ -18,7 +18,7 @@ describe ActiveFedora::Associations::HasAndBelongsToManyAssociation do
18
18
  Object.send(:remove_const, :Book)
19
19
  Object.send(:remove_const, :Page)
20
20
  end
21
- subject { Book.new('subject-a') }
21
+ subject { Book.new(id: 'subject-a') }
22
22
 
23
23
  context "a one way relationship " do
24
24
  describe "adding memeber" do
@@ -12,8 +12,8 @@ describe ActiveFedora::Associations::HasManyAssociation do
12
12
  Object.send(:remove_const, :Book)
13
13
  Object.send(:remove_const, :Page)
14
14
  end
15
- let(:book) { Book.new('subject-a') }
16
- let(:page) { Page.new('object-b') }
15
+ let(:book) { Book.new(id: 'subject-a') }
16
+ let(:page) { Page.new(id: 'object-b') }
17
17
 
18
18
  describe "setting the foreign key" do
19
19
  before do
@@ -256,37 +256,6 @@ describe ActiveFedora::OmDatastream do
256
256
  end
257
257
  end
258
258
 
259
- describe '.has_solr_name?' do
260
- let(:name0_role0) { ActiveFedora.index_field_mapper.solr_name("desc_metadata__name_0_role_0_roleTerm", type: :string) }
261
- let(:name1_role1) { ActiveFedora.index_field_mapper.solr_name("desc_metadata__name_1_role_1_roleTerm", type: :string) }
262
- let(:solr_doc) do
263
- { "id" => "mods_article1",
264
- ActiveFedora.index_field_mapper.solr_name("desc_metadata__name_role_roleTerm", type: :string) => ["creator", "submitter", "teacher"],
265
- ActiveFedora.index_field_mapper.solr_name("desc_metadata__name_0_role", type: :string) => "\r\ncreator\r\nsubmitter\r\n",
266
- ActiveFedora.index_field_mapper.solr_name("desc_metadata__name_1_role", type: :string) => "\r\n teacher \r\n",
267
- name0_role0 => "creator",
268
- ActiveFedora.index_field_mapper.solr_name("desc_metadata__name_0_role_1_roleTerm", type: :string) => "submitter",
269
- ActiveFedora.index_field_mapper.solr_name("desc_metadata__name_1_role_0_roleTerm", type: :string) => ["teacher"] }
270
- end
271
-
272
- it "returns true if the given key exists in the solr document passed in" do
273
- expect(subject).to have_solr_name(name0_role0, solr_doc)
274
- expect(subject).to have_solr_name(name0_role0.to_sym, solr_doc)
275
- expect(subject).to_not have_solr_name(name1_role1, solr_doc)
276
- # if not doc passed in should be new empty solr doc and always return false
277
- expect(subject).to_not have_solr_name(name0_role0)
278
- end
279
- end
280
-
281
- describe '.is_hierarchical_term_pointer?' do
282
- it "returns true only if the pointer passed in is an array that contains a hash" do
283
- expect(subject.is_hierarchical_term_pointer?(*[:image, { tag1: 1 }, :tag2])).to be true
284
- expect(subject.is_hierarchical_term_pointer?(*[:image, :tag1, { tag2: 1 }])).to be true
285
- expect(subject.is_hierarchical_term_pointer?(*[:image, :tag1, :tag2])).to be false
286
- expect(subject.is_hierarchical_term_pointer?(nil)).to be false
287
- end
288
- end
289
-
290
259
  describe '.update_values' do
291
260
  subject { described_class.new }
292
261
 
@@ -64,6 +64,7 @@ describe ActiveFedora::Orders do
64
64
  subject.save!
65
65
  solr_doc = ActiveFedora::SolrService.query("id:#{subject.id}").first
66
66
 
67
+ allow(Deprecation).to receive(:warn)
67
68
  expect { ActiveFedora::Base.load_instance_from_solr(subject.id, solr_doc) }.not_to raise_error
68
69
  end
69
70
 
@@ -35,7 +35,7 @@ RSpec.describe ActiveFedora::Orders::ListNode do
35
35
  end
36
36
  context "and it doesn't exist" do
37
37
  it "returns an AT::Resource" do
38
- member = Member.new("testing")
38
+ member = Member.new(id: "testing")
39
39
  graph << [rdf_subject, RDF::Vocab::ORE.proxyFor, member.resource.rdf_subject]
40
40
  expect(subject.target.rdf_subject).to eq member.uri
41
41
  end
@@ -79,8 +79,8 @@ describe ActiveFedora::Base do
79
79
  let(:solr) { ActiveFedora::SolrService.instance.conn }
80
80
  let(:expected_query) { "#{model_query} AND " \
81
81
  "_query_:\"{!field f=foo}bar\" AND " \
82
- "_query_:\"{!field f=baz}quix\" AND " \
83
- "_query_:\"{!field f=baz}quack\"" }
82
+ "(_query_:\"{!field f=baz}quix\" OR " \
83
+ "_query_:\"{!field f=baz}quack\")" }
84
84
  let(:expected_params) { { params: { sort: [sort_query], fl: 'id', q: expected_query, qt: 'standard' } } }
85
85
  let(:expected_sort_params) { { params: { sort: ["title_t desc"], fl: 'id', q: expected_query, qt: 'standard' } } }
86
86
  let(:mock_docs) { [{ "id" => "changeme:30" }, { "id" => "changeme:22" }] }
@@ -128,9 +128,9 @@ describe ActiveFedora::Base do
128
128
  .and_return('response' => { 'docs' => mock_docs })
129
129
 
130
130
  allow(relation).to receive(:load_from_fedora).with("changeme-30", nil)
131
- .and_return(SpecModel::Basic.new('changeme-30'))
131
+ .and_return(SpecModel::Basic.new(id: 'changeme-30'))
132
132
  allow(relation).to receive(:load_from_fedora).with("changeme-22", nil)
133
- .and_return(SpecModel::Basic.new('changeme-22'))
133
+ .and_return(SpecModel::Basic.new(id: 'changeme-22'))
134
134
  SpecModel::Basic.find_each { |obj| obj.class == SpecModel::Basic }
135
135
  end
136
136
 
@@ -138,14 +138,14 @@ describe ActiveFedora::Base do
138
138
  let(:solr) { ActiveFedora::SolrService.instance.conn }
139
139
  let(:expected_query) { "#{model_query} AND " \
140
140
  "_query_:\"{!field f=foo}bar\" AND " \
141
- "_query_:\"{!field f=baz}quix\" AND " \
142
- "_query_:\"{!field f=baz}quack\"" }
141
+ "(_query_:\"{!field f=baz}quix\" OR " \
142
+ "_query_:\"{!field f=baz}quack\")" }
143
143
  let(:expected_params) { { params: { sort: [sort_query], fl: 'id', q: expected_query, qt: 'standard' } } }
144
144
  let(:mock_docs) { [{ "id" => "changeme-30" }, { "id" => "changeme-22" }] }
145
145
 
146
146
  it "filters by the provided fields" do
147
- expect(relation).to receive(:load_from_fedora).with("changeme-30", nil).and_return(SpecModel::Basic.new('changeme-30'))
148
- expect(relation).to receive(:load_from_fedora).with("changeme-22", nil).and_return(SpecModel::Basic.new('changeme-22'))
147
+ expect(relation).to receive(:load_from_fedora).with("changeme-30", nil).and_return(SpecModel::Basic.new(id: 'changeme-30'))
148
+ expect(relation).to receive(:load_from_fedora).with("changeme-22", nil).and_return(SpecModel::Basic.new(id: 'changeme-22'))
149
149
 
150
150
  expect(mock_docs).to receive(:has_next?).and_return(false)
151
151
  expect(solr).to receive(:paginate).with(1, 1000, 'select', expected_params).and_return('response' => { 'docs' => mock_docs })
@@ -159,8 +159,8 @@ describe ActiveFedora::Base do
159
159
  let(:solr) { ActiveFedora::SolrService.instance.conn }
160
160
  let(:expected_query) { "#{model_query} AND " \
161
161
  "_query_:\"{!field f=foo}bar\" AND " \
162
- "_query_:\"{!field f=baz}quix\" AND " \
163
- "_query_:\"{!field f=baz}quack\"" }
162
+ "(_query_:\"{!field f=baz}quix\" OR " \
163
+ "_query_:\"{!field f=baz}quack\")" }
164
164
  let(:expected_params) { { params: { sort: [sort_query], fl: 'id', q: expected_query, qt: 'standard' } } }
165
165
  let(:mock_docs) { double('docs') }
166
166
 
@@ -254,8 +254,8 @@ describe ActiveFedora::Base do
254
254
  context "with a hash of conditions" do
255
255
  let(:expected_query) { "#{model_query} AND " \
256
256
  "_query_:\"{!field f=foo}bar\" AND " \
257
- "_query_:\"{!field f=baz}quix\" AND " \
258
- "_query_:\"{!field f=baz}quack\"" }
257
+ "(_query_:\"{!field f=baz}quix\" OR " \
258
+ "_query_:\"{!field f=baz}quack\")" }
259
259
  let(:conditions) { { foo: 'bar', baz: ['quix', 'quack'] } }
260
260
 
261
261
  it "makes a query to solr and returns the results" do
@@ -266,8 +266,8 @@ describe ActiveFedora::Base do
266
266
  context "with quotes in the params" do
267
267
  let(:expected_query) { "#{model_query} AND " \
268
268
  "_query_:\"{!field f=foo}9\\\" Nails\" AND " \
269
- "_query_:\"{!field f=baz}7\\\" version\" AND " \
270
- "_query_:\"{!field f=baz}quack\"" }
269
+ "(_query_:\"{!field f=baz}7\\\" version\" OR " \
270
+ "_query_:\"{!field f=baz}quack\")" }
271
271
  let(:conditions) { { foo: '9" Nails', baz: ['7" version', 'quack'] } }
272
272
 
273
273
  it "escapes quotes" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active-fedora
3
3
  version: !ruby/object:Gem::Version
4
- version: 10.0.0
4
+ version: 10.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Zumwalt
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-06-08 00:00:00.000000000 Z
13
+ date: 2016-08-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rsolr
@@ -142,20 +142,6 @@ dependencies:
142
142
  - - "~>"
143
143
  - !ruby/object:Gem::Version
144
144
  version: '1.1'
145
- - !ruby/object:Gem::Dependency
146
- name: linkeddata
147
- requirement: !ruby/object:Gem::Requirement
148
- requirements:
149
- - - ">="
150
- - !ruby/object:Gem::Version
151
- version: '0'
152
- type: :runtime
153
- prerelease: false
154
- version_requirements: !ruby/object:Gem::Requirement
155
- requirements:
156
- - - ">="
157
- - !ruby/object:Gem::Version
158
- version: '0'
159
145
  - !ruby/object:Gem::Dependency
160
146
  name: deprecation
161
147
  requirement: !ruby/object:Gem::Requirement