active-fedora 9.0.0.beta2 → 9.0.0.beta3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/config/jetty.yml +1 -1
  3. data/lib/active_fedora.rb +11 -3
  4. data/lib/active_fedora/associations/association_scope.rb +2 -2
  5. data/lib/active_fedora/associations/belongs_to_association.rb +2 -2
  6. data/lib/active_fedora/associations/collection_association.rb +13 -13
  7. data/lib/active_fedora/associations/has_and_belongs_to_many_association.rb +2 -2
  8. data/lib/active_fedora/associations/rdf.rb +2 -2
  9. data/lib/active_fedora/cleaner.rb +2 -6
  10. data/lib/active_fedora/fedora.rb +18 -0
  11. data/lib/active_fedora/fedora_attributes.rb +4 -4
  12. data/lib/active_fedora/file.rb +7 -0
  13. data/lib/active_fedora/fixity_service.rb +9 -1
  14. data/lib/active_fedora/indexing_service.rb +2 -7
  15. data/lib/active_fedora/loadable_from_json.rb +4 -0
  16. data/lib/active_fedora/om_datastream.rb +0 -4
  17. data/lib/active_fedora/qualified_dublin_core_datastream.rb +1 -1
  18. data/lib/active_fedora/query_result_builder.rb +56 -0
  19. data/lib/active_fedora/querying.rb +1 -1
  20. data/lib/active_fedora/rdf.rb +2 -1
  21. data/lib/active_fedora/rdf/fcrepo.rb +323 -9
  22. data/lib/active_fedora/rdf/fcrepo4.rb +7 -0
  23. data/lib/active_fedora/rdf/indexing.rb +1 -1
  24. data/lib/active_fedora/rdf/project_hydra.rb +12 -0
  25. data/lib/active_fedora/reflection.rb +4 -1
  26. data/lib/active_fedora/relation/finder_methods.rb +4 -4
  27. data/lib/active_fedora/simple_datastream.rb +11 -12
  28. data/lib/active_fedora/solr_instance_loader.rb +1 -1
  29. data/lib/active_fedora/solr_query_builder.rb +57 -0
  30. data/lib/active_fedora/solr_service.rb +22 -48
  31. data/lib/active_fedora/version.rb +1 -1
  32. data/lib/active_fedora/versionable.rb +12 -13
  33. data/spec/integration/associations_spec.rb +6 -6
  34. data/spec/integration/attributes_spec.rb +22 -6
  35. data/spec/integration/base_spec.rb +2 -2
  36. data/spec/integration/collection_association_spec.rb +9 -0
  37. data/spec/integration/file_spec.rb +30 -0
  38. data/spec/integration/full_featured_model_spec.rb +1 -1
  39. data/spec/integration/ntriples_datastream_spec.rb +5 -5
  40. data/spec/integration/om_datastream_spec.rb +1 -1
  41. data/spec/integration/{solr_service_spec.rb → query_result_builder_spec.rb} +5 -7
  42. data/spec/integration/relation_delegation_spec.rb +3 -3
  43. data/spec/integration/scoped_query_spec.rb +11 -11
  44. data/spec/integration/solr_instance_loader_spec.rb +8 -0
  45. data/spec/integration/versionable_spec.rb +32 -14
  46. data/spec/unit/base_spec.rb +3 -3
  47. data/spec/unit/indexing_service_spec.rb +2 -2
  48. data/spec/unit/ntriples_datastream_spec.rb +16 -16
  49. data/spec/unit/om_datastream_spec.rb +7 -7
  50. data/spec/unit/qualified_dublin_core_datastream_spec.rb +1 -1
  51. data/spec/unit/query_result_builder_spec.rb +39 -0
  52. data/spec/unit/query_spec.rb +2 -2
  53. data/spec/unit/rdf_vocab_spec.rb +30 -0
  54. data/spec/unit/simple_datastream_spec.rb +2 -2
  55. data/spec/unit/solr_config_options_spec.rb +1 -1
  56. data/spec/unit/solr_query_builder_spec.rb +20 -0
  57. data/spec/unit/solr_service_spec.rb +2 -53
  58. metadata +11 -4
@@ -21,7 +21,7 @@ describe "A base object with metadata" do
21
21
  obj = ActiveFedora::Base.find(@obj.id)
22
22
  expect(obj.foo).to_not be_new_record
23
23
  expect(obj.foo.person).to eq ['bob']
