From 9b7f3ab2e7ed4ce2bad59855151eef48c14ff7db Mon Sep 17 00:00:00 2001 From: Dan Field Date: Tue, 20 Sep 2022 15:42:34 +0100 Subject: [PATCH 01/22] added test for DISABLED digest type --- .../foxml/FoxmlInputStreamFedoraObjectProcessor.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/org/fcrepo/migration/foxml/FoxmlInputStreamFedoraObjectProcessor.java b/src/main/java/org/fcrepo/migration/foxml/FoxmlInputStreamFedoraObjectProcessor.java index 0a8fc6ec..061a2340 100644 --- a/src/main/java/org/fcrepo/migration/foxml/FoxmlInputStreamFedoraObjectProcessor.java +++ b/src/main/java/org/fcrepo/migration/foxml/FoxmlInputStreamFedoraObjectProcessor.java @@ -468,6 +468,10 @@ private String extractInlineXml() throws XMLStreamException { private void validateInlineXml() { if (isInlineXml && contentDigest != null && StringUtils.isNotBlank(contentDigest.getDigest())) { + if (StringUtils.equals(contentDigest.getType(), "DISABLED")) { + LOG.warn("Datastream Digest DISABLED. Skipping digest validation"); + return; + } final var transformedXml = transformInlineXmlForChecksum(); final var digest = DigestUtils.getDigest(contentDigest.getType()); final var digestBytes = DigestUtils.digest(digest, transformedXml); From 41e8835ad1bda8749b5f316ca9810693ad2bb333 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Fri, 25 Nov 2022 11:44:45 +0000 Subject: [PATCH 02/22] Adding Integration Test and a new exceptin for disabled digests --- ...FoxmlInputStreamFedoraObjectProcessor.java | 11 +- .../handlers/ocfl/ArchiveGroupHandler.java | 12 +- .../fcrepo/migration/DisabledDigestIT.java | 78 ++ .../org/fcrepo/migration/InlineXmlIT.java | 1 + .../objects/2013/0418/22/15/llgc-id_1591190 | 706 ++++++++++++++++++ .../spring/inline-disabled-it-setup.xml | 93 +++ 6 files changed, 894 insertions(+), 7 deletions(-) create mode 100644 src/test/java/org/fcrepo/migration/DisabledDigestIT.java create mode 100644 src/test/resources/inline-disabled-akubra/objects/2013/0418/22/15/llgc-id_1591190 create mode 100644 src/test/resources/spring/inline-disabled-it-setup.xml diff --git a/src/main/java/org/fcrepo/migration/foxml/FoxmlInputStreamFedoraObjectProcessor.java b/src/main/java/org/fcrepo/migration/foxml/FoxmlInputStreamFedoraObjectProcessor.java index 061a2340..60f85fb3 100644 --- a/src/main/java/org/fcrepo/migration/foxml/FoxmlInputStreamFedoraObjectProcessor.java +++ b/src/main/java/org/fcrepo/migration/foxml/FoxmlInputStreamFedoraObjectProcessor.java @@ -193,7 +193,11 @@ public void processObject(final StreamingFedoraObjectHandler handler) { dsInfo = new Foxml11DatastreamInfo(objectInfo, reader); } else if (reader.getLocalName().equals("datastreamVersion")) { final var v = new Foxml11DatastreamVersion(dsInfo, reader); - v.validateInlineXml(); + try { + v.validateInlineXml(); + } catch (RuntimeException e) { + // do we need to do anyting with disabled digests? + } handler.processDatastreamVersion(v); } else { throw new RuntimeException("Unexpected element! \"" + reader.getLocalName() + "\"!"); @@ -469,9 +473,10 @@ private String extractInlineXml() throws XMLStreamException { private void validateInlineXml() { if (isInlineXml && contentDigest != null && StringUtils.isNotBlank(contentDigest.getDigest())) { if (StringUtils.equals(contentDigest.getType(), "DISABLED")) { - LOG.warn("Datastream Digest DISABLED. Skipping digest validation"); - return; + LOG.info("Datastream Digest DISABLED. Skipping digest validation"); + throw new RuntimeException("DISABLED digest. Skipping digest validation"); } + final var transformedXml = transformInlineXmlForChecksum(); final var digest = DigestUtils.getDigest(contentDigest.getType()); final var digestBytes = DigestUtils.digest(digest, transformedXml); diff --git a/src/main/java/org/fcrepo/migration/handlers/ocfl/ArchiveGroupHandler.java b/src/main/java/org/fcrepo/migration/handlers/ocfl/ArchiveGroupHandler.java index f510adab..0f8b14f8 100644 --- a/src/main/java/org/fcrepo/migration/handlers/ocfl/ArchiveGroupHandler.java +++ b/src/main/java/org/fcrepo/migration/handlers/ocfl/ArchiveGroupHandler.java @@ -654,10 +654,14 @@ private ResourceHeaders createDatastreamHeaders(final DatastreamVersion dv, } if (dv.getContentDigest() != null && !Strings.isNullOrEmpty(dv.getContentDigest().getDigest())) { - final var digest = dv.getContentDigest(); - final var digests = new ArrayList(); - digests.add(URI.create("urn:" + digest.getType().toLowerCase() + ":" + digest.getDigest().toLowerCase())); - headers.withDigests(digests); + if (!dv.getContentDigest().getDigest().equals("none")) { + final var digest = dv.getContentDigest(); + final var digests = new ArrayList(); + digests.add(URI.create("urn:" + digest.getType().toLowerCase() + ":" + digest.getDigest().toLowerCase())); + headers.withDigests(digests); + } else { + LOGGER.warn("Digest content 'none' found. Not adding to header"); + } } headers.withMimeType(mime); diff --git a/src/test/java/org/fcrepo/migration/DisabledDigestIT.java b/src/test/java/org/fcrepo/migration/DisabledDigestIT.java new file mode 100644 index 00000000..4619a6a7 --- /dev/null +++ b/src/test/java/org/fcrepo/migration/DisabledDigestIT.java @@ -0,0 +1,78 @@ +/** + * Copyright 2015 DuraSpace, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.fcrepo.migration; + +import org.apache.commons.codec.digest.DigestUtils; +import org.apache.commons.io.FileUtils; +import org.junit.After; +import org.junit.Test; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +import java.io.IOException; +import java.io.UncheckedIOException; +import java.nio.file.Files; +import java.nio.file.Paths; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +/** + * @author Dan Field + */ +public class DisabledDigestIT { + + private ConfigurableApplicationContext context; + private Migrator migrator; + + @After + public void tearDown() { + if (context != null) { + context.close(); + } + } + + private void setup(final String name) throws Exception { + final var storage = Paths.get(String.format("target/test/ocfl/%s/storage", name)); + final var staging = Paths.get(String.format("target/test/ocfl/%s/staging", name)); + + if (Files.exists(storage)) { + FileUtils.forceDelete(storage.toFile()); + } + if (Files.exists(staging)) { + FileUtils.forceDelete(staging.toFile()); + } + + Files.createDirectories(storage); + Files.createDirectories(staging); + + context = new ClassPathXmlApplicationContext(String.format("spring/%s-setup.xml", name)); + migrator = (Migrator) context.getBean("migrator"); + } + + @Test + public void testMigrateObjectWithExternalDatastreamAndDisabledDigest() throws Exception { + setup("inline-disabled-it"); + try { + migrator.run(); + } catch (RuntimeException e) { + assertTrue(e.getMessage().contains("DISABLED digest. Skipping digest validation")); + } + } + +} diff --git a/src/test/java/org/fcrepo/migration/InlineXmlIT.java b/src/test/java/org/fcrepo/migration/InlineXmlIT.java index f1767efc..da49c541 100644 --- a/src/test/java/org/fcrepo/migration/InlineXmlIT.java +++ b/src/test/java/org/fcrepo/migration/InlineXmlIT.java @@ -115,4 +115,5 @@ public void failMigrationWhenInlineXmlDoesNotMatchDigest() throws Exception { } } + } diff --git a/src/test/resources/inline-disabled-akubra/objects/2013/0418/22/15/llgc-id_1591190 b/src/test/resources/inline-disabled-akubra/objects/2013/0418/22/15/llgc-id_1591190 new file mode 100644 index 00000000..ba7e0165 --- /dev/null +++ b/src/test/resources/inline-disabled-akubra/objects/2013/0418/22/15/llgc-id_1591190 @@ -0,0 +1,706 @@ + + + + + + + + + + + + + + + + + + + ingestObject + + fedoraAdmin + 2013-04-18T21:15:50.582Z + Ingested by NLW ingest program + + + + + + + + + + + + + oai:llgc.org.uk:llgc-id:1591190 + AOAAA00079444 + 10107/1591190 + (WlAbNL)006509574 + 0047235 + + + + + + + + + + + + + + + + + + + FfIG Group + Discussions November/December 2008 + + + National Library of Wales Fedora ingest program + Version 1.0 + + + Llyfrgell Genedlaethol Cymru : The National Library of Wales + + + Llyfrgell Genedlaethol Cymru : The National Library of Wales + + + + + + + + Dei Tomos: Glannau Shir Gar + + Traethau gwag, cestyll, pysgotwyr a hanes torri record byd mewn car ac mewn awyren. Dei Tomos' travels along the shores of Carmarthenshire. + + BBC Radio Cymru + 2013-01-01T17:28:00 + 2013-01-01T18:35:00 + 201301011728 + + wlk + + + sound recording + 166 Kbps + + 01:07:00 + access +
electronic
+
+ + WlAbNL + 130417 + 20130417194300.0 + vtls006509574 + Converted from MARCXML to MODS version 3.3 using MARC21slim2MODS3-3.xsl + (Revision 1.51) + + eng + + 10107/1591190 + llgc-id:1591190 + 0047235 + + I wylio/gwrando ar y recordiad hwn, gwnewch gais a chysylltwch ag aelod o staff, os gwelwch yn dda. = To consult this recording, please place a request and contact a member of staff. + Recorded 1 January 2013 17:28:00. + Recorded off-air by NLW under the terms of Statutory Instrument 1991 No. 1116. Freeview data stream and associated metadata captured by BoB (Box of Broadcasts), supplied by Cambridge Imaging Systems Ltd. + Content not verified. + Radio programs. + + BBC Radio Cymru + +
+
+
+
+ + + + + + + + + + + + WlAbNL_METS_AOAAA00079444 + BoB1 + + file + aoaaa00079444 + + + + + + + + + + + + + + + lossy + + 128 + Fixed + MPEG Audio + profile: Layer 2 + 1 + 48.0 + + + 01:07:00 + Mode: Joint stereo + data_rate element above is in Kbps + sampling_frequency element above is in KHz + Stream_size: 62.3 MiB (77%) + Language: Welsh + 2 + + + + + + + + + + + + WlAbNL_METS_AOAAA00079444 + bob1 + + file + + 0 + + MD5 + 9c188cb6ec979097c0927d632baf8745 + + + SHA-1 + a8466bd11039eda5c667f202aa72867a + + + + MPEG2 Transport Stream + ISO/IEC 13818-1, Second edition 2000-12-01, http://neuron2.net/library/mpeg2/iso13818-1.pdf + + + + + + + + + + + + + + + WlAbNL + R-001 + + all + + Copyright (Archiving Broadcasts Designated + Bodies), Order, 18/10/1993, No. 74 + +

The Library is a designated body under the Order made under Section 75 of the + Copyright, Designs and Patents Act 1988 which provides that copies of broadcasts + of a designated class may be made for the purpose of being placed in an archive + maintained by a designated body without infringement of copyright.

+
+
+ + all + + 2008-12-01 + 9999-01-01 + + +
+
+
+
+
+ + + + + + + + + WlAbNL + V-001 + + format validation + 2013-02-13T12:02:02 + + C-001 + + + WlAbNL + media_info + + + + + + + + + + + WlAbNL + FC-001 + + fixity check + 2008-11-21T10:00:00 + + C-001 + + + WlAbNL + UNIX_TOOLS-001 + + + + + + + + + + + WlAbNL + REC-001 + + off-air recording + 2013-01-01T17:28:00 + + WlAbNL + HP-01 + + + WlAbNL + HP-02 + + + WlAbNL + INFORTREND-01 + + + WlAbNL + CIS-01 + + + WlAbNL + CIS-02 + + + WlAbNL + CIS-03 + + + WlAbNL + CIS-04 + + + WlAbNL + CIS-05 + + + WlAbNL + IMAGEN-01 + + + WlAbNL + IMAGEN-02 + + + WlAbNL + IMAGEN-03 + + + WlAbNL + IMAGEN-04 + + + WlAbNL + IMAGEN-05 + + + WlAbNL + IMAGEN-06 + + + WlAbNL + PHP-01 + + + WlAbNL + POSTGRE-01 + + + WlAbNL + MEDIAPLAN-01 + + + WlAbNL + VIDEOARCHIVE-01 + + + + + + + + + + + WlAbNL + media_info + + media_info version 0.7.60 + software + + + + + + + + + + WlAbNL +UNIX_TOOLS-001 + + UNIX checksum tools (/usr/bin/md5sum, /usr/bin/gpg --print-md sha1), + see dev.llgc.org.uk + software + + + + + + + + + + WlAbNL + CIS-01 + + CIS Capture Server version 1.5.0.14 + software + + + + + + + + + + WlAbNL + CIS-02 + + CIS Feed Server 2.5.129.2 + software + + + + + + + + + + WlAbNL + CIS-03 + + CIS Transcoder version 1.9.0.23 + software + + + + + + + + + + WlAbNL + IMAGEN-01 + + Imagen Server version 1.1.0.69 + software + + + + + + + + + + WlAbNL + IMAGEN-02 + + Imagen Server Soap Interface version 1.0.0.30 + software + + + + + + + + + + WlAbNL + IMAGEN-03 + + Imagen Client version 2.1.0.179 + software + + + + + + + + + + WlAbNL + IMAGEN-04 + + Imagen Media Control Centre version 1.0.0.48 + software + + + + + + + + + + WlAbNL + PHP-01 + + PHP version 5.0.5.5 + software + + + + + + + + + + WlAbNL + POSTGRE-01 + + PostrgreSQL version 8.1 + software + + + + + + + + + + WlAbNL + CIS-04 + + CIS Web Site version 1.6 + software + + + + + + + + + + WlAbNL + CIS-05 + + CIS Encoder Service version 1.0.0.22 + software + + + + + + + + + + WlAbNL + IMAGEN-05 + + Imagen Ingest GUI version 1.0.0.39 + software + + + + + + + + + + WlAbNL + IMAGEN-06 + + Imagen Client 2.1.0.174 + software + + + + + + + + + + WlAbNL + MEDIAPLAN-01 + + Media Plan version 1.3.0.36 + software + + + + + + + + + + WlAbNL + VIDEOARCHIVE-01 + + Video Archive.NET version 1.4.1.34 + software + + + + + + + + + + WlAbNL + HP-01 + + 2 x HP DL360 G4p servers each with 2xSCSI hard disk drives, with RAID1 + mirror configuration + hardware + + + + + + + + + + WlAbNL + INFORTREND-01 + + 2x Infortrend 24-Bay SCSI to SATA RAID controllers + hardware + + + + + + + + + + WlAbNL + HP-02 + + 1x HP DC7700 workstation with 6Mbps encoder card + hardware + + + + +
+ + + + + + + + + + + + +
+
+
+
+ + + + + + Dei Tomos: Glannau Shir Gar + BBC Radio Cymru + Traethau gwag, cestyll, pysgotwyr a hanes torri record byd mewn car ac mewn awyren. Dei Tomos' travels along the shores of Carmarthenshire. + Recorded 1 January 2013 17:28:00. + [Wales] : BBC Radio Cymru, + 2013-January-01 17:28:00 + sound recording + Radio programs. + llgc-id:1591190 + ||| + + Nid oes modd gwneud copïau o'r deunydd hwn heb ganiatâd deiliaid yr hawlfraint. = It is not possible to make copies of this material without permission from the copyright holders. + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/test/resources/spring/inline-disabled-it-setup.xml b/src/test/resources/spring/inline-disabled-it-setup.xml new file mode 100644 index 00000000..c1324249 --- /dev/null +++ b/src/test/resources/spring/inline-disabled-it-setup.xml @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From c6be76a9394189dcdb6385cc9a3b6ff0d2d517fd Mon Sep 17 00:00:00 2001 From: Dan Field Date: Mon, 28 Nov 2022 09:44:35 +0000 Subject: [PATCH 03/22] checkstyle fixes --- .../foxml/FoxmlInputStreamFedoraObjectProcessor.java | 6 +++--- .../fcrepo/migration/handlers/ocfl/ArchiveGroupHandler.java | 3 ++- src/test/java/org/fcrepo/migration/DisabledDigestIT.java | 5 ----- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/fcrepo/migration/foxml/FoxmlInputStreamFedoraObjectProcessor.java b/src/main/java/org/fcrepo/migration/foxml/FoxmlInputStreamFedoraObjectProcessor.java index 60f85fb3..d715d918 100644 --- a/src/main/java/org/fcrepo/migration/foxml/FoxmlInputStreamFedoraObjectProcessor.java +++ b/src/main/java/org/fcrepo/migration/foxml/FoxmlInputStreamFedoraObjectProcessor.java @@ -195,9 +195,9 @@ public void processObject(final StreamingFedoraObjectHandler handler) { final var v = new Foxml11DatastreamVersion(dsInfo, reader); try { v.validateInlineXml(); - } catch (RuntimeException e) { - // do we need to do anyting with disabled digests? - } + } catch (RuntimeException e) { + // do we need to do anyting with disabled digests? + } handler.processDatastreamVersion(v); } else { throw new RuntimeException("Unexpected element! \"" + reader.getLocalName() + "\"!"); diff --git a/src/main/java/org/fcrepo/migration/handlers/ocfl/ArchiveGroupHandler.java b/src/main/java/org/fcrepo/migration/handlers/ocfl/ArchiveGroupHandler.java index 0f8b14f8..4e2cc466 100644 --- a/src/main/java/org/fcrepo/migration/handlers/ocfl/ArchiveGroupHandler.java +++ b/src/main/java/org/fcrepo/migration/handlers/ocfl/ArchiveGroupHandler.java @@ -657,7 +657,8 @@ private ResourceHeaders createDatastreamHeaders(final DatastreamVersion dv, if (!dv.getContentDigest().getDigest().equals("none")) { final var digest = dv.getContentDigest(); final var digests = new ArrayList(); - digests.add(URI.create("urn:" + digest.getType().toLowerCase() + ":" + digest.getDigest().toLowerCase())); + digests.add(URI.create("urn:" + digest.getType().toLowerCase() + ":" + + digest.getDigest().toLowerCase())); headers.withDigests(digests); } else { LOGGER.warn("Digest content 'none' found. Not adding to header"); diff --git a/src/test/java/org/fcrepo/migration/DisabledDigestIT.java b/src/test/java/org/fcrepo/migration/DisabledDigestIT.java index 4619a6a7..a6f149f1 100644 --- a/src/test/java/org/fcrepo/migration/DisabledDigestIT.java +++ b/src/test/java/org/fcrepo/migration/DisabledDigestIT.java @@ -16,21 +16,16 @@ package org.fcrepo.migration; -import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.io.FileUtils; import org.junit.After; import org.junit.Test; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; -import java.io.IOException; -import java.io.UncheckedIOException; import java.nio.file.Files; import java.nio.file.Paths; -import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; /** * @author Dan Field From 13f3ce30029fb3c1ff18bd6e057b9ffc7e2f575c Mon Sep 17 00:00:00 2001 From: Dan Field Date: Mon, 28 Nov 2022 10:22:12 +0000 Subject: [PATCH 04/22] changing index to match inline-it et al --- src/test/resources/spring/inline-disabled-it-setup.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/resources/spring/inline-disabled-it-setup.xml b/src/test/resources/spring/inline-disabled-it-setup.xml index c1324249..15ddd459 100644 --- a/src/test/resources/spring/inline-disabled-it-setup.xml +++ b/src/test/resources/spring/inline-disabled-it-setup.xml @@ -38,7 +38,7 @@ - + From bb13c9e1223dc0f099ac1dd905045d9b7f39098d Mon Sep 17 00:00:00 2001 From: Dan Field Date: Mon, 28 Nov 2022 15:51:33 +0000 Subject: [PATCH 05/22] seperating test index in case of clash --- src/test/resources/spring/inline-disabled-it-setup.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/resources/spring/inline-disabled-it-setup.xml b/src/test/resources/spring/inline-disabled-it-setup.xml index 15ddd459..c1324249 100644 --- a/src/test/resources/spring/inline-disabled-it-setup.xml +++ b/src/test/resources/spring/inline-disabled-it-setup.xml @@ -38,7 +38,7 @@ - + From 00d36d30625c9cf58d21459c9ee082b3b6899fee Mon Sep 17 00:00:00 2001 From: Dan Field Date: Tue, 29 Nov 2022 10:17:11 +0000 Subject: [PATCH 06/22] fixing issues with the disabled integration test --- .../foxml/FoxmlInputStreamFedoraObjectProcessor.java | 3 +++ src/test/resources/spring/inline-disabled-it-setup.xml | 8 ++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/fcrepo/migration/foxml/FoxmlInputStreamFedoraObjectProcessor.java b/src/main/java/org/fcrepo/migration/foxml/FoxmlInputStreamFedoraObjectProcessor.java index d715d918..f427956e 100644 --- a/src/main/java/org/fcrepo/migration/foxml/FoxmlInputStreamFedoraObjectProcessor.java +++ b/src/main/java/org/fcrepo/migration/foxml/FoxmlInputStreamFedoraObjectProcessor.java @@ -197,6 +197,8 @@ public void processObject(final StreamingFedoraObjectHandler handler) { v.validateInlineXml(); } catch (RuntimeException e) { // do we need to do anyting with disabled digests? + LOG.error("Inline Validation failed", e); + throw new RuntimeException(e); } handler.processDatastreamVersion(v); } else { @@ -472,6 +474,7 @@ private String extractInlineXml() throws XMLStreamException { private void validateInlineXml() { if (isInlineXml && contentDigest != null && StringUtils.isNotBlank(contentDigest.getDigest())) { + if (StringUtils.equals(contentDigest.getType(), "DISABLED")) { LOG.info("Datastream Digest DISABLED. Skipping digest validation"); throw new RuntimeException("DISABLED digest. Skipping digest validation"); diff --git a/src/test/resources/spring/inline-disabled-it-setup.xml b/src/test/resources/spring/inline-disabled-it-setup.xml index c1324249..182975b4 100644 --- a/src/test/resources/spring/inline-disabled-it-setup.xml +++ b/src/test/resources/spring/inline-disabled-it-setup.xml @@ -17,15 +17,11 @@ - + - - - + From c72a9929c449b8ec7686377834da829644b7a46d Mon Sep 17 00:00:00 2001 From: Dan Field Date: Tue, 29 Nov 2022 10:21:17 +0000 Subject: [PATCH 07/22] removing superflous log message as we throw an exception now --- .../migration/foxml/FoxmlInputStreamFedoraObjectProcessor.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/org/fcrepo/migration/foxml/FoxmlInputStreamFedoraObjectProcessor.java b/src/main/java/org/fcrepo/migration/foxml/FoxmlInputStreamFedoraObjectProcessor.java index f427956e..f84d5bd4 100644 --- a/src/main/java/org/fcrepo/migration/foxml/FoxmlInputStreamFedoraObjectProcessor.java +++ b/src/main/java/org/fcrepo/migration/foxml/FoxmlInputStreamFedoraObjectProcessor.java @@ -476,7 +476,6 @@ private void validateInlineXml() { if (isInlineXml && contentDigest != null && StringUtils.isNotBlank(contentDigest.getDigest())) { if (StringUtils.equals(contentDigest.getType(), "DISABLED")) { - LOG.info("Datastream Digest DISABLED. Skipping digest validation"); throw new RuntimeException("DISABLED digest. Skipping digest validation"); } From 99d22f4672fb341eab41945ca12336f9bddf29c3 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Tue, 29 Nov 2022 11:45:01 +0000 Subject: [PATCH 08/22] git wasn't adding an empty dir. used .gitkeep and now the test should parse tge datastream dir --- src/test/resources/inline-disabled-akubra/datastreams/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/test/resources/inline-disabled-akubra/datastreams/.gitkeep diff --git a/src/test/resources/inline-disabled-akubra/datastreams/.gitkeep b/src/test/resources/inline-disabled-akubra/datastreams/.gitkeep new file mode 100644 index 00000000..e69de29b From d7066acb8fceb7231a397d6f515a4a52dba73fc3 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Tue, 29 Nov 2022 11:52:43 +0000 Subject: [PATCH 09/22] .gitkeep broke the indexer. copying a datastream from another test --- .../datastreams/.gitkeep | 0 ...en-access-UW-Madison-all%2FXACML%2FXACML.0 | 30 +++++++++++++++++++ 2 files changed, 30 insertions(+) delete mode 100644 src/test/resources/inline-disabled-akubra/datastreams/.gitkeep create mode 100644 src/test/resources/inline-disabled-akubra/datastreams/dlmap/e/9e/b4/info%3Afedora%2F1711.dl%3AAccess-policy-open-access-UW-Madison-all%2FXACML%2FXACML.0 diff --git a/src/test/resources/inline-disabled-akubra/datastreams/.gitkeep b/src/test/resources/inline-disabled-akubra/datastreams/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/src/test/resources/inline-disabled-akubra/datastreams/dlmap/e/9e/b4/info%3Afedora%2F1711.dl%3AAccess-policy-open-access-UW-Madison-all%2FXACML%2FXACML.0 b/src/test/resources/inline-disabled-akubra/datastreams/dlmap/e/9e/b4/info%3Afedora%2F1711.dl%3AAccess-policy-open-access-UW-Madison-all%2FXACML%2FXACML.0 new file mode 100644 index 00000000..49e89aee --- /dev/null +++ b/src/test/resources/inline-disabled-akubra/datastreams/dlmap/e/9e/b4/info%3Afedora%2F1711.dl%3AAccess-policy-open-access-UW-Madison-all%2FXACML%2FXACML.0 @@ -0,0 +1,30 @@ + + + + Open Access: any user can view, listen to, and/or download any representation of the object, + as long as they're associated with or present at UW-Madison. + + + + + + + + + + http://digital.library.wisc.edu/1711.dl/vocabulary/access/population#uwmadison + + + + + From 888afb2b111ab2b5fd2a20ce949a8c97f2c8e167 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Thu, 12 Jan 2023 16:52:08 +0000 Subject: [PATCH 10/22] reverting to logging rather than throwing exception --- .../foxml/FoxmlInputStreamFedoraObjectProcessor.java | 3 ++- .../java/org/fcrepo/migration/DisabledDigestIT.java | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/fcrepo/migration/foxml/FoxmlInputStreamFedoraObjectProcessor.java b/src/main/java/org/fcrepo/migration/foxml/FoxmlInputStreamFedoraObjectProcessor.java index f84d5bd4..5137e7a7 100644 --- a/src/main/java/org/fcrepo/migration/foxml/FoxmlInputStreamFedoraObjectProcessor.java +++ b/src/main/java/org/fcrepo/migration/foxml/FoxmlInputStreamFedoraObjectProcessor.java @@ -476,7 +476,8 @@ private void validateInlineXml() { if (isInlineXml && contentDigest != null && StringUtils.isNotBlank(contentDigest.getDigest())) { if (StringUtils.equals(contentDigest.getType(), "DISABLED")) { - throw new RuntimeException("DISABLED digest. Skipping digest validation"); + LOG.warn("Datastream Digest DISABLED. Skipping digest validation"); + return; } final var transformedXml = transformInlineXmlForChecksum(); diff --git a/src/test/java/org/fcrepo/migration/DisabledDigestIT.java b/src/test/java/org/fcrepo/migration/DisabledDigestIT.java index a6f149f1..92cfdd18 100644 --- a/src/test/java/org/fcrepo/migration/DisabledDigestIT.java +++ b/src/test/java/org/fcrepo/migration/DisabledDigestIT.java @@ -63,11 +63,11 @@ private void setup(final String name) throws Exception { @Test public void testMigrateObjectWithExternalDatastreamAndDisabledDigest() throws Exception { setup("inline-disabled-it"); - try { - migrator.run(); - } catch (RuntimeException e) { - assertTrue(e.getMessage().contains("DISABLED digest. Skipping digest validation")); - } + migrator.run(); + final var migratedAuditPath = "target/test/ocfl/inline-disabled-it/storage/8f8/e55/54c/" + + "8f8e5554c836c316e17cdaf961657eb6ed6e56c7747304627fdc178b7e15ed75/v1/content/AUDIT"; + final var migratedAudit = Paths.get(migratedAuditPath); + assertTrue(Files.exists(migratedAudit)); } } From 8cd2a061beaf642091aefea71177370136ce161d Mon Sep 17 00:00:00 2001 From: Dan Field Date: Thu, 19 Jan 2023 14:57:47 +0000 Subject: [PATCH 11/22] improved DISABLED fixity Integration Test to use fcrepo-storage-ocfl session object --- src/test/java/org/fcrepo/migration/DisabledDigestIT.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/test/java/org/fcrepo/migration/DisabledDigestIT.java b/src/test/java/org/fcrepo/migration/DisabledDigestIT.java index 92cfdd18..3033ee78 100644 --- a/src/test/java/org/fcrepo/migration/DisabledDigestIT.java +++ b/src/test/java/org/fcrepo/migration/DisabledDigestIT.java @@ -21,6 +21,7 @@ import org.junit.Test; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; +import org.fcrepo.storage.ocfl.OcflObjectSessionFactory; import java.nio.file.Files; import java.nio.file.Paths; @@ -34,6 +35,7 @@ public class DisabledDigestIT { private ConfigurableApplicationContext context; private Migrator migrator; + private OcflObjectSessionFactory sessionFactory; @After public void tearDown() { @@ -58,16 +60,15 @@ private void setup(final String name) throws Exception { context = new ClassPathXmlApplicationContext(String.format("spring/%s-setup.xml", name)); migrator = (Migrator) context.getBean("migrator"); + sessionFactory = (OcflObjectSessionFactory) context.getBean("ocflSessionFactory"); } @Test public void testMigrateObjectWithExternalDatastreamAndDisabledDigest() throws Exception { setup("inline-disabled-it"); migrator.run(); - final var migratedAuditPath = "target/test/ocfl/inline-disabled-it/storage/8f8/e55/54c/" + - "8f8e5554c836c316e17cdaf961657eb6ed6e56c7747304627fdc178b7e15ed75/v1/content/AUDIT"; - final var migratedAudit = Paths.get(migratedAuditPath); - assertTrue(Files.exists(migratedAudit)); + final var session = sessionFactory.newSession("info:fedora/llgc-id:1591190"); + assertTrue(session.containsResource("info:fedora/llgc-id:1591190/AUDIT")); } } From 5b3651c4a7cd6bc6baef1f15ac0e533831076b6c Mon Sep 17 00:00:00 2001 From: Jared Whiklo Date: Thu, 13 Oct 2022 01:10:41 -0500 Subject: [PATCH 12/22] Switch from assembly to shade plugin to correct Jena re-packaging (#189) Resolves: https://fedora-repository.atlassian.net/browse/FCREPO-3836 --- conf/fedora3.xml | 167 ---------------------------------------- pom.xml | 52 ++++++------- src/assembly/driver.xml | 24 ------ src/assembly/zip.xml | 47 ----------- 4 files changed, 26 insertions(+), 264 deletions(-) delete mode 100644 conf/fedora3.xml delete mode 100644 src/assembly/driver.xml delete mode 100644 src/assembly/zip.xml diff --git a/conf/fedora3.xml b/conf/fedora3.xml deleted file mode 100644 index fb0a261a..00000000 --- a/conf/fedora3.xml +++ /dev/null @@ -1,167 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pom.xml b/pom.xml index 949ffefd..34f98ee2 100644 --- a/pom.xml +++ b/pom.xml @@ -16,6 +16,7 @@ migration-utils UTF-8 + org.fcrepo.migration.PicocliMigrator 5.2.22.RELEASE 6.3.0-SNAPSHOT 7.1.0 @@ -349,42 +350,41 @@ - maven-assembly-plugin - 3.3.0 + org.apache.maven.plugins + maven-shade-plugin + 3.2.4 - create-runnable-jar + create-shaded-jar package - single + shade - - src/assembly/driver.xml - - - - org.fcrepo.migration.PicocliMigrator - - - - - - create-distribution - package - - single - - - migration-utils - - src/assembly/zip.xml - + true + ${project.artifactId}-${project.version}-driver + + + + + ${project.main.class} + + + + + + *:* + + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + + + - diff --git a/src/assembly/driver.xml b/src/assembly/driver.xml deleted file mode 100644 index cce71c69..00000000 --- a/src/assembly/driver.xml +++ /dev/null @@ -1,24 +0,0 @@ - - driver - false - - jar - - - - - src/main/resources - - *.properties - - - - - - - true - - - - - diff --git a/src/assembly/zip.xml b/src/assembly/zip.xml deleted file mode 100644 index f1902fab..00000000 --- a/src/assembly/zip.xml +++ /dev/null @@ -1,47 +0,0 @@ - - zip - - zip - - - - ${project.basedir}/conf - conf - - - ${project.basedir}/src/main/resources - conf - - namespaces.properties - custom-mapping.properties - - - - ${project.build.directory} - - - *-driver.jar - - - - ${project.basedir} - - - README.md - - - - ${project.basedir}/src/test/resources/exported - src/test/resources/exported - - - ${project.basedir}/src/test/resources/akubraFS - src/test/resources/akubraFS - - - ${project.basedir}/src/test/resources/legacyFS - src/test/resources/legacyFS - - - - From 6c4f3739b9a2932757db954dd498382431431543 Mon Sep 17 00:00:00 2001 From: Jared Whiklo Date: Mon, 14 Nov 2022 17:29:14 -0600 Subject: [PATCH 13/22] Alter test assertion to allow for ocfl 1.0 and 1.1 (#192) Resolves: https://fedora-repository.atlassian.net/browse/FCREPO-3863 --- .../java/org/fcrepo/migration/PicocliIT.java | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/test/java/org/fcrepo/migration/PicocliIT.java b/src/test/java/org/fcrepo/migration/PicocliIT.java index f09b247f..d1a0abae 100644 --- a/src/test/java/org/fcrepo/migration/PicocliIT.java +++ b/src/test/java/org/fcrepo/migration/PicocliIT.java @@ -64,6 +64,11 @@ public void tearDown() throws IOException { } } + private boolean checkDirForNamaste(final Path targetDir) throws IOException { + return Files.list(targetDir).map(Path::getFileName).map(Path::toString) + .anyMatch(e -> e.startsWith("0=ocfl_1.")); + } + @Test public void testPlainOcfl() throws Exception { final String[] args = {"--target-dir", targetDir.toString(), "--working-dir", workingDir.toString(), @@ -74,7 +79,7 @@ public void testPlainOcfl() throws Exception { final CommandLine cmd = new CommandLine(migrator); cmd.execute(args); - assertTrue(Files.list(targetDir).anyMatch(element -> element.endsWith("0=ocfl_1.0"))); + assertTrue(checkDirForNamaste(targetDir)); final Path baseDir = targetDir.resolve("5b5").resolve("62d").resolve("d69") .resolve("5b562dd698f17e3198e007e6f77f9e48f20a556c6bae84e6fc8d98544831daa6"); final File inventory = baseDir.resolve("inventory.json").toFile(); @@ -95,7 +100,7 @@ public void testPlainOcflEmptyIdPrefix() throws Exception { final int result = cmd.execute(args); assertEquals(0, result); - assertTrue(Files.list(targetDir).anyMatch(element -> element.endsWith("0=ocfl_1.0"))); + assertTrue(checkDirForNamaste(targetDir)); final Path baseDir = targetDir.resolve("750").resolve("677").resolve("e9b") .resolve("750677e9b953845ba5069d27a3775fbced186987fd0f4a8c968ac457a7d415a8"); final File inventory = baseDir.resolve("inventory.json").toFile(); @@ -129,7 +134,7 @@ public void testPlainOcflNoWorkingDirOption() throws Exception { cmd.execute(args); final Path workingDir = Path.of(System.getProperty("user.dir")); - assertTrue(Files.list(targetDir).anyMatch(element -> element.endsWith("0=ocfl_1.0"))); + assertTrue(checkDirForNamaste(targetDir)); assertTrue(Files.list(workingDir).anyMatch(element -> element.endsWith("index"))); assertTrue(Files.list(workingDir).anyMatch(element -> element.endsWith("pid"))); } @@ -144,8 +149,7 @@ public void testFedoraOcfl() throws Exception { final CommandLine cmd = new CommandLine(migrator); cmd.execute(args); - assertTrue(Files.list(targetDir.resolve("data").resolve("ocfl-root")) - .anyMatch(element -> element.endsWith("0=ocfl_1.0"))); + assertTrue(checkDirForNamaste(targetDir.resolve("data").resolve("ocfl-root"))); assertTrue(Files.list(workingDir).anyMatch(element -> element.endsWith("index"))); assertTrue(Files.list(workingDir).anyMatch(element -> element.endsWith("pid"))); } @@ -158,7 +162,7 @@ public void testExistingRepoDifferentStorageLayout() throws Exception { .storage(OcflStorageBuilder.builder().fileSystem(targetDir).build()) .workDir(tmpDir) .build(); - assertTrue(Files.list(targetDir).anyMatch(element -> element.endsWith("0=ocfl_1.0"))); + assertTrue(checkDirForNamaste(targetDir)); //migrate object into it final Path workingDir = tmpDir.resolve("working"); @@ -212,8 +216,8 @@ public void testMigrateFoxmlFileInsteadOfPropertyFiles() throws Exception { //now check for a FOXML, which should show up in a previous version final var versions = ocflRepo.describeObject("example:1").getVersionMap().values(); boolean foundFoxml = false; - for (VersionDetails v : versions) { - for (FileDetails f : v.getFiles()) { + for (final VersionDetails v : versions) { + for (final FileDetails f : v.getFiles()) { if (f.getPath().equals("FOXML")) { foundFoxml = true; break; @@ -266,7 +270,7 @@ public void testSha256DigestAlgorithm() throws Exception { final int result = cmd.execute(args); assertEquals(0, result); - assertTrue(Files.list(targetDir).anyMatch(element -> element.endsWith("0=ocfl_1.0"))); + assertTrue(checkDirForNamaste(targetDir)); final Path baseDir = targetDir.resolve("5b5").resolve("62d").resolve("d69") .resolve("5b562dd698f17e3198e007e6f77f9e48f20a556c6bae84e6fc8d98544831daa6"); final File inventory = baseDir.resolve("inventory.json").toFile(); From f1583e95ebdc6b8583f99fe4bf23ac045d10a602 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 16 Nov 2022 09:12:00 -0800 Subject: [PATCH 14/22] Bump woodstox-core from 6.2.3 to 6.4.0 (#191) Bumps [woodstox-core](https://github.com/FasterXML/woodstox) from 6.2.3 to 6.4.0. - [Release notes](https://github.com/FasterXML/woodstox/releases) - [Commits](https://github.com/FasterXML/woodstox/compare/woodstox-core-6.2.3...woodstox-core-6.4.0) --- updated-dependencies: - dependency-name: com.fasterxml.woodstox:woodstox-core dependency-type: direct:production ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 34f98ee2..f6e36270 100644 --- a/pom.xml +++ b/pom.xml @@ -32,7 +32,7 @@ 2.3.1 2.3.0.1 2.3.1 - 6.2.3 + 6.4.0 2.12.2 s01.oss.sonatype.org From d391ed41a483a9b8b3fcee5b8755ef9f125111ec Mon Sep 17 00:00:00 2001 From: Daniel Bernstein Date: Wed, 16 Nov 2022 14:41:37 -0800 Subject: [PATCH 15/22] Increment version to 6.3.1-SNAPSHOT --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index f6e36270..0fae88ad 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ org.fcrepo.migration migration-utils - 6.3.0-SNAPSHOT + 6.3.1-SNAPSHOT jar migration-utils From 0753f0bbc682a3565b3435f16c4f1572dc5e0af0 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Tue, 29 Nov 2022 10:17:11 +0000 Subject: [PATCH 16/22] fixing issues with the disabled integration test --- .../foxml/FoxmlInputStreamFedoraObjectProcessor.java | 3 +++ src/test/resources/spring/inline-disabled-it-setup.xml | 8 ++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/fcrepo/migration/foxml/FoxmlInputStreamFedoraObjectProcessor.java b/src/main/java/org/fcrepo/migration/foxml/FoxmlInputStreamFedoraObjectProcessor.java index d715d918..f427956e 100644 --- a/src/main/java/org/fcrepo/migration/foxml/FoxmlInputStreamFedoraObjectProcessor.java +++ b/src/main/java/org/fcrepo/migration/foxml/FoxmlInputStreamFedoraObjectProcessor.java @@ -197,6 +197,8 @@ public void processObject(final StreamingFedoraObjectHandler handler) { v.validateInlineXml(); } catch (RuntimeException e) { // do we need to do anyting with disabled digests? + LOG.error("Inline Validation failed", e); + throw new RuntimeException(e); } handler.processDatastreamVersion(v); } else { @@ -472,6 +474,7 @@ private String extractInlineXml() throws XMLStreamException { private void validateInlineXml() { if (isInlineXml && contentDigest != null && StringUtils.isNotBlank(contentDigest.getDigest())) { + if (StringUtils.equals(contentDigest.getType(), "DISABLED")) { LOG.info("Datastream Digest DISABLED. Skipping digest validation"); throw new RuntimeException("DISABLED digest. Skipping digest validation"); diff --git a/src/test/resources/spring/inline-disabled-it-setup.xml b/src/test/resources/spring/inline-disabled-it-setup.xml index c1324249..182975b4 100644 --- a/src/test/resources/spring/inline-disabled-it-setup.xml +++ b/src/test/resources/spring/inline-disabled-it-setup.xml @@ -17,15 +17,11 @@ - + - - - + From db3fbd9a5ef419b128ecfa806022e913f7a5410c Mon Sep 17 00:00:00 2001 From: Dan Field Date: Tue, 29 Nov 2022 10:21:17 +0000 Subject: [PATCH 17/22] removing superflous log message as we throw an exception now --- .../migration/foxml/FoxmlInputStreamFedoraObjectProcessor.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/org/fcrepo/migration/foxml/FoxmlInputStreamFedoraObjectProcessor.java b/src/main/java/org/fcrepo/migration/foxml/FoxmlInputStreamFedoraObjectProcessor.java index f427956e..f84d5bd4 100644 --- a/src/main/java/org/fcrepo/migration/foxml/FoxmlInputStreamFedoraObjectProcessor.java +++ b/src/main/java/org/fcrepo/migration/foxml/FoxmlInputStreamFedoraObjectProcessor.java @@ -476,7 +476,6 @@ private void validateInlineXml() { if (isInlineXml && contentDigest != null && StringUtils.isNotBlank(contentDigest.getDigest())) { if (StringUtils.equals(contentDigest.getType(), "DISABLED")) { - LOG.info("Datastream Digest DISABLED. Skipping digest validation"); throw new RuntimeException("DISABLED digest. Skipping digest validation"); } From af793ece8600b87197f1ea3943243945ad6ef255 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Tue, 29 Nov 2022 11:45:01 +0000 Subject: [PATCH 18/22] git wasn't adding an empty dir. used .gitkeep and now the test should parse tge datastream dir --- src/test/resources/inline-disabled-akubra/datastreams/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/test/resources/inline-disabled-akubra/datastreams/.gitkeep diff --git a/src/test/resources/inline-disabled-akubra/datastreams/.gitkeep b/src/test/resources/inline-disabled-akubra/datastreams/.gitkeep new file mode 100644 index 00000000..e69de29b From 8f7ddfdd75a8a74503f447140cfba4523cc91771 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Tue, 29 Nov 2022 11:52:43 +0000 Subject: [PATCH 19/22] .gitkeep broke the indexer. copying a datastream from another test --- .../datastreams/.gitkeep | 0 ...en-access-UW-Madison-all%2FXACML%2FXACML.0 | 30 +++++++++++++++++++ 2 files changed, 30 insertions(+) delete mode 100644 src/test/resources/inline-disabled-akubra/datastreams/.gitkeep create mode 100644 src/test/resources/inline-disabled-akubra/datastreams/dlmap/e/9e/b4/info%3Afedora%2F1711.dl%3AAccess-policy-open-access-UW-Madison-all%2FXACML%2FXACML.0 diff --git a/src/test/resources/inline-disabled-akubra/datastreams/.gitkeep b/src/test/resources/inline-disabled-akubra/datastreams/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/src/test/resources/inline-disabled-akubra/datastreams/dlmap/e/9e/b4/info%3Afedora%2F1711.dl%3AAccess-policy-open-access-UW-Madison-all%2FXACML%2FXACML.0 b/src/test/resources/inline-disabled-akubra/datastreams/dlmap/e/9e/b4/info%3Afedora%2F1711.dl%3AAccess-policy-open-access-UW-Madison-all%2FXACML%2FXACML.0 new file mode 100644 index 00000000..49e89aee --- /dev/null +++ b/src/test/resources/inline-disabled-akubra/datastreams/dlmap/e/9e/b4/info%3Afedora%2F1711.dl%3AAccess-policy-open-access-UW-Madison-all%2FXACML%2FXACML.0 @@ -0,0 +1,30 @@ + + + + Open Access: any user can view, listen to, and/or download any representation of the object, + as long as they're associated with or present at UW-Madison. + + + + + + + + + + http://digital.library.wisc.edu/1711.dl/vocabulary/access/population#uwmadison + + + + + From e28c397e769296867c615c5bd4e9f75da98e283a Mon Sep 17 00:00:00 2001 From: Dan Field Date: Thu, 12 Jan 2023 16:52:08 +0000 Subject: [PATCH 20/22] reverting to logging rather than throwing exception --- .../foxml/FoxmlInputStreamFedoraObjectProcessor.java | 3 ++- .../java/org/fcrepo/migration/DisabledDigestIT.java | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/fcrepo/migration/foxml/FoxmlInputStreamFedoraObjectProcessor.java b/src/main/java/org/fcrepo/migration/foxml/FoxmlInputStreamFedoraObjectProcessor.java index f84d5bd4..5137e7a7 100644 --- a/src/main/java/org/fcrepo/migration/foxml/FoxmlInputStreamFedoraObjectProcessor.java +++ b/src/main/java/org/fcrepo/migration/foxml/FoxmlInputStreamFedoraObjectProcessor.java @@ -476,7 +476,8 @@ private void validateInlineXml() { if (isInlineXml && contentDigest != null && StringUtils.isNotBlank(contentDigest.getDigest())) { if (StringUtils.equals(contentDigest.getType(), "DISABLED")) { - throw new RuntimeException("DISABLED digest. Skipping digest validation"); + LOG.warn("Datastream Digest DISABLED. Skipping digest validation"); + return; } final var transformedXml = transformInlineXmlForChecksum(); diff --git a/src/test/java/org/fcrepo/migration/DisabledDigestIT.java b/src/test/java/org/fcrepo/migration/DisabledDigestIT.java index a6f149f1..92cfdd18 100644 --- a/src/test/java/org/fcrepo/migration/DisabledDigestIT.java +++ b/src/test/java/org/fcrepo/migration/DisabledDigestIT.java @@ -63,11 +63,11 @@ private void setup(final String name) throws Exception { @Test public void testMigrateObjectWithExternalDatastreamAndDisabledDigest() throws Exception { setup("inline-disabled-it"); - try { - migrator.run(); - } catch (RuntimeException e) { - assertTrue(e.getMessage().contains("DISABLED digest. Skipping digest validation")); - } + migrator.run(); + final var migratedAuditPath = "target/test/ocfl/inline-disabled-it/storage/8f8/e55/54c/" + + "8f8e5554c836c316e17cdaf961657eb6ed6e56c7747304627fdc178b7e15ed75/v1/content/AUDIT"; + final var migratedAudit = Paths.get(migratedAuditPath); + assertTrue(Files.exists(migratedAudit)); } } From 1065504d583bb7d4a53b1841ebc9e074fa13f597 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Thu, 19 Jan 2023 14:57:47 +0000 Subject: [PATCH 21/22] improved DISABLED fixity Integration Test to use fcrepo-storage-ocfl session object --- src/test/java/org/fcrepo/migration/DisabledDigestIT.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/test/java/org/fcrepo/migration/DisabledDigestIT.java b/src/test/java/org/fcrepo/migration/DisabledDigestIT.java index 92cfdd18..3033ee78 100644 --- a/src/test/java/org/fcrepo/migration/DisabledDigestIT.java +++ b/src/test/java/org/fcrepo/migration/DisabledDigestIT.java @@ -21,6 +21,7 @@ import org.junit.Test; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; +import org.fcrepo.storage.ocfl.OcflObjectSessionFactory; import java.nio.file.Files; import java.nio.file.Paths; @@ -34,6 +35,7 @@ public class DisabledDigestIT { private ConfigurableApplicationContext context; private Migrator migrator; + private OcflObjectSessionFactory sessionFactory; @After public void tearDown() { @@ -58,16 +60,15 @@ private void setup(final String name) throws Exception { context = new ClassPathXmlApplicationContext(String.format("spring/%s-setup.xml", name)); migrator = (Migrator) context.getBean("migrator"); + sessionFactory = (OcflObjectSessionFactory) context.getBean("ocflSessionFactory"); } @Test public void testMigrateObjectWithExternalDatastreamAndDisabledDigest() throws Exception { setup("inline-disabled-it"); migrator.run(); - final var migratedAuditPath = "target/test/ocfl/inline-disabled-it/storage/8f8/e55/54c/" + - "8f8e5554c836c316e17cdaf961657eb6ed6e56c7747304627fdc178b7e15ed75/v1/content/AUDIT"; - final var migratedAudit = Paths.get(migratedAuditPath); - assertTrue(Files.exists(migratedAudit)); + final var session = sessionFactory.newSession("info:fedora/llgc-id:1591190"); + assertTrue(session.containsResource("info:fedora/llgc-id:1591190/AUDIT")); } } From 0009f78eda48eb6a715f7c2d43e20a1e151eb9d9 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Thu, 16 Feb 2023 14:50:07 +0000 Subject: [PATCH 22/22] fixed test to look for a DISABLED digest --- src/test/java/org/fcrepo/migration/DisabledDigestIT.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/org/fcrepo/migration/DisabledDigestIT.java b/src/test/java/org/fcrepo/migration/DisabledDigestIT.java index 3033ee78..d231337f 100644 --- a/src/test/java/org/fcrepo/migration/DisabledDigestIT.java +++ b/src/test/java/org/fcrepo/migration/DisabledDigestIT.java @@ -68,7 +68,7 @@ public void testMigrateObjectWithExternalDatastreamAndDisabledDigest() throws Ex setup("inline-disabled-it"); migrator.run(); final var session = sessionFactory.newSession("info:fedora/llgc-id:1591190"); - assertTrue(session.containsResource("info:fedora/llgc-id:1591190/AUDIT")); + assertTrue(session.containsResource("info:fedora/llgc-id:1591190/POLICY")); } }