Skip to content

Commit

Permalink
[TLC-674] Update duplicate IT, handle feature disable more gracefully
Browse files Browse the repository at this point in the history
Instead of throwing illegal state, simply return an empty
data section if the feature is not enabled and the
section is requested
  • Loading branch information
kshepherd committed Mar 4, 2024
1 parent 456182a commit 9a5427e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ public DataDuplicateDetection getData(SubmissionService submissionService, InPro
}
// Immediately return an empty if this feature is not configured
if (!configurationService.getBooleanProperty("duplicate.enable", false)) {
throw new IllegalStateException("Duplicate detection feature is not enabled. " +
"See dspace/config/modules/duplicate-detection.cfg");
log.debug("Duplicate detection is not enabled, returning empty section");
return new DataDuplicateDetection();
}
// Validate context
Context context = getContext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public void searchDuplicatesBySearchMethodTest() throws Exception {

context.restoreAuthSystemState();

getClient(token).perform(get("/api/submission/duplicates/search?uuid=" + item1.getID()))
getClient(token).perform(get("/api/submission/duplicates/search/findByItem?uuid=" + item1.getID()))
.andExpect(status().isOk())
.andExpect(content().contentType(contentType))
// Valid duplicates array
Expand Down Expand Up @@ -384,7 +384,7 @@ public void submissionSectionWorkflowItemVisibilityTest() throws Exception {
String reviewerToken = getAuthToken(admin.getEmail(), password);

// The reviewer should be able to see the workflow item as a potential duplicate of the test item
getClient(reviewerToken).perform(get("/api/submission/duplicates/search?uuid="
getClient(reviewerToken).perform(get("/api/submission/duplicates/search/findByItem?uuid="
+ workflowItem1.getItem().getID()))
.andExpect(status().isOk())
.andExpect(content().contentType(contentType))
Expand All @@ -396,7 +396,7 @@ public void submissionSectionWorkflowItemVisibilityTest() throws Exception {

// Another random user will NOT see this
getClient(getAuthToken(anotherEPerson.getEmail(), password))
.perform(get("/api/submission/duplicates/search?uuid="
.perform(get("/api/submission/duplicates/search/findByItem?uuid="
+ workflowItem1.getItem().getID()))
.andExpect(status().isOk())
.andExpect(content().contentType(contentType))
Expand Down

0 comments on commit 9a5427e

Please sign in to comment.