24
- person_field = ActiveFedora::SolrService.solr_name('foo__person', type: :string)
24
+ person_field = ActiveFedora::SolrQueryBuilder.solr_name('foo__person', type: :string)
25
25
  solr_result = ActiveFedora::SolrService.query("{!raw f=id}#{@obj.id}", :fl=>"id #{person_field}").first
26
26
  expect(solr_result).to eq("id"=>@obj.id, person_field =>['bob'])
27
27
  end
@@ -40,7 +40,7 @@ describe "A base object with metadata" do
40
40
  end
41
41
  it "should save the datastream." do
42
42
  expect(MockAFBaseRelationship.find(@release.id).foo.person).to eq ['frank']
43
- person_field = ActiveFedora::SolrService.solr_name('foo__person', type: :string)
43
+ person_field = ActiveFedora::SolrQueryBuilder.solr_name('foo__person', type: :string)
44
44
  expect(ActiveFedora::SolrService.query("id:\"#{@release.id}\"", :fl=>"id #{person_field}").first).to eq("id"=>@release.id, person_field =>['frank'])
45
45
  end
46
46
  end
@@ -55,4 +55,13 @@ describe ActiveFedora::Base do
55
55
  end
56
56
  end
57
57
  end
58
+
59
+ # TODO: Bug described in issue #609
60
+ describe "#select" do
61
+ it "should choose a subset of objects in the relationship" do
62
+ pending "method has private visibility"
63
+ expect(library.books.select([:id])).to include(book1.id)
64
+ end
65
+ end
66
+
58
67
  end
@@ -12,6 +12,36 @@ describe ActiveFedora::File do
12
12
  end
13
13
  end
14
14
 
15
+ context "stand alone operation with UploadedFile" do
16
+ before(:all) do
17
+ module ActionDispatch
18
+ module Http
19
+ class UploadedFile
20
+
21
+ def initialize
22
+ @content = StringIO.new("hello world")
23
+ end
24
+
25
+ def read(a, b)
26
+ return @content.read(a, b)
27
+ end
28
+
29
+ def size
30
+ @content.length
31
+ end
32
+
33
+ end
34
+ end
35
+ end
36
+ end
37
+
38
+ it "should save" do
39
+ subject.content = ActionDispatch::Http::UploadedFile.new
40
+ subject.save
41
+ expect(subject).not_to be_new_record
42
+ end
43
+ end
44
+
15
45
  context "when autocreate is true" do
16
46
  before(:all) do
17
47
  class MockAFBase < ActiveFedora::Base
@@ -142,7 +142,7 @@ describe ActiveFedora::Base do
142
142
  @properties_sample_values.each_pair do |field, value|
143
143
  next if field == :hard_copy_availability #FIXME HYDRA-824
144
144
  next if field == :location #FIXME HYDRA-825
145
- expect((@solr_result[ActiveFedora::SolrService.solr_name(field, type: :string)] || @solr_result[ActiveFedora::SolrService.solr_name(field, type: :date)])).to eq [::Solrizer::Extractor.format_node_value(value)]
145
+ expect((@solr_result[ActiveFedora::SolrQueryBuilder.solr_name(field, type: :string)] || @solr_result[ActiveFedora::SolrQueryBuilder.solr_name(field, type: :date)])).to eq [::Solrizer::Extractor.format_node_value(value)]
146
146
  end
147
147
 
148
148
  @dublin_core_sample_values.each_pair do |field, value|
@@ -78,21 +78,21 @@ describe ActiveFedora::NtriplesRDFDatastream do
78
78
  subject.date_uploaded = [Date.parse('2012-11-02')]
79
79
  expect(subject.date_uploaded.first).to be_kind_of Date
80
80
  solr_document = subject.to_solr
81
- expect(solr_document[ActiveFedora::SolrService.solr_name('rdf__date_uploaded', type: :date)]).to eq ['2012-11-02T00:00:00Z']
81
+ expect(solr_document[ActiveFedora::SolrQueryBuilder.solr_name('rdf__date_uploaded', type: :date)]).to eq ['2012-11-02T00:00:00Z']
82
82
  end
83
83
  it "should handle integers" do
84
- subject.filesize = 12345
84
+ subject.filesize = 12345
85
85
  expect(subject.filesize).to be_kind_of Fixnum
86
86
  solr_document = subject.to_solr
