From 108e000461d9535de90d83e562b605f5fbd60be8 Mon Sep 17 00:00:00 2001 From: krwong Date: Thu, 9 May 2024 13:17:07 -0400 Subject: [PATCH 1/7] add streaming metadata to file object SIPS --- .../cdm/services/sips/WorkGenerator.java | 16 ++++++++ .../cdm/services/SipServiceTest.java | 37 +++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/src/main/java/edu/unc/lib/boxc/migration/cdm/services/sips/WorkGenerator.java b/src/main/java/edu/unc/lib/boxc/migration/cdm/services/sips/WorkGenerator.java index a85b357c..7dc99c67 100644 --- a/src/main/java/edu/unc/lib/boxc/migration/cdm/services/sips/WorkGenerator.java +++ b/src/main/java/edu/unc/lib/boxc/migration/cdm/services/sips/WorkGenerator.java @@ -12,6 +12,7 @@ import edu.unc.lib.boxc.migration.cdm.services.PostMigrationReportService; import edu.unc.lib.boxc.migration.cdm.services.RedirectMappingService; import edu.unc.lib.boxc.migration.cdm.services.SipService; +import edu.unc.lib.boxc.migration.cdm.services.StreamingMetadataService; import edu.unc.lib.boxc.model.api.DatastreamType; import edu.unc.lib.boxc.model.api.ids.PID; import edu.unc.lib.boxc.model.api.ids.PIDMinter; @@ -58,6 +59,7 @@ public class WorkGenerator { protected AccessFileService accessFileService; protected PostMigrationReportService postMigrationReportService; protected PermissionsInfo permissionsInfo; + protected StreamingMetadataService streamingMetadataService; protected String cdmId; protected String cdmCreated; @@ -175,6 +177,9 @@ protected PID addFileObject(String cdmId, String cdmFileCreated, SourceFilesInfo // Add permission to source file addFilePermission(cdmId, fileObjResc); + // Add streamingUrl + addStreamingMetadata(cdmId, fileObjResc); + // Link access file if (accessFilesInfo != null) { SourceFilesInfo.SourceFileMapping accessMapping = accessFilesInfo.getMappingByCdmId(cdmId); @@ -229,4 +234,15 @@ protected void addPermission(String cdmId, Resource resource) { } } } + + protected void addStreamingMetadata(String cdmId, Resource resource) { + if (streamingMetadataService.verifyRecordHasStreamingMetadata(cdmId)) { + String[] streamingMetadata = streamingMetadataService.getStreamingMetadata(cdmId); + String duracloudSpace = streamingMetadata[1]; + String streamingFile = streamingMetadata[0]; + String streamingUrlValue = "https://durastream.lib.unc.edu/player?spaceId=" + duracloudSpace + + "&filename=" + streamingFile; + resource.addProperty(Cdr.streamingUrl, streamingUrlValue); + } + } } diff --git a/src/test/java/edu/unc/lib/boxc/migration/cdm/services/SipServiceTest.java b/src/test/java/edu/unc/lib/boxc/migration/cdm/services/SipServiceTest.java index 0b4bdcd7..038bedc8 100644 --- a/src/test/java/edu/unc/lib/boxc/migration/cdm/services/SipServiceTest.java +++ b/src/test/java/edu/unc/lib/boxc/migration/cdm/services/SipServiceTest.java @@ -1374,6 +1374,43 @@ public void generateSipsGroupedWorkWorkPermissions() throws Exception { assertPersistedSipInfoMatches(sip); } + @Test + public void generateSipsWithStreamingUrl() throws Exception { + testHelper.indexExportData("mini_gilmer"); + testHelper.generateDefaultDestinationsMapping(DEST_UUID, null); + testHelper.populateDescriptions("gilmer_mods1.xml"); + List stagingLocs = testHelper.populateSourceFiles("276_182_E.tif", "276_183_E.tif", "276_203_E.tif"); + + List sips = service.generateSips(makeOptions()); + assertEquals(1, sips.size()); + MigrationSip sip = sips.get(0); + + assertTrue(Files.exists(sip.getSipPath())); + + DepositDirectoryManager dirManager = testHelper.createDepositDirectoryManager(sip); + + Model model = testHelper.getSipModel(sip); + + Bag depBag = model.getBag(sip.getDepositPid().getRepositoryPath()); + List depBagChildren = depBag.iterator().toList(); + assertEquals(3, depBagChildren.size()); + + Resource workResc1 = testHelper.getResourceByCreateTime(depBagChildren, "2005-11-23"); + testHelper.assertObjectPopulatedInSip(workResc1, dirManager, model, stagingLocs.get(0), null, "25"); + assertFalse(workResc1.hasProperty(Cdr.streamingUrl, "https://durastream.lib.unc.edu/player?" + + "spaceId=open-hls&filename=gilmer_recording-playlist.m3u8")); + Resource workResc2 = testHelper.getResourceByCreateTime(depBagChildren, "2005-11-24"); + testHelper.assertObjectPopulatedInSip(workResc2, dirManager, model, stagingLocs.get(1), null, "26"); + assertFalse(workResc2.hasProperty(Cdr.streamingUrl, "https://durastream.lib.unc.edu/player?" + + "spaceId=open-hls&filename=gilmer_recording-playlist.m3u8")); + Resource workResc3 = testHelper.getResourceByCreateTime(depBagChildren, "2005-12-08"); + testHelper.assertObjectPopulatedInSip(workResc3, dirManager, model, stagingLocs.get(2), null, "27"); + assertTrue(workResc3.hasProperty(Cdr.streamingUrl, "https://durastream.lib.unc.edu/player?" + + "spaceId=open-hls&filename=gilmer_recording-playlist.m3u8")); + + assertPersistedSipInfoMatches(sip); + } + private void solrResponseWithPid() throws Exception { QueryResponse testResponse1 = new QueryResponse(); SolrDocument testDocument1 = new SolrDocument(); From c1c385b3f62d2fafb68e42fbadb7e4c8bca6e93a Mon Sep 17 00:00:00 2001 From: krwong Date: Thu, 9 May 2024 14:15:44 -0400 Subject: [PATCH 2/7] add local streamingUrl property and setters --- .../unc/lib/boxc/migration/cdm/services/SipService.java | 6 ++++++ .../boxc/migration/cdm/services/sips/WorkGenerator.java | 6 +++++- .../migration/cdm/services/sips/WorkGeneratorFactory.java | 7 +++++++ .../lib/boxc/migration/cdm/services/SipServiceTest.java | 7 ++++--- .../unc/lib/boxc/migration/cdm/test/SipServiceHelper.java | 7 +++++++ 5 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/main/java/edu/unc/lib/boxc/migration/cdm/services/SipService.java b/src/main/java/edu/unc/lib/boxc/migration/cdm/services/SipService.java index 365eb2c4..c2e32583 100644 --- a/src/main/java/edu/unc/lib/boxc/migration/cdm/services/SipService.java +++ b/src/main/java/edu/unc/lib/boxc/migration/cdm/services/SipService.java @@ -72,6 +72,7 @@ public class SipService { private MigrationProject project; private ChompbConfigService.ChompbConfig chompbConfig; private PermissionsService permissionsService; + private StreamingMetadataService streamingMetadataService; private PIDMinter pidMinter; private CdmToDestMapper cdmToDestMapper = new CdmToDestMapper(); private WorkGeneratorFactory workGeneratorFactory; @@ -104,6 +105,7 @@ private void initDependencies(SipGenerationOptions options, Connection conn) thr workGeneratorFactory.setPostMigrationReportService(postMigrationReportService); workGeneratorFactory.setAggregateTopMappingService(aggregateTopMappingService); workGeneratorFactory.setAggregateBottomMappingService(aggregateBottomMappingService); + workGeneratorFactory.setStreamingMetadataService(streamingMetadataService); try { workGeneratorFactory.setPermissionsInfo(permissionsService.loadMappings(project)); } catch (NoSuchFileException e) { @@ -378,6 +380,10 @@ public void setPermissionsService(PermissionsService permissionsService) { this.permissionsService = permissionsService; } + public void setStreamingMetadataService(StreamingMetadataService streamingMetadataService) { + this.streamingMetadataService = streamingMetadataService; + } + public void setPidMinter(PIDMinter pidMinter) { this.pidMinter = pidMinter; } diff --git a/src/main/java/edu/unc/lib/boxc/migration/cdm/services/sips/WorkGenerator.java b/src/main/java/edu/unc/lib/boxc/migration/cdm/services/sips/WorkGenerator.java index 7dc99c67..714b1061 100644 --- a/src/main/java/edu/unc/lib/boxc/migration/cdm/services/sips/WorkGenerator.java +++ b/src/main/java/edu/unc/lib/boxc/migration/cdm/services/sips/WorkGenerator.java @@ -37,6 +37,7 @@ import static edu.unc.lib.boxc.auth.api.AccessPrincipalConstants.PUBLIC_PRINC; import static edu.unc.lib.boxc.migration.cdm.util.CLIConstants.outputLogger; import static edu.unc.lib.boxc.model.api.DatastreamType.ORIGINAL_FILE; +import static org.apache.jena.rdf.model.ResourceFactory.createProperty; import static org.slf4j.LoggerFactory.getLogger; /** @@ -46,6 +47,9 @@ */ public class WorkGenerator { private static final Logger log = getLogger(WorkGenerator.class); + // use local streamingUrl property for now because Cdr.streamingUrl only exists in a feature branch + public static final Property streamingUrl = createProperty( + "http://cdr.unc.edu/definitions/model#streamingUrl"); protected PIDMinter pidMinter; protected RedirectMappingService redirectMappingService; protected SourceFilesInfo sourceFilesInfo; @@ -242,7 +246,7 @@ protected void addStreamingMetadata(String cdmId, Resource resource) { String streamingFile = streamingMetadata[0]; String streamingUrlValue = "https://durastream.lib.unc.edu/player?spaceId=" + duracloudSpace + "&filename=" + streamingFile; - resource.addProperty(Cdr.streamingUrl, streamingUrlValue); + resource.addProperty(streamingUrl, streamingUrlValue); } } } diff --git a/src/main/java/edu/unc/lib/boxc/migration/cdm/services/sips/WorkGeneratorFactory.java b/src/main/java/edu/unc/lib/boxc/migration/cdm/services/sips/WorkGeneratorFactory.java index bb9516c5..fc0e1fb0 100644 --- a/src/main/java/edu/unc/lib/boxc/migration/cdm/services/sips/WorkGeneratorFactory.java +++ b/src/main/java/edu/unc/lib/boxc/migration/cdm/services/sips/WorkGeneratorFactory.java @@ -9,6 +9,7 @@ import edu.unc.lib.boxc.migration.cdm.services.DescriptionsService; import edu.unc.lib.boxc.migration.cdm.services.PostMigrationReportService; import edu.unc.lib.boxc.migration.cdm.services.RedirectMappingService; +import edu.unc.lib.boxc.migration.cdm.services.StreamingMetadataService; import edu.unc.lib.boxc.model.api.ids.PIDMinter; import java.io.IOException; @@ -34,6 +35,7 @@ public class WorkGeneratorFactory { private AggregateFileMappingService aggregateBottomMappingService; private PIDMinter pidMinter; private PermissionsInfo permissionsInfo; + private StreamingMetadataService streamingMetadataService; public WorkGenerator create(String cdmId, String cdmCreated, String entryType) throws IOException { WorkGenerator gen; @@ -58,6 +60,7 @@ public WorkGenerator create(String cdmId, String cdmCreated, String entryType) t gen.redirectMappingService = redirectMappingService; gen.postMigrationReportService = postMigrationReportService; gen.permissionsInfo = permissionsInfo; + gen.streamingMetadataService = streamingMetadataService; return gen; } @@ -116,4 +119,8 @@ public void setAggregateBottomMappingService(AggregateFileMappingService aggrega public void setPermissionsInfo(PermissionsInfo permissionsInfo) { this.permissionsInfo = permissionsInfo; } + + public void setStreamingMetadataService(StreamingMetadataService streamingMetadataService) { + this.streamingMetadataService = streamingMetadataService; + } } diff --git a/src/test/java/edu/unc/lib/boxc/migration/cdm/services/SipServiceTest.java b/src/test/java/edu/unc/lib/boxc/migration/cdm/services/SipServiceTest.java index 038bedc8..62c00aaf 100644 --- a/src/test/java/edu/unc/lib/boxc/migration/cdm/services/SipServiceTest.java +++ b/src/test/java/edu/unc/lib/boxc/migration/cdm/services/SipServiceTest.java @@ -60,6 +60,7 @@ import static edu.unc.lib.boxc.auth.api.AccessPrincipalConstants.AUTHENTICATED_PRINC; import static edu.unc.lib.boxc.auth.api.AccessPrincipalConstants.PUBLIC_PRINC; +import static edu.unc.lib.boxc.migration.cdm.services.sips.WorkGenerator.streamingUrl; import static edu.unc.lib.boxc.migration.cdm.test.PostMigrationReportTestHelper.assertContainsRow; import static java.nio.file.StandardOpenOption.APPEND; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -1397,15 +1398,15 @@ public void generateSipsWithStreamingUrl() throws Exception { Resource workResc1 = testHelper.getResourceByCreateTime(depBagChildren, "2005-11-23"); testHelper.assertObjectPopulatedInSip(workResc1, dirManager, model, stagingLocs.get(0), null, "25"); - assertFalse(workResc1.hasProperty(Cdr.streamingUrl, "https://durastream.lib.unc.edu/player?" + + assertFalse(workResc1.hasProperty(streamingUrl, "https://durastream.lib.unc.edu/player?" + "spaceId=open-hls&filename=gilmer_recording-playlist.m3u8")); Resource workResc2 = testHelper.getResourceByCreateTime(depBagChildren, "2005-11-24"); testHelper.assertObjectPopulatedInSip(workResc2, dirManager, model, stagingLocs.get(1), null, "26"); - assertFalse(workResc2.hasProperty(Cdr.streamingUrl, "https://durastream.lib.unc.edu/player?" + + assertFalse(workResc2.hasProperty(streamingUrl, "https://durastream.lib.unc.edu/player?" + "spaceId=open-hls&filename=gilmer_recording-playlist.m3u8")); Resource workResc3 = testHelper.getResourceByCreateTime(depBagChildren, "2005-12-08"); testHelper.assertObjectPopulatedInSip(workResc3, dirManager, model, stagingLocs.get(2), null, "27"); - assertTrue(workResc3.hasProperty(Cdr.streamingUrl, "https://durastream.lib.unc.edu/player?" + + assertTrue(workResc3.hasProperty(streamingUrl, "https://durastream.lib.unc.edu/player?" + "spaceId=open-hls&filename=gilmer_recording-playlist.m3u8")); assertPersistedSipInfoMatches(sip); diff --git a/src/test/java/edu/unc/lib/boxc/migration/cdm/test/SipServiceHelper.java b/src/test/java/edu/unc/lib/boxc/migration/cdm/test/SipServiceHelper.java index 87aa663e..ec38a03a 100644 --- a/src/test/java/edu/unc/lib/boxc/migration/cdm/test/SipServiceHelper.java +++ b/src/test/java/edu/unc/lib/boxc/migration/cdm/test/SipServiceHelper.java @@ -28,6 +28,7 @@ import edu.unc.lib.boxc.migration.cdm.services.ChompbConfigService; import edu.unc.lib.boxc.migration.cdm.services.GroupMappingService; import edu.unc.lib.boxc.migration.cdm.services.PermissionsService; +import edu.unc.lib.boxc.migration.cdm.services.StreamingMetadataService; import org.apache.commons.io.FileUtils; import org.apache.jena.rdf.model.Bag; import org.apache.jena.rdf.model.Model; @@ -91,6 +92,7 @@ public class SipServiceHelper { private CdmIndexService indexService; private GroupMappingService groupMappingService; private PermissionsService permissionsService; + private StreamingMetadataService streamingMetadataService; private PIDMinter pidMinter; private PremisLoggerFactoryImpl premisLoggerFactory; private ChompbConfigService.ChompbConfig chompbConfig; @@ -125,6 +127,10 @@ public SipServiceHelper(MigrationProject project, Path filesBasePath) throws IOE archivalDestinationsService.setDestinationsService(destinationsService); permissionsService = new PermissionsService(); permissionsService.setProject(project); + streamingMetadataService = new StreamingMetadataService(); + streamingMetadataService.setProject(project); + streamingMetadataService.setFieldService(fieldService); + streamingMetadataService.setIndexService(indexService); Files.createDirectories(project.getExportPath()); } @@ -142,6 +148,7 @@ public SipService createSipsService() { service.setAggregateTopMappingService(getAggregateFileMappingService()); service.setAggregateBottomMappingService(getAggregateBottomMappingService()); service.setPermissionsService(permissionsService); + service.setStreamingMetadataService(streamingMetadataService); return service; } From cbe3712da89d7dd481ce616228490bf081fd4598 Mon Sep 17 00:00:00 2001 From: krwong Date: Thu, 9 May 2024 16:04:09 -0400 Subject: [PATCH 3/7] call addStreamingMetadat in generateWork --- .../lib/boxc/migration/cdm/services/sips/WorkGenerator.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/edu/unc/lib/boxc/migration/cdm/services/sips/WorkGenerator.java b/src/main/java/edu/unc/lib/boxc/migration/cdm/services/sips/WorkGenerator.java index 714b1061..40a944f8 100644 --- a/src/main/java/edu/unc/lib/boxc/migration/cdm/services/sips/WorkGenerator.java +++ b/src/main/java/edu/unc/lib/boxc/migration/cdm/services/sips/WorkGenerator.java @@ -101,6 +101,9 @@ protected void generateWork() throws IOException { // add permission to work addPermission(cdmId, workBag); + // Add streamingUrl + addStreamingMetadata(cdmId, workBag); + // Copy description to SIP copyDescriptionToSip(workPid, expDescPath); @@ -181,9 +184,6 @@ protected PID addFileObject(String cdmId, String cdmFileCreated, SourceFilesInfo // Add permission to source file addFilePermission(cdmId, fileObjResc); - // Add streamingUrl - addStreamingMetadata(cdmId, fileObjResc); - // Link access file if (accessFilesInfo != null) { SourceFilesInfo.SourceFileMapping accessMapping = accessFilesInfo.getMappingByCdmId(cdmId); From a642df7107ac887c9e3b4f5935d638918c545d4c Mon Sep 17 00:00:00 2001 From: krwong Date: Thu, 9 May 2024 16:50:34 -0400 Subject: [PATCH 4/7] fix addStreamingMetadata --- .../boxc/migration/cdm/services/sips/WorkGenerator.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/edu/unc/lib/boxc/migration/cdm/services/sips/WorkGenerator.java b/src/main/java/edu/unc/lib/boxc/migration/cdm/services/sips/WorkGenerator.java index 40a944f8..6e530749 100644 --- a/src/main/java/edu/unc/lib/boxc/migration/cdm/services/sips/WorkGenerator.java +++ b/src/main/java/edu/unc/lib/boxc/migration/cdm/services/sips/WorkGenerator.java @@ -4,6 +4,7 @@ import edu.unc.lib.boxc.deposit.impl.model.DepositModelHelpers; import edu.unc.lib.boxc.migration.cdm.exceptions.InvalidProjectStateException; import edu.unc.lib.boxc.migration.cdm.model.DestinationSipEntry; +import edu.unc.lib.boxc.migration.cdm.model.GroupMappingInfo; import edu.unc.lib.boxc.migration.cdm.model.PermissionsInfo; import edu.unc.lib.boxc.migration.cdm.model.SourceFilesInfo; import edu.unc.lib.boxc.migration.cdm.options.SipGenerationOptions; @@ -102,7 +103,9 @@ protected void generateWork() throws IOException { addPermission(cdmId, workBag); // Add streamingUrl - addStreamingMetadata(cdmId, workBag); + if (!cdmId.startsWith(GroupMappingInfo.GROUPED_WORK_PREFIX)) { + addStreamingMetadata(cdmId, workBag); + } // Copy description to SIP copyDescriptionToSip(workPid, expDescPath); @@ -184,6 +187,9 @@ protected PID addFileObject(String cdmId, String cdmFileCreated, SourceFilesInfo // Add permission to source file addFilePermission(cdmId, fileObjResc); + // Add streamingUrl + addStreamingMetadata(cdmId, fileObjResc); + // Link access file if (accessFilesInfo != null) { SourceFilesInfo.SourceFileMapping accessMapping = accessFilesInfo.getMappingByCdmId(cdmId); From 5caa81476fb0c43a1d4f156450a4c76bf674084c Mon Sep 17 00:00:00 2001 From: krwong Date: Thu, 9 May 2024 17:07:56 -0400 Subject: [PATCH 5/7] initialize streamingMetadataService --- .../edu/unc/lib/boxc/migration/cdm/SipsCommand.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/edu/unc/lib/boxc/migration/cdm/SipsCommand.java b/src/main/java/edu/unc/lib/boxc/migration/cdm/SipsCommand.java index a7e30191..d3ed1127 100644 --- a/src/main/java/edu/unc/lib/boxc/migration/cdm/SipsCommand.java +++ b/src/main/java/edu/unc/lib/boxc/migration/cdm/SipsCommand.java @@ -8,6 +8,8 @@ import java.util.List; import edu.unc.lib.boxc.migration.cdm.services.AggregateFileMappingService; +import edu.unc.lib.boxc.migration.cdm.services.CdmFieldService; +import edu.unc.lib.boxc.migration.cdm.services.StreamingMetadataService; import org.slf4j.Logger; import edu.unc.lib.boxc.migration.cdm.exceptions.MigrationException; @@ -46,6 +48,8 @@ public class SipsCommand { private CdmIndexService indexService; private AggregateFileMappingService aggregateTopMappingService; private AggregateFileMappingService aggregateBottomMappingService; + private CdmFieldService fieldService; + private StreamingMetadataService streamingMetadataService; private PIDMinter pidMinter; private PremisLoggerFactoryImpl premisLoggerFactory; private SipService sipService; @@ -135,6 +139,11 @@ private void initialize() throws IOException { aggregateBottomMappingService = new AggregateFileMappingService(true); aggregateBottomMappingService.setIndexService(indexService); aggregateBottomMappingService.setProject(project); + fieldService = new CdmFieldService(); + streamingMetadataService = new StreamingMetadataService(); + streamingMetadataService.setProject(project); + streamingMetadataService.setFieldService(fieldService); + streamingMetadataService.setIndexService(indexService); sipService = new SipService(); sipService.setIndexService(indexService); @@ -147,5 +156,6 @@ private void initialize() throws IOException { sipService.setChompbConfig(parentCommand.getChompbConfig()); sipService.setAggregateTopMappingService(aggregateTopMappingService); sipService.setAggregateBottomMappingService(aggregateBottomMappingService); + sipService.setStreamingMetadataService(streamingMetadataService); } } From 97a789097999b3fc27b09e0ba0db8f4f3c722dfc Mon Sep 17 00:00:00 2001 From: krwong Date: Fri, 10 May 2024 10:13:52 -0400 Subject: [PATCH 6/7] file in work should have streamingUrl --- .../boxc/migration/cdm/services/sips/WorkGenerator.java | 5 ----- .../lib/boxc/migration/cdm/services/SipServiceTest.java | 7 ++++++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/edu/unc/lib/boxc/migration/cdm/services/sips/WorkGenerator.java b/src/main/java/edu/unc/lib/boxc/migration/cdm/services/sips/WorkGenerator.java index 6e530749..e015bd26 100644 --- a/src/main/java/edu/unc/lib/boxc/migration/cdm/services/sips/WorkGenerator.java +++ b/src/main/java/edu/unc/lib/boxc/migration/cdm/services/sips/WorkGenerator.java @@ -102,11 +102,6 @@ protected void generateWork() throws IOException { // add permission to work addPermission(cdmId, workBag); - // Add streamingUrl - if (!cdmId.startsWith(GroupMappingInfo.GROUPED_WORK_PREFIX)) { - addStreamingMetadata(cdmId, workBag); - } - // Copy description to SIP copyDescriptionToSip(workPid, expDescPath); diff --git a/src/test/java/edu/unc/lib/boxc/migration/cdm/services/SipServiceTest.java b/src/test/java/edu/unc/lib/boxc/migration/cdm/services/SipServiceTest.java index 62c00aaf..8dec01dc 100644 --- a/src/test/java/edu/unc/lib/boxc/migration/cdm/services/SipServiceTest.java +++ b/src/test/java/edu/unc/lib/boxc/migration/cdm/services/SipServiceTest.java @@ -1406,7 +1406,12 @@ public void generateSipsWithStreamingUrl() throws Exception { "spaceId=open-hls&filename=gilmer_recording-playlist.m3u8")); Resource workResc3 = testHelper.getResourceByCreateTime(depBagChildren, "2005-12-08"); testHelper.assertObjectPopulatedInSip(workResc3, dirManager, model, stagingLocs.get(2), null, "27"); - assertTrue(workResc3.hasProperty(streamingUrl, "https://durastream.lib.unc.edu/player?" + + // assert file in workResc3 has streamingUrl + Bag workResc3Bag = model.getBag(workResc3); + List workChildren = workResc3Bag.iterator().toList(); + assertEquals(1, workChildren.size()); + Resource fileObjResc = workChildren.get(0).asResource(); + assertTrue(fileObjResc.hasProperty(streamingUrl, "https://durastream.lib.unc.edu/player?" + "spaceId=open-hls&filename=gilmer_recording-playlist.m3u8")); assertPersistedSipInfoMatches(sip); From 1446a5b47a19309bdd8abf2c7fd3607e956d519f Mon Sep 17 00:00:00 2001 From: krwong Date: Fri, 10 May 2024 10:53:51 -0400 Subject: [PATCH 7/7] verify other file objects don't have streamingUrl --- .../cdm/services/SipServiceTest.java | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/test/java/edu/unc/lib/boxc/migration/cdm/services/SipServiceTest.java b/src/test/java/edu/unc/lib/boxc/migration/cdm/services/SipServiceTest.java index 8dec01dc..999f1b4d 100644 --- a/src/test/java/edu/unc/lib/boxc/migration/cdm/services/SipServiceTest.java +++ b/src/test/java/edu/unc/lib/boxc/migration/cdm/services/SipServiceTest.java @@ -1398,20 +1398,27 @@ public void generateSipsWithStreamingUrl() throws Exception { Resource workResc1 = testHelper.getResourceByCreateTime(depBagChildren, "2005-11-23"); testHelper.assertObjectPopulatedInSip(workResc1, dirManager, model, stagingLocs.get(0), null, "25"); - assertFalse(workResc1.hasProperty(streamingUrl, "https://durastream.lib.unc.edu/player?" + + Bag workResc1Bag = model.getBag(workResc1); + List workResc1Children = workResc1Bag.iterator().toList(); + assertEquals(1, workResc1Children.size()); + Resource workResc1FileObj = workResc1Children.get(0).asResource(); + assertFalse(workResc1FileObj.hasProperty(streamingUrl, "https://durastream.lib.unc.edu/player?" + "spaceId=open-hls&filename=gilmer_recording-playlist.m3u8")); Resource workResc2 = testHelper.getResourceByCreateTime(depBagChildren, "2005-11-24"); testHelper.assertObjectPopulatedInSip(workResc2, dirManager, model, stagingLocs.get(1), null, "26"); - assertFalse(workResc2.hasProperty(streamingUrl, "https://durastream.lib.unc.edu/player?" + + Bag workResc2Bag = model.getBag(workResc2); + List workResc2Children = workResc2Bag.iterator().toList(); + assertEquals(1, workResc2Children.size()); + Resource workResc2FileObj = workResc2Children.get(0).asResource(); + assertFalse(workResc2FileObj.hasProperty(streamingUrl, "https://durastream.lib.unc.edu/player?" + "spaceId=open-hls&filename=gilmer_recording-playlist.m3u8")); Resource workResc3 = testHelper.getResourceByCreateTime(depBagChildren, "2005-12-08"); testHelper.assertObjectPopulatedInSip(workResc3, dirManager, model, stagingLocs.get(2), null, "27"); - // assert file in workResc3 has streamingUrl Bag workResc3Bag = model.getBag(workResc3); - List workChildren = workResc3Bag.iterator().toList(); - assertEquals(1, workChildren.size()); - Resource fileObjResc = workChildren.get(0).asResource(); - assertTrue(fileObjResc.hasProperty(streamingUrl, "https://durastream.lib.unc.edu/player?" + + List workResc3Children = workResc3Bag.iterator().toList(); + assertEquals(1, workResc3Children.size()); + Resource workResc3FileObj = workResc3Children.get(0).asResource(); + assertTrue(workResc3FileObj.hasProperty(streamingUrl, "https://durastream.lib.unc.edu/player?" + "spaceId=open-hls&filename=gilmer_recording-playlist.m3u8")); assertPersistedSipInfoMatches(sip);