Skip to content

Commit

Permalink
fix payload-size-mismatch fixture data
Browse files Browse the repository at this point in the history
  • Loading branch information
ndushay committed Mar 6, 2018
1 parent 9e42fa7 commit d6588c2
Show file tree
Hide file tree
Showing 17 changed files with 144 additions and 15 deletions.
3 changes: 3 additions & 0 deletions spec/fixtures/deposit/payload-size-mismatch-old/bag-info.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
External-Identifier: druid:hp579td0044-v7
Payload-Oxum: 666.3
Bag-Size: 44.49 KB
2 changes: 2 additions & 0 deletions spec/fixtures/deposit/payload-size-mismatch-old/bagit.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Tag-File-Character-Encoding: UTF-8
BagIt-Version: 0.97
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<versionMetadata objectId="druid:hp579td0044">
<version versionId="1" tag="1.0.0">
<description>Initial Version</description>
</version>
<version versionId="2" tag="2.0.0"><description>rights</description></version><version versionId="3" tag="2.1.0"><description>Prepare for combination - legacy-3107</description></version><version versionId="4" tag="2.2.0"><description>Descriptive metadata upload from SC1094_modsulator_revised_05.xlsx</description></version><version versionId="5" tag="2.3.0"><description>Descriptive metadata upload from matt_kahn_remediated_03_jc.xml</description></version><version versionId="6" tag="3.0.0"><description>rights</description></version><version versionId="7" tag="4.0.0"><description>APO change</description></version></versionMetadata>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8b67199f81fe6cd7733f540e26895c844afa0b77eee363fa12f20712fdb863e7 data/metadata/versionMetadata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
4227e88364c1f99ceb6aa9da763f5a9db345cb56d4a97ea56e5fb4e34e5123fd bagit.txt
b4a5fe40bb19ce78aa63a0ef1d83fbde4b9a014ff354bb277d49068b0257ff14 versionInventory.xml
6c199781c9fc842a473313bc4c8e81ccce042b69ab3b6fc99b35f03ac6def93e versionAdditions.xml
8d70566d1ef37853872943a86716bd12810b30d2c9e401447c1d6102aca5f1ee manifest-sha256.txt
337111860a267ff327848695e5c670d959ec4a61a5207e779e99d43d3f8b07df bag-info.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<fileInventory type="additions" objectId="druid:hp579td0044" versionId="7" inventoryDatetime="2018-03-02T23:41:05Z" fileCount="5" byteCount="45555" blockCount="47">
<fileGroup groupId="metadata" dataSource="" fileCount="5" byteCount="45555" blockCount="47">
<file>
<fileSignature size="1122" sha256="3fc4ffddbdf1fd014511c58745c1f14a891ede208ff758402a65b61c7167d5d3"/>
<fileInstance path="events.xml" datetime="2018-03-02T23:41:04Z"/>
</file>
<file>
<fileSignature size="263" sha256="dce0ceb5bc94b47a4511425070117d1b94db49c34efa6b79ea5c5a415c4ed493"/>
<fileInstance path="provenanceMetadata.xml" datetime="2018-03-02T23:41:04Z"/>
</file>
<file>
<fileSignature size="721" sha256="a33b90a61f7e0b8085502610f92a5a69fca7cff7860b37da608597047d1d1610"/>
<fileInstance path="relationshipMetadata.xml" datetime="2018-03-02T23:41:04Z"/>
</file>
<file>
<fileSignature size="783" sha256="8b67199f81fe6cd7733f540e26895c844afa0b77eee363fa12f20712fdb863e7"/>
<fileInstance path="versionMetadata.xml" datetime="2018-03-02T23:41:05Z"/>
</file>
<file>
<fileSignature size="42666" sha256="b363d142eed647143eb849d732702e92870a34c03a482694d0a99bd3d6609702"/>
<fileInstance path="workflows.xml" datetime="2018-03-02T23:41:05Z"/>
</file>
</fileGroup>
</fileInventory>
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<fileInventory type="version" objectId="druid:hp579td0044" versionId="7" inventoryDatetime="2018-03-02T23:41:05Z" fileCount="11" byteCount="217686224" blockCount="212590">
<fileGroup groupId="content" dataSource="contentMetadata-preserve" fileCount="1" byteCount="217628920" blockCount="212529">
<file>
<fileSignature size="217628920" sha256="83e051adf571d3650e04357296a851421b7b34495b80dc9273d0c2cc80f21181"/>
<fileInstance path="SC1094_s2_b25_f04_DSB_Utility_0035.tif" datetime=""/>
</file>
</fileGroup>
<fileGroup groupId="metadata" dataSource="/dor/workspace/hp/579/td/0044/hp579td0044/metadata" fileCount="10" byteCount="57304" blockCount="61">
<file>
<fileSignature size="855" sha256="24341db27a3818d7bae22fbeb5a2ad9667df25f0c369e2e99b3328e3db2f33fe"/>
<fileInstance path="contentMetadata.xml" datetime="2018-03-02T23:41:04Z"/>
</file>
<file>
<fileSignature size="4560" sha256="f4dee999750a3fd154a0c4935f5aec9a122819510608cf53fe9d9aae19c6ee2f"/>
<fileInstance path="descMetadata.xml" datetime="2018-03-02T23:41:04Z"/>
</file>
<file>
<fileSignature size="1122" sha256="3fc4ffddbdf1fd014511c58745c1f14a891ede208ff758402a65b61c7167d5d3"/>
<fileInstance path="events.xml" datetime="2018-03-02T23:41:04Z"/>
</file>
<file>
<fileSignature size="554" sha256="7b72f434ca1e0bec9f1b0aca838973e137d40589e15cbbe417e3e74869418a94"/>
<fileInstance path="identityMetadata.xml" datetime="2018-03-02T23:41:04Z"/>
</file>
<file>
<fileSignature size="263" sha256="dce0ceb5bc94b47a4511425070117d1b94db49c34efa6b79ea5c5a415c4ed493"/>
<fileInstance path="provenanceMetadata.xml" datetime="2018-03-02T23:41:04Z"/>
</file>
<file>
<fileSignature size="721" sha256="a33b90a61f7e0b8085502610f92a5a69fca7cff7860b37da608597047d1d1610"/>
<fileInstance path="relationshipMetadata.xml" datetime="2018-03-02T23:41:04Z"/>
</file>
<file>
<fileSignature size="476" sha256="33eebe087660b4d331167358f381f54a84410dffbe3b85f9cf46a2e4bf3a6bce"/>
<fileInstance path="rightsMetadata.xml" datetime="2018-03-02T23:41:04Z"/>
</file>
<file>
<fileSignature size="5304" sha256="2203bd3c19ccc1ba85de694f909105b4c8074ee68acba3926f5e7aeafc6e3fc0"/>
<fileInstance path="technicalMetadata.xml" datetime="2018-03-02T23:41:04Z"/>
</file>
<file>
<fileSignature size="783" sha256="8b67199f81fe6cd7733f540e26895c844afa0b77eee363fa12f20712fdb863e7"/>
<fileInstance path="versionMetadata.xml" datetime="2018-03-02T23:41:05Z"/>
</file>
<file>
<fileSignature size="42666" sha256="b363d142eed647143eb849d732702e92870a34c03a482694d0a99bd3d6609702"/>
<fileInstance path="workflows.xml" datetime="2018-03-02T23:41:05Z"/>
</file>
</fileGroup>
</fileInventory>
4 changes: 2 additions & 2 deletions spec/fixtures/deposit/payload-size-mismatch/bag-info.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
External-Identifier: druid:hp579td0044-v7
External-Identifier: druid:oo000oo0000-v1
Payload-Oxum: 666.3
Bag-Size: 44.49 KB
Bag-Size: 0.66 KB
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<provenanceMetadata objectId="druid:oo000oo0000">
<agent name="DOR">
<what object="druid:oo000oo0000">
<event who="DOR-accessionWF" when="2018-03-02T15:40:42-08:00">DOR Common Accessioning completed</event>
</what>
</agent>
</provenanceMetadata>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