87
- expect(solr_document[ActiveFedora::SolrService.solr_name('rdf__filesize', :stored_sortable, type: :integer)]).to eq '12345'
87
+ expect(solr_document[ActiveFedora::SolrQueryBuilder.solr_name('rdf__filesize', :stored_sortable, type: :integer)]).to eq '12345'
88
88
  end
89
89
  end
90
90
 
91
91
  it "should produce a solr document" do
92
92
  @subject = RdfTest.new(title: "War and Peace")
93
93
  solr_document = @subject.to_solr
94
- expect(solr_document[ActiveFedora::SolrService.solr_name('rdf__title', :facetable)]).to eq ["War and Peace"]
95
- expect(solr_document[ActiveFedora::SolrService.solr_name('rdf__title', type: :string)]).to eq ["War and Peace"]
94
+ expect(solr_document[ActiveFedora::SolrQueryBuilder.solr_name('rdf__title', :facetable)]).to eq ["War and Peace"]
95
+ expect(solr_document[ActiveFedora::SolrQueryBuilder.solr_name('rdf__title', type: :string)]).to eq ["War and Peace"]
96
96
  end
97
97
 
98
98
  it "should set and recall values" do
@@ -73,7 +73,7 @@ describe ActiveFedora::OmDatastream do
73
73
  obj.reload
74
74
  end
75
75
  it "should solrize terms with :type=>'date' to *_dt solr terms" do
76
- expect(obj.to_solr[ActiveFedora::SolrService.solr_name('desc_metadata__journal_issue_publication_date', type: :date)]).to eq ['2012-11-02T00:00:00Z']
76
+ expect(obj.to_solr[ActiveFedora::SolrQueryBuilder.solr_name('desc_metadata__journal_issue_publication_date', type: :date)]).to eq ['2012-11-02T00:00:00Z']
77
77
  end
78
78
  end
79
79
  end
@@ -1,13 +1,13 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe ActiveFedora::SolrService do
3
+ describe ActiveFedora::QueryResultBuilder do
4
4
  describe "#reify_solr_results" do
5
5
  before(:each) do
6
6
  class FooObject < ActiveFedora::Base
7
7
  def self.id_namespace
8
8
  "foo"
9
9
  end
10
-
10
+
11
11
  has_metadata :name => "descMetadata", :type => ActiveFedora::QualifiedDublinCoreDatastream
12
12
  end
13
13
  @test_object = ActiveFedora::Base.new
@@ -27,24 +27,22 @@ describe ActiveFedora::SolrService do
27
27
  @foo_content = @foo_object.attached_files['descMetadata'].content
28
28
  end
29
29
  after(:each) do
30
- @test_object.delete
31
- @foo_object.delete
32
30
  Object.send(:remove_const, :FooObject)
33
31
  end
34
32
  it "should return an array of objects that are of the class stored in active_fedora_model_s" do
35
33
  query = "id\:#{RSolr.escape(@test_object.id)} OR id\:#{RSolr.escape(@foo_object.id)}"
36
34
  solr_result = ActiveFedora::SolrService.query(query)
37
- result = ActiveFedora::SolrService.reify_solr_results(solr_result)
35
+ result = ActiveFedora::QueryResultBuilder.reify_solr_results(solr_result)
38
36
  expect(result.length).to eq 2
39
37
  result.each do |r|
40
38
  expect((r.class == ActiveFedora::Base || r.class == FooObject)).to be true
41
39
  end
42
40
  end
43
-
41
+
44
42
  it 'should #reify a lightweight object as a new instance' do
45
43
  query = "id\:#{RSolr.escape(@foo_object.id)}"
46
44
  solr_result = ActiveFedora::SolrService.query(query)
47
- result = ActiveFedora::SolrService.reify_solr_results(solr_result,{:load_from_solr=>true})
45
+ result = ActiveFedora::QueryResultBuilder.reify_solr_results(solr_result,{:load_from_solr=>true})
48
46
  expect(result.first).to be_instance_of FooObject
49
47
  end
50
48
  end
@@ -1,8 +1,8 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe ActiveFedora::Model do
4
-
5
- before(:all) do
4
+
5
+ before(:all) do
6
6
  module ModelIntegrationSpec
7
7
  class Basic < ActiveFedora::Base
8
8
  has_metadata :name => "properties", :type => ActiveFedora::SimpleDatastream do |m|
@@ -15,7 +15,7 @@ describe ActiveFedora::Model do
15
15
 
