active-fedora 9.2.0.rc1 → 9.2.0.rc2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/History.txt +3 -0
- data/lib/active_fedora/fixity_service.rb +17 -17
- data/lib/active_fedora/version.rb +1 -1
- data/spec/unit/fixity_service_spec.rb +23 -11
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bada647c029b7bff0f7068d8226fe256996f091a
|
4
|
+
data.tar.gz: 1c240deeaff193cdca424a8ec0d9c01ab2aefd13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e402d06c32089846dc47542963fccdcf38e512e10c203fb27220e6a7df1e770c805a9aa8435f50729abec853fea9fc83263c20ae885530132236a96cd9024376
|
7
|
+
data.tar.gz: ef787677ed7601618bdf0c989f2298fff0bf43da788a01f5ac94031f296e1f7e1ee2bb8bf0c3b436a37c30d4e169cce19474520529a1957179a33610510c8cf3
|
data/History.txt
CHANGED
@@ -4,10 +4,10 @@ module ActiveFedora
|
|
4
4
|
|
5
5
|
attr_accessor :target, :response
|
6
6
|
|
7
|
-
#
|
7
|
+
# @param [String, RDF::URI] target url for a Fedora resource
|
8
8
|
def initialize target
|
9
9
|
raise ArgumentError, 'You must provide a uri' unless target
|
10
|
-
@target = target
|
10
|
+
@target = target.to_s
|
11
11
|
end
|
12
12
|
|
13
13
|
# Executes a fixity check on Fedora and saves the Faraday::Response.
|
@@ -23,23 +23,23 @@ module ActiveFedora
|
|
23
23
|
|
24
24
|
private
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
def fixity_graph
|
32
|
-
::RDF::Graph.new << ::RDF::Reader.for(:ttl).new(response.body)
|
33
|
-
end
|
26
|
+
def get_fixity_response_from_fedora
|
27
|
+
uri = target + "/fcr:fixity"
|
28
|
+
ActiveFedora.fedora.connection.get(encoded_url(uri))
|
29
|
+
end
|
34
30
|
|
35
|
-
|
36
|
-
|
37
|
-
if uri.match("fcr:versions")
|
38
|
-
uri.gsub(/fcr:versions/,"fcr%3aversions")
|
39
|
-
else
|
40
|
-
uri
|
31
|
+
def fixity_graph
|
32
|
+
::RDF::Graph.new << ::RDF::Reader.for(:ttl).new(response.body)
|
41
33
|
end
|
42
|
-
end
|
43
34
|
|
35
|
+
# See https://jira.duraspace.org/browse/FCREPO-1247
|
36
|
+
# @param [String] uri
|
37
|
+
def encoded_url uri
|
38
|
+
if uri.match("fcr:versions")
|
39
|
+
uri.gsub(/fcr:versions/,"fcr%3aversions")
|
40
|
+
else
|
41
|
+
uri
|
42
|
+
end
|
43
|
+
end
|
44
44
|
end
|
45
45
|
end
|
@@ -2,32 +2,44 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe ActiveFedora::FixityService do
|
4
4
|
|
5
|
-
|
5
|
+
let(:service) { described_class.new(uri) }
|
6
|
+
let(:uri) { RDF::URI("http://path/to/resource") }
|
6
7
|
|
7
|
-
|
8
|
-
|
8
|
+
describe "the instance" do
|
9
|
+
subject { described_class.new(uri) }
|
10
|
+
it { is_expected.to respond_to(:response) }
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "initialize" do
|
14
|
+
context "with a string" do
|
15
|
+
let(:uri) { 'http://path/to/resource' }
|
16
|
+
subject { service.target }
|
17
|
+
it { is_expected.to eq 'http://path/to/resource' }
|
18
|
+
end
|
19
|
+
|
20
|
+
context "with an RDF::URI" do
|
21
|
+
subject { service.target }
|
22
|
+
it { is_expected.to eq 'http://path/to/resource' }
|
23
|
+
end
|
24
|
+
end
|
9
25
|
|
10
26
|
describe "#check" do
|
11
27
|
before do
|
12
|
-
|
28
|
+
allow(service).to receive(:get_fixity_response_from_fedora).and_return(response)
|
13
29
|
end
|
30
|
+
subject { service.check }
|
14
31
|
context "with a passing result" do
|
15
32
|
let(:response) do
|
16
33
|
instance_double("Response", body: '<subject> <http://fedora.info/definitions/v4/repository#status> "SUCCESS"^^<http://www.w3.org/2001/XMLSchema#string> .')
|
17
34
|
end
|
18
|
-
|
19
|
-
expect(subject.check).to be true
|
20
|
-
end
|
21
|
-
|
35
|
+
it { is_expected.to be true }
|
22
36
|
end
|
23
37
|
|
24
38
|
context "with a failing result" do
|
25
39
|
let(:response) do
|
26
40
|
instance_double("Response", body: '<subject> <http://fedora.info/definitions/v4/repository#status> "BAD_CHECKSUM"^^<http://www.w3.org/2001/XMLSchema#string> .')
|
27
41
|
end
|
28
|
-
|
29
|
-
expect(subject.check).to be false
|
30
|
-
end
|
42
|
+
it { is_expected.to be false }
|
31
43
|
end
|
32
44
|
end
|
33
45
|
|
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: 9.2.0.
|
4
|
+
version: 9.2.0.rc2
|
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: 2015-
|
13
|
+
date: 2015-07-01 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rsolr
|