mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 10:04:21 +00:00
CST-12850 IT class
This commit is contained in:
@@ -204,6 +204,44 @@ public class LDNInboxControllerIT extends AbstractControllerIntegrationTest {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ldnInboxAnnounceReleaseTest() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
Community community = CommunityBuilder.createCommunity(context).withName("community").build();
|
||||
Collection collection = CollectionBuilder.createCollection(context, community).build();
|
||||
Item item = ItemBuilder.createItem(context, collection).build();
|
||||
InputStream announceRelationshipStream = getClass().getResourceAsStream("ldn_announce_release.json");
|
||||
String object = configurationService.getProperty("dspace.ui.url") + "/handle/" + item.getHandle();
|
||||
NotifyServiceEntity notifyServiceEntity = NotifyServiceBuilder.createNotifyServiceBuilder(context)
|
||||
.withName("service name")
|
||||
.withDescription("service description")
|
||||
.withUrl("https://review-service.com/inbox/about/")
|
||||
.withLdnUrl("https://review-service.com/inbox/")
|
||||
.withScore(BigDecimal.valueOf(0.6d))
|
||||
.build();
|
||||
String announceRelationship = IOUtils.toString(announceRelationshipStream, Charset.defaultCharset());
|
||||
announceRelationshipStream.close();
|
||||
String message = announceRelationship.replaceAll("<<object>>", object);
|
||||
message = message.replaceAll("<<object_handle>>", object);
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
Notification notification = mapper.readValue(message, Notification.class);
|
||||
getClient()
|
||||
.perform(post("/ldn/inbox")
|
||||
.contentType("application/ld+json")
|
||||
.content(message))
|
||||
.andExpect(status().isAccepted());
|
||||
|
||||
ldnMessageService.extractAndProcessMessageFromQueue(context);
|
||||
|
||||
assertThat(qaEventService.findAllSources(context, 0, 20),
|
||||
hasItem(QASourceMatcher.with(COAR_NOTIFY_SOURCE, 1L)));
|
||||
|
||||
assertThat(qaEventService.findAllTopicsBySource(context, COAR_NOTIFY_SOURCE, 0, 20), hasItem(
|
||||
QATopicMatcher.with(QANotifyPatterns.TOPIC_ENRICH_MORE_LINK, 1L)));
|
||||
|
||||
}
|
||||
|
||||
private void checkStoredLDNMessage(Notification notification, LDNMessageEntity ldnMessage, String object)
|
||||
throws Exception {
|
||||
|
||||
|
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"@context": [
|
||||
"https://www.w3.org/ns/activitystreams",
|
||||
"https://purl.org/coar/notify"
|
||||
],
|
||||
"actor": {
|
||||
"id": "https://research-organisation.org",
|
||||
"name": "Research Organisation",
|
||||
"type": "Organization"
|
||||
},
|
||||
"context": {
|
||||
"id": "<<object>>",
|
||||
"id_handle": "http://localhost:4000/handle/123456789/1119",
|
||||
"ietf:cite-as": "https://doi.org/10.5555/12345680",
|
||||
"type": "sorg:AboutPage",
|
||||
"url": {
|
||||
"id": "https://another-research-organisation.org/repository/datasets/item/201203421/data_archive.zip",
|
||||
"mediaType": "application/zip",
|
||||
"type": [
|
||||
"Article",
|
||||
"sorg:Dataset"
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "urn:uuid:94ecae35-dcfd-4182-8550-22c7164fe24f",
|
||||
"object": {
|
||||
"oldas:object": "https://another-research-organisation.org/repository/datasets/item/201203421/",
|
||||
"as:object": "newValue",
|
||||
"oldas:relationship": "http://purl.org/vocab/frbr/core#supplement",
|
||||
"as:relationship": "somethingElse",
|
||||
"as:subject": "https://research-organisation.org/repository/item/201203/421/",
|
||||
"id": "<<object_handle>>",
|
||||
"type": "Relationship"
|
||||
},
|
||||
"origin": {
|
||||
"id": "https://review-service.com/inbox/about/",
|
||||
"inbox": "https://review-service.com/inbox/",
|
||||
"type": "Service"
|
||||
},
|
||||
"target": {
|
||||
"id": "https://another-research-organisation.org/repository",
|
||||
"inbox": "https://another-research-organisation.org/inbox/",
|
||||
"type": "Service"
|
||||
},
|
||||
"type": [
|
||||
"Announce",
|
||||
"coar-notify:RelationshipAction"
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user