16
16
  def to_solr(doc = {})
17
17
  doc = super
18
- doc[ActiveFedora::SolrService.solr_name('foo', :sortable)] = doc[ActiveFedora::SolrService.solr_name('foo', type: :string)]
18
+ doc[ActiveFedora::SolrQueryBuilder.solr_name('foo', :sortable)] = doc[ActiveFedora::SolrQueryBuilder.solr_name('foo', type: :string)]
19
19
  doc
20
20
  end
21
21
  end
@@ -15,7 +15,7 @@ describe "scoped queries" do
15
15
 
16
16
  def to_solr(doc = {})
17
17
  doc = super
18
- doc[ActiveFedora::SolrService.solr_name('foo', :sortable)] = doc[ActiveFedora::SolrService.solr_name('foo', type: :string)]
18
+ doc[ActiveFedora::SolrQueryBuilder.solr_name('foo', :sortable)] = doc[ActiveFedora::SolrQueryBuilder.solr_name('foo', type: :string)]
19
19
  doc
20
20
  end
21
21
 
@@ -66,12 +66,12 @@ describe "scoped queries" do
66
66
  end
67
67
 
68
68
  it "should query" do
69
- field = ActiveFedora::SolrService.solr_name('foo', type: :string)
69
+ field = ActiveFedora::SolrQueryBuilder.solr_name('foo', type: :string)
70
70
  expect(ModelIntegrationSpec::Basic.where(field => 'Beta')).to eq [test_instance1]
71
71
  expect(ModelIntegrationSpec::Basic.where('foo' => 'Beta')).to eq [test_instance1]
72
72
  end
73
73
  it "should order" do
74
- expect(ModelIntegrationSpec::Basic.order(ActiveFedora::SolrService.solr_name('foo', :sortable) + ' asc')).to eq [test_instance2, test_instance1, test_instance3]
74
+ expect(ModelIntegrationSpec::Basic.order(ActiveFedora::SolrQueryBuilder.solr_name('foo', :sortable) + ' asc')).to eq [test_instance2, test_instance1, test_instance3]
75
75
  end
76
76
  it "should limit" do
77
77
  expect(ModelIntegrationSpec::Basic.limit(1)).to eq [test_instance1]
@@ -81,7 +81,7 @@ describe "scoped queries" do
81
81
  end
82
82
 
83
83
  it "should chain queries" do
84
- expect(ModelIntegrationSpec::Basic.where(ActiveFedora::SolrService.solr_name('bar', type: :string) => 'Peanuts').order(ActiveFedora::SolrService.solr_name('foo', :sortable) + ' asc').limit(1)).to eq [test_instance2]
84
+ expect(ModelIntegrationSpec::Basic.where(ActiveFedora::SolrQueryBuilder.solr_name('bar', type: :string) => 'Peanuts').order(ActiveFedora::SolrQueryBuilder.solr_name('foo', :sortable) + ' asc').limit(1)).to eq [test_instance2]
85
85
  end
86
86
 
87
87
  it "should wrap string conditions with parentheses" do
@@ -89,26 +89,26 @@ describe "scoped queries" do
89
89
  end
90
90
 
91
91
  it "should chain where queries" do
92
- expect(ModelIntegrationSpec::Basic.where(ActiveFedora::SolrService.solr_name('bar', type: :string) => 'Peanuts').where("#{ActiveFedora::SolrService.solr_name('foo', type: :string)}:bar").where_values).to eq ["#{ActiveFedora::SolrService.solr_name('bar', type: :string)}:Peanuts", "(#{ActiveFedora::SolrService.solr_name('foo', type: :string)}:bar)"]
92
+ expect(ModelIntegrationSpec::Basic.where(ActiveFedora::SolrQueryBuilder.solr_name('bar', type: :string) => 'Peanuts').where("#{ActiveFedora::SolrQueryBuilder.solr_name('foo', type: :string)}:bar").where_values).to eq ["#{ActiveFedora::SolrQueryBuilder.solr_name('bar', type: :string)}:Peanuts", "(#{ActiveFedora::SolrQueryBuilder.solr_name('foo', type: :string)}:bar)"]
93
93
  end
94
94
 
95
95
  it "should chain count" do