<rdf:RDF xmlns:fedora="info:fedora/fedora-system:def/relations-external#" xmlns:fedora-model="info:fedora/fedora-system:def/model#" xmlns:hydra="http://projecthydra.org/ns/relations#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="info:fedora/druid:oo000oo0000">
<hydra:isGovernedBy rdf:resource="info:fedora/druid:oo000oo0000"></hydra:isGovernedBy>
<fedora-model:hasModel rdf:resource="info:fedora/afmodel:Dor_Item"></fedora-model:hasModel>
<fedora:isMemberOf rdf:resource="info:fedora/druid:aa111aa1111"></fedora:isMemberOf>
<fedora:isMemberOfCollection rdf:resource="info:fedora/druid:aa111aa1111"></fedora:isMemberOfCollection>
</rdf:Description>
</rdf:RDF>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<versionMetadata objectId="druid:hp579td0044">
<versionMetadata objectId="druid:oo000oo0000">
<version versionId="1" tag="1.0.0">
<description>Initial Version</description>
</version>
<version versionId="2" tag="2.0.0"><description>rights</description></version><version versionId="3" tag="2.1.0"><description>Prepare for combination - legacy-3107</description></version><version versionId="4" tag="2.2.0"><description>Descriptive metadata upload from SC1094_modsulator_revised_05.xlsx</description></version><version versionId="5" tag="2.3.0"><description>Descriptive metadata upload from matt_kahn_remediated_03_jc.xml</description></version><version versionId="6" tag="3.0.0"><description>rights</description></version><version versionId="7" tag="4.0.0"><description>APO change</description></version></versionMetadata>
</versionMetadata>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<workflows objectId="druid:oo000oo0000">
<workflow repository="dor" objectId="druid:oo000oo0000" id="accessionWF">
<process version="1" priority="0" lifecycle="submitted" laneId="default" elapsed="0.0" archived="true" attempts="1" datetime="2017-06-09T16:33:38-0700" status="completed" name="start-accession"/>
<process version="1" priority="0" note="sul-robots1-prod.stanford.edu" lifecycle="described" laneId="default" elapsed="0.627" archived="true" attempts="2" datetime="2017-06-09T16:34:01-0700" status="completed" name="descriptive-metadata"/>
<process version="1" priority="0" note="sul-robots2-prod.stanford.edu" laneId="default" elapsed="0.478" archived="true" attempts="2" datetime="2017-06-09T16:34:19-0700" status="completed" name="rights-metadata"/>
<process version="1" priority="0" note="sul-robots2-prod.stanford.edu" laneId="default" elapsed="0.726" archived="true" attempts="2" datetime="2017-06-09T16:34:45-0700" status="completed" name="content-metadata"/>
<process version="1" priority="0" note="sul-robots1-prod.stanford.edu" laneId="default" elapsed="6.103" archived="true" attempts="2" datetime="2017-06-09T16:35:11-0700" status="completed" name="technical-metadata"/>
<process version="1" priority="0" note="sul-robots1-prod.stanford.edu" laneId="default" elapsed="0.32" archived="true" attempts="2" datetime="2017-06-09T16:35:23-0700" status="completed" name="remediate-object"/>
<process version="1" priority="0" note="sul-robots1-prod.stanford.edu" laneId="default" elapsed="4.616" archived="true" attempts="2" datetime="2017-06-09T16:35:47-0700" status="completed" name="shelve"/>
<process version="1" priority="0" note="sul-robots1-prod.stanford.edu" lifecycle="published" laneId="default" elapsed="3.074" archived="true" attempts="2" datetime="2017-06-09T16:36:12-0700" status="completed" name="publish"/>
<process version="1" priority="0" note="sul-robots2-prod.stanford.edu" laneId="default" elapsed="0.388" archived="true" attempts="2" datetime="2017-06-09T16:36:28-0700" status="completed" name="provenance-metadata"/>
<process version="1" priority="0" note="sul-robots5-prod.stanford.edu" laneId="default" elapsed="17.058" archived="true" attempts="2" datetime="2017-06-09T16:37:06-0700" status="completed" name="sdr-ingest-transfer"/>
<process version="1" priority="0" note="sul-sdr-services.stanford.edu" lifecycle="deposited" laneId="default" elapsed="1.0" archived="true" attempts="1" datetime="2017-06-09T16:38:55-0700" status="completed" name="sdr-ingest-received"/>
<process version="1" priority="0" note="sul-robots5-prod.stanford.edu" laneId="default" elapsed="0.376" archived="true" attempts="2" datetime="2017-06-09T16:39:19-0700" status="completed" name="reset-workspace"/>
<process version="1" priority="0" note="sul-robots2-prod.stanford.edu" lifecycle="accessioned" laneId="default" elapsed="3.808" archived="true" attempts="2" datetime="2017-06-09T16:39:43-0700" status="completed" name="end-accession"/>
</workflow>
</workflows>
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
8b67199f81fe6cd7733f540e26895c844afa0b77eee363fa12f20712fdb863e7 data/metadata/versionMetadata.xml
8417d68d2703c8d1fbe8f045883d735ae2643ce1d2343ec50e60c5c4a7956cc6 data/metadata/provenanceMetadata.xml
d17e3dcb639ccfb958e4beab2c7f8945b28f4f5b4eb8992c34a15aa5811166ee data/metadata/relationshipMetadata.xml
c5410a4bb014d9d65371a0335d06483626ce35115124270ce08b01432c80e4b0 data/metadata/versionMetadata.xml
6b2d9ca1a85dd9a2a92ee7903898c590afbdfc4a5dbfdf5843f8ad729e489700 data/metadata/workflows.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
4227e88364c1f99ceb6aa9da763f5a9db345cb56d4a97ea56e5fb4e34e5123fd bagit.txt
b4a5fe40bb19ce78aa63a0ef1d83fbde4b9a014ff354bb277d49068b0257ff14 versionInventory.xml
6c199781c9fc842a473313bc4c8e81ccce042b69ab3b6fc99b35f03ac6def93e versionAdditions.xml
8d70566d1ef37853872943a86716bd12810b30d2c9e401447c1d6102aca5f1ee manifest-sha256.txt
337111860a267ff327848695e5c670d959ec4a61a5207e779e99d43d3f8b07df bag-info.txt
8b1baf8a8306eb0ae2f452c3607793ca85e3997b31967ec77fa9d81cdce2dde8 versionInventory.xml
a9cff8b88293b40188bb50e71654a214e8d3e8da5134324da593f3f1d340d44d versionAdditions.xml
171b09aa2177fad56fc30c67d8e73e7d6fc6249c73cefd8395ed8fc72ad3d83f manifest-sha256.txt
43937dd4e84d49fba633b0f9695292f883c50e2e806fa7cb89dee473198061cd bag-info.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<fileInventory type="additions" objectId="druid:hp579td0044" versionId="7" inventoryDatetime="2018-03-02T23:41:05Z" fileCount="5" byteCount="45555" blockCount="47">
<fileInventory type="additions" objectId="druid:oo000oo0000" versionId="1" inventoryDatetime="2018-03-02T23:41:05Z" fileCount="5" byteCount="45555" blockCount="47">
<fileGroup groupId="metadata" dataSource="" fileCount="5" byteCount="45555" blockCount="47">
<file>
<fileSignature size="1122" sha256="3fc4ffddbdf1fd014511c58745c1f14a891ede208ff758402a65b61c7167d5d3"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<fileInventory type="version" objectId="druid:hp579td0044" versionId="7" inventoryDatetime="2018-03-02T23:41:05Z" fileCount="11" byteCount="217686224" blockCount="212590">
<fileInventory type="version" objectId="druid:oo000oo0000" versionId="1" inventoryDatetime="2018-03-02T23:41:05Z" fileCount="11" byteCount="217686224" blockCount="212590">
<fileGroup groupId="content" dataSource="contentMetadata-preserve" fileCount="1" byteCount="217628920" blockCount="212529">
<file>
<fileSignature size="217628920" sha256="83e051adf571d3650e04357296a851421b7b34495b80dc9273d0c2cc80f21181"/>
<fileInstance path="SC1094_s2_b25_f04_DSB_Utility_0035.tif" datetime=""/>
</file>
</fileGroup>
<fileGroup groupId="metadata" dataSource="/dor/workspace/hp/579/td/0044/hp579td0044/metadata" fileCount="10" byteCount="57304" blockCount="61">
<fileGroup groupId="metadata" dataSource="/dor/workspace/oo/000/oo/0000/oo000oo0000/metadata" fileCount="10" byteCount="57304" blockCount="61">
<file>
<fileSignature size="855" sha256="24341db27a3818d7bae22fbeb5a2ad9667df25f0c369e2e99b3328e3db2f33fe"/>
<fileInstance path="contentMetadata.xml" datetime="2018-03-02T23:41:04Z"/>
Expand Down
6 changes: 3 additions & 3 deletions spec/unit_tests/moab/deposit_bag_validator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
expect(dbv.validation_errors).to eq [{ code => "Deposit bag directory #{bag_pathname} does not exist" }]
end

