fedora-migrate 0.0.1

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 (63) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +16 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +19 -0
  5. data/Gemfile +7 -0
  6. data/LICENSE.txt +22 -0
  7. data/README.md +31 -0
  8. data/Rakefile +5 -0
  9. data/config/fedora.yml +14 -0
  10. data/config/fedora3.yml +12 -0
  11. data/config/jetty.yml +6 -0
  12. data/config/solr.yml +15 -0
  13. data/fedora-migrate.gemspec +30 -0
  14. data/lib/fedora-migrate.rb +82 -0
  15. data/lib/fedora_migrate/datastream_mover.rb +78 -0
  16. data/lib/fedora_migrate/errors.rb +7 -0
  17. data/lib/fedora_migrate/file_configurator.rb +34 -0
  18. data/lib/fedora_migrate/hooks.rb +11 -0
  19. data/lib/fedora_migrate/logger.rb +36 -0
  20. data/lib/fedora_migrate/migration_options.rb +11 -0
  21. data/lib/fedora_migrate/mover.rb +44 -0
  22. data/lib/fedora_migrate/object_mover.rb +62 -0
  23. data/lib/fedora_migrate/permissions.rb +32 -0
  24. data/lib/fedora_migrate/permissions_mover.rb +31 -0
  25. data/lib/fedora_migrate/rdf_datastream_mover.rb +28 -0
  26. data/lib/fedora_migrate/rdf_datastream_parser.rb +29 -0
  27. data/lib/fedora_migrate/rels_ext_datastream_mover.rb +90 -0
  28. data/lib/fedora_migrate/repository_migrator.rb +60 -0
  29. data/lib/fedora_migrate/rights_metadata.rb +281 -0
  30. data/lib/fedora_migrate/rubydora_connection.rb +21 -0
  31. data/lib/fedora_migrate/triple_converter.rb +39 -0
  32. data/lib/fedora_migrate/version.rb +3 -0
  33. data/lib/tasks/fedora-migrate.rake +45 -0
  34. data/spec/fixtures/datastreams/rdf_ntriples_datastream.txt +2 -0
  35. data/spec/fixtures/datastreams/sufia-rb68xc089-characterization.xml +27 -0
  36. data/spec/fixtures/objects/f3-migration-a.xml +110 -0
  37. data/spec/fixtures/objects/gf-versioned-content.xml +2776 -0
  38. data/spec/fixtures/objects/sufia-batch-gf-1.xml +94 -0
  39. data/spec/fixtures/objects/sufia-batch-gf-2.xml +93 -0
  40. data/spec/fixtures/objects/sufia-batch.xml +51 -0
  41. data/spec/integration/content_versions_spec.rb +42 -0
  42. data/spec/integration/fedora3_interface_spec.rb +23 -0
  43. data/spec/integration/object_migration_spec.rb +112 -0
  44. data/spec/integration/permission_migration_spec.rb +13 -0
  45. data/spec/integration/rdf_migration_spec.rb +22 -0
  46. data/spec/integration/relationship_migration_spec.rb +51 -0
  47. data/spec/integration/repository_migration_spec.rb +59 -0
  48. data/spec/spec_helper.rb +39 -0
  49. data/spec/support/example_model.rb +36 -0
  50. data/spec/unit/datastream_mover_spec.rb +39 -0
  51. data/spec/unit/fedora_migrate_spec.rb +19 -0
  52. data/spec/unit/file_configurator_spec.rb +17 -0
  53. data/spec/unit/mover_spec.rb +39 -0
  54. data/spec/unit/object_mover_spec.rb +38 -0
  55. data/spec/unit/permissions_mover_spec.rb +53 -0
  56. data/spec/unit/rdf_datastream_mover_spec.rb +8 -0
  57. data/spec/unit/rdf_datastream_parser_spec.rb +38 -0
  58. data/spec/unit/rels_ext_datastream_mover_spec.rb +36 -0
  59. data/spec/unit/repository_migrator_spec.rb +43 -0
  60. data/spec/unit/rubydora_connection_spec.rb +25 -0
  61. data/spec/unit/triple_converter_spec.rb +35 -0
  62. data/tasks/dev.rake +37 -0
  63. metadata +246 -0