96
- expect(ModelIntegrationSpec::Basic.where(ActiveFedora::SolrService.solr_name('bar', type: :string) => 'Peanuts').count).to eq 2
96
+ expect(ModelIntegrationSpec::Basic.where(ActiveFedora::SolrQueryBuilder.solr_name('bar', type: :string) => 'Peanuts').count).to eq 2
97
97
  end
98
98
 
99
99
  it "calling first should not affect the relation's ability to get all results later" do
100
- relation = ModelIntegrationSpec::Basic.where(ActiveFedora::SolrService.solr_name('bar', type: :string) => 'Peanuts')
100
+ relation = ModelIntegrationSpec::Basic.where(ActiveFedora::SolrQueryBuilder.solr_name('bar', type: :string) => 'Peanuts')
101
101
  expect {relation.first}.not_to change {relation.to_a.size}
102
102
  end
103
103
 
104
104
  it "calling where should not affect the relation's ability to get all results later" do
105
- relation = ModelIntegrationSpec::Basic.where(ActiveFedora::SolrService.solr_name('bar', type: :string) => 'Peanuts')
106
- expect {relation.where(ActiveFedora::SolrService.solr_name('foo', type: :string) => 'bar')}.not_to change {relation.to_a.size}
105
+ relation = ModelIntegrationSpec::Basic.where(ActiveFedora::SolrQueryBuilder.solr_name('bar', type: :string) => 'Peanuts')
106
+ expect {relation.where(ActiveFedora::SolrQueryBuilder.solr_name('foo', type: :string) => 'bar')}.not_to change {relation.to_a.size}
107
107
  end
108
108
 
109
109
  it "calling order should not affect the original order of the relation later" do
110
- relation = ModelIntegrationSpec::Basic.order(ActiveFedora::SolrService.solr_name('foo', :sortable) + ' asc')
111
- expect {relation.order(ActiveFedora::SolrService.solr_name('foo', :sortable) + ' desc')}.not_to change {relation.to_a}
110
+ relation = ModelIntegrationSpec::Basic.order(ActiveFedora::SolrQueryBuilder.solr_name('foo', :sortable) + ' asc')
111
+ expect {relation.order(ActiveFedora::SolrQueryBuilder.solr_name('foo', :sortable) + ' desc')}.not_to change {relation.to_a}
112
112
  end
113
113
  end
114
114
 
@@ -66,6 +66,14 @@ describe ActiveFedora::SolrInstanceLoader do
66
66
  expect(object.foo).to eq ['baz']
67
67
  end
68
68
  end
69
+
70
+ context "with children" do
71
+ let(:loader) { ActiveFedora::SolrInstanceLoader.new(Foo, obj.id) }
72
+
73
+ it "should have stub implementation of the children" do
74
+ expect(subject.descMetadata).to be_kind_of ActiveFedora::LoadableFromJson::SolrBackedMetadataFile
75
+ end
76
+ end
69
77
  end
70
78
 
71
79
  context "with a solr doc" do
@@ -29,7 +29,8 @@ describe "a versionable class" do
29
29
 
30
30
  it "should have one version" do
31
31
  expect(subject.versions.size).to eq 1
32
- expect(subject.versions.first).to be_kind_of ::RDF::Literal
32
+ expect(subject.versions.first).to be_kind_of String
33
+ expect(subject.versions.first).to end_with "version1"
33
34
  end
34
35
 
35
36
  context "two times" do
@@ -41,8 +42,8 @@ describe "a versionable class" do
41
42
 
42
43
  it "should have two versions" do
43
44
  expect(subject.versions.size).to eq 2
44
- subject.versions.each do |version|
45
- expect(version).to be_kind_of ::RDF::Literal
45
+ subject.versions.each_index do |index|
46
+ expect(subject.versions[index]).to end_with "version"+(index+1).to_s
46
47
  end
47
48
  end
48
49
 
@@ -126,7 +127,7 @@ describe "a versionable rdf datastream" do
126
127
  end
127
128
 
128
129
  it "should have one version" do
129
- expect(subject.versions.first).to be_kind_of ::RDF::Literal
130
+ expect(subject.versions.first).to end_with "version1"
130
131
  end
131
132
 
132
133
  it "should have a title" do
@@ -146,8 +147,8 @@ describe "a versionable rdf datastream" do
146
147
 
147
148
  it "should have two versions" do
148
149
  expect(subject.versions.size).to eq 2
149
- subject.versions.each do |version|
150
- expect(version).to be_kind_of ::RDF::Literal
150
+ subject.versions.each_index do |index|
151
+ expect(subject.versions[index]).to end_with "version"+(index+1).to_s
151
152
  end
