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 patent as orcid entity sync settings and orcid queue
- Loading branch information
1 parent
5f68e21
commit 47d7bd1
Showing
4 changed files
with
310 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 |
---|---|---|
|
@@ -4254,6 +4254,93 @@ public void testDeletionOfProductToBeSynchronizedWithOrcid() throws Exception { | |
|
||
} | ||
|
||
@Test | ||
public void testDeletionOfPatentToBeSynchronizedWithOrcid() throws Exception { | ||
|
||
context.turnOffAuthorisationSystem(); | ||
|
||
parentCommunity = CommunityBuilder.createCommunity(context) | ||
.withName("Parent Community") | ||
.build(); | ||
|
||
Collection profileCollection = CollectionBuilder.createCollection(context, parentCommunity) | ||
.withName("Profiles") | ||
.withEntityType("Person") | ||
.build(); | ||
|
||
Collection patentCollection = CollectionBuilder.createCollection(context, parentCommunity) | ||
.withName("Patents") | ||
.withEntityType("Patent") | ||
.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) | ||
.withOrcidSynchronizationPatentsPreference(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) | ||
.withOrcidSynchronizationPatentsPreference(ALL) | ||
.build(); | ||
|
||
Item patent = ItemBuilder.createItem(context, patentCollection) | ||
.withTitle("Test patent") | ||
.build(); | ||
|
||
createOrcidQueue(context, firstProfile, patent).build(); | ||
createOrcidQueue(context, secondProfile, patent).build(); | ||
|
||
List<OrcidHistory> historyRecords = new ArrayList<>(); | ||
historyRecords.add(createOrcidHistory(context, firstProfile, patent).build()); | ||
historyRecords.add(createOrcidHistory(context, firstProfile, patent).withPutCode("12345").build()); | ||
historyRecords.add(createOrcidHistory(context, secondProfile, patent).build()); | ||
historyRecords.add(createOrcidHistory(context, secondProfile, patent).withPutCode("67891").build()); | ||
historyRecords.add(createOrcidHistory(context, thirdProfile, patent).build()); | ||
|
||
context.restoreAuthSystemState(); | ||
|
||
String token = getAuthToken(admin.getEmail(), password); | ||
|
||
getClient(token).perform(delete("/api/core/items/" + patent.getID())) | ||
.andExpect(status().is(204)); | ||
|
||
List<OrcidQueue> orcidQueueRecords = orcidQueueService.findAll(context); | ||
assertThat(orcidQueueRecords, hasSize(1)); | ||
assertThat(orcidQueueRecords, hasItem(matches(firstProfile, null, "Patent", "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.