-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Write payload manifest checksums to tag manifests #15
Conversation
This updates how checksums are calculated, moving away from a more inlined version of instantiating and updating MessageDigests to wrapping each available algorithm in a DigestOutputStream.
Codecov Report
@@ Coverage Diff @@
## master #15 +/- ##
============================================
+ Coverage 85.61% 87.41% +1.79%
- Complexity 136 141 +5
============================================
Files 16 16
Lines 577 572 -5
Branches 86 82 -4
============================================
+ Hits 494 500 +6
+ Misses 45 42 -3
+ Partials 38 30 -8
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
The only comments I have (which are inspired by, but not related to this PR) are that we should probably test:
- On Windows (paths and input/output streams are not allows cross-platform compatible), fcrepo travis example
- Add one or more tests that include UTF-8 characters.
Java is currently unsupported on windows with travis so this downloads openjdk8 and maven on windows before building.
@awoods I added a Windows job to Travis for this PR since it doesn't have a large impact. It took a bit more fiddling than I expected (didn't initially read that java isn't officially supported on Windows, learning things about travis and chocolatey), but both builds are now passing. For adding were you referring to a file with UTF-8 characters in it, or UTF-8 in the filename? Regardless I'm thinking it would be best to pull that up into its own issue so that we can add tests for some of the other classes as well. |
Resolves: #10
This updates the
BagWriter
to write the checksums for payload manifests to each of the tag manifests.The biggest change for this is that it updates the logic for creating the checksums - instead of having many
MessageDigest
instances in theBagWriter
, theOutputStream
for a file is wrapped usingDigestOutputStream
s. These pass the contents being written to theOutputStream
which they were created with, so they do not impact the writing of the file itself or interfere with any other digests. This is handled by thestreamFor
method and an addition fieldactiveStreams
which keeps track of the ongoing checksums.