create a data file and calculate checksum
$ head -c 8192 /dev/zero > file1.dat
$ shasum file1.dat
0631457264ff7f8d5fb1edc2c0211992a67c73e6 file1.dat
transmission fixity failure
HTTP/1.1 100 Continue
HTTP/1.1 409 Conflict
Server: Apache-Coyote/1.1
Cache-Control: private
Expires: Thu, 01 Jan 1970 00:00:00 UTC
Content-Type: text/plain;charset=utf-8
Content-Length: 88
Date: Sat, 13 Jan 2018 12:36:11 GMT
Checksum Mismatch of urn:sha1:bad and urn:sha1:0631457264ff7f8d5fb1edc2c0211992a67c73e6
transmission fixity success
$ curl -i -u fedoraAdmin:secret3 -X PUT --data-binary @file1.dat -H "Digest: sha1=0631457264ff7f8d5fb1edc2c0211992a67c73e6" http://localhost:8080/fcrepo/rest/file1
HTTP/1.1 100 Continue
HTTP/1.1 201 Created
Server: Apache-Coyote/1.1
Cache-Control: private
Expires: Thu, 01 Jan 1970 00:00:00 UTC
ETag: "4a2cd452fee08d0b7dabb20c093daf154b822840"
Last-Modified: Sat, 13 Jan 2018 12:36:36 GMT
Link: <http://localhost:8080/fcrepo/rest/file1/fcr:metadata>; rel="describedby"; anchor="http://localhost:8080/fcrepo/rest/file1"
Location: http://localhost:8080/fcrepo/rest/file1
Content-Type: text/plain
Content-Length: 39
Date: Sat, 13 Jan 2018 12:36:36 GMT
http://localhost:8080/fcrepo/rest/file1
persistence fixity success
$ curl -i -u fedoraAdmin:secret3 http://localhost:8080/fcrepo/rest/file1/fcr:fixity
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Cache-Control: private
Expires: Thu, 01 Jan 1970 00:00:00 UTC
Link: <http://www.w3.org/ns/ldp#Resource>; rel="type"
Link: <http://www.w3.org/ns/ldp#RDFSource>; rel="type"
Content-Type: text/turtle;charset=utf-8
Content-Length: 1509
Date: Sat, 13 Jan 2018 12:36:56 GMT
@prefix premis: <http://www.loc.gov/premis/rdf/v1#> .
@prefix test: <info:fedora/test/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsi: <http://www.w3.org/2001/XMLSchema-instance> .
@prefix xmlns: <http://www.w3.org/2000/xmlns/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix fedora: <http://fedora.info/definitions/v4/repository#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix ebucore: <http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#> .
@prefix ldp: <http://www.w3.org/ns/ldp#> .
@prefix xs: <http://www.w3.org/2001/XMLSchema> .
@prefix fedoraconfig: <http://fedora.info/definitions/v4/config#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix authz: <http://fedora.info/definitions/v4/authorization#> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
<http://localhost:8080/fcrepo/rest/file1>
premis:hasFixity <http://localhost:8080/fcrepo/rest/file1#fixity/1515847016030> .
<http://localhost:8080/fcrepo/rest/file1#fixity/1515847016030>
rdf:type premis:Fixity ;
rdf:type premis:EventOutcomeDetail ;
premis:hasEventOutcome "SUCCESS"^^<http://www.w3.org/2001/XMLSchema#string> ;
premis:hasMessageDigestAlgorithm "SHA-1"^^<http://www.w3.org/2001/XMLSchema#string> ;
premis:hasMessageDigest <urn:sha1:0631457264ff7f8d5fb1edc2c0211992a67c73e6> ;
premis:hasSize "8192"^^<http://www.w3.org/2001/XMLSchema#long> .
extra credit: persistence fixity failure
$ vagrant ssh
vagrant$ sudo -s
root$ echo "corruption" > /var/lib/tomcat7/fcrepo4-data/fcrepo.binary.directory/06/31/45/0631457264ff7f8d5fb1edc2c0211992a67c73e6
check fixity again to see the failure
$ curl -i -u fedoraAdmin:secret3 http://localhost:8080/fcrepo/rest/file1/fcr:fixity
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Cache-Control: private
Expires: Thu, 01 Jan 1970 00:00:00 UTC
Link: <http://www.w3.org/ns/ldp#Resource>; rel="type"
Link: <http://www.w3.org/ns/ldp#RDFSource>; rel="type"
Content-Type: text/turtle;charset=utf-8
Content-Length: 1601
Date: Sat, 13 Jan 2018 12:41:15 GMT
@prefix premis: <http://www.loc.gov/premis/rdf/v1#> .
@prefix test: <info:fedora/test/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsi: <http://www.w3.org/2001/XMLSchema-instance> .
@prefix xmlns: <http://www.w3.org/2000/xmlns/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix fedora: <http://fedora.info/definitions/v4/repository#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix ebucore: <http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#> .
@prefix ldp: <http://www.w3.org/ns/ldp#> .
@prefix xs: <http://www.w3.org/2001/XMLSchema> .
@prefix fedoraconfig: <http://fedora.info/definitions/v4/config#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix authz: <http://fedora.info/definitions/v4/authorization#> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
<http://localhost:8080/fcrepo/rest/file1>
premis:hasFixity <http://localhost:8080/fcrepo/rest/file1#fixity/1515847275733> .
<http://localhost:8080/fcrepo/rest/file1#fixity/1515847275733>
rdf:type premis:Fixity ;
rdf:type premis:EventOutcomeDetail ;
premis:hasEventOutcome "BAD_CHECKSUM"^^<http://www.w3.org/2001/XMLSchema#string> ;
premis:hasEventOutcome "BAD_SIZE"^^<http://www.w3.org/2001/XMLSchema#string> ;
premis:hasMessageDigestAlgorithm "SHA-1"^^<http://www.w3.org/2001/XMLSchema#string> ;
premis:hasMessageDigest <urn:sha1:6a7bb2556144babe3899b25e5428123735bb1e27> ;
premis:hasSize "11"^^<http://www.w3.org/2001/XMLSchema#long> .