152
153
  end
153
154
 
@@ -255,8 +256,7 @@ describe "a versionable OM datastream" do
255
256
  end
256
257
 
257
258
  it "should have one version" do
258
- expect(subject.versions.size).to eq 1
259
- expect(subject.versions.first).to be_kind_of ::RDF::Literal
259
+ expect(subject.versions.first).to end_with "version1"
260
260
  end
261
261
 
262
262
  it "should have a title" do
@@ -277,8 +277,8 @@ describe "a versionable OM datastream" do
277
277
 
278
278
  it "should have two unique versions" do
279
279
  expect(subject.versions.size).to eq 2
280
- subject.versions.each do |version|
281
- expect(version).to be_kind_of ::RDF::Literal
280
+ subject.versions.each_index do |index|
281
+ expect(subject.versions[index]).to end_with "version"+(index+1).to_s
282
282
  end
283
283
  end
284
284
 
@@ -384,7 +384,7 @@ describe "a versionable binary datastream" do
384
384
  expect(subject.versions.size).to eq 1
385
385
  expect(subject.original_name).to eql(first_name)
386
386
  expect(subject.content.size).to eq first_file.size
387
- expect(subject.versions.first).to be_kind_of ::RDF::Literal
387
+ expect(subject.versions.first).to end_with "version1"
388
388
  end
389
389
 
390
390
  context "two times" do
@@ -401,8 +401,24 @@ describe "a versionable binary datastream" do
401
401
  expect(subject.versions.size).to eq 2
402
402
  expect(subject.original_name).to eql(second_name)
403
403
  expect(subject.content.size).to eq second_file.size
404
- subject.versions.each do |version|
405
- expect(version).to be_kind_of ::RDF::Literal
404
+ subject.versions.each_index do |index|
405
+ expect(subject.versions[index]).to end_with "version"+(index+1).to_s
406
+ end
407
+ end
408
+
409
+ context "with fixity checking" do
410
+ let(:results) do
411
+ results = Array.new
412
+ subject.versions.each do |uri|
413
+ results << ActiveFedora::FixityService.new(uri).check
414
+ end
415
+ return results
416
+ end
417
+
418
+ it "should report on the fixity of each version" do
419
+ results.each do |result|
420
+ expect(result).to be true
421
+ end
406
422
  end
407
423
  end
408
424
 
@@ -436,7 +452,9 @@ describe "a versionable binary datastream" do
436
452
  expect(subject.versions.size).to eq 3
437
453
  expect(subject.original_name).to eql(first_name)
438
454
  expect(subject.content.size).to eq first_file.size
439
- expect(subject.versions.first).to be_kind_of ::RDF::Literal
455
+ subject.versions.each_index do |index|
456
+ expect(subject.versions[index]).to end_with "version"+(index+1).to_s
457
+ end
440
458
  end
441
459
 
442
460
  end
@@ -264,15 +264,15 @@ describe ActiveFedora::Base do
264
264
  expect(@test_object).to receive(:modified_date).and_return(DateTime.parse("2012-03-07T03:12:02Z")).twice
265
265
  allow(@test_object).to receive(:id).and_return('changeme:123')
266
266
  solr_doc = @test_object.to_solr
267
- expect(solr_doc[ActiveFedora::SolrService.solr_name("system_create", :stored_sortable, type: :date)]).to eql("2012-03-04T03:12:02Z")
268
- expect(solr_doc[ActiveFedora::SolrService.solr_name("system_modified", :stored_sortable, type: :date)]).to eql("2012-03-07T03:12:02Z")
267
+ expect(solr_doc[ActiveFedora::SolrQueryBuilder.solr_name("system_create", :stored_sortable, type: :date)]).to eql("2012-03-04T03:12:02Z")
268
+ expect(solr_doc[ActiveFedora::SolrQueryBuilder.solr_name("system_modified", :stored_sortable, type: :date)]).to eql("2012-03-07T03:12:02Z")
269
269
  expect(solr_doc[:id]).to eql("changeme:123")
270
270
  end
271
271
 
272
272
  it "should add self.class as the :active_fedora_model" do
273
273
  @test_history = FooHistory.new()
274
274
  solr_doc = @test_history.to_solr