@@ -0,0 +1,94 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <foxml:digitalObject VERSION="1.1" PID="sufia:rb68xc10b"
3
+ xmlns:foxml="info:fedora/fedora-system:def/foxml#"
4
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5
+ xsi:schemaLocation="info:fedora/fedora-system:def/foxml# http://www.fedora.info/definitions/1/0/foxml1-1.xsd">
6
+ <foxml:objectProperties>
7
+ <foxml:property NAME="info:fedora/fedora-system:def/model#state" VALUE="Active"/>
8
+ <foxml:property NAME="info:fedora/fedora-system:def/model#label" VALUE=""/>
9
+ <foxml:property NAME="info:fedora/fedora-system:def/model#ownerId" VALUE="fedoraAdmin"/>
10
+ <foxml:property NAME="info:fedora/fedora-system:def/model#createdDate" VALUE="2014-10-15T03:58:35.903Z"/>
11
+ <foxml:property NAME="info:fedora/fedora-system:def/view#lastModifiedDate" VALUE="2014-10-15T03:58:36.022Z"/>
12
+ </foxml:objectProperties>
13
+ <foxml:datastream ID="AUDIT" STATE="A" CONTROL_GROUP="X" VERSIONABLE="false">
14
+ <foxml:datastreamVersion ID="AUDIT.0" LABEL="Audit Trail for this object" CREATED="2014-10-15T03:58:35.903Z" MIMETYPE="text/xml" FORMAT_URI="info:fedora/fedora-system:format/xml.fedora.audit">
15
+ <foxml:xmlContent>
16
+ <audit:auditTrail xmlns:audit="info:fedora/fedora-system:def/audit#">
17
+ <audit:record ID="AUDREC1">
18
+ <audit:process type="Fedora API-M"/>
19
+ <audit:action>addDatastream</audit:action>
20
+ <audit:componentID>RELS-EXT</audit:componentID>
21
+ <audit:responsibility>fedoraAdmin</audit:responsibility>
22
+ <audit:date>2014-10-15T03:58:35.961Z</audit:date>
23
+ <audit:justification></audit:justification>
24
+ </audit:record>
25
+ <audit:record ID="AUDREC2">
26
+ <audit:process type="Fedora API-M"/>
27
+ <audit:action>addDatastream</audit:action>
28
+ <audit:componentID>rightsMetadata</audit:componentID>
29
+ <audit:responsibility>fedoraAdmin</audit:responsibility>
30
+ <audit:date>2014-10-15T03:58:35.992Z</audit:date>
31
+ <audit:justification></audit:justification>
32
+ </audit:record>
33
+ <audit:record ID="AUDREC3">
34
+ <audit:process type="Fedora API-M"/>
35
+ <audit:action>addDatastream</audit:action>
36
+ <audit:componentID>properties</audit:componentID>
37
+ <audit:responsibility>fedoraAdmin</audit:responsibility>
38
+ <audit:date>2014-10-15T03:58:36.022Z</audit:date>
39
+ <audit:justification></audit:justification>
40
+ </audit:record>
41
+ </audit:auditTrail>
42
+ </foxml:xmlContent>
43
+ </foxml:datastreamVersion>
44
+ </foxml:datastream>
45
+ <foxml:datastream ID="DC" STATE="A" CONTROL_GROUP="X" VERSIONABLE="true">
46
+ <foxml:datastreamVersion ID="DC1.0" LABEL="Dublin Core Record for this object" CREATED="2014-10-15T03:58:35.903Z" MIMETYPE="text/xml" FORMAT_URI="http://www.openarchives.org/OAI/2.0/oai_dc/" SIZE="344">
47
+ <foxml:contentDigest TYPE="SHA-1" DIGEST="a1926e6296956e32087f4af1d2d5e29d47a56864"/>
48
+ <foxml:xmlContent>
49
+ <oai_dc:dc xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
50
+ <dc:identifier>sufia:rb68xc10b</dc:identifier>
51
+ </oai_dc:dc>
52
+ </foxml:xmlContent>
53
+ </foxml:datastreamVersion>
54
+ </foxml:datastream>
55
+ <foxml:datastream ID="RELS-EXT" STATE="A" CONTROL_GROUP="X" VERSIONABLE="true">
56
+ <foxml:datastreamVersion ID="RELS-EXT.0" LABEL="Fedora Object-to-Object Relationship Metadata" CREATED="2014-10-15T03:58:35.961Z" MIMETYPE="application/rdf+xml" SIZE="428">
57
+ <foxml:contentDigest TYPE="SHA-1" DIGEST="bd4482d2fb46dd5877a458fc9b1c86468b5721d5"/>
58
+ <foxml:xmlContent>
59
+ <rdf:RDF xmlns:ns0="info:fedora/fedora-system:def/relations-external#" xmlns:ns1="info:fedora/fedora-system:def/model#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
60
+ <rdf:Description rdf:about="info:fedora/sufia:rb68xc10b">
61
+ <ns1:hasModel rdf:resource="info:fedora/afmodel:GenericFile"></ns1:hasModel>
62
+ <ns0:isPartOf rdf:resource="info:fedora/sufia:rb68xc09k"></ns0:isPartOf>
63
+ </rdf:Description>
64
+ </rdf:RDF>
65
+ </foxml:xmlContent>
66
+ </foxml:datastreamVersion>
67
+ </foxml:datastream>
68
+ <foxml:datastream ID="rightsMetadata" STATE="A" CONTROL_GROUP="M" VERSIONABLE="true">
69
+ <foxml:datastreamVersion ID="rightsMetadata.0" LABEL="" CREATED="2014-10-15T03:58:35.992Z" MIMETYPE="text/xml" SIZE="555">
70
+ <foxml:contentDigest TYPE="SHA-1" DIGEST="3ae82805357b4f8d627fc555cf970a22c211c846"/>
71
+ <foxml:binaryContent>
72
+ PHJpZ2h0c01ldGFkYXRhIHhtbG5zPSJodHRwOi8vaHlkcmEtY29sbGFiLnN0YW5mb3JkLmVkdS9zY2hl
73
+ bWFzL3JpZ2h0c01ldGFkYXRhL3YxIiB2ZXJzaW9uPSIwLjEiPgogIDxjb3B5cmlnaHQ+CiAgICA8aHVt
74
+ YW4gdHlwZT0idGl0bGUiLz4KICAgIDxodW1hbiB0eXBlPSJkZXNjcmlwdGlvbiIvPgogICAgPG1hY2hp
75
+ bmUgdHlwZT0idXJpIi8+CiAgPC9jb3B5cmlnaHQ+CiAgPGFjY2VzcyB0eXBlPSJkaXNjb3ZlciI+CiAg
76
+ ICA8aHVtYW4vPgogICAgPG1hY2hpbmUvPgogIDwvYWNjZXNzPgogIDxhY2Nlc3MgdHlwZT0icmVhZCI+
77
+ CiAgICA8aHVtYW4vPgogICAgPG1hY2hpbmUvPgogIDwvYWNjZXNzPgogIDxhY2Nlc3MgdHlwZT0iZWRp
78
+ dCI+CiAgICA8aHVtYW4vPgogICAgPG1hY2hpbmU+CiAgICAgIDxwZXJzb24+amlsbHVzZXJAZXhhbXBs
79
+ ZS5jb208L3BlcnNvbj4KICAgIDwvbWFjaGluZT4KICA8L2FjY2Vzcz4KICA8ZW1iYXJnbz4KICAgIDxt
80
+ YWNoaW5lLz4KICA8L2VtYmFyZ28+CiAgPGxlYXNlPgogICAgPG1hY2hpbmUvPgogIDwvbGVhc2U+Cjwv
81
+ cmlnaHRzTWV0YWRhdGE+
82
+ </foxml:binaryContent>
83
+ </foxml:datastreamVersion>
84
+ </foxml:datastream>
85
+ <foxml:datastream ID="properties" STATE="A" CONTROL_GROUP="M" VERSIONABLE="true">
86
+ <foxml:datastreamVersion ID="properties.0" LABEL="" CREATED="2014-10-15T03:58:36.022Z" MIMETYPE="text/xml" SIZE="64">
87
+ <foxml:contentDigest TYPE="SHA-1" DIGEST="0d6b1b68c115ba892f3bd5055d335226d42a351c"/>
88
+ <foxml:binaryContent>
89
+ PGZpZWxkcz4KICA8ZGVwb3NpdG9yPmppbGx1c2VyQGV4YW1wbGUuY29tPC9kZXBvc2l0b3I+CjwvZmll
90
+ bGRzPg==
91
+ </foxml:binaryContent>
92
+ </foxml:datastreamVersion>
93
+ </foxml:datastream>
94
+ </foxml:digitalObject>
@@ -0,0 +1,93 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <foxml:digitalObject VERSION="1.1" PID="sufia:rb68xc11m"
3
+ xmlns:foxml="info:fedora/fedora-system:def/foxml#"
4
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5
+ xsi:schemaLocation="info:fedora/fedora-system:def/foxml# http://www.fedora.info/definitions/1/0/foxml1-1.xsd">
6
+ <foxml:objectProperties>
7
+ <foxml:property NAME="info:fedora/fedora-system:def/model#state" VALUE="Active"/>
8
+ <foxml:property NAME="info:fedora/fedora-system:def/model#label" VALUE=""/>
9
+ <foxml:property NAME="info:fedora/fedora-system:def/model#ownerId" VALUE="fedoraAdmin"/>
10
+ <foxml:property NAME="info:fedora/fedora-system:def/model#createdDate" VALUE="2014-10-15T03:58:36.410Z"/>
11
+ <foxml:property NAME="info:fedora/fedora-system:def/view#lastModifiedDate" VALUE="2014-10-15T03:58:36.524Z"/>
12
+ </foxml:objectProperties>
13
+ <foxml:datastream ID="AUDIT" STATE="A" CONTROL_GROUP="X" VERSIONABLE="false">
14
+ <foxml:datastreamVersion ID="AUDIT.0" LABEL="Audit Trail for this object" CREATED="2014-10-15T03:58:36.410Z" MIMETYPE="text/xml" FORMAT_URI="info:fedora/fedora-system:format/xml.fedora.audit">
15
+ <foxml:xmlContent>
16
+ <audit:auditTrail xmlns:audit="info:fedora/fedora-system:def/audit#">
17
+ <audit:record ID="AUDREC1">
18
+ <audit:process type="Fedora API-M"/>
19
+ <audit:action>addDatastream</audit:action>
20
+ <audit:componentID>RELS-EXT</audit:componentID>
21
+ <audit:responsibility>fedoraAdmin</audit:responsibility>
22
+ <audit:date>2014-10-15T03:58:36.465Z</audit:date>
23
+ <audit:justification></audit:justification>
24
+ </audit:record>
25
+ <audit:record ID="AUDREC2">
26
+ <audit:process type="Fedora API-M"/>
27
+ <audit:action>addDatastream</audit:action>
28
+ <audit:componentID>rightsMetadata</audit:componentID>
29
+ <audit:responsibility>fedoraAdmin</audit:responsibility>
30
+ <audit:date>2014-10-15T03:58:36.496Z</audit:date>
31
+ <audit:justification></audit:justification>
32
+ </audit:record>
33
+ <audit:record ID="AUDREC3">
34
+ <audit:process type="Fedora API-M"/>
35
+ <audit:action>addDatastream</audit:action>
36
+ <audit:componentID>properties</audit:componentID>
37
+ <audit:responsibility>fedoraAdmin</audit:responsibility>
38
+ <audit:date>2014-10-15T03:58:36.524Z</audit:date>
39
+ <audit:justification></audit:justification>
40
+ </audit:record>
41
+ </audit:auditTrail>
42
+ </foxml:xmlContent>
43
+ </foxml:datastreamVersion>
44
+ </foxml:datastream>
45
+ <foxml:datastream ID="DC" STATE="A" CONTROL_GROUP="X" VERSIONABLE="true">
46
+ <foxml:datastreamVersion ID="DC1.0" LABEL="Dublin Core Record for this object" CREATED="2014-10-15T03:58:36.410Z" MIMETYPE="text/xml" FORMAT_URI="http://www.openarchives.org/OAI/2.0/oai_dc/" SIZE="344">
47
+ <foxml:contentDigest TYPE="SHA-1" DIGEST="a9011e329a13aa8835a33178df1bf14d791bba6e"/>
48
+ <foxml:xmlContent>
49
+ <oai_dc:dc xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
50
+ <dc:identifier>sufia:rb68xc11m</dc:identifier>
51
+ </oai_dc:dc>
52
+ </foxml:xmlContent>
53
+ </foxml:datastreamVersion>
54
+ </foxml:datastream>
55
+ <foxml:datastream ID="RELS-EXT" STATE="A" CONTROL_GROUP="X" VERSIONABLE="true">
56
+ <foxml:datastreamVersion ID="RELS-EXT.0" LABEL="Fedora Object-to-Object Relationship Metadata" CREATED="2014-10-15T03:58:36.465Z" MIMETYPE="application/rdf+xml" SIZE="428">
57
+ <foxml:contentDigest TYPE="SHA-1" DIGEST="592419e15e6daa523a7e290d80c8f21c7453d38b"/>
58
+ <foxml:xmlContent>
59
+ <rdf:RDF xmlns:ns0="info:fedora/fedora-system:def/relations-external#" xmlns:ns1="info:fedora/fedora-system:def/model#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
60
+ <rdf:Description rdf:about="info:fedora/sufia:rb68xc11m">
61
+ <ns1:hasModel rdf:resource="info:fedora/afmodel:GenericFile"></ns1:hasModel>
62
+ <ns0:isPartOf rdf:resource="info:fedora/sufia:rb68xc09k"></ns0:isPartOf>
63
+ </rdf:Description>
64
+ </rdf:RDF>
65
+ </foxml:xmlContent>
66
+ </foxml:datastreamVersion>
67
+ </foxml:datastream>
68
+ <foxml:datastream ID="rightsMetadata" STATE="A" CONTROL_GROUP="M" VERSIONABLE="true">
69
+ <foxml:datastreamVersion ID="rightsMetadata.0" LABEL="" CREATED="2014-10-15T03:58:36.496Z" MIMETYPE="text/xml" SIZE="544">
70
+ <foxml:contentDigest TYPE="SHA-1" DIGEST="24ff894f6377e039c207ae172514c24f99814400"/>
71
+ <foxml:binaryContent>
72
+ PHJpZ2h0c01ldGFkYXRhIHhtbG5zPSJodHRwOi8vaHlkcmEtY29sbGFiLnN0YW5mb3JkLmVkdS9zY2hl
73
+ bWFzL3JpZ2h0c01ldGFkYXRhL3YxIiB2ZXJzaW9uPSIwLjEiPgogIDxjb3B5cmlnaHQ+CiAgICA8aHVt
74
+ YW4gdHlwZT0idGl0bGUiLz4KICAgIDxodW1hbiB0eXBlPSJkZXNjcmlwdGlvbiIvPgogICAgPG1hY2hp
75
+ bmUgdHlwZT0idXJpIi8+CiAgPC9jb3B5cmlnaHQ+CiAgPGFjY2VzcyB0eXBlPSJkaXNjb3ZlciI+CiAg
76
+ ICA8aHVtYW4vPgogICAgPG1hY2hpbmUvPgogIDwvYWNjZXNzPgogIDxhY2Nlc3MgdHlwZT0icmVhZCI+
77
+ CiAgICA8aHVtYW4vPgogICAgPG1hY2hpbmUvPgogIDwvYWNjZXNzPgogIDxhY2Nlc3MgdHlwZT0iZWRp
78
+ dCI+CiAgICA8aHVtYW4vPgogICAgPG1hY2hpbmU+CiAgICAgIDxwZXJzb24+b3RoZXJVc2VyPC9wZXJz
79
+ b24+CiAgICA8L21hY2hpbmU+CiAgPC9hY2Nlc3M+CiAgPGVtYmFyZ28+CiAgICA8bWFjaGluZS8+CiAg
80
+ PC9lbWJhcmdvPgogIDxsZWFzZT4KICAgIDxtYWNoaW5lLz4KICA8L2xlYXNlPgo8L3JpZ2h0c01ldGFk
81
+ YXRhPg==
82
+ </foxml:binaryContent>
83
+ </foxml:datastreamVersion>
84
+ </foxml:datastream>
85
+ <foxml:datastream ID="properties" STATE="A" CONTROL_GROUP="M" VERSIONABLE="true">
86
+ <foxml:datastreamVersion ID="properties.0" LABEL="" CREATED="2014-10-15T03:58:36.524Z" MIMETYPE="text/xml" SIZE="53">
87
+ <foxml:contentDigest TYPE="SHA-1" DIGEST="9ceaa7d066cb62242c1e7369c9118100cade5613"/>
88
+ <foxml:binaryContent>
89
+ PGZpZWxkcz4KICA8ZGVwb3NpdG9yPm90aGVyVXNlcjwvZGVwb3NpdG9yPgo8L2ZpZWxkcz4=
90
+ </foxml:binaryContent>
91
+ </foxml:datastreamVersion>
92
+ </foxml:datastream>
93
+ </foxml:digitalObject>
@@ -0,0 +1,51 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <foxml:digitalObject VERSION="1.1" PID="sufia:rb68xc09k"
3
+ xmlns:foxml="info:fedora/fedora-system:def/foxml#"
4
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5
+ xsi:schemaLocation="info:fedora/fedora-system:def/foxml# http://www.fedora.info/definitions/1/0/foxml1-1.xsd">
6
+ <foxml:objectProperties>
7
+ <foxml:property NAME="info:fedora/fedora-system:def/model#state" VALUE="Active"/>
8
+ <foxml:property NAME="info:fedora/fedora-system:def/model#label" VALUE=""/>
9
+ <foxml:property NAME="info:fedora/fedora-system:def/model#ownerId" VALUE="fedoraAdmin"/>
10
+ <foxml:property NAME="info:fedora/fedora-system:def/model#createdDate" VALUE="2014-10-15T03:58:35.251Z"/>
11
+ <foxml:property NAME="info:fedora/fedora-system:def/view#lastModifiedDate" VALUE="2014-10-15T03:58:35.308Z"/>
12
+ </foxml:objectProperties>
13
+ <foxml:datastream ID="AUDIT" STATE="A" CONTROL_GROUP="X" VERSIONABLE="false">
14
+ <foxml:datastreamVersion ID="AUDIT.0" LABEL="Audit Trail for this object" CREATED="2014-10-15T03:58:35.251Z" MIMETYPE="text/xml" FORMAT_URI="info:fedora/fedora-system:format/xml.fedora.audit">
15
+ <foxml:xmlContent>
16
+ <audit:auditTrail xmlns:audit="info:fedora/fedora-system:def/audit#">
17
+ <audit:record ID="AUDREC1">
18
+ <audit:process type="Fedora API-M"/>
19
+ <audit:action>addDatastream</audit:action>
20
+ <audit:componentID>RELS-EXT</audit:componentID>
21
+ <audit:responsibility>fedoraAdmin</audit:responsibility>
22
+ <audit:date>2014-10-15T03:58:35.308Z</audit:date>
23
+ <audit:justification></audit:justification>
24
+ </audit:record>
25
+ </audit:auditTrail>
26
+ </foxml:xmlContent>
27
+ </foxml:datastreamVersion>
28
+ </foxml:datastream>
29
+ <foxml:datastream ID="DC" STATE="A" CONTROL_GROUP="X" VERSIONABLE="true">
30
+ <foxml:datastreamVersion ID="DC1.0" LABEL="Dublin Core Record for this object" CREATED="2014-10-15T03:58:35.251Z" MIMETYPE="text/xml" FORMAT_URI="http://www.openarchives.org/OAI/2.0/oai_dc/" SIZE="344">
31
+ <foxml:contentDigest TYPE="SHA-1" DIGEST="6ca3ba63cd8be297135bb8ec0116c211ca1b5de8"/>
32
+ <foxml:xmlContent>
33
+ <oai_dc:dc xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
34
+ <dc:identifier>sufia:rb68xc09k</dc:identifier>
35
+ </oai_dc:dc>
36
+ </foxml:xmlContent>
37
+ </foxml:datastreamVersion>
38
+ </foxml:datastream>
39
+ <foxml:datastream ID="RELS-EXT" STATE="A" CONTROL_GROUP="X" VERSIONABLE="true">
40
+ <foxml:datastreamVersion ID="RELS-EXT.0" LABEL="Fedora Object-to-Object Relationship Metadata" CREATED="2014-10-15T03:58:35.308Z" MIMETYPE="application/rdf+xml" SIZE="283">
41
+ <foxml:contentDigest TYPE="SHA-1" DIGEST="6d2aaa4201889afeb689f43192ba78e88b622668"/>
42
+ <foxml:xmlContent>
43
+ <rdf:RDF xmlns:ns0="info:fedora/fedora-system:def/model#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
44
+ <rdf:Description rdf:about="info:fedora/sufia:rb68xc09k">
45
+ <ns0:hasModel rdf:resource="info:fedora/afmodel:Batch"></ns0:hasModel>
46
+ </rdf:Description>
47
+ </rdf:RDF>
48
+ </foxml:xmlContent>
49
+ </foxml:datastreamVersion>
50
+ </foxml:datastream>
51
+ </foxml:digitalObject>
@@ -0,0 +1,42 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Versioned content" do
4
+
5
+ let(:mover) do
6
+ FedoraMigrate::DatastreamMover.new(
7
+ FedoraMigrate.source.connection.find("sufia:rb68xc089").datastreams["content"],
8
+ ExampleModel::VersionedContent.create.attached_files["content"]
9
+ )
10
+ end
11
+
12
+ context "with migrating versions" do
13
+ subject do
14
+ mover.migrate
15
+ mover.target
16
+ end
17
+ it "should migrate all versions" do
18
+ expect(subject.versions.all.count).to eql 3
19
+ end
20
+ it "should preserve metadata" do
21
+ expect(subject.mime_type).to eql "image/png"
22
+ expect(subject.original_name).to eql "world.png"
23
+ end
24
+ end
25
+
26
+ context "without migrating versions" do
27
+ subject do
28
+ mover.versionable = false
29
+ mover.migrate
30
+ mover.target
31
+ end
32
+ it "should migrate only the most recent version" do
33
+ expect(subject.versions.count).to eql 0
34
+ expect(subject.content).to_not be_nil
35
+ end
36
+ it "should preserve metadata" do
37
+ expect(subject.mime_type).to eql "image/png"
38
+ expect(subject.original_name).to eql "world.png"
39
+ end
40
+ end
41
+
42
+ end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ describe "The interface to Fedora3" do
4
+
5
+ context "with an object's datastreams" do
6
+
7
+ subject { FedoraMigrate.source.connection.find("sufia:rb68xc089") }
8
+
9
+ it "should load them" do
10
+ expect(subject.datastreams.count).to eql 8
11
+ end
12
+
13
+ it "should see thier names" do
14
+ expect(subject.datastreams.keys).to include("content")
15
+ end
16
+
17
+ it "should return their content" do
18
+ expect(subject.datastreams["content"].content).to_not be_nil
19
+ end
20
+
21
+ end
22
+
23
+ end
@@ -0,0 +1,112 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Migrating an object" do
4
+
5
+ let(:source) { FedoraMigrate.source.connection.find("sufia:rb68xc089") }
6
+ let(:fits_xml) { load_fixture("sufia-rb68xc089-characterization.xml").read }
7
+
8
+ context "when the target model is provided" do
9
+
10
+ let(:mover) { FedoraMigrate::ObjectMover.new source, ExampleModel::MigrationObject.new }
11
+
12
+ subject do
13
+ mover.migrate
14
+ mover.target
15
+ end
16
+
17
+ it "should migrate the entire object" do
18
+ expect(subject.content.versions.all.count).to eql 3
19
+ expect(subject.thumbnail.mime_type).to eql "image/jpeg"
20
+ expect(subject.thumbnail.versions.all.count).to eql 0
21
+ expect(subject.characterization.content).to be_equivalent_to(fits_xml)
22
+ expect(subject.characterization.versions.all.count).to eql 0
23
+ expect(subject).to be_kind_of ExampleModel::MigrationObject
24
+ end
25
+
26
+ it "should migrate the object's permissions" do
27
+ expect(subject.edit_users).to include("jilluser@example.com")
28
+ end
29
+
30
+ end
31
+
32
+ context "when we have to determine the model" do
33
+
34
+ let(:mover) { FedoraMigrate::ObjectMover.new source }
35
+
36
+ context "and it is defined" do
37
+
38
+ before do
39
+ Object.send(:remove_const, :GenericFile) if defined?(GenericFile)
40
+ class GenericFile < ActiveFedora::Base
41
+ contains "content", class_name: "ExampleModel::VersionedDatastream"
42
+ contains "thumbnail", class_name: "ActiveFedora::Datastream"
43
+ contains "characterization", class_name: "ActiveFedora::Datastream"
44
+ end
45
+ end
46
+
47
+ subject do
48
+ mover.migrate
49
+ mover.target
50
+ end
51
+
52
+ it "should migrate the entire object" do
53
+ expect(subject.content.versions.all.count).to eql 3
54
+ expect(subject.thumbnail.mime_type).to eql "image/jpeg"
55
+ expect(subject.thumbnail.versions.all.count).to eql 0
56
+ expect(subject.characterization.content).to be_equivalent_to(fits_xml)
57
+ expect(subject.characterization.versions.all.count).to eql 0
58
+ expect(subject).to be_kind_of GenericFile
59
+ end
60
+ end
61
+
62
+ context "and it is not defined" do
63
+ before do
64
+ Object.send(:remove_const, :GenericFile) if defined?(GenericFile)
65
+ end
66
+ it "should fail" do
67
+ expect{mover.migrate}.to raise_error(NameError)
68
+ end
69
+ end
70
+
71
+ end
72
+
73
+ context "when the object has an ntriples datastream" do
74
+
75
+ context "and we want to convert it to a provided model" do
76
+ let(:mover) { FedoraMigrate::ObjectMover.new(source, ExampleModel::RDFObject.new, {convert: "descMetadata"}) }
77
+
78
+ subject do
79
+ mover.migrate
80
+ mover.target
81
+ end
82
+
83
+ it "should migrate the entire object" do
84
+ expect(subject.content.versions.all.count).to eql 3
85
+ expect(subject.thumbnail.mime_type).to eql "image/jpeg"
86
+ expect(subject.thumbnail.versions.all.count).to eql 0
87
+ expect(subject.characterization.content).to be_equivalent_to(fits_xml)
88
+ expect(subject.characterization.versions.all.count).to eql 0
89
+ expect(subject).to be_kind_of ExampleModel::RDFObject
90
+ expect(subject.title).to eql(["world.png"])
91
+ end
92
+
93
+ end
94
+
95
+ context "and we want to convert multiple datastreas" do
96
+
97
+ # Need a fixture with two different datastreams for this test to be more effective
98
+ let(:mover) { FedoraMigrate::ObjectMover.new(source, ExampleModel::RDFObject.new, {convert: ["descMetadata", "descMetadata"]}) }
99
+
100
+ subject do
101
+ mover.migrate
102
+ mover.target
103
+ end
104
+
105
+ it "should migrate all the datastreams" do
106
+ expect(subject.title).to eql(["world.png"])
107
+ end
108
+ end
109
+
110
+ end
111
+
112
+ end
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Migrating permisisons" do
4
+
5
+ let(:source) { FedoraMigrate.source.connection.find("sufia:rb68xc089") }
6
+
7
+ subject { FedoraMigrate::PermissionsMover.new(source.datastreams["rightsMetadata"], ExampleModel::MigrationObject.new)}
8
+
9
+ it "should display the permissions from the source datastream" do
10
+ expect(subject.edit_users).to include("jilluser@example.com")
11
+ end
12
+
13
+ end
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Mirating RDF terms" do
4
+
5
+ let(:mover) do
6
+ FedoraMigrate::RDFDatastreamMover.new(
7
+ FedoraMigrate.source.connection.find("sufia:xp68km39w").datastreams["descMetadata"],
8
+ ExampleModel::RDFProperties.new
9
+ )
10
+ end
11
+
12
+ subject do
13
+ mover.migrate
14
+ mover.target
15
+ end
16
+
17
+ it "adds each triple to a new Fedora4 resource" do
18
+ expect(subject.title.first).to eql "Sample Migration Object A"
19
+ expect(subject.creator.first).to eql "Adam Wead"
20
+ end
21
+
22
+ end