From 86ad64b33ac55972b9e1180b69b9629db21116bb Mon Sep 17 00:00:00 2001 From: Jim Myers Date: Tue, 20 Aug 2024 17:32:40 -0400 Subject: [PATCH 01/11] fix/workaround for when PID provider is down --- .../CuratePublishedDatasetVersionCommand.java | 44 +++++++++++-------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/CuratePublishedDatasetVersionCommand.java b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/CuratePublishedDatasetVersionCommand.java index f83041d87bd..6a4c78d4f4f 100644 --- a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/CuratePublishedDatasetVersionCommand.java +++ b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/CuratePublishedDatasetVersionCommand.java @@ -1,7 +1,6 @@ package edu.harvard.iq.dataverse.engine.command.impl; import edu.harvard.iq.dataverse.authorization.Permission; -import edu.harvard.iq.dataverse.datavariable.VarGroup; import edu.harvard.iq.dataverse.engine.command.CommandContext; import edu.harvard.iq.dataverse.engine.command.DataverseRequest; import edu.harvard.iq.dataverse.engine.command.RequiredPermissions; @@ -20,7 +19,6 @@ import edu.harvard.iq.dataverse.DataFileCategory; import edu.harvard.iq.dataverse.DatasetVersionDifference; -import java.util.Collection; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; @@ -167,33 +165,41 @@ public Dataset execute(CommandContext ctxt) throws CommandException { DeleteDatasetVersionCommand cmd; cmd = new DeleteDatasetVersionCommand(getRequest(), savedDataset); - ctxt.engine().submit(cmd); - // Running the command above reindexes the dataset, so we don't need to do it - // again in here. + cmd.execute(ctxt); // And update metadata at PID provider - ctxt.engine().submit( - new UpdateDvObjectPIDMetadataCommand(savedDataset, getRequest())); - - //And the exported metadata files try { - ExportService instance = ExportService.getInstance(); - instance.exportAllFormats(getDataset()); - } catch (ExportException ex) { - // Just like with indexing, a failure to export is not a fatal condition. - logger.log(Level.WARNING, "Curate Published DatasetVersion: exception while exporting metadata files:{0}", ex.getMessage()); + ctxt.engine().submit( + new UpdateDvObjectPIDMetadataCommand(savedDataset, getRequest())); + } catch (CommandException ex) { + //Make this non-fatal as after the DeleteDatasetVersionCommand, we can't roll back - for some reason no datasetfields remain in the DB + //(The old version doesn't need them and the new version doesn't get updated to include them?) + logger.log(Level.WARNING, "Curate Published DatasetVersion: exception while updating PID metadata:{0}", ex.getMessage()); } - - // Update so that getDataset() in updateDatasetUser will get the up-to-date copy // (with no draft version) setDataset(savedDataset); updateDatasetUser(ctxt); - - - return savedDataset; } + @Override + public boolean onSuccess(CommandContext ctxt, Object r) { + boolean retVal = true; + Dataset d = (Dataset) r; + + ctxt.index().asyncIndexDataset(d, true); + + // And the exported metadata files + try { + ExportService instance = ExportService.getInstance(); + instance.exportAllFormats(d); + } catch (ExportException ex) { + // Just like with indexing, a failure to export is not a fatal condition. + retVal = false; + logger.log(Level.WARNING, "Curate Published DatasetVersion: exception while exporting metadata files:{0}", ex.getMessage()); + } + return retVal; + } } From 3a9568e5a458157dab514e0a42d71fac70aaea33 Mon Sep 17 00:00:00 2001 From: Jim Myers Date: Fri, 23 Aug 2024 13:42:34 -0400 Subject: [PATCH 02/11] curate it test updates --- .../harvard/iq/dataverse/api/DatasetsIT.java | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/test/java/edu/harvard/iq/dataverse/api/DatasetsIT.java b/src/test/java/edu/harvard/iq/dataverse/api/DatasetsIT.java index 4f1ee1717c1..8bb33552fdd 100644 --- a/src/test/java/edu/harvard/iq/dataverse/api/DatasetsIT.java +++ b/src/test/java/edu/harvard/iq/dataverse/api/DatasetsIT.java @@ -3632,11 +3632,36 @@ public void testCuratePublishedDatasetVersionCommand() throws IOException { UtilIT.publishDatasetViaNativeApi(datasetId, "updatecurrent", apiToken).then().assertThat().statusCode(OK.getStatusCode()); + //Check that the dataset contains the updated metadata (which includes the name Spruce) Response getDatasetJsonAfterUpdate = UtilIT.nativeGet(datasetId, apiToken); - getDatasetJsonAfterUpdate.prettyPrint(); + assertTrue(getDatasetJsonAfterUpdate.prettyPrint().contains("Spruce")); getDatasetJsonAfterUpdate.then().assertThat() .statusCode(OK.getStatusCode()); + //Check that the draft version is gone + Response getDraft1 = UtilIT.getDatasetVersion(updatedContent, DS_VERSION_DRAFT, apiToken); + getDraft1.then().assertThat() + .statusCode(NOT_FOUND.getStatusCode()); + + + //Also test a terms change + String jsonLDTerms = "{'https://dataverse.org/schema/core#dataAccessPlace':'Somewhere'}"; + Response updateTerms = UtilIT.updateDatasetJsonLDMetadata(datasetId, apiToken, jsonLDTerms, true); + updateTerms.then().assertThat() + .statusCode(OK.getStatusCode()); + + //Verify the new term is there + Response jsonLDResponse = UtilIT.getDatasetJsonLDMetadata(datasetId, apiToken); + assertTrue(jsonLDResponse.prettyPrint().contains("Somewhere")); + jsonLDResponse.then().assertThat() + .statusCode(OK.getStatusCode()); + + //And that the draft is gone + Response getDraft2 = UtilIT.getDatasetVersion(updatedContent, DS_VERSION_DRAFT, apiToken); + getDraft2.then().assertThat() + .statusCode(NOT_FOUND.getStatusCode()); + + } /** From c93c8bd72d1f08699cab978b17d0f3c4b2ba8403 Mon Sep 17 00:00:00 2001 From: Jim Myers Date: Fri, 23 Aug 2024 13:46:52 -0400 Subject: [PATCH 03/11] minimal fix for changing terms issue --- .../command/impl/CuratePublishedDatasetVersionCommand.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/CuratePublishedDatasetVersionCommand.java b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/CuratePublishedDatasetVersionCommand.java index 6a4c78d4f4f..03987aa2f60 100644 --- a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/CuratePublishedDatasetVersionCommand.java +++ b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/CuratePublishedDatasetVersionCommand.java @@ -12,6 +12,7 @@ import edu.harvard.iq.dataverse.util.DatasetFieldUtil; import edu.harvard.iq.dataverse.workflows.WorkflowComment; import edu.harvard.iq.dataverse.Dataset; +import edu.harvard.iq.dataverse.DatasetField; import edu.harvard.iq.dataverse.DatasetVersion; import edu.harvard.iq.dataverse.TermsOfUseAndAccess; import edu.harvard.iq.dataverse.DataFile; @@ -19,6 +20,8 @@ import edu.harvard.iq.dataverse.DataFileCategory; import edu.harvard.iq.dataverse.DatasetVersionDifference; + +import java.util.ArrayList; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; @@ -56,6 +59,7 @@ public Dataset execute(CommandContext ctxt) throws CommandException { DatasetVersion newVersion = getDataset().getOrCreateEditVersion(); // Copy metadata from draft version to latest published version updateVersion.setDatasetFields(newVersion.initDatasetFields()); + newVersion.setDatasetFields(new ArrayList()); From e67f53590f9bb8a59e2d1224000f58602fe97ab1 Mon Sep 17 00:00:00 2001 From: Jim Myers Date: Fri, 23 Aug 2024 16:35:53 -0400 Subject: [PATCH 04/11] don't use DeleteDV command could allow PID update to be fatal again when provider service is down (not tested so left as is) --- .../CuratePublishedDatasetVersionCommand.java | 88 ++++++++++++------- .../privateurl/PrivateUrlServiceBean.java | 2 +- 2 files changed, 58 insertions(+), 32 deletions(-) diff --git a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/CuratePublishedDatasetVersionCommand.java b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/CuratePublishedDatasetVersionCommand.java index 03987aa2f60..fd272b76e1c 100644 --- a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/CuratePublishedDatasetVersionCommand.java +++ b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/CuratePublishedDatasetVersionCommand.java @@ -17,11 +17,12 @@ import edu.harvard.iq.dataverse.TermsOfUseAndAccess; import edu.harvard.iq.dataverse.DataFile; import edu.harvard.iq.dataverse.FileMetadata; +import edu.harvard.iq.dataverse.RoleAssignment; import edu.harvard.iq.dataverse.DataFileCategory; import edu.harvard.iq.dataverse.DatasetVersionDifference; - import java.util.ArrayList; +import java.util.Iterator; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; @@ -51,6 +52,9 @@ public Dataset execute(CommandContext ctxt) throws CommandException { if (!getUser().isSuperuser()) { throw new IllegalCommandException("Only superusers can curate published dataset versions", this); } + Dataset savedDataset = null; + // Merge the dataset into our JPA context + setDataset(ctxt.em().merge(getDataset())); ctxt.permissions().checkEditDatasetLock(getDataset(), getRequest(), this); // Invariant: Dataset has no locks preventing the update @@ -61,22 +65,21 @@ public Dataset execute(CommandContext ctxt) throws CommandException { updateVersion.setDatasetFields(newVersion.initDatasetFields()); newVersion.setDatasetFields(new ArrayList()); - - // final DatasetVersion editVersion = getDataset().getEditVersion(); DatasetFieldUtil.tidyUpFields(updateVersion.getDatasetFields(), true); - // Merge the new version into our JPA context - ctxt.em().merge(updateVersion); - TermsOfUseAndAccess oldTerms = updateVersion.getTermsOfUseAndAccess(); TermsOfUseAndAccess newTerms = newVersion.getTermsOfUseAndAccess(); newTerms.setDatasetVersion(updateVersion); updateVersion.setTermsOfUseAndAccess(newTerms); - //Put old terms on version that will be deleted.... - newVersion.setTermsOfUseAndAccess(oldTerms); - - //Validate metadata and TofA conditions + // Clear unnecessary terms relationships .... + newVersion.setTermsOfUseAndAccess(null); + oldTerms.setDatasetVersion(null); + // Without this there's a db exception related to the oldTerms being referenced + // by the datasetversion table at the flush around line 212 + ctxt.em().flush(); + + // Validate metadata and TofA conditions validateOrDie(updateVersion, isValidateLenient()); //Also set the fileaccessrequest boolean on the dataset to match the new terms @@ -89,19 +92,20 @@ public Dataset execute(CommandContext ctxt) throws CommandException { updateVersion.getWorkflowComments().addAll(newComments); } - // we have to merge to update the database but not flush because // we don't want to create two draft versions! - Dataset tempDataset = ctxt.em().merge(getDataset()); - + Dataset tempDataset = getDataset(); updateVersion = tempDataset.getLatestVersionForCopy(); // Look for file metadata changes and update published metadata if needed List pubFmds = updateVersion.getFileMetadatas(); int pubFileCount = pubFmds.size(); int newFileCount = tempDataset.getOrCreateEditVersion().getFileMetadatas().size(); - /* The policy for this command is that it should only be used when the change is a 'minor update' with no file changes. - * Nominally we could call .isMinorUpdate() for that but we're making the same checks as we go through the update here. + /* + * The policy for this command is that it should only be used when the change is + * a 'minor update' with no file changes. Nominally we could call + * .isMinorUpdate() for that but we're making the same checks as we go through + * the update here. */ if (pubFileCount != newFileCount) { logger.severe("Draft version of dataset: " + tempDataset.getId() + " has: " + newFileCount + " while last published version has " + pubFileCount); @@ -110,7 +114,10 @@ public Dataset execute(CommandContext ctxt) throws CommandException { Long thumbId = null; if(tempDataset.getThumbnailFile()!=null) { thumbId = tempDataset.getThumbnailFile().getId(); - }; + } + + // Note - Curate allows file metadata changes but not adding/deleting files. If + // that ever changes, this command needs to be updated. for (FileMetadata publishedFmd : pubFmds) { DataFile dataFile = publishedFmd.getDataFile(); FileMetadata draftFmd = dataFile.getLatestFileMetadata(); @@ -157,34 +164,53 @@ public Dataset execute(CommandContext ctxt) throws CommandException { // Update modification time on the published version and the dataset updateVersion.setLastUpdateTime(getTimestamp()); tempDataset.setModificationTime(getTimestamp()); - ctxt.em().merge(updateVersion); - Dataset savedDataset = ctxt.em().merge(tempDataset); - - // Flush before calling DeleteDatasetVersion which calls - // PrivateUrlServiceBean.getPrivateUrlFromDatasetId() that will query the DB and - // fail if our changes aren't there - ctxt.em().flush(); + newVersion = ctxt.em().merge(newVersion); + savedDataset = ctxt.em().merge(tempDataset); // Now delete draft version - DeleteDatasetVersionCommand cmd; - cmd = new DeleteDatasetVersionCommand(getRequest(), savedDataset); - cmd.execute(ctxt); + ctxt.em().remove(newVersion); + + Iterator dvIt = savedDataset.getVersions().iterator(); + while (dvIt.hasNext()) { + DatasetVersion dv = dvIt.next(); + if (dv.isDraft()) { + dvIt.remove(); + break; // We've removed the draft version, no need to continue iterating + } + } + + savedDataset = ctxt.em().merge(savedDataset); + ctxt.em().flush(); + + RoleAssignment ra = ctxt.privateUrl().getPrivateUrlRoleAssignmentFromDataset(savedDataset); + if (ra != null) { + ctxt.roles().revoke(ra); + } // And update metadata at PID provider try { ctxt.engine().submit( - new UpdateDvObjectPIDMetadataCommand(savedDataset, getRequest())); + new UpdateDvObjectPIDMetadataCommand(savedDataset, getRequest())); } catch (CommandException ex) { - //Make this non-fatal as after the DeleteDatasetVersionCommand, we can't roll back - for some reason no datasetfields remain in the DB - //(The old version doesn't need them and the new version doesn't get updated to include them?) + // Make this non-fatal? This can be corrected by running the update PID API + // later, but who will look in the log? + // With the change to not use the DeleteDatasetVersionCommand above and other + // fixes, this error may now cleanly restore the initial state + // with the draft and last published versions unchanged. logger.log(Level.WARNING, "Curate Published DatasetVersion: exception while updating PID metadata:{0}", ex.getMessage()); } - // Update so that getDataset() in updateDatasetUser will get the up-to-date copy - // (with no draft version) + // Update so that getDataset() in updateDatasetUser() will get the up-to-date + // copy (with no draft version) setDataset(savedDataset); + updateDatasetUser(ctxt); + // ToDo - see if there are other DatasetVersionUser entries unique to the draft + // version that should be moved to the last published version + // As this command is intended for minor fixes, often done by the person pushing + // the update-current-version button, this is probably a minor issue. + return savedDataset; } diff --git a/src/main/java/edu/harvard/iq/dataverse/privateurl/PrivateUrlServiceBean.java b/src/main/java/edu/harvard/iq/dataverse/privateurl/PrivateUrlServiceBean.java index 9e5879106e4..01710e06f8f 100644 --- a/src/main/java/edu/harvard/iq/dataverse/privateurl/PrivateUrlServiceBean.java +++ b/src/main/java/edu/harvard/iq/dataverse/privateurl/PrivateUrlServiceBean.java @@ -96,7 +96,7 @@ private RoleAssignment getRoleAssignmentFromPrivateUrlToken(String privateUrlTok * * @todo This might be a good place for Optional. */ - private RoleAssignment getPrivateUrlRoleAssignmentFromDataset(Dataset dataset) { + public RoleAssignment getPrivateUrlRoleAssignmentFromDataset(Dataset dataset) { if (dataset == null) { return null; } From c2365416bbe73b23397c5221560e98432168ffdf Mon Sep 17 00:00:00 2001 From: Jim Myers Date: Fri, 23 Aug 2024 16:58:19 -0400 Subject: [PATCH 05/11] release note/suggested fix in older versions --- .../10797-update-current-version-bug-fix.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 doc/release-notes/10797-update-current-version-bug-fix.md diff --git a/doc/release-notes/10797-update-current-version-bug-fix.md b/doc/release-notes/10797-update-current-version-bug-fix.md new file mode 100644 index 00000000000..2cfaf69cad3 --- /dev/null +++ b/doc/release-notes/10797-update-current-version-bug-fix.md @@ -0,0 +1,11 @@ +A significant bug in the superuser-only "Update-Current-Version" publication was found and fixed in this release. If the Update-Current-Version option was used when changes were made to the dataset Terms (rather than to dataset metadata), or if the PID provider service was down/returned an error, the update would fail and render the dataset unusable and require restoration from a backup. The fix in this release allows the update to succeed in both of these cases and redesigns the functionality such that any unknown issues should not make the dataset unusable (i.e. the error would be reported and the dataset would remain in its current state with the last-published version as it was and changes still in the draft version.) + +Users of earlier Dataverse releases are encouraged to alert their superusers to this issue. Those who wish to disable this functionality have two options: +* Change the dataset.updateRelease entry in the Bundle.properties file (or local language version) to "Do Not Use" or similar (doesn't disable but alerts superusers to the issue), or +* Edit the dataset.xhtml file to remove the lines + + + + + +, delete the contents of the generated and osgi-cache directories in the Dataverse Payara domain, and restart the Payara server. From 86f95719e53423dfc05b1b1442745d13b385cb08 Mon Sep 17 00:00:00 2001 From: Jim Myers Date: Mon, 26 Aug 2024 16:43:05 -0400 Subject: [PATCH 06/11] Clarify code comment. --- .../command/impl/CuratePublishedDatasetVersionCommand.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/CuratePublishedDatasetVersionCommand.java b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/CuratePublishedDatasetVersionCommand.java index fd272b76e1c..e6e8279a314 100644 --- a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/CuratePublishedDatasetVersionCommand.java +++ b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/CuratePublishedDatasetVersionCommand.java @@ -193,11 +193,12 @@ public Dataset execute(CommandContext ctxt) throws CommandException { ctxt.engine().submit( new UpdateDvObjectPIDMetadataCommand(savedDataset, getRequest())); } catch (CommandException ex) { - // Make this non-fatal? This can be corrected by running the update PID API - // later, but who will look in the log? + // The try/catch makes this non-fatal. Should it be non-fatal - it's different from what we do in publish? + // This can be corrected by running the update PID API later, but who will look in the log? // With the change to not use the DeleteDatasetVersionCommand above and other // fixes, this error may now cleanly restore the initial state - // with the draft and last published versions unchanged. + // with the draft and last published versions unchanged, but this has not yet bee tested. + // (Alternately this could move to onSuccess if we intend it to stay non-fatal.) logger.log(Level.WARNING, "Curate Published DatasetVersion: exception while updating PID metadata:{0}", ex.getMessage()); } // Update so that getDataset() in updateDatasetUser() will get the up-to-date From 192585e917f4d88b4ce1b531c4dc8af9e8d6e2a1 Mon Sep 17 00:00:00 2001 From: Jim Myers Date: Mon, 26 Aug 2024 18:14:33 -0400 Subject: [PATCH 07/11] typos --- src/test/java/edu/harvard/iq/dataverse/api/DatasetsIT.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/java/edu/harvard/iq/dataverse/api/DatasetsIT.java b/src/test/java/edu/harvard/iq/dataverse/api/DatasetsIT.java index 8bb33552fdd..92032438962 100644 --- a/src/test/java/edu/harvard/iq/dataverse/api/DatasetsIT.java +++ b/src/test/java/edu/harvard/iq/dataverse/api/DatasetsIT.java @@ -3639,7 +3639,7 @@ public void testCuratePublishedDatasetVersionCommand() throws IOException { .statusCode(OK.getStatusCode()); //Check that the draft version is gone - Response getDraft1 = UtilIT.getDatasetVersion(updatedContent, DS_VERSION_DRAFT, apiToken); + Response getDraft1 = UtilIT.getDatasetVersion(datasetPid, DS_VERSION_DRAFT, apiToken); getDraft1.then().assertThat() .statusCode(NOT_FOUND.getStatusCode()); @@ -3657,7 +3657,7 @@ public void testCuratePublishedDatasetVersionCommand() throws IOException { .statusCode(OK.getStatusCode()); //And that the draft is gone - Response getDraft2 = UtilIT.getDatasetVersion(updatedContent, DS_VERSION_DRAFT, apiToken); + Response getDraft2 = UtilIT.getDatasetVersion(datasetPid, DS_VERSION_DRAFT, apiToken); getDraft2.then().assertThat() .statusCode(NOT_FOUND.getStatusCode()); From 9464873b622c6dccea8f2f2f7451e3e682d7644c Mon Sep 17 00:00:00 2001 From: Jim Myers Date: Tue, 27 Aug 2024 09:14:13 -0400 Subject: [PATCH 08/11] remove deprecated call to makeSuperuser (and trigger tests) --- src/test/java/edu/harvard/iq/dataverse/api/DatasetsIT.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/edu/harvard/iq/dataverse/api/DatasetsIT.java b/src/test/java/edu/harvard/iq/dataverse/api/DatasetsIT.java index 92032438962..8d3841482a7 100644 --- a/src/test/java/edu/harvard/iq/dataverse/api/DatasetsIT.java +++ b/src/test/java/edu/harvard/iq/dataverse/api/DatasetsIT.java @@ -3626,7 +3626,7 @@ public void testCuratePublishedDatasetVersionCommand() throws IOException { UtilIT.publishDatasetViaNativeApi(datasetId, "updatecurrent", apiToken).then().assertThat().statusCode(FORBIDDEN.getStatusCode()); - Response makeSuperUser = UtilIT.makeSuperUser(username); + Response makeSuperUser = UtilIT.setSuperuserStatus(username, true); //should work after making super user From 3674a6f86c9df19ae0aac57ec4e3ebcee513fd01 Mon Sep 17 00:00:00 2001 From: Jim Myers Date: Wed, 28 Aug 2024 14:40:11 -0400 Subject: [PATCH 09/11] change server used in test to avoid bad cert --- .../iq/dataverse/dataaccess/RemoteOverlayAccessIOTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/edu/harvard/iq/dataverse/dataaccess/RemoteOverlayAccessIOTest.java b/src/test/java/edu/harvard/iq/dataverse/dataaccess/RemoteOverlayAccessIOTest.java index 2c0e0a5c6b7..c57fa71a340 100644 --- a/src/test/java/edu/harvard/iq/dataverse/dataaccess/RemoteOverlayAccessIOTest.java +++ b/src/test/java/edu/harvard/iq/dataverse/dataaccess/RemoteOverlayAccessIOTest.java @@ -41,7 +41,7 @@ public class RemoteOverlayAccessIOTest { public void setUp() { System.setProperty("dataverse.files.test.type", "remote"); System.setProperty("dataverse.files.test.label", "testOverlay"); - System.setProperty("dataverse.files.test.base-url", "https://demo.dataverse.org/resources"); + System.setProperty("dataverse.files.test.base-url", "https://data.qdr.syr.edu/resources"); System.setProperty("dataverse.files.test.base-store", "file"); System.setProperty("dataverse.files.test.download-redirect", "true"); System.setProperty("dataverse.files.test.remote-store-name", "DemoDataCorp"); From b2b023a6c6c7a33214c80cd5cd3421c5735feb31 Mon Sep 17 00:00:00 2001 From: Jim Myers Date: Thu, 29 Aug 2024 10:34:42 -0400 Subject: [PATCH 10/11] fix test jsonld --- src/test/java/edu/harvard/iq/dataverse/api/DatasetsIT.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/edu/harvard/iq/dataverse/api/DatasetsIT.java b/src/test/java/edu/harvard/iq/dataverse/api/DatasetsIT.java index 8d3841482a7..9bebb22e321 100644 --- a/src/test/java/edu/harvard/iq/dataverse/api/DatasetsIT.java +++ b/src/test/java/edu/harvard/iq/dataverse/api/DatasetsIT.java @@ -3645,7 +3645,7 @@ public void testCuratePublishedDatasetVersionCommand() throws IOException { //Also test a terms change - String jsonLDTerms = "{'https://dataverse.org/schema/core#dataAccessPlace':'Somewhere'}"; + String jsonLDTerms = "{\"https://dataverse.org/schema/core#fileTermsOfAccess\":{\"https://dataverse.org/schema/core#dataAccessPlace\":\"Somewhere\"}}"; Response updateTerms = UtilIT.updateDatasetJsonLDMetadata(datasetId, apiToken, jsonLDTerms, true); updateTerms.then().assertThat() .statusCode(OK.getStatusCode()); From 9f300752f3156d9c6c782dfcb514342dc4aafaeb Mon Sep 17 00:00:00 2001 From: Jim Myers Date: Thu, 29 Aug 2024 11:53:56 -0400 Subject: [PATCH 11/11] another test fix --- src/test/java/edu/harvard/iq/dataverse/api/DatasetsIT.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/test/java/edu/harvard/iq/dataverse/api/DatasetsIT.java b/src/test/java/edu/harvard/iq/dataverse/api/DatasetsIT.java index 9bebb22e321..7476117d67d 100644 --- a/src/test/java/edu/harvard/iq/dataverse/api/DatasetsIT.java +++ b/src/test/java/edu/harvard/iq/dataverse/api/DatasetsIT.java @@ -3650,6 +3650,11 @@ public void testCuratePublishedDatasetVersionCommand() throws IOException { updateTerms.then().assertThat() .statusCode(OK.getStatusCode()); + //Run Update-Current Version again + + UtilIT.publishDatasetViaNativeApi(datasetId, "updatecurrent", apiToken).then().assertThat().statusCode(OK.getStatusCode()); + + //Verify the new term is there Response jsonLDResponse = UtilIT.getDatasetJsonLDMetadata(datasetId, apiToken); assertTrue(jsonLDResponse.prettyPrint().contains("Somewhere"));