CST-12406 instroduce constants first implementation and test fixes

This commit is contained in:
frabacche
2023-11-16 17:05:50 +01:00
parent af0686d50f
commit 20f668aac3
7 changed files with 228 additions and 166 deletions

View File

@@ -0,0 +1,29 @@
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.dspace.qaevent;
/**
* Constants for Quality Assurance configurations to be used into cfg and xml spring.
*
* @author Francesco Bacchelli (francesco.bacchelli at 4science.it)
*
*/
public class QANotifyPatterns {
public static final String TOPIC_ENRICH_MORE_PROJECT = "ENRICH/MORE/PROJECT";
public static final String TOPIC_ENRICH_MISSING_PROJECT = "ENRICH/MISSING/PROJECT";
public static final String TOPIC_ENRICH_MISSING_ABSTRACT = "ENRICH/MISSING/ABSTRACT";
public static final String TOPIC_ENRICH_MORE_REVIEW = "ENRICH/MORE/REVIEW";
public static final String TOPIC_ENRICH_MORE_ENDORSEMENT = "ENRICH/MORE/ENDORSEMENT";
public static final String TOPIC_ENRICH_MORE_PID = "ENRICH/MORE/PID";
public static final String TOPIC_ENRICH_MISSING_PID = "ENRICH/MISSING/PID";
/**
* Default constructor
*/
private QANotifyPatterns() { }
}

View File

