fedora-migrate 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +128 -0
- data/.rubocop_todo.yml +9 -0
- data/.travis.yml +3 -2
- data/Gemfile +2 -0
- data/fedora-migrate.gemspec +1 -0
- data/lib/fedora-migrate.rb +3 -5
- data/lib/fedora_migrate/content_mover.rb +7 -11
- data/lib/fedora_migrate/datastream_mover.rb +21 -24
- data/lib/fedora_migrate/datastream_verification.rb +15 -17
- data/lib/fedora_migrate/dates_mover.rb +0 -2
- data/lib/fedora_migrate/file_configurator.rb +3 -5
- data/lib/fedora_migrate/hooks.rb +0 -2
- data/lib/fedora_migrate/logger.rb +8 -11
- data/lib/fedora_migrate/migration_options.rb +6 -7
- data/lib/fedora_migrate/migration_report.rb +18 -22
- data/lib/fedora_migrate/mover.rb +4 -6
- data/lib/fedora_migrate/object_mover.rb +28 -34
- data/lib/fedora_migrate/permissions.rb +8 -10
- data/lib/fedora_migrate/permissions_mover.rb +7 -11
- data/lib/fedora_migrate/rdf_datastream_mover.rb +1 -2
- data/lib/fedora_migrate/rels_ext_datastream_mover.rb +29 -31
- data/lib/fedora_migrate/repository_migrator.rb +40 -43
- data/lib/fedora_migrate/rights_metadata.rb +109 -114
- data/lib/fedora_migrate/rubydora_connection.rb +4 -5
- data/lib/fedora_migrate/target_constructor.rb +19 -22
- data/lib/fedora_migrate/version.rb +1 -1
- data/spec/integration/content_versions_spec.rb +12 -14
- data/spec/integration/custom_target_spec.rb +44 -0
- data/spec/integration/fedora3_interface_spec.rb +7 -11
- data/spec/integration/missing_relationships_spec.rb +8 -10
- data/spec/integration/object_migration_spec.rb +20 -31
- data/spec/integration/permission_migration_spec.rb +4 -6
- data/spec/integration/rdf_migration_spec.rb +3 -6
- data/spec/integration/relationship_migration_spec.rb +6 -7
- data/spec/integration/repository_migration_spec.rb +14 -19
- data/spec/integration/versions_spec.rb +6 -8
- data/spec/spec_helper.rb +3 -3
- data/spec/support/example_model.rb +23 -25
- data/spec/unit/content_mover_spec.rb +21 -23
- data/spec/unit/datastream_mover_spec.rb +10 -14
- data/spec/unit/datastream_verification_spec.rb +7 -9
- data/spec/unit/dates_mover_spec.rb +3 -4
- data/spec/unit/fedora_migrate_spec.rb +2 -6
- data/spec/unit/file_configurator_spec.rb +4 -8
- data/spec/unit/migration_options_spec.rb +1 -3
- data/spec/unit/migration_report_spec.rb +5 -6
- data/spec/unit/mover_spec.rb +10 -12
- data/spec/unit/object_mover_spec.rb +9 -16
- data/spec/unit/permissions_mover_spec.rb +8 -11
- data/spec/unit/rels_ext_datastream_mover_spec.rb +4 -6
- data/spec/unit/repository_migrator_spec.rb +12 -14
- data/spec/unit/rubydora_connection_spec.rb +3 -5
- data/spec/unit/target_constructor_spec.rb +10 -16
- data/tasks/dev.rake +9 -1
- metadata +21 -3
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe FedoraMigrate::ObjectMover do
|
4
|
+
let(:source) { FedoraMigrate.source.connection.find("sufia:rb68xc089") }
|
5
|
+
let(:original_pid) { FedoraMigrate::Mover.id_component(source) }
|
6
|
+
|
7
|
+
context "when we use our own target constructor" do
|
8
|
+
let(:mover) { described_class.new source }
|
9
|
+
|
10
|
+
before do
|
11
|
+
# Override .build to use Fedora's default id minter
|
12
|
+
class FedoraMigrate::TargetConstructor
|
13
|
+
def build
|
14
|
+
target.new
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
Object.send(:remove_const, :GenericFile) if defined?(GenericFile)
|
19
|
+
class GenericFile < ActiveFedora::Base
|
20
|
+
contains "content", class_name: "ExampleModel::VersionedDatastream"
|
21
|
+
contains "thumbnail", class_name: "ActiveFedora::Datastream"
|
22
|
+
contains "characterization", class_name: "ActiveFedora::Datastream"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
after do
|
27
|
+
load './lib/fedora_migrate/target_constructor.rb'
|
28
|
+
end
|
29
|
+
|
30
|
+
subject do
|
31
|
+
mover.migrate
|
32
|
+
mover.target
|
33
|
+
end
|
34
|
+
|
35
|
+
it "migrates the entire object using a different id" do
|
36
|
+
expect(subject.content.versions.all.count).to eql 3
|
37
|
+
expect(subject.thumbnail.mime_type).to eql "image/jpeg"
|
38
|
+
expect(subject.thumbnail.versions.all.count).to eql 0
|
39
|
+
expect(subject.characterization.versions.all.count).to eql 0
|
40
|
+
expect(subject).to be_kind_of GenericFile
|
41
|
+
expect(subject.id).not_to eq(original_pid)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -1,23 +1,19 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe
|
4
|
-
|
3
|
+
describe FedoraMigrate do
|
5
4
|
context "with an object's datastreams" do
|
5
|
+
subject { described_class.source.connection.find("sufia:rb68xc089") }
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
it "should load them" do
|
10
|
-
expect(subject.datastreams.count).to eql 8
|
7
|
+
it "loads them" do
|
8
|
+
expect(subject.datastreams.count).to eql 8
|
11
9
|
end
|
12
10
|
|
13
|
-
it "
|
11
|
+
it "sees thier names" do
|
14
12
|
expect(subject.datastreams.keys).to include("content")
|
15
13
|
end
|
16
14
|
|
17
|
-
it "
|
18
|
-
expect(subject.datastreams["content"].content).
|
15
|
+
it "returns their content" do
|
16
|
+
expect(subject.datastreams["content"].content).not_to be_nil
|
19
17
|
end
|
20
|
-
|
21
18
|
end
|
22
|
-
|
23
19
|
end
|
@@ -1,39 +1,37 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe
|
4
|
-
|
3
|
+
describe ExampleModel::Collection do
|
5
4
|
let(:collection) { "x346dj04v" }
|
6
5
|
let(:files) { ["x346dj06d", "x346dj08z"] }
|
7
6
|
let(:missing_file) { "x346dj07p" }
|
8
7
|
|
9
8
|
before do
|
10
|
-
FedoraMigrate::ObjectMover.new(FedoraMigrate.find("scholarsphere:#{collection}"),
|
9
|
+
FedoraMigrate::ObjectMover.new(FedoraMigrate.find("scholarsphere:#{collection}"), described_class.new(collection)).migrate
|
11
10
|
files.each { |f| FedoraMigrate::ObjectMover.new(FedoraMigrate.find("scholarsphere:#{f}"), ExampleModel::MigrationObject.new(f)).migrate }
|
12
11
|
end
|
13
12
|
|
14
13
|
context "when migrating relationships" do
|
15
|
-
let(:migrated_collection) {
|
14
|
+
let(:migrated_collection) { described_class.first }
|
16
15
|
let(:error_message) do
|
17
16
|
"scholarsphere:#{collection} could not migrate relationship info:fedora/fedora-system:def/relations-external#hasCollectionMember because info:fedora/scholarsphere:#{missing_file} doesn't exist in Fedora 4"
|
18
17
|
end
|
19
18
|
before { FedoraMigrate::RelsExtDatastreamMover.new(FedoraMigrate.find("scholarsphere:#{collection}")).migrate }
|
20
|
-
it "
|
19
|
+
it "only migrates existing relationships" do
|
21
20
|
expect(migrated_collection.members.count).to eql 2
|
22
|
-
expect(migrated_collection.member_ids).
|
21
|
+
expect(migrated_collection.member_ids).not_to include(missing_file)
|
23
22
|
end
|
24
23
|
end
|
25
24
|
|
26
25
|
context "when reporting" do
|
27
26
|
subject { FedoraMigrate::RelsExtDatastreamMover.new(FedoraMigrate.find("scholarsphere:#{collection}")).migrate }
|
28
|
-
it "
|
27
|
+
it "includes failed relationships" do
|
29
28
|
expect(subject.sort.first).to match(/^could not migrate relationship/)
|
30
29
|
end
|
31
|
-
it "
|
30
|
+
it "includes all the possible relationships" do
|
32
31
|
expect(subject.count).to eql 3
|
33
32
|
end
|
34
|
-
it "
|
33
|
+
it "includes the successful relationships" do
|
35
34
|
expect(subject.sort.last).to match(/^http/)
|
36
35
|
end
|
37
36
|
end
|
38
|
-
|
39
37
|
end
|
@@ -1,20 +1,18 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe
|
4
|
-
|
3
|
+
describe FedoraMigrate::ObjectMover do
|
5
4
|
let(:source) { FedoraMigrate.source.connection.find("sufia:rb68xc089") }
|
6
5
|
let(:fits_xml) { load_fixture("sufia-rb68xc089-characterization.xml").read }
|
7
6
|
|
8
7
|
context "when the target model is provided" do
|
9
|
-
|
10
|
-
let(:mover) { FedoraMigrate::ObjectMover.new source, ExampleModel::MigrationObject.new }
|
8
|
+
let(:mover) { described_class.new source, ExampleModel::MigrationObject.new }
|
11
9
|
|
12
10
|
subject do
|
13
11
|
mover.migrate
|
14
12
|
mover.target
|
15
13
|
end
|
16
14
|
|
17
|
-
it "
|
15
|
+
it "migrates the entire object" do
|
18
16
|
expect(subject.content.versions.all.count).to eql 3
|
19
17
|
expect(subject.thumbnail.mime_type).to eql "image/jpeg"
|
20
18
|
expect(subject.thumbnail.versions.all.count).to eql 0
|
@@ -23,30 +21,27 @@ describe "Migrating an object" do
|
|
23
21
|
expect(subject).to be_kind_of ExampleModel::MigrationObject
|
24
22
|
end
|
25
23
|
|
26
|
-
it "
|
24
|
+
it "migrates the object's permissions" do
|
27
25
|
expect(subject.edit_users).to include("jilluser@example.com")
|
28
26
|
end
|
29
27
|
|
30
28
|
describe "objects with Om datastreams" do
|
31
|
-
let(:mover) {
|
29
|
+
let(:mover) { described_class.new(source, ExampleModel::OmDatastreamExample.new) }
|
32
30
|
subject do
|
33
31
|
mover.migrate
|
34
32
|
mover.target
|
35
33
|
end
|
36
|
-
it "
|
37
|
-
expect(FedoraMigrate::Logger).
|
34
|
+
it "migrates the object without warnings" do
|
35
|
+
expect(FedoraMigrate::Logger).not_to receive(:warn)
|
38
36
|
expect(subject.characterization.ng_xml).to be_equivalent_to(fits_xml)
|
39
37
|
end
|
40
38
|
end
|
41
|
-
|
42
39
|
end
|
43
40
|
|
44
41
|
context "when we have to determine the model" do
|
45
|
-
|
46
|
-
let(:mover) { FedoraMigrate::ObjectMover.new source }
|
42
|
+
let(:mover) { described_class.new source }
|
47
43
|
|
48
44
|
context "and it is defined" do
|
49
|
-
|
50
45
|
before do
|
51
46
|
Object.send(:remove_const, :GenericFile) if defined?(GenericFile)
|
52
47
|
class GenericFile < ActiveFedora::Base
|
@@ -61,7 +56,7 @@ describe "Migrating an object" do
|
|
61
56
|
mover.target
|
62
57
|
end
|
63
58
|
|
64
|
-
it "
|
59
|
+
it "migrates the entire object" do
|
65
60
|
expect(subject.content.versions.all.count).to eql 3
|
66
61
|
expect(subject.thumbnail.mime_type).to eql "image/jpeg"
|
67
62
|
expect(subject.thumbnail.versions.all.count).to eql 0
|
@@ -75,24 +70,22 @@ describe "Migrating an object" do
|
|
75
70
|
before do
|
76
71
|
Object.send(:remove_const, :GenericFile) if defined?(GenericFile)
|
77
72
|
end
|
78
|
-
it "
|
79
|
-
expect{mover.migrate}.to raise_error(FedoraMigrate::Errors::MigrationError)
|
73
|
+
it "fails" do
|
74
|
+
expect { mover.migrate }.to raise_error(FedoraMigrate::Errors::MigrationError)
|
80
75
|
end
|
81
76
|
end
|
82
|
-
|
83
77
|
end
|
84
78
|
|
85
79
|
context "when the object has an ntriples datastream" do
|
86
|
-
|
87
80
|
context "and we want to convert it to a provided model" do
|
88
|
-
let(:mover) {
|
81
|
+
let(:mover) { described_class.new(source, ExampleModel::RDFObject.new, convert: "descMetadata") }
|
89
82
|
|
90
83
|
subject do
|
91
84
|
mover.migrate
|
92
85
|
mover.target
|
93
86
|
end
|
94
87
|
|
95
|
-
it "
|
88
|
+
it "migrates the entire object" do
|
96
89
|
expect(subject.content.versions.all.count).to eql 3
|
97
90
|
expect(subject.thumbnail.mime_type).to eql "image/jpeg"
|
98
91
|
expect(subject.thumbnail.versions.all.count).to eql 0
|
@@ -102,7 +95,7 @@ describe "Migrating an object" do
|
|
102
95
|
expect(subject.title).to eql(["world.png"])
|
103
96
|
end
|
104
97
|
|
105
|
-
it "
|
98
|
+
it "migrates the createdDate and lastModifiedDate" do
|
106
99
|
# The value of lastModifiedDate will depend on when you loaded your test fixtures
|
107
100
|
expect(subject.date_modified).to eq source.lastModifiedDate
|
108
101
|
expect(subject.date_uploaded).to eq '2014-10-15T03:50:37.063Z'
|
@@ -111,46 +104,42 @@ describe "Migrating an object" do
|
|
111
104
|
|
112
105
|
context "with ISO-8859-1 characters" do
|
113
106
|
let(:problem_source) { FedoraMigrate.source.connection.find("scholarsphere:5712mc568") }
|
114
|
-
let(:mover) {
|
107
|
+
let(:mover) { described_class.new(problem_source, ExampleModel::RDFObject.new, convert: "descMetadata") }
|
115
108
|
subject do
|
116
109
|
mover.migrate
|
117
110
|
mover.target
|
118
111
|
end
|
119
112
|
|
120
|
-
it "
|
113
|
+
it "migrates the content" do
|
121
114
|
expect(subject.description.first).to match(/^The relationship between school administrators and music teachers/)
|
122
115
|
end
|
123
|
-
|
124
116
|
end
|
125
117
|
|
126
118
|
context "and we want to convert multiple datastreas" do
|
127
|
-
|
128
119
|
# Need a fixture with two different datastreams for this test to be more effective
|
129
|
-
let(:mover) {
|
120
|
+
let(:mover) { described_class.new(source, ExampleModel::RDFObject.new, convert: ["descMetadata", "descMetadata"]) }
|
130
121
|
|
131
122
|
subject do
|
132
123
|
mover.migrate
|
133
124
|
mover.target
|
134
125
|
end
|
135
126
|
|
136
|
-
it "
|
127
|
+
it "migrates all the datastreams" do
|
137
128
|
expect(subject.title).to eql(["world.png"])
|
138
129
|
end
|
139
130
|
end
|
140
131
|
|
141
132
|
context "with RDF errors" do
|
142
133
|
let(:problem_source) { FedoraMigrate.source.connection.find("scholarsphere:sf2686078") }
|
143
|
-
let(:mover) {
|
134
|
+
let(:mover) { described_class.new(problem_source, ExampleModel::RDFObject.new, convert: "descMetadata") }
|
144
135
|
subject do
|
145
136
|
mover.migrate
|
146
137
|
mover.target
|
147
138
|
end
|
148
139
|
|
149
|
-
it "
|
140
|
+
it "migrates the content" do
|
150
141
|
expect(subject.title).to eql([" The \"Value Added\" in Editorial Acquisitions.pdf"])
|
151
142
|
end
|
152
143
|
end
|
153
|
-
|
154
144
|
end
|
155
|
-
|
156
145
|
end
|
@@ -1,13 +1,11 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe
|
4
|
-
|
3
|
+
describe FedoraMigrate::PermissionsMover do
|
5
4
|
let(:source) { FedoraMigrate.source.connection.find("sufia:rb68xc089") }
|
6
|
-
|
7
|
-
subject { FedoraMigrate::PermissionsMover.new(source.datastreams["rightsMetadata"], ExampleModel::MigrationObject.new)}
|
8
5
|
|
9
|
-
|
6
|
+
subject { described_class.new(source.datastreams["rightsMetadata"], ExampleModel::MigrationObject.new) }
|
7
|
+
|
8
|
+
it "displays the permissions from the source datastream" do
|
10
9
|
expect(subject.edit_users).to include("jilluser@example.com")
|
11
10
|
end
|
12
|
-
|
13
11
|
end
|
@@ -1,13 +1,12 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe
|
4
|
-
let(:mover) {
|
3
|
+
describe FedoraMigrate::RDFDatastreamMover do
|
4
|
+
let(:mover) { described_class.new(file, ExampleModel::RDFProperties.new) }
|
5
5
|
|
6
6
|
context "normal record" do
|
7
|
-
|
8
7
|
let(:file) { FedoraMigrate.source.connection.find("sufia:xp68km39w").datastreams["descMetadata"] }
|
9
8
|
|
10
|
-
it "
|
9
|
+
it "calls the before and after hooks when migrating" do
|
11
10
|
expect(mover).to receive(:before_rdf_datastream_migration)
|
12
11
|
expect(mover).to receive(:after_rdf_datastream_migration)
|
13
12
|
mover.migrate
|
@@ -27,7 +26,6 @@ describe "Mirating RDF terms" do
|
|
27
26
|
end
|
28
27
|
|
29
28
|
context "record with UTF8 chracters" do
|
30
|
-
|
31
29
|
let(:file) { FedoraMigrate.source.connection.find("scholarsphere:7d279232g").datastreams["descMetadata"] }
|
32
30
|
|
33
31
|
describe "using triples" do
|
@@ -42,6 +40,5 @@ describe "Mirating RDF terms" do
|
|
42
40
|
expect(subject.description.first). to eql "Objectives:\r\n• Explain the role of a new genomic assay (Target Now™) in guiding oncology treatment plans.\r\n• Describe the Target Now™ assay.\r\n• Present a case study where Target Now™ was instrumental in the patient’s treatment plan."
|
43
41
|
end
|
44
42
|
end
|
45
|
-
|
46
43
|
end
|
47
44
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe
|
4
|
-
|
3
|
+
describe FedoraMigrate::ObjectMover do
|
5
4
|
before :all do
|
5
|
+
Object.send(:remove_const, :GenericFile) if defined?(GenericFile)
|
6
6
|
class GenericFile < ActiveFedora::Base
|
7
7
|
belongs_to :batch, predicate: ActiveFedora::RDF::Fcrepo::RelsExt.isPartOf
|
8
8
|
property :title, predicate: ::RDF::DC.title do |index|
|
@@ -13,6 +13,7 @@ describe "Migrating objects with relationships" do
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
+
Object.send(:remove_const, :Batch) if defined?(Batch)
|
16
17
|
class Batch < ActiveFedora::Base
|
17
18
|
has_many :generic_files, predicate: ActiveFedora::RDF::Fcrepo::RelsExt.isPartOf
|
18
19
|
end
|
@@ -20,16 +21,16 @@ describe "Migrating objects with relationships" do
|
|
20
21
|
|
21
22
|
after :all do
|
22
23
|
Object.send(:remove_const, :GenericFile) if defined?(GenericFile)
|
24
|
+
Object.send(:remove_const, :Batch) if defined?(Batch)
|
23
25
|
end
|
24
26
|
|
25
27
|
let(:parent_source) { FedoraMigrate.source.connection.find("sufia:rb68xc09k") }
|
26
28
|
let(:child_source) { FedoraMigrate.source.connection.find("sufia:rb68xc11m") }
|
27
29
|
|
28
30
|
context "when all objects exist in Fedora4" do
|
29
|
-
|
30
31
|
before do
|
31
|
-
|
32
|
-
|
32
|
+
described_class.new(parent_source).migrate
|
33
|
+
described_class.new(child_source).migrate
|
33
34
|
end
|
34
35
|
|
35
36
|
subject { Batch.find("rb68xc09k") }
|
@@ -46,7 +47,5 @@ describe "Migrating objects with relationships" do
|
|
46
47
|
expect(subject.generic_files.count).to eql 1
|
47
48
|
end
|
48
49
|
end
|
49
|
-
|
50
50
|
end
|
51
|
-
|
52
51
|
end
|
@@ -1,24 +1,21 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe
|
4
|
-
|
3
|
+
describe FedoraMigrate do
|
5
4
|
context "when no target objects are defined" do
|
6
|
-
|
7
5
|
before do
|
8
6
|
Object.send(:remove_const, :GenericFile) if defined?(GenericFile)
|
9
7
|
Object.send(:remove_const, :Batch) if defined?(Batch)
|
10
8
|
Object.send(:remove_const, :Collection) if defined?(Collection)
|
11
9
|
end
|
12
10
|
|
13
|
-
subject {
|
11
|
+
subject { described_class.migrate_repository(namespace: "sufia", options: { convert: "descMetadata" }).report }
|
14
12
|
|
15
|
-
it "
|
13
|
+
it "reports warnings" do
|
16
14
|
expect(subject.failed_objects.count).to eql 9
|
17
15
|
end
|
18
16
|
end
|
19
17
|
|
20
18
|
context "when all target objects are defined" do
|
21
|
-
|
22
19
|
before do
|
23
20
|
Object.send(:remove_const, :GenericFile) if defined?(GenericFile)
|
24
21
|
class GenericFile < ExampleModel::MigrationObject
|
@@ -52,8 +49,8 @@ describe "Migrating the repository" do
|
|
52
49
|
let(:versions_report) { GenericFile.all.map { |f| f.content.versions.count }.uniq }
|
53
50
|
|
54
51
|
context "by default" do
|
55
|
-
before {
|
56
|
-
it "
|
52
|
+
before { described_class.migrate_repository(namespace: "sufia", options: { convert: "descMetadata" }) }
|
53
|
+
it "moves every object and its versions" do
|
57
54
|
expect(file1.title).to eql ["world.png"]
|
58
55
|
expect(file2.title).to eql ["Sample Migration Object A"]
|
59
56
|
expect(file2.creator).to eql ["Adam Wead"]
|
@@ -63,17 +60,17 @@ describe "Migrating the repository" do
|
|
63
60
|
expect(Batch.all.last.generic_files.count).to eql 2
|
64
61
|
expect(Collection.all.count).to eql 1
|
65
62
|
expect(Collection.first.members.count).to eql 2
|
66
|
-
expect(versions_report).to match_array [0,3,9]
|
63
|
+
expect(versions_report).to match_array [0, 3, 9]
|
67
64
|
end
|
68
65
|
end
|
69
66
|
|
70
67
|
context "and the application will create versions" do
|
71
68
|
before do
|
72
|
-
|
73
|
-
|
74
|
-
|
69
|
+
described_class.migrate_repository(namespace: "sufia",
|
70
|
+
options: { convert: "descMetadata", application_creates_versions: true }
|
71
|
+
)
|
75
72
|
end
|
76
|
-
it "
|
73
|
+
it "moves every object but not its versions" do
|
77
74
|
expect(file1.title).to eql ["world.png"]
|
78
75
|
expect(versions_report).to eql [0]
|
79
76
|
end
|
@@ -88,7 +85,7 @@ describe "Migrating the repository" do
|
|
88
85
|
before do
|
89
86
|
FileUtils.rm_rf(failed_report)
|
90
87
|
FileUtils.cp_r(sample_report, failed_report)
|
91
|
-
|
88
|
+
described_class.migrate_repository(namespace: "sufia", options: { convert: "descMetadata", report: failed_report })
|
92
89
|
end
|
93
90
|
after { FileUtils.rm_rf(failed_report) }
|
94
91
|
it "only migrates the objects that have failed" do
|
@@ -98,7 +95,7 @@ describe "Migrating the repository" do
|
|
98
95
|
expect(new_report.total_objects).to eql 9
|
99
96
|
expect(original_report.results[sample_pid]["status"]).to be false
|
100
97
|
expect(new_report.results[sample_pid]["status"]).to be true
|
101
|
-
expect(new_report.results[sample_pid]["object"]).
|
98
|
+
expect(new_report.results[sample_pid]["object"]).not_to be_nil
|
102
99
|
end
|
103
100
|
end
|
104
101
|
|
@@ -106,11 +103,9 @@ describe "Migrating the repository" do
|
|
106
103
|
let(:pid1) { "sufia:rb68xc089" }
|
107
104
|
let(:pid2) { "sufia:xp68km39w" }
|
108
105
|
let(:report) { FedoraMigrate::MigrationReport.new }
|
109
|
-
before {
|
106
|
+
before { described_class.migrate_repository(namespace: "sufia", options: { convert: "descMetadata", blacklist: [pid1, pid2] }) }
|
110
107
|
subject { report.results.keys }
|
111
|
-
it { is_expected.
|
108
|
+
it { is_expected.not_to include(pid1) }
|
112
109
|
end
|
113
|
-
|
114
110
|
end
|
115
|
-
|
116
111
|
end
|