New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DS-4300] Optionally apply given Handles when importing community/collection structure #2469
Conversation
Close/open to get Travis to run. |
@mwoodiupui : Could we add tests for this PR in the existing StructBuilderIT? https://github.com/DSpace/DSpace/blob/main/dspace-api/src/test/java/org/dspace/administer/StructBuilderIT.java |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi @mwoodiupui thanks for this PR and to ping us on the recent bug report about it!
I made a quick code review and added inline a question for you about the test, can you take a look?
my colleague will make a functional test in the next days as well
IMPORT_DOCUMENT.getBytes(StandardCharsets.UTF_8))); | ||
Diff myDiff = DiffBuilder.compare(reference).withTest(output) | ||
.normalizeWhitespace() | ||
// .withNodeFilter(new MyNodeFilter()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove comment out code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
for (Community community : communityService.findAllTop(context)) { | ||
for (Handle handle : community.getHandles()) { | ||
if (handle.getHandle().equals(COMMUNITY_1_HANDLE)) { | ||
found = true; | ||
break; | ||
} | ||
if (found) { | ||
break; | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a reason to apply a different test strategy than the one used in testImportStructure
via the DiffBuilder
?
checking for just a single handle could hide lot of (future) issues (maybe the import skip all the community without a handle or handle are not set for collection, etc.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a spot-check for a Collection handle and a Community with handle not specified.
Below the cited code, this test also applies the strategy from testImportStructure
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 by code review
I must mention: a small part of that code goes back to a PR I created for @mwoodiupui (see mwoodiupui#13). So I'm kind of reviewing a small part of my own code. Even if it is a small PR, it should get a second review.
Yes, thanks to @pnbecker for the original code. I chose to treat it as a separate issue rather than merge it into that other PR. |
Hi @abollini, the functional tests are done, and I think we can accept these changes @tdonohue. |
Merging as this is at +2. Thanks @mwoodiupui ! |
Fixes #7640
Based on mwoodiupui#13