275
- expect(solr_doc[ActiveFedora::SolrService.solr_name("active_fedora_model", :stored_sortable)]).to eql("FooHistory")
275
+ expect(solr_doc[ActiveFedora::SolrQueryBuilder.solr_name("active_fedora_model", :stored_sortable)]).to eql("FooHistory")
276
276
  end
277
277
 
278
278
  it "should call .to_solr on all datastreams, passing the resulting document to solr" do
@@ -15,8 +15,8 @@ describe ActiveFedora::IndexingService do
15
15
  expect(object).to receive(:[]).with('person_id').and_return('info:fedora/demo:10')
16
16
  expect(object).to receive(:[]).with('location_id').and_return('info:fedora/demo:11')
17
17
  expect(object.class).to receive(:reflections).and_return(reflections)
18
- expect(subject[ActiveFedora::SolrService.solr_name("http://fedora.info/definitions/v4/rels-ext#isMemberOf", :symbol)]).to eq "info:fedora/demo:10"
19
- expect(subject[ActiveFedora::SolrService.solr_name("http://fedora.info/definitions/v4/rels-ext#isPartOf", :symbol)]).to eq "info:fedora/demo:11"
18
+ expect(subject[ActiveFedora::SolrQueryBuilder.solr_name("http://fedora.info/definitions/v4/rels-ext#isMemberOf", :symbol)]).to eq "info:fedora/demo:10"
19
+ expect(subject[ActiveFedora::SolrQueryBuilder.solr_name("http://fedora.info/definitions/v4/rels-ext#isPartOf", :symbol)]).to eq "info:fedora/demo:11"
20
20
  end
21
21
  end
22
22
 
@@ -218,26 +218,26 @@ describe ActiveFedora::NtriplesRDFDatastream do
218
218
  describe ".to_solr()" do
219
219
  subject { @obj.to_solr({}, name: 'solrRdf') }
220
220
  it "should return the right fields" do
221
- expect(subject.keys).to include(ActiveFedora::SolrService.solr_name("solr_rdf__related_url", type: :string),
222
- ActiveFedora::SolrService.solr_name("solr_rdf__publisher", type: :string),
223
- ActiveFedora::SolrService.solr_name("solr_rdf__publisher", :sortable),
224
- ActiveFedora::SolrService.solr_name("solr_rdf__publisher", :facetable),
225
- ActiveFedora::SolrService.solr_name("solr_rdf__created", :sortable, type: :date),
226
- ActiveFedora::SolrService.solr_name("solr_rdf__created", :displayable),
227
- ActiveFedora::SolrService.solr_name("solr_rdf__title", type: :string),
228
- ActiveFedora::SolrService.solr_name("solr_rdf__title", :sortable),
229
- ActiveFedora::SolrService.solr_name("solr_rdf__based_near", type: :string),
230
- ActiveFedora::SolrService.solr_name("solr_rdf__based_near", :facetable))
221
+ expect(subject.keys).to include(ActiveFedora::SolrQueryBuilder.solr_name("solr_rdf__related_url", type: :string),
222
+ ActiveFedora::SolrQueryBuilder.solr_name("solr_rdf__publisher", type: :string),
223
+ ActiveFedora::SolrQueryBuilder.solr_name("solr_rdf__publisher", :sortable),
224
+ ActiveFedora::SolrQueryBuilder.solr_name("solr_rdf__publisher", :facetable),
225
+ ActiveFedora::SolrQueryBuilder.solr_name("solr_rdf__created", :sortable, type: :date),
226
+ ActiveFedora::SolrQueryBuilder.solr_name("solr_rdf__created", :displayable),
227
+ ActiveFedora::SolrQueryBuilder.solr_name("solr_rdf__title", type: :string),
228
+ ActiveFedora::SolrQueryBuilder.solr_name("solr_rdf__title", :sortable),
229
+ ActiveFedora::SolrQueryBuilder.solr_name("solr_rdf__based_near", type: :string),
230
+ ActiveFedora::SolrQueryBuilder.solr_name("solr_rdf__based_near", :facetable))
231
231
 
232
232
  end
233
233
 
234
234
  it "should return the right values" do