@@ -47,6 +47,7 @@ import org.dspace.content.Item;
import org.dspace.content.QAEvent; import org.dspace.content.QAEvent;
import org.dspace.matcher.QASourceMatcher; import org.dspace.matcher.QASourceMatcher;
import org.dspace.matcher.QATopicMatcher; import org.dspace.matcher.QATopicMatcher;
import org.dspace.qaevent.QANotifyPatterns;
import org.dspace.qaevent.QATopic; import org.dspace.qaevent.QATopic;
import org.dspace.qaevent.service.BrokerClientFactory; import org.dspace.qaevent.service.BrokerClientFactory;
import org.dspace.qaevent.service.QAEventService; import org.dspace.qaevent.service.QAEventService;
@@ -57,6 +58,7 @@ import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
/** /**
* Integration tests for {@link OpenaireEventsImport}. * Integration tests for {@link OpenaireEventsImport}.
* *
@@ -171,11 +173,11 @@ public class OpenaireEventsImportIT extends AbstractIntegrationTestWithDatabase
); );
List<QATopic> topicList = qaEventService.findAllTopicsBySource(context, OPENAIRE_SOURCE, 0, 20); List<QATopic> topicList = qaEventService.findAllTopicsBySource(context, OPENAIRE_SOURCE, 0, 20);
assertThat(topicList, hasItem(QATopicMatcher.with("ENRICH/MORE/PROJECT", 1L))); assertThat(topicList, hasItem(QATopicMatcher.with(QANotifyPatterns.TOPIC_ENRICH_MORE_PROJECT, 1L)));
assertThat(topicList, hasItem(QATopicMatcher.with("ENRICH/MORE/PID", 1L))); assertThat(topicList, hasItem(QATopicMatcher.with(QANotifyPatterns.TOPIC_ENRICH_MORE_PID, 1L)));
assertThat(topicList, hasItem(QATopicMatcher.with("ENRICH/MISSING/PID", 1L))); assertThat(topicList, hasItem(QATopicMatcher.with(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID, 1L)));
assertThat(topicList, hasItem(QATopicMatcher.with("ENRICH/MISSING/PROJECT", 1L))); assertThat(topicList, hasItem(QATopicMatcher.with(QANotifyPatterns.TOPIC_ENRICH_MISSING_PROJECT, 1L)));
assertThat(topicList, hasItem(QATopicMatcher.with("ENRICH/MISSING/ABSTRACT", 1L))); assertThat(topicList, hasItem(QATopicMatcher.with(QANotifyPatterns.TOPIC_ENRICH_MISSING_ABSTRACT, 1L)));
String projectMessage = "{\"projects[0].acronym\":\"PAThs\",\"projects[0].code\":\"687567\"," String projectMessage = "{\"projects[0].acronym\":\"PAThs\",\"projects[0].code\":\"687567\","
+ "\"projects[0].funder\":\"EC\",\"projects[0].fundingProgram\":\"H2020\"," + "\"projects[0].funder\":\"EC\",\"projects[0].fundingProgram\":\"H2020\","
@@ -183,18 +185,21 @@ public class OpenaireEventsImportIT extends AbstractIntegrationTestWithDatabase
+ "\"projects[0].openaireId\":\"40|corda__h2020::6e32f5eb912688f2424c68b851483ea4\"," + "\"projects[0].openaireId\":\"40|corda__h2020::6e32f5eb912688f2424c68b851483ea4\","
+ "\"projects[0].title\":\"Tracking Papyrus and Parchment Paths\"}"; + "\"projects[0].title\":\"Tracking Papyrus and Parchment Paths\"}";
assertThat(qaEventService.findEventsByTopicAndPage(context, OPENAIRE_SOURCE, "ENRICH/MORE/PROJECT", 0, 20), assertThat(qaEventService.findEventsByTopicAndPage(context, OPENAIRE_SOURCE,
QANotifyPatterns.TOPIC_ENRICH_MORE_PROJECT, 0, 20),
contains( contains(
pendingOpenaireEventWith("oai:www.openstarts.units.it:123456789/99998", firstItem, pendingOpenaireEventWith("oai:www.openstarts.units.it:123456789/99998", firstItem,
"Egypt, crossroad of translations and literary interweavings", projectMessage, "Egypt, crossroad of translations and literary interweavings", projectMessage,
"ENRICH/MORE/PROJECT", 1.00d))); QANotifyPatterns.TOPIC_ENRICH_MORE_PROJECT, 1.00d)));
String abstractMessage = "{\"abstracts[0]\":\"Missing Abstract\"}"; String abstractMessage = "{\"abstracts[0]\":\"Missing Abstract\"}";
assertThat(qaEventService.findEventsByTopicAndPage(context, OPENAIRE_SOURCE, "ENRICH/MISSING/ABSTRACT", 0, 20), assertThat(qaEventService.findEventsByTopicAndPage(context, OPENAIRE_SOURCE,
QANotifyPatterns.TOPIC_ENRICH_MISSING_ABSTRACT, 0, 20),
contains( contains(
pendingOpenaireEventWith("oai:www.openstarts.units.it:123456789/99999", secondItem, "Test Publication", pendingOpenaireEventWith("oai:www.openstarts.units.it:123456789/99999",
abstractMessage, "ENRICH/MISSING/ABSTRACT", 1.00d))); secondItem, "Test Publication",
abstractMessage, QANotifyPatterns.TOPIC_ENRICH_MISSING_ABSTRACT, 1.00d)));
verifyNoInteractions(mockBrokerClient); verifyNoInteractions(mockBrokerClient);
@@ -229,16 +234,17 @@ public class OpenaireEventsImportIT extends AbstractIntegrationTestWithDatabase
assertThat(qaEventService.findAllSources(context, 0, 20), hasItem(QASourceMatcher.with(OPENAIRE_SOURCE, 3L))); assertThat(qaEventService.findAllSources(context, 0, 20), hasItem(QASourceMatcher.with(OPENAIRE_SOURCE, 3L)));
List<QATopic> topicList = qaEventService.findAllTopicsBySource(context, OPENAIRE_SOURCE, 0, 20); List<QATopic> topicList = qaEventService.findAllTopicsBySource(context, OPENAIRE_SOURCE, 0, 20);
assertThat(topicList, hasItem(QATopicMatcher.with("ENRICH/MISSING/ABSTRACT", 1L))); assertThat(topicList, hasItem(QATopicMatcher.with(QANotifyPatterns.TOPIC_ENRICH_MISSING_ABSTRACT, 1L)));
assertThat(topicList, hasItem(QATopicMatcher.with("ENRICH/MISSING/PROJECT", 1L))); assertThat(topicList, hasItem(QATopicMatcher.with(QANotifyPatterns.TOPIC_ENRICH_MISSING_PROJECT, 1L)));
assertThat(topicList, hasItem(QATopicMatcher.with("ENRICH/MORE/PID", 1L))); assertThat(topicList, hasItem(QATopicMatcher.with(QANotifyPatterns.TOPIC_ENRICH_MORE_PID, 1L)));
String abstractMessage = "{\"abstracts[0]\":\"Missing Abstract\"}"; String abstractMessage = "{\"abstracts[0]\":\"Missing Abstract\"}";
assertThat(qaEventService.findEventsByTopicAndPage(context, OPENAIRE_SOURCE, "ENRICH/MISSING/ABSTRACT", 0, 20), assertThat(qaEventService.findEventsByTopicAndPage(context, OPENAIRE_SOURCE,
QANotifyPatterns.TOPIC_ENRICH_MISSING_ABSTRACT, 0, 20),
contains( contains(
pendingOpenaireEventWith("oai:www.openstarts.units.it:123456789/99999", item, "Test Publication", pendingOpenaireEventWith("oai:www.openstarts.units.it:123456789/99999", item, "Test Publication",
abstractMessage, "ENRICH/MISSING/ABSTRACT", 1.00d))); abstractMessage, QANotifyPatterns.TOPIC_ENRICH_MISSING_ABSTRACT, 1.00d)));
verifyNoInteractions(mockBrokerClient); verifyNoInteractions(mockBrokerClient);
@@ -269,14 +275,15 @@ public class OpenaireEventsImportIT extends AbstractIntegrationTestWithDatabase
assertThat(qaEventService.findAllSources(context, 0, 20), hasItem(QASourceMatcher.with(OPENAIRE_SOURCE, 1L))); assertThat(qaEventService.findAllSources(context, 0, 20), hasItem(QASourceMatcher.with(OPENAIRE_SOURCE, 1L)));
assertThat(qaEventService.findAllTopicsBySource(context, OPENAIRE_SOURCE, 0, 20), assertThat(qaEventService.findAllTopicsBySource(context, OPENAIRE_SOURCE, 0, 20),
contains(QATopicMatcher.with("ENRICH/MISSING/ABSTRACT", 1L))); contains(QATopicMatcher.with(org.dspace.qaevent.QANotifyPatterns.TOPIC_ENRICH_MISSING_ABSTRACT, 1L)));
String abstractMessage = "{\"abstracts[0]\":\"Missing Abstract\"}"; String abstractMessage = "{\"abstracts[0]\":\"Missing Abstract\"}";
assertThat(qaEventService.findEventsByTopicAndPage(context, OPENAIRE_SOURCE, "ENRICH/MISSING/ABSTRACT", 0, 20), assertThat(qaEventService.findEventsByTopicAndPage(context, OPENAIRE_SOURCE,
QANotifyPatterns.TOPIC_ENRICH_MISSING_ABSTRACT, 0, 20),
contains( contains(
pendingOpenaireEventWith("oai:www.openstarts.units.it:123456789/999991", secondItem, "Test Publication 2", pendingOpenaireEventWith("oai:www.openstarts.units.it:123456789/999991", secondItem, "Test Publication 2",
abstractMessage, "ENRICH/MISSING/ABSTRACT", 1.00d))); abstractMessage, org.dspace.qaevent.QANotifyPatterns.TOPIC_ENRICH_MISSING_ABSTRACT, 1.00d)));
verifyNoInteractions(mockBrokerClient); verifyNoInteractions(mockBrokerClient);
@@ -345,11 +352,11 @@ public class OpenaireEventsImportIT extends AbstractIntegrationTestWithDatabase
assertThat(qaEventService.findAllSources(context, 0, 20), hasItem(QASourceMatcher.with(OPENAIRE_SOURCE, 6L))); assertThat(qaEventService.findAllSources(context, 0, 20), hasItem(QASourceMatcher.with(OPENAIRE_SOURCE, 6L)));
List<QATopic> topicList = qaEventService.findAllTopicsBySource(context, OPENAIRE_SOURCE, 0, 20); List<QATopic> topicList = qaEventService.findAllTopicsBySource(context, OPENAIRE_SOURCE, 0, 20);
assertThat(topicList, hasItem(QATopicMatcher.with("ENRICH/MORE/PROJECT", 1L))); assertThat(topicList, hasItem(QATopicMatcher.with(QANotifyPatterns.TOPIC_ENRICH_MORE_PROJECT, 1L)));
assertThat(topicList, hasItem(QATopicMatcher.with("ENRICH/MORE/PID", 1L))); assertThat(topicList, hasItem(QATopicMatcher.with(QANotifyPatterns.TOPIC_ENRICH_MORE_PID, 1L)));
assertThat(topicList, hasItem(QATopicMatcher.with("ENRICH/MISSING/PID", 1L))); assertThat(topicList, hasItem(QATopicMatcher.with(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID, 1L)));
assertThat(topicList, hasItem(QATopicMatcher.with("ENRICH/MISSING/PROJECT", 1L))); assertThat(topicList, hasItem(QATopicMatcher.with(QANotifyPatterns.TOPIC_ENRICH_MISSING_PROJECT, 1L)));
assertThat(topicList, hasItem(QATopicMatcher.with("ENRICH/MISSING/ABSTRACT", 2L))); assertThat(topicList, hasItem(QATopicMatcher.with(QANotifyPatterns.TOPIC_ENRICH_MISSING_ABSTRACT, 2L)));
String projectMessage = "{\"projects[0].acronym\":\"PAThs\",\"projects[0].code\":\"687567\"," String projectMessage = "{\"projects[0].acronym\":\"PAThs\",\"projects[0].code\":\"687567\","
+ "\"projects[0].funder\":\"EC\",\"projects[0].fundingProgram\":\"H2020\"," + "\"projects[0].funder\":\"EC\",\"projects[0].fundingProgram\":\"H2020\","
@@ -357,22 +364,23 @@ public class OpenaireEventsImportIT extends AbstractIntegrationTestWithDatabase
+ "\"projects[0].openaireId\":\"40|corda__h2020::6e32f5eb912688f2424c68b851483ea4\"," + "\"projects[0].openaireId\":\"40|corda__h2020::6e32f5eb912688f2424c68b851483ea4\","
+ "\"projects[0].title\":\"Tracking Papyrus and Parchment Paths\"}"; + "\"projects[0].title\":\"Tracking Papyrus and Parchment Paths\"}";
assertThat(qaEventService.findEventsByTopicAndPage(context, OPENAIRE_SOURCE, "ENRICH/MORE/PROJECT", 0, 20), assertThat(qaEventService.findEventsByTopicAndPage(context, OPENAIRE_SOURCE,
QANotifyPatterns.TOPIC_ENRICH_MORE_PROJECT, 0, 20),
contains( contains(
pendingOpenaireEventWith("oai:www.openstarts.units.it:123456789/99998", firstItem, pendingOpenaireEventWith("oai:www.openstarts.units.it:123456789/99998", firstItem,
"Egypt, crossroad of translations and literary interweavings", projectMessage, "Egypt, crossroad of translations and literary interweavings", projectMessage,
"ENRICH/MORE/PROJECT", 1.00d))); QANotifyPatterns.TOPIC_ENRICH_MORE_PROJECT, 1.00d)));
String abstractMessage = "{\"abstracts[0]\":\"Missing Abstract\"}"; String abstractMessage = "{\"abstracts[0]\":\"Missing Abstract\"}";
List<QAEvent> eventList = qaEventService.findEventsByTopicAndPage(context, OPENAIRE_SOURCE, List<QAEvent> eventList = qaEventService.findEventsByTopicAndPage(context, OPENAIRE_SOURCE,
"ENRICH/MISSING/ABSTRACT", 0, 20); QANotifyPatterns.TOPIC_ENRICH_MISSING_ABSTRACT, 0, 20);
assertThat(eventList, hasItem( assertThat(eventList, hasItem(
pendingOpenaireEventWith("oai:www.openstarts.units.it:123456789/99999", secondItem, "Test Publication", pendingOpenaireEventWith("oai:www.openstarts.units.it:123456789/99999", secondItem, "Test Publication",
abstractMessage, "ENRICH/MISSING/ABSTRACT", 1.00d))); abstractMessage, QANotifyPatterns.TOPIC_ENRICH_MISSING_ABSTRACT, 1.00d)));
assertThat(eventList, hasItem( assertThat(eventList, hasItem(
pendingOpenaireEventWith("oai:www.openstarts.units.it:123456789/999991", thirdItem, "Test Publication 2", pendingOpenaireEventWith("oai:www.openstarts.units.it:123456789/999991", thirdItem, "Test Publication 2",
abstractMessage, "ENRICH/MISSING/ABSTRACT", 1.00d))); abstractMessage, QANotifyPatterns.TOPIC_ENRICH_MISSING_ABSTRACT, 1.00d)));
verify(mockBrokerClient).listSubscriptions(openaireURL, "user@test.com"); verify(mockBrokerClient).listSubscriptions(openaireURL, "user@test.com");
verify(mockBrokerClient).downloadEvents(eq(openaireURL), eq("sub1"), any()); verify(mockBrokerClient).downloadEvents(eq(openaireURL), eq("sub1"), any());
@@ -454,15 +462,17 @@ public class OpenaireEventsImportIT extends AbstractIntegrationTestWithDatabase
assertThat(qaEventService.findAllSources(context, 0, 20), hasItem(QASourceMatcher.with(OPENAIRE_SOURCE, 6L))); assertThat(qaEventService.findAllSources(context, 0, 20), hasItem(QASourceMatcher.with(OPENAIRE_SOURCE, 6L)));
List<QATopic> topicList = qaEventService.findAllTopicsBySource(context, OPENAIRE_SOURCE, 0, 20); List<QATopic> topicList = qaEventService.findAllTopicsBySource(context, OPENAIRE_SOURCE, 0, 20);
assertThat(topicList, hasItem(QATopicMatcher.with("ENRICH/MORE/PROJECT", 1L))); assertThat(topicList, hasItem(QATopicMatcher.with(QANotifyPatterns.TOPIC_ENRICH_MORE_PROJECT, 1L)));
assertThat(topicList, hasItem(QATopicMatcher.with("ENRICH/MISSING/PID", 1L))); assertThat(topicList, hasItem(QATopicMatcher.with(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID, 1L)));
assertThat(topicList, hasItem(QATopicMatcher.with("ENRICH/MORE/PID", 1L))); assertThat(topicList, hasItem(QATopicMatcher.with(QANotifyPatterns.TOPIC_ENRICH_MORE_PID, 1L)));
assertThat(topicList, hasItem(QATopicMatcher.with("ENRICH/MISSING/PROJECT", 1L))); assertThat(topicList, hasItem(QATopicMatcher.with(QANotifyPatterns.TOPIC_ENRICH_MISSING_PROJECT, 1L)));
assertThat(topicList, hasItem(QATopicMatcher.with("ENRICH/MISSING/ABSTRACT", 2L))); assertThat(topicList, hasItem(QATopicMatcher.with(QANotifyPatterns.TOPIC_ENRICH_MISSING_ABSTRACT, 2L)));
assertThat(qaEventService.findEventsByTopicAndPage(context, OPENAIRE_SOURCE, "ENRICH/MORE/PROJECT", 0, 20), assertThat(qaEventService.findEventsByTopicAndPage(context, OPENAIRE_SOURCE,
QANotifyPatterns.TOPIC_ENRICH_MORE_PROJECT, 0, 20),
hasSize(1)); hasSize(1));
assertThat(qaEventService.findEventsByTopicAndPage(context, OPENAIRE_SOURCE, "ENRICH/MISSING/ABSTRACT", 0, 20), assertThat(qaEventService.findEventsByTopicAndPage(context, OPENAIRE_SOURCE,
QANotifyPatterns.TOPIC_ENRICH_MISSING_ABSTRACT, 0, 20),
hasSize(2)); hasSize(2));
verify(mockBrokerClient).listSubscriptions(openaireURL, "user@test.com"); verify(mockBrokerClient).listSubscriptions(openaireURL, "user@test.com");
@@ -489,7 +499,7 @@ public class OpenaireEventsImportIT extends AbstractIntegrationTestWithDatabase
ScriptLauncher.handleScript(args, ScriptLauncher.getConfig(kernelImpl), handler, kernelImpl); ScriptLauncher.handleScript(args, ScriptLauncher.getConfig(kernelImpl), handler, kernelImpl);
assertThat(qaEventService.findAllTopicsBySource(context, OPENAIRE_SOURCE, 0, 20), contains( assertThat(qaEventService.findAllTopicsBySource(context, OPENAIRE_SOURCE, 0, 20), contains(
QATopicMatcher.with("ENRICH/MORE/REVIEW", 1L))); QATopicMatcher.with(QANotifyPatterns.TOPIC_ENRICH_MORE_REVIEW, 1L)));
assertThat(qaEventService.findAllSources(context, 0, 20), hasItem(QASourceMatcher.with(OPENAIRE_SOURCE, 1L))); assertThat(qaEventService.findAllSources(context, 0, 20), hasItem(QASourceMatcher.with(OPENAIRE_SOURCE, 1L)));

View File

@@ -36,6 +36,7 @@ import org.dspace.content.Community;
import org.dspace.content.Item; import org.dspace.content.Item;
import org.dspace.matcher.QASourceMatcher; import org.dspace.matcher.QASourceMatcher;
import org.dspace.matcher.QATopicMatcher; import org.dspace.matcher.QATopicMatcher;
import org.dspace.qaevent.QANotifyPatterns;
import org.dspace.qaevent.service.QAEventService; import org.dspace.qaevent.service.QAEventService;
import org.dspace.services.ConfigurationService; import org.dspace.services.ConfigurationService;
import org.dspace.utils.DSpace; import org.dspace.utils.DSpace;
@@ -134,7 +135,7 @@ public class LDNInboxControllerIT extends AbstractControllerIntegrationTest {
assertThat(qaEventService.findAllSources(context, 0, 20), hasItem(QASourceMatcher.with(COAR_NOTIFY, 1L))); assertThat(qaEventService.findAllSources(context, 0, 20), hasItem(QASourceMatcher.with(COAR_NOTIFY, 1L)));
assertThat(qaEventService.findAllTopicsBySource(context, COAR_NOTIFY, 0, 20), contains( assertThat(qaEventService.findAllTopicsBySource(context, COAR_NOTIFY, 0, 20), contains(
QATopicMatcher.with("ENRICH/MORE/REVIEW", 1L))); QATopicMatcher.with(QANotifyPatterns.TOPIC_ENRICH_MORE_REVIEW, 1L)));
} }

View File

@@ -48,6 +48,7 @@ import org.dspace.content.Item;
import org.dspace.content.QAEvent; import org.dspace.content.QAEvent;
import org.dspace.content.QAEventProcessed; import org.dspace.content.QAEventProcessed;
import org.dspace.eperson.EPerson; import org.dspace.eperson.EPerson;
import org.dspace.qaevent.QANotifyPatterns;
import org.dspace.qaevent.dao.QAEventsDao; import org.dspace.qaevent.dao.QAEventsDao;
import org.hamcrest.Matchers; import org.hamcrest.Matchers;
import org.junit.Test; import org.junit.Test;
@@ -81,17 +82,17 @@ public class QAEventRestRepositoryIT extends AbstractControllerIntegrationTest {
parentCommunity = CommunityBuilder.createCommunity(context).withName("Parent Community").build(); parentCommunity = CommunityBuilder.createCommunity(context).withName("Parent Community").build();
Collection col1 = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection 1").build(); Collection col1 = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection 1").build();
QAEvent event1 = QAEventBuilder.createTarget(context, col1, "Science and Freedom") QAEvent event1 = QAEventBuilder.createTarget(context, col1, "Science and Freedom")
.withTopic("ENRICH/MISSING/PID") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID)
.withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144300\"}").build(); .withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144300\"}").build();
QAEvent event2 = QAEventBuilder.createTarget(context, col1, "Science and Freedom 4") QAEvent event2 = QAEventBuilder.createTarget(context, col1, "Science and Freedom 4")
.withTopic("ENRICH/MISSING/ABSTRACT") .withTopic(org.dspace.qaevent.QANotifyPatterns.TOPIC_ENRICH_MISSING_ABSTRACT)
.withMessage("{\"abstracts[0]\": \"Descrizione delle caratteristiche...\"}").build(); .withMessage("{\"abstracts[0]\": \"Descrizione delle caratteristiche...\"}").build();
EPerson anotherSubmitter = EPersonBuilder.createEPerson(context).withEmail("another-submitter@example.com") EPerson anotherSubmitter = EPersonBuilder.createEPerson(context).withEmail("another-submitter@example.com")
.withPassword(password).build(); .withPassword(password).build();
context.setCurrentUser(anotherSubmitter); context.setCurrentUser(anotherSubmitter);
QAEvent event3 = QAEventBuilder.createTarget(context, col1, "Science and Freedom") QAEvent event3 = QAEventBuilder.createTarget(context, col1, "Science and Freedom")
.withSource(COAR_NOTIFY) .withSource(COAR_NOTIFY)
.withTopic("ENRICH/MORE/REVIEW") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MORE_REVIEW)
.withMessage("{\"abstracts[0]\": \"Descrizione delle caratteristiche...\"}").build(); .withMessage("{\"abstracts[0]\": \"Descrizione delle caratteristiche...\"}").build();
context.restoreAuthSystemState(); context.restoreAuthSystemState();
String authToken = getAuthToken(admin.getEmail(), password); String authToken = getAuthToken(admin.getEmail(), password);
@@ -117,10 +118,10 @@ public class QAEventRestRepositoryIT extends AbstractControllerIntegrationTest {
parentCommunity = CommunityBuilder.createCommunity(context).withName("Parent Community").build(); parentCommunity = CommunityBuilder.createCommunity(context).withName("Parent Community").build();
Collection col1 = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection 1").build(); Collection col1 = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection 1").build();
QAEvent event1 = QAEventBuilder.createTarget(context, col1, "Science and Freedom") QAEvent event1 = QAEventBuilder.createTarget(context, col1, "Science and Freedom")
.withTopic("ENRICH/MISSING/PID") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID)
.withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144300\"}").build(); .withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144300\"}").build();
QAEvent event5 = QAEventBuilder.createTarget(context, col1, "Science and Freedom 5") QAEvent event5 = QAEventBuilder.createTarget(context, col1, "Science and Freedom 5")
.withTopic("ENRICH/MISSING/PROJECT") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PROJECT)
.withMessage( .withMessage(
"{\"projects[0].acronym\":\"PAThs\"," "{\"projects[0].acronym\":\"PAThs\","
+ "\"projects[0].code\":\"687567\"," + "\"projects[0].code\":\"687567\","
@@ -151,7 +152,7 @@ public class QAEventRestRepositoryIT extends AbstractControllerIntegrationTest {
parentCommunity = CommunityBuilder.createCommunity(context).withName("Parent Community").build(); parentCommunity = CommunityBuilder.createCommunity(context).withName("Parent Community").build();
Collection col1 = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection 1").build(); Collection col1 = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection 1").build();
QAEvent event1 = QAEventBuilder.createTarget(context, col1, "Science and Freedom") QAEvent event1 = QAEventBuilder.createTarget(context, col1, "Science and Freedom")
.withTopic("ENRICH/MISSING/PID") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID)
.withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144300\"}").build(); .withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144300\"}").build();
context.restoreAuthSystemState(); context.restoreAuthSystemState();
getClient().perform(get("/api/integration/qualityassuranceevents/" + event1.getEventId())) getClient().perform(get("/api/integration/qualityassuranceevents/" + event1.getEventId()))
@@ -164,14 +165,14 @@ public class QAEventRestRepositoryIT extends AbstractControllerIntegrationTest {
parentCommunity = CommunityBuilder.createCommunity(context).withName("Parent Community").build(); parentCommunity = CommunityBuilder.createCommunity(context).withName("Parent Community").build();
Collection col1 = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection 1").build(); Collection col1 = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection 1").build();
QAEvent event1 = QAEventBuilder.createTarget(context, col1, "Science and Freedom") QAEvent event1 = QAEventBuilder.createTarget(context, col1, "Science and Freedom")
.withTopic("ENRICH/MISSING/PID") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID)
.withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144300\"}").build(); .withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144300\"}").build();
EPerson anotherSubmitter = EPersonBuilder.createEPerson(context).withEmail("another_submitter@example.com") EPerson anotherSubmitter = EPersonBuilder.createEPerson(context).withEmail("another_submitter@example.com")
.build(); .build();
context.setCurrentUser(anotherSubmitter); context.setCurrentUser(anotherSubmitter);
QAEvent event2 = QAEventBuilder.createTarget(context, col1, "Science and Freedom") QAEvent event2 = QAEventBuilder.createTarget(context, col1, "Science and Freedom")
.withSource(COAR_NOTIFY) .withSource(COAR_NOTIFY)
.withTopic("ENRICH/MORE/REVIEW") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MORE_REVIEW)
.withMessage("{\"href\":\"https://doi.org/10.2307/2144300\"}").build(); .withMessage("{\"href\":\"https://doi.org/10.2307/2144300\"}").build();
context.restoreAuthSystemState(); context.restoreAuthSystemState();
String authToken = getAuthToken(eperson.getEmail(), password); String authToken = getAuthToken(eperson.getEmail(), password);
@@ -190,12 +191,12 @@ public class QAEventRestRepositoryIT extends AbstractControllerIntegrationTest {
Item item = ItemBuilder.createItem(context, col1).withTitle("Tracking Papyrus and Parchment Paths") Item item = ItemBuilder.createItem(context, col1).withTitle("Tracking Papyrus and Parchment Paths")
.build(); .build();
QAEvent event1 = QAEventBuilder.createTarget(context, item) QAEvent event1 = QAEventBuilder.createTarget(context, item)
.withTopic("ENRICH/MISSING/PID") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID)
.withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144300\"}") .withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144300\"}")
.build(); .build();
QAEvent event2 = QAEventBuilder.createTarget(context, item) QAEvent event2 = QAEventBuilder.createTarget(context, item)
.withSource(COAR_NOTIFY) .withSource(COAR_NOTIFY)
.withTopic("ENRICH/MORE/REVIEW") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MORE_REVIEW)
.withMessage("{\"href\":\"https://doi.org/10.2307/2144301\"}").build(); .withMessage("{\"href\":\"https://doi.org/10.2307/2144301\"}").build();
EPerson anotherSubmitter = EPersonBuilder.createEPerson(context).withEmail("another-submitter@example.com") EPerson anotherSubmitter = EPersonBuilder.createEPerson(context).withEmail("another-submitter@example.com")
.withPassword(password).build(); .withPassword(password).build();
@@ -203,7 +204,7 @@ public class QAEventRestRepositoryIT extends AbstractControllerIntegrationTest {
// this event is related to a new item not submitted by eperson // this event is related to a new item not submitted by eperson
QAEvent event3 = QAEventBuilder.createTarget(context, col1, "Science and Freedom") QAEvent event3 = QAEventBuilder.createTarget(context, col1, "Science and Freedom")
.withSource(COAR_NOTIFY) .withSource(COAR_NOTIFY)
.withTopic("ENRICH/MORE/REVIEW") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MORE_REVIEW)
.withMessage("{\"href\":\"https://doi.org/10.2307/2144300\"}").build(); .withMessage("{\"href\":\"https://doi.org/10.2307/2144300\"}").build();
context.restoreAuthSystemState(); context.restoreAuthSystemState();
String authToken = getAuthToken(admin.getEmail(), password); String authToken = getAuthToken(admin.getEmail(), password);
@@ -305,45 +306,45 @@ public class QAEventRestRepositoryIT extends AbstractControllerIntegrationTest {
parentCommunity = CommunityBuilder.createCommunity(context).withName("Parent Community").build(); parentCommunity = CommunityBuilder.createCommunity(context).withName("Parent Community").build();
Collection col1 = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection 1").build(); Collection col1 = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection 1").build();
QAEvent event1 = QAEventBuilder.createTarget(context, col1, "Science and Freedom") QAEvent event1 = QAEventBuilder.createTarget(context, col1, "Science and Freedom")
.withTopic("ENRICH/MISSING/PID") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID)
.withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144300\"}").build(); .withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144300\"}").build();
QAEvent event2 = QAEventBuilder.createTarget(context, col1, "Science and Freedom 2") QAEvent event2 = QAEventBuilder.createTarget(context, col1, "Science and Freedom 2")
.withTopic("ENRICH/MISSING/PID") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID)
.withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144301\"}").build(); .withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144301\"}").build();
QAEvent event3 = QAEventBuilder.createTarget(context, col1, "Science and Freedom 3") QAEvent event3 = QAEventBuilder.createTarget(context, col1, "Science and Freedom 3")
.withTopic("ENRICH/MISSING/PID") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID)
.withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144302\"}").build(); .withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144302\"}").build();
QAEvent event4 = QAEventBuilder.createTarget(context, col1, "Science and Freedom 4") QAEvent event4 = QAEventBuilder.createTarget(context, col1, "Science and Freedom 4")
.withTopic("ENRICH/MISSING/PID") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID)
.withMessage("{\"pids[0].type\":\"pmc\",\"pids[0].value\":\"2144303\"}").build(); .withMessage("{\"pids[0].type\":\"pmc\",\"pids[0].value\":\"2144303\"}").build();
QAEvent event5 = QAEventBuilder.createTarget(context, col1, "Science and Freedom 5") QAEvent event5 = QAEventBuilder.createTarget(context, col1, "Science and Freedom 5")
.withTopic("ENRICH/MISSING/PID") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID)
.withMessage("{\"pids[0].type\":\"pmid\",\"pids[0].value\":\"2144304\"}").build(); .withMessage("{\"pids[0].type\":\"pmid\",\"pids[0].value\":\"2144304\"}").build();
QAEvent event6 = QAEventBuilder.createTarget(context, col1, "Science and Freedom") QAEvent event6 = QAEventBuilder.createTarget(context, col1, "Science and Freedom")
.withSource(COAR_NOTIFY) .withSource(COAR_NOTIFY)
.withTopic("ENRICH/MISSING/PID") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID)
.withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144300\"}").build(); .withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144300\"}").build();
QAEvent event7 = QAEventBuilder.createTarget(context, col1, "Science and Freedom 2") QAEvent event7 = QAEventBuilder.createTarget(context, col1, "Science and Freedom 2")
.withSource(COAR_NOTIFY) .withSource(COAR_NOTIFY)
.withTopic("ENRICH/MISSING/PID") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID)
.withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144301\"}").build(); .withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144301\"}").build();
QAEvent event8 = QAEventBuilder.createTarget(context, col1, "Science and Freedom 3") QAEvent event8 = QAEventBuilder.createTarget(context, col1, "Science and Freedom 3")
.withSource(COAR_NOTIFY) .withSource(COAR_NOTIFY)
.withTopic("ENRICH/MISSING/PID") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID)
.withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144302\"}").build(); .withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144302\"}").build();
QAEvent event9 = QAEventBuilder.createTarget(context, col1, "Science and Freedom 4") QAEvent event9 = QAEventBuilder.createTarget(context, col1, "Science and Freedom 4")
.withSource(COAR_NOTIFY) .withSource(COAR_NOTIFY)
.withTopic("ENRICH/MISSING/PID") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID)
.withMessage("{\"pids[0].type\":\"pmc\",\"pids[0].value\":\"2144303\"}").build(); .withMessage("{\"pids[0].type\":\"pmc\",\"pids[0].value\":\"2144303\"}").build();
QAEvent event10 = QAEventBuilder.createTarget(context, col1, "Science and Freedom 5") QAEvent event10 = QAEventBuilder.createTarget(context, col1, "Science and Freedom 5")
.withSource(COAR_NOTIFY) .withSource(COAR_NOTIFY)
.withTopic("ENRICH/MISSING/PID") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID)
.withMessage("{\"pids[0].type\":\"pmid\",\"pids[0].value\":\"2144304\"}").build(); .withMessage("{\"pids[0].type\":\"pmid\",\"pids[0].value\":\"2144304\"}").build();
context.setCurrentUser(admin); context.setCurrentUser(admin);
// this event will be related to an item submitted by the admin // this event will be related to an item submitted by the admin
QAEvent event11 = QAEventBuilder.createTarget(context, col1, "Science and Freedom 5") QAEvent event11 = QAEventBuilder.createTarget(context, col1, "Science and Freedom 5")
.withSource(COAR_NOTIFY) .withSource(COAR_NOTIFY)
.withTopic("ENRICH/MISSING/PID") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID)
.withMessage("{\"pids[0].type\":\"pmid\",\"pids[0].value\":\"2144304\"}").build(); .withMessage("{\"pids[0].type\":\"pmid\",\"pids[0].value\":\"2144304\"}").build();
context.restoreAuthSystemState(); context.restoreAuthSystemState();
@@ -597,16 +598,16 @@ public class QAEventRestRepositoryIT extends AbstractControllerIntegrationTest {
parentCommunity = CommunityBuilder.createCommunity(context).withName("Parent Community").build(); parentCommunity = CommunityBuilder.createCommunity(context).withName("Parent Community").build();
Collection col1 = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection 1").build(); Collection col1 = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection 1").build();
QAEvent event1 = QAEventBuilder.createTarget(context, col1, "Science and Freedom") QAEvent event1 = QAEventBuilder.createTarget(context, col1, "Science and Freedom")
.withTopic("ENRICH/MISSING/PID") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID)
.withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144300\"}").build(); .withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144300\"}").build();
QAEvent event2 = QAEventBuilder.createTarget(context, col1, "Science and Freedom 2") QAEvent event2 = QAEventBuilder.createTarget(context, col1, "Science and Freedom 2")
.withTopic("ENRICH/MISSING/PID") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID)
.withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144301\"}").build(); .withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144301\"}").build();
QAEvent event3 = QAEventBuilder.createTarget(context, col1, "Science and Freedom 3") QAEvent event3 = QAEventBuilder.createTarget(context, col1, "Science and Freedom 3")
.withTopic("ENRICH/MORE/PID") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MORE_PID)
.withMessage("{\"pids[0].type\":\"pmid\",\"pids[0].value\":\"10.2307/2144302\"}").build(); .withMessage("{\"pids[0].type\":\"pmid\",\"pids[0].value\":\"10.2307/2144302\"}").build();
QAEvent event4 = QAEventBuilder.createTarget(context, col1, "Science and Freedom 4") QAEvent event4 = QAEventBuilder.createTarget(context, col1, "Science and Freedom 4")
.withTopic("ENRICH/MISSING/ABSTRACT") .withTopic(org.dspace.qaevent.QANotifyPatterns.TOPIC_ENRICH_MISSING_ABSTRACT)
.withMessage("{\"abstracts[0]\": \"Descrizione delle caratteristiche...\"}").build(); .withMessage("{\"abstracts[0]\": \"Descrizione delle caratteristiche...\"}").build();
context.restoreAuthSystemState(); context.restoreAuthSystemState();
getClient() getClient()
@@ -622,16 +623,16 @@ public class QAEventRestRepositoryIT extends AbstractControllerIntegrationTest {
parentCommunity = CommunityBuilder.createCommunity(context).withName("Parent Community").build(); parentCommunity = CommunityBuilder.createCommunity(context).withName("Parent Community").build();
Collection col1 = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection 1").build(); Collection col1 = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection 1").build();
QAEvent event1 = QAEventBuilder.createTarget(context, col1, "Science and Freedom") QAEvent event1 = QAEventBuilder.createTarget(context, col1, "Science and Freedom")
.withTopic("ENRICH/MISSING/PID") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID)
.withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144300\"}").build(); .withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144300\"}").build();
QAEvent event2 = QAEventBuilder.createTarget(context, col1, "Science and Freedom 2") QAEvent event2 = QAEventBuilder.createTarget(context, col1, "Science and Freedom 2")
.withTopic("ENRICH/MISSING/PID") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID)
.withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144301\"}").build(); .withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144301\"}").build();
QAEvent event3 = QAEventBuilder.createTarget(context, col1, "Science and Freedom 3") QAEvent event3 = QAEventBuilder.createTarget(context, col1, "Science and Freedom 3")
.withTopic("ENRICH/MORE/PID") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MORE_PID)
.withMessage("{\"pids[0].type\":\"pmid\",\"pids[0].value\":\"10.2307/2144302\"}").build(); .withMessage("{\"pids[0].type\":\"pmid\",\"pids[0].value\":\"10.2307/2144302\"}").build();
QAEvent event4 = QAEventBuilder.createTarget(context, col1, "Science and Freedom 4") QAEvent event4 = QAEventBuilder.createTarget(context, col1, "Science and Freedom 4")
.withTopic("ENRICH/MISSING/ABSTRACT") .withTopic(org.dspace.qaevent.QANotifyPatterns.TOPIC_ENRICH_MISSING_ABSTRACT)
.withMessage("{\"abstracts[0]\": \"Descrizione delle caratteristiche...\"}").build(); .withMessage("{\"abstracts[0]\": \"Descrizione delle caratteristiche...\"}").build();
context.restoreAuthSystemState(); context.restoreAuthSystemState();
String adminToken = getAuthToken(admin.getEmail(), password); String adminToken = getAuthToken(admin.getEmail(), password);
@@ -657,7 +658,7 @@ public class QAEventRestRepositoryIT extends AbstractControllerIntegrationTest {
Item funding = ItemBuilder.createItem(context, colFunding).withTitle("Tracking Papyrus and Parchment Paths") Item funding = ItemBuilder.createItem(context, colFunding).withTitle("Tracking Papyrus and Parchment Paths")
.build(); .build();
QAEvent eventProjectBound = QAEventBuilder.createTarget(context, col1, "Science and Freedom with project") QAEvent eventProjectBound = QAEventBuilder.createTarget(context, col1, "Science and Freedom with project")
.withTopic("ENRICH/MISSING/PROJECT") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PROJECT)
.withMessage( .withMessage(
"{\"projects[0].acronym\":\"PAThs\"," "{\"projects[0].acronym\":\"PAThs\","
+ "\"projects[0].code\":\"687567\"," + "\"projects[0].code\":\"687567\","
@@ -673,7 +674,7 @@ public class QAEventRestRepositoryIT extends AbstractControllerIntegrationTest {
.build(); .build();
QAEvent eventProjectNoBound = QAEventBuilder QAEvent eventProjectNoBound = QAEventBuilder
.createTarget(context, col1, "Science and Freedom with unrelated project") .createTarget(context, col1, "Science and Freedom with unrelated project")
.withTopic("ENRICH/MISSING/PROJECT") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PROJECT)
.withMessage( .withMessage(
"{\"projects[0].acronym\":\"NEW\"," "{\"projects[0].acronym\":\"NEW\","
+ "\"projects[0].code\":\"123456\"," + "\"projects[0].code\":\"123456\","
@@ -684,24 +685,24 @@ public class QAEventRestRepositoryIT extends AbstractControllerIntegrationTest {
+ "\"projects[0].title\":\"A new project\"}") + "\"projects[0].title\":\"A new project\"}")
.build(); .build();
QAEvent eventMissingPID1 = QAEventBuilder.createTarget(context, col1, "Science and Freedom") QAEvent eventMissingPID1 = QAEventBuilder.createTarget(context, col1, "Science and Freedom")
.withTopic("ENRICH/MISSING/PID") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID)
.withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144300\"}").build(); .withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144300\"}").build();
QAEvent eventMissingPID2 = QAEventBuilder.createTarget(context, col1, "Science and Freedom 2") QAEvent eventMissingPID2 = QAEventBuilder.createTarget(context, col1, "Science and Freedom 2")
.withTopic("ENRICH/MISSING/PID") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID)
.withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144301\"}").build(); .withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144301\"}").build();
QAEvent eventMissingUnknownPID = QAEventBuilder.createTarget(context, col1, "Science and Freedom URN PID") QAEvent eventMissingUnknownPID = QAEventBuilder.createTarget(context, col1, "Science and Freedom URN PID")
.withTopic("ENRICH/MISSING/PID") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID)
.withMessage( .withMessage(
"{\"pids[0].type\":\"urn\",\"pids[0].value\":\"http://thesis2.sba.units.it/store/handle/item/12937\"}") "{\"pids[0].type\":\"urn\",\"pids[0].value\":\"http://thesis2.sba.units.it/store/handle/item/12937\"}")
.build(); .build();
QAEvent eventMorePID = QAEventBuilder.createTarget(context, col1, "Science and Freedom 3") QAEvent eventMorePID = QAEventBuilder.createTarget(context, col1, "Science and Freedom 3")
.withTopic("ENRICH/MORE/PID") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MORE_PID)
.withMessage("{\"pids[0].type\":\"pmid\",\"pids[0].value\":\"2144302\"}").build(); .withMessage("{\"pids[0].type\":\"pmid\",\"pids[0].value\":\"2144302\"}").build();
QAEvent eventAbstract = QAEventBuilder.createTarget(context, col1, "Science and Freedom 4") QAEvent eventAbstract = QAEventBuilder.createTarget(context, col1, "Science and Freedom 4")
.withTopic("ENRICH/MISSING/ABSTRACT") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_ABSTRACT)
.withMessage("{\"abstracts[0]\": \"An abstract to add...\"}").build(); .withMessage("{\"abstracts[0]\": \"An abstract to add...\"}").build();
QAEvent eventAbstractToDiscard = QAEventBuilder.createTarget(context, col1, "Science and Freedom 7") QAEvent eventAbstractToDiscard = QAEventBuilder.createTarget(context, col1, "Science and Freedom 7")
.withTopic("ENRICH/MISSING/ABSTRACT") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_ABSTRACT)
.withMessage("{\"abstracts[0]\": \"Abstract to discard...\"}").build(); .withMessage("{\"abstracts[0]\": \"Abstract to discard...\"}").build();
context.restoreAuthSystemState(); context.restoreAuthSystemState();
// prepare the different patches for our decisions // prepare the different patches for our decisions
@@ -834,7 +835,7 @@ public class QAEventRestRepositoryIT extends AbstractControllerIntegrationTest {
Collection colFunding = CollectionBuilder.createCollection(context, parentCommunity) Collection colFunding = CollectionBuilder.createCollection(context, parentCommunity)
.withName("Collection Fundings").build(); .withName("Collection Fundings").build();
QAEvent event = QAEventBuilder.createTarget(context, col1, "Science and Freedom 5") QAEvent event = QAEventBuilder.createTarget(context, col1, "Science and Freedom 5")
.withTopic("ENRICH/MISSING/PROJECT") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PROJECT)
.withMessage( .withMessage(
"{\"projects[0].acronym\":\"PAThs\"," "{\"projects[0].acronym\":\"PAThs\","
+ "\"projects[0].code\":\"687567\"," + "\"projects[0].code\":\"687567\","
@@ -883,7 +884,7 @@ public class QAEventRestRepositoryIT extends AbstractControllerIntegrationTest {
Item funding = ItemBuilder.createItem(context, colFunding).withTitle("Tracking Papyrus and Parchment Paths") Item funding = ItemBuilder.createItem(context, colFunding).withTitle("Tracking Papyrus and Parchment Paths")
.build(); .build();
QAEvent event = QAEventBuilder.createTarget(context, col1, "Science and Freedom 5") QAEvent event = QAEventBuilder.createTarget(context, col1, "Science and Freedom 5")
.withTopic("ENRICH/MISSING/PROJECT") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PROJECT)
.withMessage( .withMessage(
"{\"projects[0].acronym\":\"PAThs\"," "{\"projects[0].acronym\":\"PAThs\","
+ "\"projects[0].code\":\"687567\"," + "\"projects[0].code\":\"687567\","
@@ -926,7 +927,7 @@ public class QAEventRestRepositoryIT extends AbstractControllerIntegrationTest {
Collection colFunding = CollectionBuilder.createCollection(context, parentCommunity) Collection colFunding = CollectionBuilder.createCollection(context, parentCommunity)
.withName("Collection Fundings").build(); .withName("Collection Fundings").build();
QAEvent event = QAEventBuilder.createTarget(context, col1, "Science and Freedom") QAEvent event = QAEventBuilder.createTarget(context, col1, "Science and Freedom")
.withTopic("ENRICH/MISSING/PID") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID)
.withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144300\"}").build(); .withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144300\"}").build();
Item funding = ItemBuilder.createItem(context, colFunding).withTitle("Tracking Papyrus and Parchment Paths") Item funding = ItemBuilder.createItem(context, colFunding).withTitle("Tracking Papyrus and Parchment Paths")
.build(); .build();
@@ -954,10 +955,10 @@ public class QAEventRestRepositoryIT extends AbstractControllerIntegrationTest {
parentCommunity = CommunityBuilder.createCommunity(context).withName("Parent Community").build(); parentCommunity = CommunityBuilder.createCommunity(context).withName("Parent Community").build();
Collection col1 = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection 1").build(); Collection col1 = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection 1").build();
QAEvent event1 = QAEventBuilder.createTarget(context, col1, "Science and Freedom") QAEvent event1 = QAEventBuilder.createTarget(context, col1, "Science and Freedom")
.withTopic("ENRICH/MISSING/PID") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID)
.withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144300\"}").build(); .withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144300\"}").build();
QAEvent event2 = QAEventBuilder.createTarget(context, col1, "Science and Freedom 2") QAEvent event2 = QAEventBuilder.createTarget(context, col1, "Science and Freedom 2")
.withTopic("ENRICH/MISSING/PID") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID)
.withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144301\"}").build(); .withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144301\"}").build();
context.restoreAuthSystemState(); context.restoreAuthSystemState();
String authToken = getAuthToken(admin.getEmail(), password); String authToken = getAuthToken(admin.getEmail(), password);
@@ -1000,7 +1001,7 @@ public class QAEventRestRepositoryIT extends AbstractControllerIntegrationTest {
.build(); .build();
QAEvent event = QAEventBuilder.createTarget(context, col1, "Science and Freedom") QAEvent event = QAEventBuilder.createTarget(context, col1, "Science and Freedom")
.withTopic("ENRICH/MISSING/PID") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID)
.withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144300\"}") .withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144300\"}")
.build(); .build();
@@ -1044,7 +1045,7 @@ public class QAEventRestRepositoryIT extends AbstractControllerIntegrationTest {
QAEventBuilder.createTarget(context, item) QAEventBuilder.createTarget(context, item)
.withSource(COAR_NOTIFY) .withSource(COAR_NOTIFY)
.withTrust(0.8) .withTrust(0.8)
.withTopic("ENRICH/MORE/REVIEW") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MORE_REVIEW)
.withMessage("{\"abstracts[0]\": \"https://doi.org/10.3214/987654\"}") .withMessage("{\"abstracts[0]\": \"https://doi.org/10.3214/987654\"}")
.build(); .build();
@@ -1071,7 +1072,7 @@ public class QAEventRestRepositoryIT extends AbstractControllerIntegrationTest {
QAEventBuilder.createTarget(context, item) QAEventBuilder.createTarget(context, item)
.withSource(COAR_NOTIFY) .withSource(COAR_NOTIFY)
.withTrust(0.4) .withTrust(0.4)
.withTopic("ENRICH/MORE/REVIEW") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MORE_REVIEW)
.withMessage("{\"abstracts[0]\": \"https://doi.org/10.3214/987654\"}") .withMessage("{\"abstracts[0]\": \"https://doi.org/10.3214/987654\"}")
.build(); .build();
@@ -1097,7 +1098,7 @@ public class QAEventRestRepositoryIT extends AbstractControllerIntegrationTest {
QAEventBuilder.createTarget(context, item) QAEventBuilder.createTarget(context, item)
.withSource(COAR_NOTIFY) .withSource(COAR_NOTIFY)
.withTrust(0.3) .withTrust(0.3)
.withTopic("ENRICH/MORE/REVIEW") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MORE_REVIEW)
.withMessage("{\"abstracts[0]\": \"https://doi.org/10.3214/987654\"}") .withMessage("{\"abstracts[0]\": \"https://doi.org/10.3214/987654\"}")
.build(); .build();
@@ -1123,7 +1124,7 @@ public class QAEventRestRepositoryIT extends AbstractControllerIntegrationTest {
QAEventBuilder.createTarget(context, item) QAEventBuilder.createTarget(context, item)
.withSource(COAR_NOTIFY) .withSource(COAR_NOTIFY)
.withTrust(0.7) .withTrust(0.7)
.withTopic("ENRICH/MORE/REVIEW") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MORE_REVIEW)
.withMessage("{\"abstracts[0]\": \"https://doi.org/10.3214/987654\"}") .withMessage("{\"abstracts[0]\": \"https://doi.org/10.3214/987654\"}")
.build(); .build();
@@ -1151,7 +1152,7 @@ public class QAEventRestRepositoryIT extends AbstractControllerIntegrationTest {
QAEventBuilder.createTarget(context, item) QAEventBuilder.createTarget(context, item)
.withSource(COAR_NOTIFY) .withSource(COAR_NOTIFY)
.withTrust(0.8) .withTrust(0.8)
.withTopic("ENRICH/MORE/REVIEW") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MORE_REVIEW)
.withMessage("{\"abstracts[0]\": \"https://doi.org/10.3214/987654\"}") .withMessage("{\"abstracts[0]\": \"https://doi.org/10.3214/987654\"}")
.build(); .build();

View File

@@ -97,17 +97,16 @@ public class QASourceRestRepositoryIT extends AbstractControllerIntegrationTest
matchQASourceEntry("test-source-2", 0)))) matchQASourceEntry("test-source-2", 0))))
.andExpect(jsonPath("$.page.size", is(20))) .andExpect(jsonPath("$.page.size", is(20)))
.andExpect(jsonPath("$.page.totalElements", is(4))); .andExpect(jsonPath("$.page.totalElements", is(4)));
// check with our eperson submitter
authToken = getAuthToken(eperson.getEmail(), password);
getClient(authToken).perform(get("/api/integration/qualityassurancesources")) getClient(authToken).perform(get("/api/integration/qualityassurancesources"))
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(content().contentType(contentType)) .andExpect(content().contentType(contentType))
.andExpect(jsonPath("$._embedded.qualityassurancesources", contains( .andExpect(jsonPath("$._embedded.qualityassurancesources", contains(
matchQASourceEntry("coar-notify", 2), matchQASourceEntry("coar-notify", 3))))
matchQASourceEntry("openaire", 0),
matchQASourceEntry("test-source", 0),
matchQASourceEntry("test-source-2", 0))))
.andExpect(jsonPath("$.page.size", is(20))) .andExpect(jsonPath("$.page.size", is(20)))
.andExpect(jsonPath("$.page.totalElements", is(4))); .andExpect(jsonPath("$.page.totalElements", is(1)));
} }
@Test @Test
@@ -130,16 +129,16 @@ public class QASourceRestRepositoryIT extends AbstractControllerIntegrationTest
context.turnOffAuthorisationSystem(); context.turnOffAuthorisationSystem();
createEvent("openaire", "TOPIC/OPENAIRE/1", "Title 1"); createEvent(QAEvent.OPENAIRE_SOURCE, "TOPIC/OPENAIRE/1", "Title 1");
createEvent("openaire", "TOPIC/OPENAIRE/2", "Title 2"); createEvent(QAEvent.OPENAIRE_SOURCE, "TOPIC/OPENAIRE/2", "Title 2");
createEvent("openaire", "TOPIC/OPENAIRE/2", "Title 3"); createEvent(QAEvent.OPENAIRE_SOURCE, "TOPIC/OPENAIRE/2", "Title 3");
createEvent("test-source", "TOPIC/TEST/1", "Title 4"); createEvent("test-source", "TOPIC/TEST/1", "Title 4");
createEvent("test-source", "TOPIC/TEST/1", "Title 5"); createEvent("test-source", "TOPIC/TEST/1", "Title 5");
createEvent("coar-notify", "TOPIC", "Title 7"); createEvent(QAEvent.COAR_NOTIFY, "TOPIC", "Title 7");
context.setCurrentUser(eperson); context.setCurrentUser(eperson);
createEvent("coar-notify", "TOPIC", "Title 8"); createEvent(QAEvent.COAR_NOTIFY, "TOPIC", "Title 8");
createEvent("coar-notify", "TOPIC", "Title 9"); createEvent(QAEvent.COAR_NOTIFY, "TOPIC", "Title 9");
context.setCurrentUser(null); context.setCurrentUser(null);
context.restoreAuthSystemState(); context.restoreAuthSystemState();
@@ -172,8 +171,8 @@ public class QASourceRestRepositoryIT extends AbstractControllerIntegrationTest
getClient(authToken).perform(get("/api/integration/qualityassurancesources/openaire")) getClient(authToken).perform(get("/api/integration/qualityassurancesources/openaire"))
.andExpect(status().isForbidden()); .andExpect(status().isForbidden());
getClient(authToken).perform(get("/api/integration/qualityassurancesources/unknown-test-source")) getClient(authToken).perform(get("/api/integration/qualityassurancesources/unknown-test-source"))
.andExpect(status().isNotFound()); .andExpect(status().isForbidden());
// the eperson will see only 2 events in coar-notify as 1 is related ot an item was submitted by other // the eperson will see only 2 events in coar-notify as 1 is related to an item was submitted by other
getClient(authToken).perform(get("/api/integration/qualityassurancesources/coar-notify")) getClient(authToken).perform(get("/api/integration/qualityassurancesources/coar-notify"))
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(content().contentType(contentType)) .andExpect(content().contentType(contentType))
@@ -203,7 +202,7 @@ public class QASourceRestRepositoryIT extends AbstractControllerIntegrationTest
context.turnOffAuthorisationSystem(); context.turnOffAuthorisationSystem();
createEvent("openaire", "TOPIC/OPENAIRE/1", "Title 1"); createEvent(QAEvent.OPENAIRE_SOURCE, "TOPIC/OPENAIRE/1", "Title 1");
createEvent("test-source", "TOPIC/TEST/1", "Title 4"); createEvent("test-source", "TOPIC/TEST/1", "Title 4");
context.restoreAuthSystemState(); context.restoreAuthSystemState();
@@ -221,17 +220,17 @@ public class QASourceRestRepositoryIT extends AbstractControllerIntegrationTest
Collection col = CollectionBuilder.createCollection(context, com).withName("Test collection").build(); Collection col = CollectionBuilder.createCollection(context, com).withName("Test collection").build();
Item target1 = ItemBuilder.createItem(context, col).withTitle("Test item1").build(); Item target1 = ItemBuilder.createItem(context, col).withTitle("Test item1").build();
Item target2 = ItemBuilder.createItem(context, col).withTitle("Test item2").build(); Item target2 = ItemBuilder.createItem(context, col).withTitle("Test item2").build();
createEvent("openaire", "TOPIC/OPENAIRE/1", target1); createEvent(QAEvent.OPENAIRE_SOURCE, "TOPIC/OPENAIRE/1", target1);
createEvent("openaire", "TOPIC/OPENAIRE/2", target1); createEvent(QAEvent.OPENAIRE_SOURCE, "TOPIC/OPENAIRE/2", target1);
createEvent("test-source", "TOPIC/TEST/1", target1); createEvent("test-source", "TOPIC/TEST/1", target1);
createEvent("test-source", "TOPIC/TEST/1", target2); createEvent("test-source", "TOPIC/TEST/1", target2);
context.setCurrentUser(eperson); context.setCurrentUser(eperson);
Item target3 = ItemBuilder.createItem(context, col).withTitle("Test item3").build(); Item target3 = ItemBuilder.createItem(context, col).withTitle("Test item3").build();
context.setCurrentUser(null); context.setCurrentUser(null);
createEvent("coar-notify", "TOPIC", target3); createEvent(QAEvent.COAR_NOTIFY, "TOPIC", target3);
createEvent("coar-notify", "TOPIC", target3); createEvent(QAEvent.COAR_NOTIFY, "TOPIC2", target3);
createEvent("coar-notify", "TOPIC", target2); createEvent(QAEvent.COAR_NOTIFY, "TOPIC", target2);
context.restoreAuthSystemState(); context.restoreAuthSystemState();
String authToken = getAuthToken(admin.getEmail(), password); String authToken = getAuthToken(admin.getEmail(), password);
@@ -240,7 +239,7 @@ public class QASourceRestRepositoryIT extends AbstractControllerIntegrationTest
target1.getID().toString())) target1.getID().toString()))
.andExpect(status().isOk()).andExpect(content().contentType(contentType)) .andExpect(status().isOk()).andExpect(content().contentType(contentType))
.andExpect(jsonPath("$._embedded.qualityassurancesources", .andExpect(jsonPath("$._embedded.qualityassurancesources",
contains(matchQASourceEntry("openaire:" + target1.getID().toString(), 2), contains(matchQASourceEntry(QAEvent.OPENAIRE_SOURCE + ":" + target1.getID().toString(), 2),
matchQASourceEntry("test-source:" + target1.getID().toString(), 1)))) matchQASourceEntry("test-source:" + target1.getID().toString(), 1))))
.andExpect(jsonPath("$.page.size", is(20))) .andExpect(jsonPath("$.page.size", is(20)))
.andExpect(jsonPath("$.page.totalElements", is(2))); .andExpect(jsonPath("$.page.totalElements", is(2)));
@@ -251,7 +250,7 @@ public class QASourceRestRepositoryIT extends AbstractControllerIntegrationTest
.andExpect(status().isOk()).andExpect(content().contentType(contentType)) .andExpect(status().isOk()).andExpect(content().contentType(contentType))
.andExpect(jsonPath("$._embedded.qualityassurancesources", .andExpect(jsonPath("$._embedded.qualityassurancesources",
contains( contains(
matchQASourceEntry("coar-notify:" + target2.getID().toString(), 1), matchQASourceEntry(QAEvent.COAR_NOTIFY + ":" + target2.getID().toString(), 1),
matchQASourceEntry("test-source:" + target2.getID().toString(), 1)))) matchQASourceEntry("test-source:" + target2.getID().toString(), 1))))
.andExpect(jsonPath("$.page.size", is(20))) .andExpect(jsonPath("$.page.size", is(20)))
.andExpect(jsonPath("$.page.totalElements", is(2))); .andExpect(jsonPath("$.page.totalElements", is(2)));
@@ -260,7 +259,7 @@ public class QASourceRestRepositoryIT extends AbstractControllerIntegrationTest
target3.getID().toString())) target3.getID().toString()))
.andExpect(status().isOk()).andExpect(content().contentType(contentType)) .andExpect(status().isOk()).andExpect(content().contentType(contentType))
.andExpect(jsonPath("$._embedded.qualityassurancesources", .andExpect(jsonPath("$._embedded.qualityassurancesources",
contains(matchQASourceEntry("coar-notify:" + target3.getID().toString(), 2)))) contains(matchQASourceEntry("coar-notify:" + target3.getID().toString(), 2))))
.andExpect(jsonPath("$.page.size", is(20))) .andExpect(jsonPath("$.page.size", is(20)))
.andExpect(jsonPath("$.page.totalElements", is(1))); .andExpect(jsonPath("$.page.totalElements", is(1)));
@@ -277,7 +276,7 @@ public class QASourceRestRepositoryIT extends AbstractControllerIntegrationTest
target2.getID().toString())) target2.getID().toString()))
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(jsonPath("$.page.size", is(20))) .andExpect(jsonPath("$.page.size", is(20)))
.andExpect(jsonPath("$.page.totalElements", is(0))); .andExpect(jsonPath("$.page.totalElements", is(1)));
getClient(authToken) getClient(authToken)
.perform(get("/api/integration/qualityassurancesources/search/byTarget").param("target", .perform(get("/api/integration/qualityassurancesources/search/byTarget").param("target",
target3.getID().toString())) target3.getID().toString()))
@@ -296,8 +295,8 @@ public class QASourceRestRepositoryIT extends AbstractControllerIntegrationTest
Collection col = CollectionBuilder.createCollection(context, com).withName("Test collection").build(); Collection col = CollectionBuilder.createCollection(context, com).withName("Test collection").build();
Item target1 = ItemBuilder.createItem(context, col).withTitle("Test item1").build(); Item target1 = ItemBuilder.createItem(context, col).withTitle("Test item1").build();
Item target2 = ItemBuilder.createItem(context, col).withTitle("Test item2").build(); Item target2 = ItemBuilder.createItem(context, col).withTitle("Test item2").build();
createEvent("openaire", "TOPIC/OPENAIRE/1", target1); createEvent(QAEvent.OPENAIRE_SOURCE, "TOPIC/OPENAIRE/1", target1);
createEvent("openaire", "TOPIC/OPENAIRE/2", target1); createEvent(QAEvent.OPENAIRE_SOURCE, "TOPIC/OPENAIRE/2", target1);
createEvent("test-source", "TOPIC/TEST/1", target1); createEvent("test-source", "TOPIC/TEST/1", target1);
createEvent("test-source", "TOPIC/TEST/1", target2); createEvent("test-source", "TOPIC/TEST/1", target2);
@@ -318,8 +317,8 @@ public class QASourceRestRepositoryIT extends AbstractControllerIntegrationTest
Collection col = CollectionBuilder.createCollection(context, com).withName("Test collection").build(); Collection col = CollectionBuilder.createCollection(context, com).withName("Test collection").build();
Item target1 = ItemBuilder.createItem(context, col).withTitle("Test item1").build(); Item target1 = ItemBuilder.createItem(context, col).withTitle("Test item1").build();
Item target2 = ItemBuilder.createItem(context, col).withTitle("Test item2").build(); Item target2 = ItemBuilder.createItem(context, col).withTitle("Test item2").build();
createEvent("openaire", "TOPIC/OPENAIRE/1", target1); createEvent(QAEvent.OPENAIRE_SOURCE, "TOPIC/OPENAIRE/1", target1);
createEvent("openaire", "TOPIC/OPENAIRE/2", target1); createEvent(QAEvent.OPENAIRE_SOURCE, "TOPIC/OPENAIRE/2", target1);
createEvent("test-source", "TOPIC/TEST/1", target1); createEvent("test-source", "TOPIC/TEST/1", target1);
createEvent("test-source", "TOPIC/TEST/1", target2); createEvent("test-source", "TOPIC/TEST/1", target2);

View File

@@ -25,6 +25,7 @@ import org.dspace.builder.QAEventBuilder;
import org.dspace.content.Collection; import org.dspace.content.Collection;
import org.dspace.content.Item; import org.dspace.content.Item;
import org.dspace.content.QAEvent; import org.dspace.content.QAEvent;
import org.dspace.qaevent.QANotifyPatterns;
import org.dspace.services.ConfigurationService; import org.dspace.services.ConfigurationService;
import org.hamcrest.Matchers; import org.hamcrest.Matchers;
import org.junit.Test; import org.junit.Test;
@@ -49,16 +50,16 @@ public class QATopicRestRepositoryIT extends AbstractControllerIntegrationTest {
.build(); .build();
Collection col1 = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection 1").build(); Collection col1 = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection 1").build();
QAEventBuilder.createTarget(context, col1, "Science and Freedom") QAEventBuilder.createTarget(context, col1, "Science and Freedom")
.withTopic("ENRICH/MISSING/PID") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID)
.withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144300\"}").build(); .withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144300\"}").build();
QAEventBuilder.createTarget(context, col1, "Science and Freedom 2") QAEventBuilder.createTarget(context, col1, "Science and Freedom 2")
.withTopic("ENRICH/MISSING/PID") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID)
.withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144301\"}").build(); .withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144301\"}").build();
QAEventBuilder.createTarget(context, col1, "Science and Freedom 3") QAEventBuilder.createTarget(context, col1, "Science and Freedom 3")
.withTopic("ENRICH/MORE/PID") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MORE_PID)
.withMessage("{\"pids[0].type\":\"pmid\",\"pids[0].value\":\"10.2307/2144302\"}").build(); .withMessage("{\"pids[0].type\":\"pmid\",\"pids[0].value\":\"10.2307/2144302\"}").build();
QAEventBuilder.createTarget(context, col1, "Science and Freedom 4") QAEventBuilder.createTarget(context, col1, "Science and Freedom 4")
.withTopic("ENRICH/MISSING/ABSTRACT") .withTopic(org.dspace.qaevent.QANotifyPatterns.TOPIC_ENRICH_MISSING_ABSTRACT)
.withMessage( .withMessage(
"{\"abstracts[0]\": \"Descrizione delle caratteristiche...\"}") "{\"abstracts[0]\": \"Descrizione delle caratteristiche...\"}")
.build(); .build();
@@ -78,16 +79,16 @@ public class QATopicRestRepositoryIT extends AbstractControllerIntegrationTest {
.build(); .build();
Collection col1 = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection 1").build(); Collection col1 = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection 1").build();
QAEventBuilder.createTarget(context, col1, "Science and Freedom") QAEventBuilder.createTarget(context, col1, "Science and Freedom")
.withTopic("ENRICH/MISSING/PID") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID)
.withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144300\"}").build(); .withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144300\"}").build();
QAEventBuilder.createTarget(context, col1, "Science and Freedom 2") QAEventBuilder.createTarget(context, col1, "Science and Freedom 2")
.withTopic("ENRICH/MISSING/PID") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID)
.withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144301\"}").build(); .withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144301\"}").build();
QAEventBuilder.createTarget(context, col1, "Science and Freedom 3") QAEventBuilder.createTarget(context, col1, "Science and Freedom 3")
.withTopic("ENRICH/MORE/PID") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MORE_PID)
.withMessage("{\"pids[0].type\":\"pmid\",\"pids[0].value\":\"10.2307/2144302\"}").build(); .withMessage("{\"pids[0].type\":\"pmid\",\"pids[0].value\":\"10.2307/2144302\"}").build();
QAEventBuilder.createTarget(context, col1, "Science and Freedom 4") QAEventBuilder.createTarget(context, col1, "Science and Freedom 4")
.withTopic("ENRICH/MISSING/ABSTRACT") .withTopic(org.dspace.qaevent.QANotifyPatterns.TOPIC_ENRICH_MISSING_ABSTRACT)
.withMessage( .withMessage(
"{\"test\": \"Test...\"}") "{\"test\": \"Test...\"}")
.build(); .build();
@@ -101,13 +102,16 @@ public class QATopicRestRepositoryIT extends AbstractControllerIntegrationTest {
String authToken = getAuthToken(admin.getEmail(), password); String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken).perform(get("/api/integration/qualityassurancetopics/openaire:ENRICH!MISSING!PID")) getClient(authToken).perform(get("/api/integration/qualityassurancetopics/openaire:ENRICH!MISSING!PID"))
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(jsonPath("$", QATopicMatcher.matchQATopicEntry("ENRICH/MISSING/PID", 2))); .andExpect(jsonPath("$",
QATopicMatcher.matchQATopicEntry(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID, 2)));
getClient(authToken).perform(get("/api/integration/qualityassurancetopics/openaire:ENRICH!MISSING!ABSTRACT")) getClient(authToken).perform(get("/api/integration/qualityassurancetopics/openaire:ENRICH!MISSING!ABSTRACT"))
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(jsonPath("$", QATopicMatcher.matchQATopicEntry("ENRICH/MISSING/ABSTRACT", 1))); .andExpect(jsonPath("$",
QATopicMatcher.matchQATopicEntry(QANotifyPatterns.TOPIC_ENRICH_MISSING_ABSTRACT, 1)));
getClient(authToken).perform(get("/api/integration/qualityassurancetopics/test-source:TOPIC!TEST")) getClient(authToken).perform(get("/api/integration/qualityassurancetopics/test-source:TOPIC!TEST"))
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(jsonPath("$", QATopicMatcher.matchQATopicEntry("test-source", "TOPIC/TEST", 1))); .andExpect(jsonPath("$",
QATopicMatcher.matchQATopicEntry("test-source", "TOPIC/TEST", 1)));
} }
@Test @Test
@@ -120,7 +124,7 @@ public class QATopicRestRepositoryIT extends AbstractControllerIntegrationTest {
.build(); .build();
Collection col1 = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection 1").build(); Collection col1 = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection 1").build();
QAEventBuilder.createTarget(context, col1, "Science and Freedom") QAEventBuilder.createTarget(context, col1, "Science and Freedom")
.withTopic("ENRICH/MISSING/PID") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID)
.withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144300\"}").build(); .withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144300\"}").build();
context.restoreAuthSystemState(); context.restoreAuthSystemState();
String authToken = getAuthToken(admin.getEmail(), password); String authToken = getAuthToken(admin.getEmail(), password);
@@ -144,7 +148,7 @@ public class QATopicRestRepositoryIT extends AbstractControllerIntegrationTest {
.build(); .build();
Collection col1 = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection 1").build(); Collection col1 = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection 1").build();
QAEventBuilder.createTarget(context, col1, "Science and Freedom") QAEventBuilder.createTarget(context, col1, "Science and Freedom")
.withTopic("ENRICH/MISSING/PID").build(); .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID).build();
context.restoreAuthSystemState(); context.restoreAuthSystemState();
getClient().perform(get("/api/integration/qualityassurancetopics/openaire:ENRICH!MISSING!PID")) getClient().perform(get("/api/integration/qualityassurancetopics/openaire:ENRICH!MISSING!PID"))
.andExpect(status().isUnauthorized()); .andExpect(status().isUnauthorized());
@@ -160,7 +164,7 @@ public class QATopicRestRepositoryIT extends AbstractControllerIntegrationTest {
.build(); .build();
Collection col1 = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection 1").build(); Collection col1 = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection 1").build();
QAEventBuilder.createTarget(context, col1, "Science and Freedom") QAEventBuilder.createTarget(context, col1, "Science and Freedom")
.withTopic("ENRICH/MISSING/PID").build(); .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID).build();
context.restoreAuthSystemState(); context.restoreAuthSystemState();
String authToken = getAuthToken(eperson.getEmail(), password); String authToken = getAuthToken(eperson.getEmail(), password);
getClient(authToken).perform(get("/api/integration/qualityassurancetopics/openaire:ENRICH!MISSING!PID")) getClient(authToken).perform(get("/api/integration/qualityassurancetopics/openaire:ENRICH!MISSING!PID"))
@@ -179,16 +183,16 @@ public class QATopicRestRepositoryIT extends AbstractControllerIntegrationTest {
.build(); .build();
Collection col1 = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection 1").build(); Collection col1 = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection 1").build();
QAEventBuilder.createTarget(context, col1, "Science and Freedom") QAEventBuilder.createTarget(context, col1, "Science and Freedom")
.withTopic("ENRICH/MISSING/PID") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID)
.withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144300\"}").build(); .withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144300\"}").build();
QAEventBuilder.createTarget(context, col1, "Science and Freedom 2") QAEventBuilder.createTarget(context, col1, "Science and Freedom 2")
.withTopic("ENRICH/MISSING/PID") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID)
.withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144301\"}").build(); .withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144301\"}").build();
QAEventBuilder.createTarget(context, col1, "Science and Freedom 3") QAEventBuilder.createTarget(context, col1, "Science and Freedom 3")
.withTopic("ENRICH/MORE/PID") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MORE_PID)
.withMessage("{\"pids[0].type\":\"pmid\",\"pids[0].value\":\"10.2307/2144302\"}").build(); .withMessage("{\"pids[0].type\":\"pmid\",\"pids[0].value\":\"10.2307/2144302\"}").build();
QAEventBuilder.createTarget(context, col1, "Science and Freedom 4") QAEventBuilder.createTarget(context, col1, "Science and Freedom 4")
.withTopic("ENRICH/MISSING/ABSTRACT") .withTopic(org.dspace.qaevent.QANotifyPatterns.TOPIC_ENRICH_MISSING_ABSTRACT)
.withMessage( .withMessage(
"{\"abstracts[0]\": \"Descrizione delle caratteristiche...\"}") "{\"abstracts[0]\": \"Descrizione delle caratteristiche...\"}")
.build(); .build();
@@ -211,9 +215,10 @@ public class QATopicRestRepositoryIT extends AbstractControllerIntegrationTest {
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(content().contentType(contentType)) .andExpect(content().contentType(contentType))
.andExpect(jsonPath("$._embedded.qualityassurancetopics", .andExpect(jsonPath("$._embedded.qualityassurancetopics",
Matchers.containsInAnyOrder(QATopicMatcher.matchQATopicEntry("ENRICH/MISSING/PID", 2), Matchers.containsInAnyOrder(
QATopicMatcher.matchQATopicEntry("ENRICH/MISSING/ABSTRACT", 1), QATopicMatcher.matchQATopicEntry(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID, 2),
QATopicMatcher.matchQATopicEntry("ENRICH/MORE/PID", 1)))) QATopicMatcher.matchQATopicEntry(QANotifyPatterns.TOPIC_ENRICH_MISSING_ABSTRACT, 1),
QATopicMatcher.matchQATopicEntry(QANotifyPatterns.TOPIC_ENRICH_MORE_PID, 1))))
.andExpect(jsonPath("$.page.size", is(20))).andExpect(jsonPath("$.page.totalElements", is(3))); .andExpect(jsonPath("$.page.size", is(20))).andExpect(jsonPath("$.page.totalElements", is(3)));
getClient(authToken).perform(get("/api/integration/qualityassurancetopics/search/bySource") getClient(authToken).perform(get("/api/integration/qualityassurancetopics/search/bySource")
.param("source", "test-source")) .param("source", "test-source"))
@@ -242,16 +247,16 @@ public class QATopicRestRepositoryIT extends AbstractControllerIntegrationTest {
//create collection //create collection
Collection col1 = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection 1").build(); Collection col1 = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection 1").build();
QAEventBuilder.createTarget(context, col1, "Science and Freedom") QAEventBuilder.createTarget(context, col1, "Science and Freedom")
.withTopic("ENRICH/MISSING/PID") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID)
.withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144300\"}").build(); .withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144300\"}").build();
QAEventBuilder.createTarget(context, col1, "Science and Freedom 2") QAEventBuilder.createTarget(context, col1, "Science and Freedom 2")
.withTopic("ENRICH/MISSING/PID") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID)
.withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144301\"}").build(); .withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144301\"}").build();
QAEventBuilder.createTarget(context, col1, "Science and Freedom 3") QAEventBuilder.createTarget(context, col1, "Science and Freedom 3")
.withTopic("ENRICH/MORE/PID") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MORE_PID)
.withMessage("{\"pids[0].type\":\"pmid\",\"pids[0].value\":\"10.2307/2144302\"}").build(); .withMessage("{\"pids[0].type\":\"pmid\",\"pids[0].value\":\"10.2307/2144302\"}").build();
QAEventBuilder.createTarget(context, col1, "Science and Freedom 4") QAEventBuilder.createTarget(context, col1, "Science and Freedom 4")
.withTopic("ENRICH/MISSING/ABSTRACT") .withTopic(org.dspace.qaevent.QANotifyPatterns.TOPIC_ENRICH_MISSING_ABSTRACT)
.withMessage( .withMessage(
"{\"abstracts[0]\": \"Descrizione delle caratteristiche...\"}") "{\"abstracts[0]\": \"Descrizione delle caratteristiche...\"}")
.build(); .build();
@@ -301,7 +306,7 @@ public class QATopicRestRepositoryIT extends AbstractControllerIntegrationTest {
.build(); .build();
Collection col1 = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection 1").build(); Collection col1 = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection 1").build();
QAEventBuilder.createTarget(context, col1, "Science and Freedom") QAEventBuilder.createTarget(context, col1, "Science and Freedom")
.withTopic("ENRICH/MISSING/PID").build(); .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID).build();
context.restoreAuthSystemState(); context.restoreAuthSystemState();
getClient().perform(get("/api/integration/qualityassurancetopics/search/bySource") getClient().perform(get("/api/integration/qualityassurancetopics/search/bySource")
.param("source", "openaire")) .param("source", "openaire"))
@@ -316,7 +321,7 @@ public class QATopicRestRepositoryIT extends AbstractControllerIntegrationTest {
.build(); .build();
Collection col1 = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection 1").build(); Collection col1 = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection 1").build();
QAEventBuilder.createTarget(context, col1, "Science and Freedom") QAEventBuilder.createTarget(context, col1, "Science and Freedom")
.withTopic("ENRICH/MISSING/PID").build(); .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID).build();
context.restoreAuthSystemState(); context.restoreAuthSystemState();
String authToken = getAuthToken(eperson.getEmail(), password); String authToken = getAuthToken(eperson.getEmail(), password);
getClient(authToken).perform(get("/api/integration/qualityassurancetopics/search/bySource") getClient(authToken).perform(get("/api/integration/qualityassurancetopics/search/bySource")
@@ -337,12 +342,12 @@ public class QATopicRestRepositoryIT extends AbstractControllerIntegrationTest {
Item item1 = ItemBuilder.createItem(context, col1).withTitle("Science and Freedom").build(); Item item1 = ItemBuilder.createItem(context, col1).withTitle("Science and Freedom").build();
Item item2 = ItemBuilder.createItem(context, col1).withTitle("Science and Freedom 2").build(); Item item2 = ItemBuilder.createItem(context, col1).withTitle("Science and Freedom 2").build();
QAEventBuilder.createTarget(context, item1) QAEventBuilder.createTarget(context, item1)
.withSource("openaire") .withSource(QAEvent.OPENAIRE_SOURCE)
.withTopic("ENRICH/MISSING/PID") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID)
.withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144300\"}").build(); .withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144300\"}").build();
QAEventBuilder.createTarget(context, item1) QAEventBuilder.createTarget(context, item1)
.withSource("openaire") .withSource(QAEvent.OPENAIRE_SOURCE)
.withTopic("ENRICH/MISSING/ABSTRACT") .withTopic(org.dspace.qaevent.QANotifyPatterns.TOPIC_ENRICH_MISSING_ABSTRACT)
.withMessage( .withMessage(
"{\"abstracts[0]\": \"Descrizione delle caratteristiche...\"}") "{\"abstracts[0]\": \"Descrizione delle caratteristiche...\"}")
.build(); .build();
@@ -355,24 +360,26 @@ public class QATopicRestRepositoryIT extends AbstractControllerIntegrationTest {
.withSource("test-source") .withSource("test-source")
.build(); .build();
QAEventBuilder.createTarget(context, item2) QAEventBuilder.createTarget(context, item2)
.withTopic("ENRICH/MISSING/PID") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID)
.withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144301\"}").build(); .withMessage("{\"pids[0].type\":\"doi\",\"pids[0].value\":\"10.2307/2144301\"}").build();
QAEventBuilder.createTarget(context, item2) QAEventBuilder.createTarget(context, item2)
.withTopic("ENRICH/MISSING/PID") .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID)
.withMessage("{\"pids[0].type\":\"pmid\",\"pids[0].value\":\"2144301\"}").build(); .withMessage("{\"pids[0].type\":\"pmid\",\"pids[0].value\":\"2144301\"}").build();
context.restoreAuthSystemState(); context.restoreAuthSystemState();
String authToken = getAuthToken(admin.getEmail(), password); String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken).perform(get("/api/integration/qualityassurancetopics/search/byTarget") getClient(authToken).perform(get("/api/integration/qualityassurancetopics/search/byTarget")
.param("target", item1.getID().toString()) .param("target", item1.getID().toString())
.param("source", "openaire")) .param("source", QAEvent.OPENAIRE_SOURCE))
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(content().contentType(contentType)) .andExpect(content().contentType(contentType))
.andExpect(jsonPath("$._embedded.qualityassurancetopics", .andExpect(jsonPath("$._embedded.qualityassurancetopics",
Matchers.containsInAnyOrder( Matchers.containsInAnyOrder(
QATopicMatcher.matchQATopicEntry("openaire", "ENRICH/MISSING/PID", QATopicMatcher.matchQATopicEntry(QAEvent.OPENAIRE_SOURCE,
QANotifyPatterns.TOPIC_ENRICH_MISSING_PID,
item1.getID().toString(), 1), item1.getID().toString(), 1),
QATopicMatcher.matchQATopicEntry("openaire", "ENRICH/MISSING/ABSTRACT", QATopicMatcher.matchQATopicEntry(QAEvent.OPENAIRE_SOURCE,
item1.getID().toString(), 1)))) QANotifyPatterns.TOPIC_ENRICH_MISSING_ABSTRACT,
item1.getID().toString(), 1))))
.andExpect(jsonPath("$.page.size", is(20))).andExpect(jsonPath("$.page.totalElements", is(2))); .andExpect(jsonPath("$.page.size", is(20))).andExpect(jsonPath("$.page.totalElements", is(2)));
getClient(authToken).perform(get("/api/integration/qualityassurancetopics/search/byTarget") getClient(authToken).perform(get("/api/integration/qualityassurancetopics/search/byTarget")
.param("target", item2.getID().toString()) .param("target", item2.getID().toString())
@@ -381,12 +388,13 @@ public class QATopicRestRepositoryIT extends AbstractControllerIntegrationTest {
.andExpect(content().contentType(contentType)) .andExpect(content().contentType(contentType))
.andExpect(jsonPath("$._embedded.qualityassurancetopics", .andExpect(jsonPath("$._embedded.qualityassurancetopics",
Matchers.containsInAnyOrder( Matchers.containsInAnyOrder(
QATopicMatcher.matchQATopicEntry("openaire", "ENRICH/MISSING/PID", QATopicMatcher.matchQATopicEntry(QAEvent.OPENAIRE_SOURCE,
QANotifyPatterns.TOPIC_ENRICH_MISSING_PID,
item2.getID().toString(), 2)))) item2.getID().toString(), 2))))
.andExpect(jsonPath("$.page.size", is(20))).andExpect(jsonPath("$.page.totalElements", is(1))); .andExpect(jsonPath("$.page.size", is(20))).andExpect(jsonPath("$.page.totalElements", is(1)));
getClient(authToken).perform(get("/api/integration/qualityassurancetopics/search/byTarget") getClient(authToken).perform(get("/api/integration/qualityassurancetopics/search/byTarget")
.param("target", UUID.randomUUID().toString()) .param("target", UUID.randomUUID().toString())
.param("source", "openaire")) .param("source", QAEvent.OPENAIRE_SOURCE))
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(content().contentType(contentType)) .andExpect(content().contentType(contentType))
.andExpect(jsonPath("$._embedded.qualityassurancetopics").doesNotExist()) .andExpect(jsonPath("$._embedded.qualityassurancetopics").doesNotExist())
@@ -410,10 +418,10 @@ public class QATopicRestRepositoryIT extends AbstractControllerIntegrationTest {
Collection col1 = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection 1").build(); Collection col1 = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection 1").build();
Item item1 = ItemBuilder.createItem(context, col1).withTitle("Science and Freedom").build(); Item item1 = ItemBuilder.createItem(context, col1).withTitle("Science and Freedom").build();
QAEventBuilder.createTarget(context, item1) QAEventBuilder.createTarget(context, item1)
.withTopic("ENRICH/MISSING/PID").build(); .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID).build();
context.restoreAuthSystemState(); context.restoreAuthSystemState();
getClient().perform(get("/api/integration/qualityassurancetopics/search/byTarget") getClient().perform(get("/api/integration/qualityassurancetopics/search/byTarget")
.param("source", "openaire") .param("source", QAEvent.OPENAIRE_SOURCE)
.param("target", item1.getID().toString())) .param("target", item1.getID().toString()))
.andExpect(status().isUnauthorized()); .andExpect(status().isUnauthorized());
} }
@@ -427,7 +435,7 @@ public class QATopicRestRepositoryIT extends AbstractControllerIntegrationTest {
Collection col1 = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection 1").build(); Collection col1 = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection 1").build();
Item item1 = ItemBuilder.createItem(context, col1).withTitle("Science and Freedom").build(); Item item1 = ItemBuilder.createItem(context, col1).withTitle("Science and Freedom").build();
QAEventBuilder.createTarget(context, item1) QAEventBuilder.createTarget(context, item1)
.withTopic("ENRICH/MISSING/PID").build(); .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID).build();
context.restoreAuthSystemState(); context.restoreAuthSystemState();
String authToken = getAuthToken(eperson.getEmail(), password); String authToken = getAuthToken(eperson.getEmail(), password);
getClient(authToken).perform(get("/api/integration/qualityassurancetopics/search/byTarget") getClient(authToken).perform(get("/api/integration/qualityassurancetopics/search/byTarget")
@@ -446,7 +454,7 @@ public class QATopicRestRepositoryIT extends AbstractControllerIntegrationTest {
Item item1 = ItemBuilder.createItem(context, col1).withTitle("Science and Freedom").build(); Item item1 = ItemBuilder.createItem(context, col1).withTitle("Science and Freedom").build();
QAEventBuilder.createTarget(context, item1) QAEventBuilder.createTarget(context, item1)
.withSource("test-source") .withSource("test-source")
.withTopic("ENRICH/MISSING/PID").build(); .withTopic(QANotifyPatterns.TOPIC_ENRICH_MISSING_PID).build();
context.restoreAuthSystemState(); context.restoreAuthSystemState();
String authToken = getAuthToken(eperson.getEmail(), password); String authToken = getAuthToken(eperson.getEmail(), password);
getClient(authToken).perform(get("/api/integration/qualityassurancetopics/search/byTarget") getClient(authToken).perform(get("/api/integration/qualityassurancetopics/search/byTarget")

View File

@@ -23,13 +23,27 @@
<map> <map>
<!--The key are the TOPIC, the value must be a valid implementation of the <!--The key are the TOPIC, the value must be a valid implementation of the
org.dspace.qaevent.QAEventAction interface --> org.dspace.qaevent.QAEventAction interface -->
<entry key="ENRICH/MORE/PROJECT" value-ref="ProjectLinkedEntityAction" /> <entry value-ref="ProjectLinkedEntityAction">
<entry key="ENRICH/MISSING/PROJECT" value-ref="ProjectLinkedEntityAction" /> <key><util:constant static-field="org.dspace.qaevent.QANotifyPatterns.TOPIC_ENRICH_MORE_PROJECT"/></key>
<entry key="ENRICH/MISSING/ABSTRACT" value-ref="AbstractMetadataAction" /> </entry>
<entry key="ENRICH/MORE/REVIEW" value-ref="AddReviewMetadataAction" /> <entry value-ref="ProjectLinkedEntityAction">
<entry key="ENRICH/MORE/ENDORSEMENT" value-ref="AddEndorsedMetadataAction"/> <key><util:constant static-field="org.dspace.qaevent.QANotifyPatterns.TOPIC_ENRICH_MISSING_PROJECT"/></key>
<entry key="ENRICH/MORE/PID" value-ref="PIDMetadataAction" /> </entry>
<entry key="ENRICH/MISSING/PID" value-ref="PIDMetadataAction" /> <entry value-ref="AbstractMetadataAction">
<key><util:constant static-field="org.dspace.qaevent.QANotifyPatterns.TOPIC_ENRICH_MISSING_ABSTRACT"/></key>
</entry>
<entry value-ref="AddReviewMetadataAction">
<key><util:constant static-field="org.dspace.qaevent.QANotifyPatterns.TOPIC_ENRICH_MORE_REVIEW"/></key>
</entry>
<entry value-ref="AddEndorsedMetadataAction">
<key><util:constant static-field="org.dspace.qaevent.QANotifyPatterns.TOPIC_ENRICH_MORE_ENDORSEMENT"/></key>
</entry>
<entry value-ref="PIDMetadataAction">
<key><util:constant static-field="org.dspace.qaevent.QANotifyPatterns.TOPIC_ENRICH_MORE_PID"/></key>
</entry>
<entry value-ref="PIDMetadataAction">
<key><util:constant static-field="org.dspace.qaevent.QANotifyPatterns.TOPIC_ENRICH_MISSING_PID"/></key>
</entry>
</map> </map>
</property> </property>
</bean> </bean>
@@ -100,7 +114,7 @@
AutomaticProcessingEvaluation implementation. Below you can find an example of configuration defining AutomaticProcessingEvaluation implementation. Below you can find an example of configuration defining
some thresholds rules for the coar-notify generated QAEvent to be approved, rejected and ignored some thresholds rules for the coar-notify generated QAEvent to be approved, rejected and ignored
--> -->
<!-- <!--
<util:map id="qaAutomaticProcessingMap"> <util:map id="qaAutomaticProcessingMap">
<entry key="coar-notify" value-ref="qaScoreEvaluation"/> <entry key="coar-notify" value-ref="qaScoreEvaluation"/>
</util:map> </util:map>
@@ -113,5 +127,5 @@
<property name="itemFilterToIgnore" ref="simple-demo_filter" /> <property name="itemFilterToIgnore" ref="simple-demo_filter" />
<property name="itemFilterToApprove" ref="simple-demo_filter" /> <property name="itemFilterToApprove" ref="simple-demo_filter" />
</bean> </bean>
--> -->
</beans> </beans>