it 'required files missing gives Array with entry for each missing req file' do
it 'REQUIRED_FILE_NOT_FOUND result hash for each missing req file' do
bag_pathname = Pathname(File.join(deposit_dir_pathname, 'missing-required-files'))
storage_obj = instance_double(Moab::StorageObject, deposit_bag_pathname: bag_pathname, current_version_id: 0)
vdn_errors = described_class.new(storage_obj).validation_errors
Expand Down Expand Up @@ -120,11 +120,11 @@

it 'result array has PAYLOAD_SIZE_MISMATCH result hash when payload size verification fails' do
bag_pathname = Pathname(File.join(deposit_dir_pathname, 'payload-size-mismatch'))
storage_obj = instance_double(Moab::StorageObject, deposit_bag_pathname: bag_pathname, current_version_id: 6)
storage_obj = instance_double(Moab::StorageObject, deposit_bag_pathname: bag_pathname, current_version_id: 0)
dbv = described_class.new(storage_obj)
code = described_class::PAYLOAD_SIZE_MISMATCH
size_from_file = dbv.send(:bag_info_payload_size)
exp_msg = "Failed payload size verification. Expected: #{size_from_file}; found: {:bytes=>783, :files=>1}"
exp_msg = "Failed payload size verification. Expected: #{size_from_file}; found: {:bytes=>4300, :files=>4}"
expect(dbv.validation_errors).to eq [{ code => exp_msg }]
end

Expand Down

0 comments on commit d6588c2

Please sign in to comment.