235
- expect(subject[ActiveFedora::SolrService.solr_name("solr_rdf__related_url", type: :string)]).to eq ["http://example.org/blogtastic/"]
236
- expect(subject[ActiveFedora::SolrService.solr_name("solr_rdf__based_near", type: :string)]).to eq ["Tacoma, WA","Renton, WA"]
237
- expect(subject[ActiveFedora::SolrService.solr_name("solr_rdf__based_near", :facetable)]).to eq ["Tacoma, WA","Renton, WA"]
238
- expect(subject[ActiveFedora::SolrService.solr_name("solr_rdf__publisher", type: :string)]).to eq ["Bob's Blogtastic Publishing"]
239
- expect(subject[ActiveFedora::SolrService.solr_name("solr_rdf__publisher", :sortable)]).to eq "Bob's Blogtastic Publishing"
240
- expect(subject[ActiveFedora::SolrService.solr_name("solr_rdf__publisher", :facetable)]).to eq ["Bob's Blogtastic Publishing"]
235
+ expect(subject[ActiveFedora::SolrQueryBuilder.solr_name("solr_rdf__related_url", type: :string)]).to eq ["http://example.org/blogtastic/"]
236
+ expect(subject[ActiveFedora::SolrQueryBuilder.solr_name("solr_rdf__based_near", type: :string)]).to eq ["Tacoma, WA","Renton, WA"]
237
+ expect(subject[ActiveFedora::SolrQueryBuilder.solr_name("solr_rdf__based_near", :facetable)]).to eq ["Tacoma, WA","Renton, WA"]
238
+ expect(subject[ActiveFedora::SolrQueryBuilder.solr_name("solr_rdf__publisher", type: :string)]).to eq ["Bob's Blogtastic Publishing"]
239
+ expect(subject[ActiveFedora::SolrQueryBuilder.solr_name("solr_rdf__publisher", :sortable)]).to eq "Bob's Blogtastic Publishing"
240
+ expect(subject[ActiveFedora::SolrQueryBuilder.solr_name("solr_rdf__publisher", :facetable)]).to eq ["Bob's Blogtastic Publishing"]
241
241
  end
242
242
  end
243
243
  end
@@ -262,16 +262,16 @@ describe ActiveFedora::OmDatastream do
262
262
 
263
263
 
264
264
  describe '.has_solr_name?' do
265
- let(:name0_role0) { ActiveFedora::SolrService.solr_name("desc_metadata__name_0_role_0_roleTerm", type: :string) }
266
- let(:name1_role1) { ActiveFedora::SolrService.solr_name("desc_metadata__name_1_role_1_roleTerm", type: :string) }
265
+ let(:name0_role0) { ActiveFedora::SolrQueryBuilder.solr_name("desc_metadata__name_0_role_0_roleTerm", type: :string) }
266
+ let(:name1_role1) { ActiveFedora::SolrQueryBuilder.solr_name("desc_metadata__name_1_role_1_roleTerm", type: :string) }
267
267
  let(:solr_doc) do
268
268
  {"id"=>"mods_article1",
269
- ActiveFedora::SolrService.solr_name("desc_metadata__name_role_roleTerm", type: :string) =>["creator","submitter","teacher"],
270
- ActiveFedora::SolrService.solr_name("desc_metadata__name_0_role", type: :string)=>"\r\ncreator\r\nsubmitter\r\n",
271
- ActiveFedora::SolrService.solr_name("desc_metadata__name_1_role", type: :string)=>"\r\n teacher \r\n",
269
+ ActiveFedora::SolrQueryBuilder.solr_name("desc_metadata__name_role_roleTerm", type: :string) =>["creator","submitter","teacher"],
270
+ ActiveFedora::SolrQueryBuilder.solr_name("desc_metadata__name_0_role", type: :string)=>"\r\ncreator\r\nsubmitter\r\n",
271
+ ActiveFedora::SolrQueryBuilder.solr_name("desc_metadata__name_1_role", type: :string)=>"\r\n teacher \r\n",
272
272
  name0_role0 =>"creator",
273
- ActiveFedora::SolrService.solr_name("desc_metadata__name_0_role_1_roleTerm", type: :string)=>"submitter",
274
- ActiveFedora::SolrService.solr_name("desc_metadata__name_1_role_0_roleTerm", type: :string)=>["teacher"]}
273
+ ActiveFedora::SolrQueryBuilder.solr_name("desc_metadata__name_0_role_1_roleTerm", type: :string)=>"submitter",
274
+ ActiveFedora::SolrQueryBuilder.solr_name("desc_metadata__name_1_role_0_roleTerm", type: :string)=>["teacher"]}
275
275
  end
276
276
 
277
277
  it "should return true if the given key exists in the solr document passed in" do