forked from DSpace/DSpace
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
further IT for product as orcid entity sync settings and orcid queue
- Loading branch information
1 parent
b55d7aa
commit 1eec67f
Showing
4 changed files
with
304 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4166,6 +4166,94 @@ public void testDeletionOfFundingToBeSynchronizedWithOrcid() throws Exception { | |
|
||
} | ||
|
||
@Test | ||
public void testDeletionOfProductToBeSynchronizedWithOrcid() throws Exception { | ||
|
||
context.turnOffAuthorisationSystem(); | ||
|
||
parentCommunity = CommunityBuilder.createCommunity(context) | ||
.withName("Parent Community") | ||
.build(); | ||
|
||
Collection profileCollection = CollectionBuilder.createCollection(context, parentCommunity) | ||
.withName("Profiles") | ||
.withEntityType("Person") | ||
.build(); | ||
|
||
Collection productCollection = CollectionBuilder.createCollection(context, parentCommunity) | ||
.withName("Products") | ||
.withEntityType("Product") | ||
.build(); | ||
|
||
EPerson firstOwner = EPersonBuilder.createEPerson(context) | ||
.withEmail("[email protected]") | ||
.build(); | ||
|
||
EPerson secondOwner = EPersonBuilder.createEPerson(context) | ||
.withEmail("[email protected]") | ||
.build(); | ||
|
||
EPerson thirdOwner = EPersonBuilder.createEPerson(context) | ||
.withEmail("[email protected]") | ||
.build(); | ||
|
||
Item firstProfile = ItemBuilder.createItem(context, profileCollection) | ||
.withTitle("Test User") | ||
.withDspaceObjectOwner(firstOwner.getFullName(), firstOwner.getID().toString()) | ||
.withOrcidIdentifier("0000-1111-2222-3333") | ||
.withOrcidAccessToken("ab4d18a0-8d9a-40f1-b601-a417255c8d20", firstOwner) | ||
.withOrcidSynchronizationProductsPreference(ALL) | ||
.build(); | ||
|
||
Item secondProfile = ItemBuilder.createItem(context, profileCollection) | ||
.withTitle("Test User") | ||
.withDspaceObjectOwner(secondOwner.getFullName(), secondOwner.getID().toString()) | ||
.withOrcidIdentifier("4444-1111-2222-3333") | ||
.withOrcidAccessToken("bb4d18a0-8d9a-40f1-b601-a417255c8d20", secondOwner) | ||
.build(); | ||
|
||
Item thirdProfile = ItemBuilder.createItem(context, profileCollection) | ||
.withTitle("Test User") | ||
.withDspaceObjectOwner(thirdOwner.getFullName(), thirdOwner.getID().toString()) | ||
.withOrcidIdentifier("5555-1111-2222-3333") | ||
.withOrcidAccessToken("cb4d18a0-8d9a-40f1-b601-a417255c8d20", thirdOwner) | ||
.withOrcidSynchronizationProductsPreference(ALL) | ||
.build(); | ||
|
||
Item product = ItemBuilder.createItem(context, productCollection) | ||
.withTitle("Test product") | ||
|
||
.build(); | ||
|
||
createOrcidQueue(context, firstProfile, product).build(); | ||
createOrcidQueue(context, secondProfile, product).build(); | ||
|
||
List<OrcidHistory> historyRecords = new ArrayList<>(); | ||
historyRecords.add(createOrcidHistory(context, firstProfile, product).build()); | ||
historyRecords.add(createOrcidHistory(context, firstProfile, product).withPutCode("12345").build()); | ||
historyRecords.add(createOrcidHistory(context, secondProfile, product).build()); | ||
historyRecords.add(createOrcidHistory(context, secondProfile, product).withPutCode("67891").build()); | ||
historyRecords.add(createOrcidHistory(context, thirdProfile, product).build()); | ||
|
||
context.restoreAuthSystemState(); | ||
|
||
String token = getAuthToken(admin.getEmail(), password); | ||
|
||
getClient(token).perform(delete("/api/core/items/" + product.getID())) | ||
.andExpect(status().is(204)); | ||
|
||
List<OrcidQueue> orcidQueueRecords = orcidQueueService.findAll(context); | ||
assertThat(orcidQueueRecords, hasSize(1)); | ||
assertThat(orcidQueueRecords, hasItem(matches(firstProfile, null, "Product", "12345", DELETE))); | ||
|
||
for (OrcidHistory historyRecord : historyRecords) { | ||
historyRecord = context.reloadEntity(historyRecord); | ||
assertThat(historyRecord, notNullValue()); | ||
assertThat(historyRecord.getEntity(), nullValue()); | ||
} | ||
|
||
} | ||
|
||
private void initPublicationAuthorsRelationships() throws SQLException { | ||
context.turnOffAuthorisationSystem(); | ||
|
||
|
Oops, something went wrong.