mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
Merge remote-tracking branch 'origin/coar-notify-7' into coar-notify-7_CST-11044
# Conflicts: # dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/NotifyServiceRestRepository.java # dspace-server-webapp/src/test/java/org/dspace/app/rest/NotifyServiceRestRepositoryIT.java # dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/NotifyServiceMatcher.java
This commit is contained in:
@@ -53,6 +53,9 @@ public class NotifyServiceEntity implements ReloadableEntity<Integer> {
|
||||
@OneToMany(mappedBy = "notifyService")
|
||||
private List<NotifyServiceOutboundPattern> outboundPatterns;
|
||||
|
||||
@Column(name = "enabled")
|
||||
private boolean enabled = false;
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
@@ -118,4 +121,12 @@ public class NotifyServiceEntity implements ReloadableEntity<Integer> {
|
||||
public Integer getID() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,13 @@
|
||||
--
|
||||
-- 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/
|
||||
--
|
||||
|
||||
-----------------------------------------------------------------------------------
|
||||
-- edit notifyservice table add enabled column
|
||||
-----------------------------------------------------------------------------------
|
||||
|
||||
ALTER TABLE notifyservice ADD COLUMN enabled BOOLEAN NOT NULL;
|
@@ -0,0 +1,13 @@
|
||||
--
|
||||
-- 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/
|
||||
--
|
||||
|
||||
-----------------------------------------------------------------------------------
|
||||
-- edit notifyservice table add enabled column
|
||||
-----------------------------------------------------------------------------------
|
||||
|
||||
ALTER TABLE notifyservice ADD COLUMN enabled BOOLEAN NOT NULL;
|
@@ -125,4 +125,9 @@ public class NotifyServiceBuilder extends AbstractBuilder<NotifyServiceEntity, N
|
||||
return this;
|
||||
}
|
||||
|
||||
public NotifyServiceBuilder isEnabled(boolean enabled) {
|
||||
notifyServiceEntity.setEnabled(enabled);
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
@@ -9,6 +9,7 @@ package org.dspace.qaevent.script;
|
||||
|
||||
import static java.util.List.of;
|
||||
import static org.dspace.content.QAEvent.OPENAIRE_SOURCE;
|
||||
import static org.dspace.content.QAEvent.COAR_NOTIFY;
|
||||
import static org.dspace.matcher.QAEventMatcher.pendingOpenaireEventWith;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.contains;
|
||||
@@ -33,7 +34,6 @@ import java.io.FileInputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URL;
|
||||
|
||||
import eu.dnetlib.broker.BrokerClient;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.dspace.AbstractIntegrationTestWithDatabase;
|
||||
import org.dspace.app.launcher.ScriptLauncher;
|
||||
@@ -53,6 +53,8 @@ import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import eu.dnetlib.broker.BrokerClient;
|
||||
|
||||
/**
|
||||
* Integration tests for {@link OpenaireEventsImport}.
|
||||
*
|
||||
@@ -155,7 +157,7 @@ public class OpenaireEventsImportIT extends AbstractIntegrationTestWithDatabase
|
||||
"Trying to read the QA events from the provided file",
|
||||
"Found 5 events in the given file"));
|
||||
|
||||
assertThat(qaEventService.findAllSources(0, 20), contains(QASourceMatcher.with(OPENAIRE_SOURCE, 5L)));
|
||||
assertThat(qaEventService.findAllSources(0, 20), containsInAnyOrder(QASourceMatcher.with(OPENAIRE_SOURCE, 5L), QASourceMatcher.with(COAR_NOTIFY, 0L)));
|
||||
|
||||
assertThat(qaEventService.findAllTopics(0, 20), containsInAnyOrder(
|
||||
QATopicMatcher.with("ENRICH/MORE/PROJECT", 1L),
|
||||
@@ -211,7 +213,7 @@ public class OpenaireEventsImportIT extends AbstractIntegrationTestWithDatabase
|
||||
"Trying to read the QA events from the provided file",
|
||||
"Found 5 events in the given file"));
|
||||
|
||||
assertThat(qaEventService.findAllSources(0, 20), contains(QASourceMatcher.with(OPENAIRE_SOURCE, 3L)));
|
||||
assertThat(qaEventService.findAllSources(0, 20), containsInAnyOrder(QASourceMatcher.with(OPENAIRE_SOURCE, 3L), QASourceMatcher.with(COAR_NOTIFY, 0L)));
|
||||
|
||||
assertThat(qaEventService.findAllTopics(0, 20), containsInAnyOrder(
|
||||
QATopicMatcher.with("ENRICH/MISSING/ABSTRACT", 1L),
|
||||
@@ -251,7 +253,7 @@ public class OpenaireEventsImportIT extends AbstractIntegrationTestWithDatabase
|
||||
"Trying to read the QA events from the provided file",
|
||||
"Found 2 events in the given file"));
|
||||
|
||||
assertThat(qaEventService.findAllSources(0, 20), contains(QASourceMatcher.with(OPENAIRE_SOURCE, 1L)));
|
||||
assertThat(qaEventService.findAllSources(0, 20), containsInAnyOrder(QASourceMatcher.with(OPENAIRE_SOURCE, 1L), QASourceMatcher.with(COAR_NOTIFY, 0L)));
|
||||
|
||||
assertThat(qaEventService.findAllTopics(0, 20), contains(QATopicMatcher.with("ENRICH/MISSING/ABSTRACT", 1L)));
|
||||
|
||||
@@ -278,7 +280,7 @@ public class OpenaireEventsImportIT extends AbstractIntegrationTestWithDatabase
|
||||
assertThat(handler.getWarningMessages(),empty());
|
||||
assertThat(handler.getInfoMessages(), contains("Trying to read the QA events from the provided file"));
|
||||
|
||||
assertThat(qaEventService.findAllSources(0, 20), contains(QASourceMatcher.with(OPENAIRE_SOURCE, 0L)));
|
||||
assertThat(qaEventService.findAllSources(0, 20), containsInAnyOrder(QASourceMatcher.with(OPENAIRE_SOURCE, 0L), QASourceMatcher.with(COAR_NOTIFY, 0L)));
|
||||
|
||||
assertThat(qaEventService.findAllTopics(0, 20), empty());
|
||||
|
||||
@@ -325,7 +327,7 @@ public class OpenaireEventsImportIT extends AbstractIntegrationTestWithDatabase
|
||||
"Found 0 events from the subscription sub2",
|
||||
"Found 2 events from the subscription sub3"));
|
||||
|
||||
assertThat(qaEventService.findAllSources(0, 20), contains(QASourceMatcher.with(OPENAIRE_SOURCE, 6L)));
|
||||
assertThat(qaEventService.findAllSources(0, 20), containsInAnyOrder(QASourceMatcher.with(OPENAIRE_SOURCE, 6L), QASourceMatcher.with(COAR_NOTIFY, 0L)));
|
||||
|
||||
assertThat(qaEventService.findAllTopics(0, 20), containsInAnyOrder(
|
||||
QATopicMatcher.with("ENRICH/MORE/PROJECT", 1L),
|
||||
@@ -379,7 +381,7 @@ public class OpenaireEventsImportIT extends AbstractIntegrationTestWithDatabase
|
||||
assertThat(handler.getWarningMessages(), empty());
|
||||
assertThat(handler.getInfoMessages(), contains("Trying to read the QA events from the OPENAIRE broker"));
|
||||
|
||||
assertThat(qaEventService.findAllSources(0, 20), contains(QASourceMatcher.with(OPENAIRE_SOURCE, 0L)));
|
||||
assertThat(qaEventService.findAllSources(0, 20), containsInAnyOrder(QASourceMatcher.with(OPENAIRE_SOURCE, 0L), QASourceMatcher.with(COAR_NOTIFY, 0L)));
|
||||
|
||||
assertThat(qaEventService.findAllTopics(0, 20), empty());
|
||||
|
||||
@@ -430,7 +432,7 @@ public class OpenaireEventsImportIT extends AbstractIntegrationTestWithDatabase
|
||||
"Found 0 events from the subscription sub2",
|
||||
"Found 2 events from the subscription sub3"));
|
||||
|
||||
assertThat(qaEventService.findAllSources(0, 20), contains(QASourceMatcher.with(OPENAIRE_SOURCE, 6L)));
|
||||
assertThat(qaEventService.findAllSources(0, 20), containsInAnyOrder(QASourceMatcher.with(OPENAIRE_SOURCE, 6L), QASourceMatcher.with(COAR_NOTIFY, 0L)));
|
||||
|
||||
assertThat(qaEventService.findAllTopics(0, 20), containsInAnyOrder(
|
||||
QATopicMatcher.with("ENRICH/MORE/PROJECT", 1L),
|
||||
@@ -455,10 +457,9 @@ public class OpenaireEventsImportIT extends AbstractIntegrationTestWithDatabase
|
||||
public void testImportFromFileEventMoreReview() throws Exception {
|
||||
|
||||
context.turnOffAuthorisationSystem();
|
||||
|
||||
Item firstItem = createItem("Test item", "123456789/99998");
|
||||
Item secondItem = createItem("Test item 2", "123456789/99999");
|
||||
|
||||
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
TestDSpaceRunnableHandler handler = new TestDSpaceRunnableHandler();
|
||||
@@ -466,11 +467,11 @@ public class OpenaireEventsImportIT extends AbstractIntegrationTestWithDatabase
|
||||
String[] args = new String[] { "import-openaire-events", "-f", getFileLocation("event-more-review.json") };
|
||||
ScriptLauncher.handleScript(args, ScriptLauncher.getConfig(kernelImpl), handler, kernelImpl);
|
||||
|
||||
assertThat(qaEventService.findAllSources(0, 20), contains(QASourceMatcher.with(OPENAIRE_SOURCE, 1L)));
|
||||
|
||||
assertThat(qaEventService.findAllTopics(0, 20), contains(
|
||||
QATopicMatcher.with("ENRICH/MORE/REVIEW", 1L)));
|
||||
|
||||
assertThat(qaEventService.findAllSources(0, 20), containsInAnyOrder(QASourceMatcher.with(OPENAIRE_SOURCE, 1L), QASourceMatcher.with(COAR_NOTIFY, 0L)));
|
||||
|
||||
verifyNoInteractions(mockBrokerClient);
|
||||
}
|
||||
|
||||
@@ -506,3 +507,4 @@ public class OpenaireEventsImportIT extends AbstractIntegrationTestWithDatabase
|
||||
return new File(resource.getFile()).getAbsolutePath();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,14 @@
|
||||
/**
|
||||
* 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.app.rest.authorization.impl;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.dspace.app.rest.authorization.AuthorizationFeature;
|
||||
import org.dspace.app.rest.authorization.AuthorizationFeatureDocumentation;
|
||||
import org.dspace.app.rest.model.BaseObjectRest;
|
||||
@@ -10,8 +19,6 @@ import org.dspace.services.ConfigurationService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
@Component
|
||||
@AuthorizationFeatureDocumentation(name = CoarNotifyLdnEnabled.NAME,
|
||||
description = "It can be used to verify if the user can see the coar notify protocol is enabled")
|
||||
@@ -28,6 +35,6 @@ public class CoarNotifyLdnEnabled implements AuthorizationFeature {
|
||||
|
||||
@Override
|
||||
public String[] getSupportedTypes() {
|
||||
return new String[]{SiteRest.CATEGORY+"."+SiteRest.NAME};
|
||||
return new String[]{SiteRest.CATEGORY + "." + SiteRest.NAME};
|
||||
}
|
||||
}
|
||||
|
@@ -37,6 +37,7 @@ public class NotifyServiceConverter implements DSpaceConverter<NotifyServiceEnti
|
||||
notifyServiceRest.setDescription(obj.getDescription());
|
||||
notifyServiceRest.setUrl(obj.getUrl());
|
||||
notifyServiceRest.setLdnUrl(obj.getLdnUrl());
|
||||
notifyServiceRest.setEnabled(obj.isEnabled());
|
||||
|
||||
if (obj.getInboundPatterns() != null) {
|
||||
notifyServiceRest.setNotifyServiceInboundPatterns(
|
||||
|
@@ -26,6 +26,7 @@ public class NotifyServiceRest extends BaseObjectRest<Integer> {
|
||||
private String description;
|
||||
private String url;
|
||||
private String ldnUrl;
|
||||
private boolean enabled;
|
||||
|
||||
private List<NotifyServiceInboundPatternRest> notifyServiceInboundPatterns;
|
||||
private List<NotifyServiceOutboundPatternRest> notifyServiceOutboundPatterns;
|
||||
@@ -77,6 +78,13 @@ public class NotifyServiceRest extends BaseObjectRest<Integer> {
|
||||
this.ldnUrl = ldnUrl;
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
public List<NotifyServiceInboundPatternRest> getNotifyServiceInboundPatterns() {
|
||||
return notifyServiceInboundPatterns;
|
||||
}
|
||||
|
@@ -9,16 +9,24 @@ package org.dspace.app.rest.repository;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.List;
|
||||
import javax.servlet.ServletInputStream;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.dspace.app.ldn.NotifyServiceEntity;
|
||||
import org.dspace.app.ldn.NotifyServiceInboundPattern;
|
||||
import org.dspace.app.ldn.NotifyServiceOutboundPattern;
|
||||
import org.dspace.app.ldn.service.NotifyService;
|
||||
import org.dspace.app.ldn.service.NotifyServiceInboundPatternService;
|
||||
import org.dspace.app.ldn.service.NotifyServiceOutboundPatternService;
|
||||
import org.dspace.app.rest.Parameter;
|
||||
import org.dspace.app.rest.SearchRestMethod;
|
||||
import org.dspace.app.rest.exception.UnprocessableEntityException;
|
||||
import org.dspace.app.rest.model.NotifyServiceInboundPatternRest;
|
||||
import org.dspace.app.rest.model.NotifyServiceOutboundPatternRest;
|
||||
import org.dspace.app.rest.model.NotifyServiceRest;
|
||||
import org.dspace.app.rest.model.patch.Patch;
|
||||
import org.dspace.app.rest.repository.patch.ResourcePatch;
|
||||
@@ -43,6 +51,12 @@ public class NotifyServiceRestRepository extends DSpaceRestRepository<NotifyServ
|
||||
@Autowired
|
||||
private NotifyService notifyService;
|
||||
|
||||
@Autowired
|
||||
private NotifyServiceInboundPatternService inboundPatternService;
|
||||
|
||||
@Autowired
|
||||
private NotifyServiceOutboundPatternService outboundPatternService;
|
||||
|
||||
@Autowired
|
||||
ResourcePatch<NotifyServiceEntity> resourcePatch;
|
||||
|
||||
@@ -88,10 +102,56 @@ public class NotifyServiceRestRepository extends DSpaceRestRepository<NotifyServ
|
||||
notifyServiceEntity.setDescription(notifyServiceRest.getDescription());
|
||||
notifyServiceEntity.setUrl(notifyServiceRest.getUrl());
|
||||
notifyServiceEntity.setLdnUrl(notifyServiceRest.getLdnUrl());
|
||||
|
||||
if (notifyServiceRest.getNotifyServiceInboundPatterns() != null) {
|
||||
appendNotifyServiceInboundPatterns(context, notifyServiceEntity,
|
||||
notifyServiceRest.getNotifyServiceInboundPatterns());
|
||||
}
|
||||
|
||||
if (notifyServiceRest.getNotifyServiceOutboundPatterns() != null) {
|
||||
appendNotifyServiceOutboundPatterns(context, notifyServiceEntity,
|
||||
notifyServiceRest.getNotifyServiceOutboundPatterns());
|
||||
}
|
||||
|
||||
notifyServiceEntity.setEnabled(notifyServiceRest.isEnabled());
|
||||
notifyService.update(context, notifyServiceEntity);
|
||||
|
||||
return converter.toRest(notifyServiceEntity, utils.obtainProjection());
|
||||
}
|
||||
|
||||
private void appendNotifyServiceInboundPatterns(Context context, NotifyServiceEntity notifyServiceEntity,
|
||||
List<NotifyServiceInboundPatternRest> inboundPatternRests) throws SQLException {
|
||||
|
||||
List<NotifyServiceInboundPattern> inboundPatterns = new ArrayList<>();
|
||||
|
||||
for (NotifyServiceInboundPatternRest inboundPatternRest : inboundPatternRests) {
|
||||
NotifyServiceInboundPattern inboundPattern = inboundPatternService.create(context, notifyServiceEntity);
|
||||
inboundPattern.setPattern(inboundPatternRest.getPattern());
|
||||
inboundPattern.setConstraint(inboundPatternRest.getConstraint());
|
||||
inboundPattern.setAutomatic(inboundPatternRest.isAutomatic());
|
||||
|
||||
inboundPatterns.add(inboundPattern);
|
||||
}
|
||||
|
||||
notifyServiceEntity.setInboundPatterns(inboundPatterns);
|
||||
}
|
||||
|
||||
private void appendNotifyServiceOutboundPatterns(Context context, NotifyServiceEntity notifyServiceEntity,
|
||||
List<NotifyServiceOutboundPatternRest> outboundPatternRests) throws SQLException {
|
||||
|
||||
List<NotifyServiceOutboundPattern> outboundPatterns = new ArrayList<>();
|
||||
|
||||
for (NotifyServiceOutboundPatternRest outboundPatternRest : outboundPatternRests) {
|
||||
NotifyServiceOutboundPattern outboundPattern = outboundPatternService.create(context, notifyServiceEntity);
|
||||
outboundPattern.setPattern(outboundPatternRest.getPattern());
|
||||
outboundPattern.setConstraint(outboundPatternRest.getConstraint());
|
||||
|
||||
outboundPatterns.add(outboundPattern);
|
||||
}
|
||||
|
||||
notifyServiceEntity.setOutboundPatterns(outboundPatterns);
|
||||
}
|
||||
|
||||
@Override
|
||||
@PreAuthorize("hasAuthority('ADMIN')")
|
||||
protected void patch(Context context, HttpServletRequest request, String apiCategory, String model, Integer id,
|
||||
|
@@ -0,0 +1,66 @@
|
||||
/**
|
||||
* 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.app.rest.repository.patch.operation.ldn;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.dspace.app.ldn.NotifyServiceEntity;
|
||||
import org.dspace.app.ldn.service.NotifyService;
|
||||
import org.dspace.app.rest.exception.DSpaceBadRequestException;
|
||||
import org.dspace.app.rest.model.patch.Operation;
|
||||
import org.dspace.app.rest.repository.patch.operation.PatchOperation;
|
||||
import org.dspace.core.Context;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* Implementation for NotifyService Enabled Replace patches.
|
||||
*
|
||||
* Example: <code>
|
||||
* curl -X PATCH http://${dspace.server.url}/api/ldn/ldnservices/<:id-notifyService> -H "
|
||||
* Content-Type: application/json" -d '
|
||||
* [{
|
||||
* "op": "replace",
|
||||
* "path": "/enabled"
|
||||
* }]'
|
||||
* </code>
|
||||
*/
|
||||
@Component
|
||||
public class NotifyServiceEnabledReplaceOperation extends PatchOperation<NotifyServiceEntity> {
|
||||
|
||||
@Autowired
|
||||
private NotifyService notifyService;
|
||||
|
||||
@Autowired
|
||||
private NotifyServicePatchUtils notifyServicePatchUtils;
|
||||
|
||||
private static final String OPERATION_PATH = "/enabled";
|
||||
|
||||
@Override
|
||||
public NotifyServiceEntity perform(Context context, NotifyServiceEntity notifyServiceEntity, Operation operation)
|
||||
throws SQLException {
|
||||
checkOperationValue(operation.getValue());
|
||||
Boolean enabled = getBooleanOperationValue(operation.getValue());
|
||||
|
||||
if (supports(notifyServiceEntity, operation)) {
|
||||
notifyServiceEntity.setEnabled(enabled);
|
||||
notifyService.update(context, notifyServiceEntity);
|
||||
return notifyServiceEntity;
|
||||
} else {
|
||||
throw new DSpaceBadRequestException(
|
||||
"NotifyServiceEnabledReplaceOperation does not support this operation");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supports(Object objectToMatch, Operation operation) {
|
||||
return (objectToMatch instanceof NotifyServiceEntity &&
|
||||
operation.getOp().trim().equalsIgnoreCase(OPERATION_REPLACE) &&
|
||||
operation.getPath().trim().toLowerCase().equalsIgnoreCase(OPERATION_PATH));
|
||||
}
|
||||
}
|
@@ -30,7 +30,7 @@ import org.springframework.stereotype.Component;
|
||||
* Content-Type: application/json" -d '
|
||||
* [{
|
||||
* "op": "replace",
|
||||
* "path": "notifyservices_inbound_patterns[index]/automatic"
|
||||
* "path": "notifyServiceInboundPatterns[index]/automatic"
|
||||
* }]'
|
||||
* </code>
|
||||
*/
|
||||
@@ -74,7 +74,7 @@ public class NotifyServiceInboundPatternAutomaticReplaceOperation extends PatchO
|
||||
|
||||
@Override
|
||||
public boolean supports(Object objectToMatch, Operation operation) {
|
||||
String path = operation.getPath().trim().toLowerCase();
|
||||
String path = operation.getPath().trim();
|
||||
return (objectToMatch instanceof NotifyServiceEntity &&
|
||||
operation.getOp().trim().equalsIgnoreCase(OPERATION_REPLACE) &&
|
||||
path.startsWith(NOTIFY_SERVICE_INBOUND_PATTERNS + "[") &&
|
||||
|
@@ -31,7 +31,7 @@ import org.springframework.stereotype.Component;
|
||||
* Content-Type: application/json" -d '
|
||||
* [{
|
||||
* "op": "add",
|
||||
* "path": "notifyservices_inbound_patterns[index]/constraint"
|
||||
* "path": "notifyServiceInboundPatterns[index]/constraint"
|
||||
* }]'
|
||||
* </code>
|
||||
*/
|
||||
@@ -86,7 +86,7 @@ public class NotifyServiceInboundPatternConstraintAddOperation extends PatchOper
|
||||
|
||||
@Override
|
||||
public boolean supports(Object objectToMatch, Operation operation) {
|
||||
String path = operation.getPath().trim().toLowerCase();
|
||||
String path = operation.getPath().trim();
|
||||
return (objectToMatch instanceof NotifyServiceEntity &&
|
||||
operation.getOp().trim().equalsIgnoreCase(OPERATION_ADD) &&
|
||||
path.startsWith(NOTIFY_SERVICE_INBOUND_PATTERNS + "[") &&
|
||||
|
@@ -30,7 +30,7 @@ import org.springframework.stereotype.Component;
|
||||
* Content-Type: application/json" -d '
|
||||
* [{
|
||||
* "op": "remove",
|
||||
* "path": "notifyservices_inbound_patterns[index]/constraint"
|
||||
* "path": "notifyServiceInboundPatterns[index]/constraint"
|
||||
* }]'
|
||||
* </code>
|
||||
*/
|
||||
@@ -72,7 +72,7 @@ public class NotifyServiceInboundPatternConstraintRemoveOperation extends PatchO
|
||||
|
||||
@Override
|
||||
public boolean supports(Object objectToMatch, Operation operation) {
|
||||
String path = operation.getPath().trim().toLowerCase();
|
||||
String path = operation.getPath().trim();
|
||||
return (objectToMatch instanceof NotifyServiceEntity &&
|
||||
operation.getOp().trim().equalsIgnoreCase(OPERATION_REMOVE) &&
|
||||
path.startsWith(NOTIFY_SERVICE_INBOUND_PATTERNS + "[") &&
|
||||
|
@@ -31,7 +31,7 @@ import org.springframework.stereotype.Component;
|
||||
* Content-Type: application/json" -d '
|
||||
* [{
|
||||
* "op": "replace",
|
||||
* "path": "notifyservices_inbound_patterns[index]/constraint"
|
||||
* "path": "notifyServiceInboundPatterns[index]/constraint"
|
||||
* }]'
|
||||
* </code>
|
||||
*/
|
||||
@@ -86,7 +86,7 @@ public class NotifyServiceInboundPatternConstraintReplaceOperation extends Patch
|
||||
|
||||
@Override
|
||||
public boolean supports(Object objectToMatch, Operation operation) {
|
||||
String path = operation.getPath().trim().toLowerCase();
|
||||
String path = operation.getPath().trim();
|
||||
return (objectToMatch instanceof NotifyServiceEntity &&
|
||||
operation.getOp().trim().equalsIgnoreCase(OPERATION_REPLACE) &&
|
||||
path.startsWith(NOTIFY_SERVICE_INBOUND_PATTERNS + "[") &&
|
||||
|
@@ -31,7 +31,7 @@ import org.springframework.stereotype.Component;
|
||||
* Content-Type: application/json" -d '
|
||||
* [{
|
||||
* "op": "add",
|
||||
* "path": "notifyservices_inbound_patterns[index]/pattern"
|
||||
* "path": "notifyServiceInboundPatterns[index]/pattern"
|
||||
* }]'
|
||||
* </code>
|
||||
*/
|
||||
@@ -86,7 +86,7 @@ public class NotifyServiceInboundPatternPatternAddOperation extends PatchOperati
|
||||
|
||||
@Override
|
||||
public boolean supports(Object objectToMatch, Operation operation) {
|
||||
String path = operation.getPath().trim().toLowerCase();
|
||||
String path = operation.getPath().trim();
|
||||
return (objectToMatch instanceof NotifyServiceEntity &&
|
||||
operation.getOp().trim().equalsIgnoreCase(OPERATION_ADD) &&
|
||||
path.startsWith(NOTIFY_SERVICE_INBOUND_PATTERNS + "[") &&
|
||||
|
@@ -31,7 +31,7 @@ import org.springframework.stereotype.Component;
|
||||
* Content-Type: application/json" -d '
|
||||
* [{
|
||||
* "op": "replace",
|
||||
* "path": "notifyservices_inbound_patterns[index]/pattern"
|
||||
* "path": "notifyServiceInboundPatterns[index]/pattern"
|
||||
* }]'
|
||||
* </code>
|
||||
*/
|
||||
@@ -86,7 +86,7 @@ public class NotifyServiceInboundPatternPatternReplaceOperation extends PatchOpe
|
||||
|
||||
@Override
|
||||
public boolean supports(Object objectToMatch, Operation operation) {
|
||||
String path = operation.getPath().trim().toLowerCase();
|
||||
String path = operation.getPath().trim();
|
||||
return (objectToMatch instanceof NotifyServiceEntity &&
|
||||
operation.getOp().trim().equalsIgnoreCase(OPERATION_REPLACE) &&
|
||||
path.startsWith(NOTIFY_SERVICE_INBOUND_PATTERNS + "[") &&
|
||||
|
@@ -30,7 +30,7 @@ import org.springframework.stereotype.Component;
|
||||
* Content-Type: application/json" -d '
|
||||
* [{
|
||||
* "op": "remove",
|
||||
* "path": "notifyservices_inbound_patterns[index]"
|
||||
* "path": "notifyServiceInboundPatterns[index]"
|
||||
* }]'
|
||||
* </code>
|
||||
*/
|
||||
@@ -70,7 +70,7 @@ public class NotifyServiceInboundPatternRemoveOperation extends PatchOperation<N
|
||||
|
||||
@Override
|
||||
public boolean supports(Object objectToMatch, Operation operation) {
|
||||
String path = operation.getPath().trim().toLowerCase();
|
||||
String path = operation.getPath().trim();
|
||||
return (objectToMatch instanceof NotifyServiceEntity &&
|
||||
operation.getOp().trim().equalsIgnoreCase(OPERATION_REMOVE) &&
|
||||
path.startsWith(OPERATION_PATH) &&
|
||||
|
@@ -30,7 +30,7 @@ import org.springframework.stereotype.Component;
|
||||
* Content-Type: application/json" -d '
|
||||
* [{
|
||||
* "op": "replace",
|
||||
* "path": "notifyservices_inbound_patterns[index]",
|
||||
* "path": "notifyServiceInboundPatterns[index]",
|
||||
* "value": {"pattern":"patternA","constraint":"itemFilterA","automatic":"false"}
|
||||
* }]'
|
||||
* </code>
|
||||
@@ -80,7 +80,7 @@ public class NotifyServiceInboundPatternReplaceOperation extends PatchOperation<
|
||||
|
||||
@Override
|
||||
public boolean supports(Object objectToMatch, Operation operation) {
|
||||
String path = operation.getPath().trim().toLowerCase();
|
||||
String path = operation.getPath().trim();
|
||||
return (objectToMatch instanceof NotifyServiceEntity &&
|
||||
operation.getOp().trim().equalsIgnoreCase(OPERATION_REPLACE) &&
|
||||
path.startsWith(OPERATION_PATH) &&
|
||||
|
@@ -29,7 +29,7 @@ import org.springframework.stereotype.Component;
|
||||
* Content-Type: application/json" -d '
|
||||
* [{
|
||||
* "op": "add",
|
||||
* "path": "notifyservices_inbound_patterns/-",
|
||||
* "path": "notifyServiceInboundPatterns/-",
|
||||
* "value": {"pattern":"patternA","constraint":"itemFilterA","automatic":"false"}
|
||||
* }]'
|
||||
* </code>
|
||||
|
@@ -29,7 +29,7 @@ import org.springframework.stereotype.Component;
|
||||
* Content-Type: application/json" -d '
|
||||
* [{
|
||||
* "op": "remove",
|
||||
* "path": "notifyservices_inbound_patterns"
|
||||
* "path": "notifyServiceInboundPatterns"
|
||||
* }]'
|
||||
* </code>
|
||||
*/
|
||||
@@ -63,7 +63,7 @@ public class NotifyServiceInboundPatternsRemoveOperation extends PatchOperation<
|
||||
|
||||
@Override
|
||||
public boolean supports(Object objectToMatch, Operation operation) {
|
||||
String path = operation.getPath().trim().toLowerCase();
|
||||
String path = operation.getPath().trim();
|
||||
return (objectToMatch instanceof NotifyServiceEntity &&
|
||||
operation.getOp().trim().equalsIgnoreCase(OPERATION_REMOVE) &&
|
||||
path.startsWith(OPERATION_PATH));
|
||||
|
@@ -30,7 +30,7 @@ import org.springframework.stereotype.Component;
|
||||
* Content-Type: application/json" -d '
|
||||
* [{
|
||||
* "op": "replace",
|
||||
* "path": "notifyservices_inbound_patterns",
|
||||
* "path": "notifyServiceInboundPatterns",
|
||||
* "value": [{"pattern":"patternA","constraint":"itemFilterA","automatic":"false"}]
|
||||
* }]'
|
||||
* </code>
|
||||
|
@@ -31,7 +31,7 @@ import org.springframework.stereotype.Component;
|
||||
* Content-Type: application/json" -d '
|
||||
* [{
|
||||
* "op": "add",
|
||||
* "path": "notifyservices_outbound_patterns[index]/constraint"
|
||||
* "path": "notifyServiceOutboundPatterns[index]/constraint"
|
||||
* }]'
|
||||
* </code>
|
||||
*/
|
||||
@@ -86,7 +86,7 @@ public class NotifyServiceOutboundPatternConstraintAddOperation extends PatchOpe
|
||||
|
||||
@Override
|
||||
public boolean supports(Object objectToMatch, Operation operation) {
|
||||
String path = operation.getPath().trim().toLowerCase();
|
||||
String path = operation.getPath().trim();
|
||||
return (objectToMatch instanceof NotifyServiceEntity &&
|
||||
operation.getOp().trim().equalsIgnoreCase(OPERATION_ADD) &&
|
||||
path.startsWith(NOTIFY_SERVICE_OUTBOUND_PATTERNS + "[") &&
|
||||
|
@@ -30,7 +30,7 @@ import org.springframework.stereotype.Component;
|
||||
* Content-Type: application/json" -d '
|
||||
* [{
|
||||
* "op": "remove",
|
||||
* "path": "notifyservices_outbound_patterns[index]/constraint"
|
||||
* "path": "notifyServiceOutboundPatterns[index]/constraint"
|
||||
* }]'
|
||||
* </code>
|
||||
*/
|
||||
@@ -72,7 +72,7 @@ public class NotifyServiceOutboundPatternConstraintRemoveOperation extends Patch
|
||||
|
||||
@Override
|
||||
public boolean supports(Object objectToMatch, Operation operation) {
|
||||
String path = operation.getPath().trim().toLowerCase();
|
||||
String path = operation.getPath().trim();
|
||||
return (objectToMatch instanceof NotifyServiceEntity &&
|
||||
operation.getOp().trim().equalsIgnoreCase(OPERATION_REMOVE) &&
|
||||
path.startsWith(NOTIFY_SERVICE_OUTBOUND_PATTERNS + "[") &&
|
||||
|
@@ -31,7 +31,7 @@ import org.springframework.stereotype.Component;
|
||||
* Content-Type: application/json" -d '
|
||||
* [{
|
||||
* "op": "replace",
|
||||
* "path": "notifyservices_outbound_patterns[index]/constraint"
|
||||
* "path": "notifyServiceOutboundPatterns[index]/constraint"
|
||||
* }]'
|
||||
* </code>
|
||||
*/
|
||||
@@ -86,7 +86,7 @@ public class NotifyServiceOutboundPatternConstraintReplaceOperation extends Patc
|
||||
|
||||
@Override
|
||||
public boolean supports(Object objectToMatch, Operation operation) {
|
||||
String path = operation.getPath().trim().toLowerCase();
|
||||
String path = operation.getPath().trim();
|
||||
return (objectToMatch instanceof NotifyServiceEntity &&
|
||||
operation.getOp().trim().equalsIgnoreCase(OPERATION_REPLACE) &&
|
||||
path.startsWith(NOTIFY_SERVICE_OUTBOUND_PATTERNS + "[") &&
|
||||
|
@@ -31,7 +31,7 @@ import org.springframework.stereotype.Component;
|
||||
* Content-Type: application/json" -d '
|
||||
* [{
|
||||
* "op": "add",
|
||||
* "path": "notifyservices_outbound_patterns[index]/pattern"
|
||||
* "path": "notifyServiceOutboundPatterns[index]/pattern"
|
||||
* }]'
|
||||
* </code>
|
||||
*/
|
||||
@@ -86,7 +86,7 @@ public class NotifyServiceOutboundPatternPatternAddOperation extends PatchOperat
|
||||
|
||||
@Override
|
||||
public boolean supports(Object objectToMatch, Operation operation) {
|
||||
String path = operation.getPath().trim().toLowerCase();
|
||||
String path = operation.getPath().trim();
|
||||
return (objectToMatch instanceof NotifyServiceEntity &&
|
||||
operation.getOp().trim().equalsIgnoreCase(OPERATION_ADD) &&
|
||||
path.startsWith(NOTIFY_SERVICE_OUTBOUND_PATTERNS + "[") &&
|
||||
|
@@ -31,7 +31,7 @@ import org.springframework.stereotype.Component;
|
||||
* Content-Type: application/json" -d '
|
||||
* [{
|
||||
* "op": "replace",
|
||||
* "path": "notifyservices_outbound_patterns[index]/pattern"
|
||||
* "path": "notifyServiceOutboundPatterns[index]/pattern"
|
||||
* }]'
|
||||
* </code>
|
||||
*/
|
||||
@@ -86,7 +86,7 @@ public class NotifyServiceOutboundPatternPatternReplaceOperation extends PatchOp
|
||||
|
||||
@Override
|
||||
public boolean supports(Object objectToMatch, Operation operation) {
|
||||
String path = operation.getPath().trim().toLowerCase();
|
||||
String path = operation.getPath().trim();
|
||||
return (objectToMatch instanceof NotifyServiceEntity &&
|
||||
operation.getOp().trim().equalsIgnoreCase(OPERATION_REPLACE) &&
|
||||
path.startsWith(NOTIFY_SERVICE_OUTBOUND_PATTERNS + "[") &&
|
||||
|
@@ -30,7 +30,7 @@ import org.springframework.stereotype.Component;
|
||||
* Content-Type: application/json" -d '
|
||||
* [{
|
||||
* "op": "remove",
|
||||
* "path": "notifyservices_outbound_patterns[index]"
|
||||
* "path": "notifyServiceOutboundPatterns[index]"
|
||||
* }]'
|
||||
* </code>
|
||||
*/
|
||||
@@ -70,7 +70,7 @@ public class NotifyServiceOutboundPatternRemoveOperation extends PatchOperation<
|
||||
|
||||
@Override
|
||||
public boolean supports(Object objectToMatch, Operation operation) {
|
||||
String path = operation.getPath().trim().toLowerCase();
|
||||
String path = operation.getPath().trim();
|
||||
return (objectToMatch instanceof NotifyServiceEntity &&
|
||||
operation.getOp().trim().equalsIgnoreCase(OPERATION_REMOVE) &&
|
||||
path.startsWith(OPERATION_PATH) &&
|
||||
|
@@ -30,7 +30,7 @@ import org.springframework.stereotype.Component;
|
||||
* Content-Type: application/json" -d '
|
||||
* [{
|
||||
* "op": "replace",
|
||||
* "path": "notifyservices_outbound_patterns[index]",
|
||||
* "path": "notifyServiceOutboundPatterns[index]",
|
||||
* "value": {"pattern":"patternA","constraint":"itemFilterA"}
|
||||
* }]'
|
||||
* </code>
|
||||
@@ -79,7 +79,7 @@ public class NotifyServiceOutboundPatternReplaceOperation extends PatchOperation
|
||||
|
||||
@Override
|
||||
public boolean supports(Object objectToMatch, Operation operation) {
|
||||
String path = operation.getPath().trim().toLowerCase();
|
||||
String path = operation.getPath().trim();
|
||||
return (objectToMatch instanceof NotifyServiceEntity &&
|
||||
operation.getOp().trim().equalsIgnoreCase(OPERATION_REPLACE) &&
|
||||
path.startsWith(OPERATION_PATH) &&
|
||||
|
@@ -29,7 +29,7 @@ import org.springframework.stereotype.Component;
|
||||
* Content-Type: application/json" -d '
|
||||
* [{
|
||||
* "op": "add",
|
||||
* "path": "notifyservices_outbound_patterns/-",
|
||||
* "path": "notifyServiceOutboundPatterns/-",
|
||||
* "value": {"pattern":"patternA","constraint":"itemFilterA"}
|
||||
* }]'
|
||||
* </code>
|
||||
|
@@ -29,7 +29,7 @@ import org.springframework.stereotype.Component;
|
||||
* Content-Type: application/json" -d '
|
||||
* [{
|
||||
* "op": "remove",
|
||||
* "path": "notifyservices_outbound_patterns"
|
||||
* "path": "notifyServiceOutboundPatterns"
|
||||
* }]'
|
||||
* </code>
|
||||
*/
|
||||
@@ -63,7 +63,7 @@ public class NotifyServiceOutboundPatternsRemoveOperation extends PatchOperation
|
||||
|
||||
@Override
|
||||
public boolean supports(Object objectToMatch, Operation operation) {
|
||||
String path = operation.getPath().trim().toLowerCase();
|
||||
String path = operation.getPath().trim();
|
||||
return (objectToMatch instanceof NotifyServiceEntity &&
|
||||
operation.getOp().trim().equalsIgnoreCase(OPERATION_REMOVE) &&
|
||||
path.startsWith(OPERATION_PATH));
|
||||
|
@@ -30,7 +30,7 @@ import org.springframework.stereotype.Component;
|
||||
* Content-Type: application/json" -d '
|
||||
* [{
|
||||
* "op": "replace",
|
||||
* "path": "notifyservices_outbound_patterns",
|
||||
* "path": "notifyServiceOutboundPatterns",
|
||||
* "value": [{"pattern":"patternA","constraint":"itemFilterA"}]
|
||||
* }]'
|
||||
* </code>
|
||||
|
@@ -18,6 +18,7 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.dspace.app.ldn.NotifyServiceInboundPattern;
|
||||
import org.dspace.app.ldn.NotifyServiceOutboundPattern;
|
||||
import org.dspace.app.rest.exception.DSpaceBadRequestException;
|
||||
import org.dspace.app.rest.model.patch.JsonValueEvaluator;
|
||||
import org.dspace.app.rest.model.patch.Operation;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -28,8 +29,8 @@ import org.springframework.stereotype.Component;
|
||||
@Component
|
||||
public final class NotifyServicePatchUtils {
|
||||
|
||||
public static final String NOTIFY_SERVICE_OUTBOUND_PATTERNS = "notifyservices_outbound_patterns";
|
||||
public static final String NOTIFY_SERVICE_INBOUND_PATTERNS = "notifyservices_inbound_patterns";
|
||||
public static final String NOTIFY_SERVICE_OUTBOUND_PATTERNS = "notifyServiceOutboundPatterns";
|
||||
public static final String NOTIFY_SERVICE_INBOUND_PATTERNS = "notifyServiceInboundPatterns";
|
||||
|
||||
private ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
@@ -47,8 +48,8 @@ public final class NotifyServicePatchUtils {
|
||||
NotifyServiceInboundPattern inboundPattern = null;
|
||||
try {
|
||||
if (operation.getValue() != null) {
|
||||
if (operation.getValue() instanceof String) {
|
||||
inboundPattern = objectMapper.readValue((String) operation.getValue(),
|
||||
if (operation.getValue() instanceof JsonValueEvaluator) {
|
||||
inboundPattern = objectMapper.readValue(((JsonValueEvaluator) operation.getValue()).getValueNode().toString(),
|
||||
NotifyServiceInboundPattern.class);
|
||||
}
|
||||
}
|
||||
@@ -73,8 +74,8 @@ public final class NotifyServicePatchUtils {
|
||||
NotifyServiceOutboundPattern outboundPattern = null;
|
||||
try {
|
||||
if (operation.getValue() != null) {
|
||||
if (operation.getValue() instanceof String) {
|
||||
outboundPattern = objectMapper.readValue((String) operation.getValue(),
|
||||
if (operation.getValue() instanceof JsonValueEvaluator) {
|
||||
outboundPattern = objectMapper.readValue(((JsonValueEvaluator) operation.getValue()).getValueNode().toString(),
|
||||
NotifyServiceOutboundPattern.class);
|
||||
}
|
||||
}
|
||||
|
@@ -10,6 +10,8 @@ package org.dspace.app.rest;
|
||||
import static org.dspace.content.QAEvent.OPENAIRE_SOURCE;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.contains;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||
|
||||
@@ -18,7 +20,9 @@ import java.nio.charset.Charset;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.dspace.app.ldn.LDNMessageEntity;
|
||||
import org.dspace.app.ldn.model.Notification;
|
||||
import org.dspace.app.ldn.service.LDNMessageService;
|
||||
import org.dspace.app.rest.test.AbstractControllerIntegrationTest;
|
||||
import org.dspace.builder.CollectionBuilder;
|
||||
import org.dspace.builder.CommunityBuilder;
|
||||
@@ -40,6 +44,9 @@ public class LDNInboxControllerIT extends AbstractControllerIntegrationTest {
|
||||
@Autowired
|
||||
private ConfigurationService configurationService;
|
||||
|
||||
@Autowired
|
||||
private LDNMessageService ldnMessageService;
|
||||
|
||||
private QAEventService qaEventService = new DSpace().getSingletonService(QAEventService.class);
|
||||
|
||||
@Test
|
||||
@@ -52,6 +59,7 @@ public class LDNInboxControllerIT extends AbstractControllerIntegrationTest {
|
||||
String object = configurationService.getProperty("dspace.ui.url") + "/handle/" + item.getHandle();
|
||||
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
InputStream offerEndorsementStream = getClass().getResourceAsStream("ldn_offer_endorsement_object.json");
|
||||
String offerEndorsementJson = IOUtils.toString(offerEndorsementStream, Charset.defaultCharset());
|
||||
offerEndorsementStream.close();
|
||||
@@ -64,14 +72,27 @@ public class LDNInboxControllerIT extends AbstractControllerIntegrationTest {
|
||||
.contentType("application/ld+json")
|
||||
.content(message))
|
||||
.andExpect(status().isAccepted());
|
||||
|
||||
LDNMessageEntity ldnMessage = ldnMessageService.find(context, notification.getId());
|
||||
checkStoredLDNMessage(notification, ldnMessage, object);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ldnInboxAnnounceEndorsementTest() 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();
|
||||
String object = configurationService.getProperty("dspace.ui.url") + "/handle/" + item.getHandle();
|
||||
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
InputStream announceEndorsementStream = getClass().getResourceAsStream("ldn_announce_endorsement.json");
|
||||
String message = IOUtils.toString(announceEndorsementStream, Charset.defaultCharset());
|
||||
String announceEndorsement = IOUtils.toString(announceEndorsementStream, Charset.defaultCharset());
|
||||
announceEndorsementStream.close();
|
||||
String message = announceEndorsement.replace("<<object>>", object);
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
Notification notification = mapper.readValue(message, Notification.class);
|
||||
getClient(getAuthToken(admin.getEmail(), password))
|
||||
@@ -79,6 +100,9 @@ public class LDNInboxControllerIT extends AbstractControllerIntegrationTest {
|
||||
.contentType("application/ld+json")
|
||||
.content(message))
|
||||
.andExpect(status().isAccepted());
|
||||
|
||||
LDNMessageEntity ldnMessage = ldnMessageService.find(context, notification.getId());
|
||||
checkStoredLDNMessage(notification, ldnMessage, object);
|
||||
}
|
||||
|
||||
|
||||
@@ -115,4 +139,28 @@ public class LDNInboxControllerIT extends AbstractControllerIntegrationTest {
|
||||
.content(message))
|
||||
.andExpect(status().isBadRequest());
|
||||
}
|
||||
|
||||
private void checkStoredLDNMessage(Notification notification, LDNMessageEntity ldnMessage, String object)
|
||||
throws Exception {
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
Notification storedMessage = mapper.readValue(ldnMessage.getMessage(), Notification.class);
|
||||
|
||||
assertNotNull(ldnMessage);
|
||||
assertNotNull(ldnMessage.getObject());
|
||||
assertEquals(ldnMessage.getObject()
|
||||
.getMetadata()
|
||||
.stream()
|
||||
.filter(metadataValue ->
|
||||
metadataValue.getMetadataField().toString('.').equals("dc.identifier.uri"))
|
||||
.map(metadataValue -> metadataValue.getValue())
|
||||
.findFirst().get(), object);
|
||||
|
||||
assertEquals(notification.getId(), storedMessage.getId());
|
||||
assertEquals(notification.getOrigin().getInbox(), storedMessage.getOrigin().getInbox());
|
||||
assertEquals(notification.getTarget().getInbox(), storedMessage.getTarget().getInbox());
|
||||
assertEquals(notification.getObject().getId(), storedMessage.getObject().getId());
|
||||
assertEquals(notification.getType(), storedMessage.getType());
|
||||
}
|
||||
|
||||
}
|
@@ -33,6 +33,8 @@ import javax.ws.rs.core.MediaType;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.apache.commons.lang3.RandomUtils;
|
||||
import org.dspace.app.ldn.NotifyServiceEntity;
|
||||
import org.dspace.app.rest.model.NotifyServiceInboundPatternRest;
|
||||
import org.dspace.app.rest.model.NotifyServiceOutboundPatternRest;
|
||||
import org.dspace.app.rest.model.NotifyServiceRest;
|
||||
import org.dspace.app.rest.model.patch.AddOperation;
|
||||
import org.dspace.app.rest.model.patch.Operation;
|
||||
@@ -149,11 +151,27 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
public void createTest() throws Exception {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
NotifyServiceInboundPatternRest inboundPatternRestOne = new NotifyServiceInboundPatternRest();
|
||||
inboundPatternRestOne.setPattern("patternA");
|
||||
inboundPatternRestOne.setConstraint("itemFilterA");
|
||||
inboundPatternRestOne.setAutomatic(true);
|
||||
|
||||
NotifyServiceInboundPatternRest inboundPatternRestTwo = new NotifyServiceInboundPatternRest();
|
||||
inboundPatternRestTwo.setPattern("patternB");
|
||||
inboundPatternRestTwo.setAutomatic(false);
|
||||
|
||||
NotifyServiceOutboundPatternRest outboundPatternRest = new NotifyServiceOutboundPatternRest();
|
||||
outboundPatternRest.setPattern("patternC");
|
||||
outboundPatternRest.setConstraint("itemFilterC");
|
||||
|
||||
NotifyServiceRest notifyServiceRest = new NotifyServiceRest();
|
||||
notifyServiceRest.setName("service name");
|
||||
notifyServiceRest.setDescription("service description");
|
||||
notifyServiceRest.setUrl("service url");
|
||||
notifyServiceRest.setLdnUrl("service ldn url");
|
||||
notifyServiceRest.setNotifyServiceInboundPatterns(List.of(inboundPatternRestOne, inboundPatternRestTwo));
|
||||
notifyServiceRest.setNotifyServiceOutboundPatterns(List.of(outboundPatternRest));
|
||||
notifyServiceRest.setEnabled(false);
|
||||
|
||||
AtomicReference<Integer> idRef = new AtomicReference<Integer>();
|
||||
String authToken = getAuthToken(admin.getEmail(), password);
|
||||
@@ -162,16 +180,26 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
.contentType(contentType))
|
||||
.andExpect(status().isCreated())
|
||||
.andExpect(jsonPath("$", matchNotifyService("service name", "service description",
|
||||
"service url", "service ldn url")))
|
||||
"service url", "service ldn url", false)))
|
||||
.andDo(result ->
|
||||
idRef.set((read(result.getResponse().getContentAsString(), "$.id"))));
|
||||
|
||||
getClient(authToken)
|
||||
.perform(get("/api/ldn/ldnservices/" + idRef.get()))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$",
|
||||
.andExpect(jsonPath("$.notifyServiceInboundPatterns", hasSize(2)))
|
||||
.andExpect(jsonPath("$.notifyServiceOutboundPatterns", hasSize(1)))
|
||||
.andExpect(jsonPath("$", allOf(
|
||||
matchNotifyService(idRef.get(), "service name", "service description",
|
||||
"service url", "service ldn url")));
|
||||
"service url", "service ldn url", false),
|
||||
hasJsonPath("$.notifyServiceInboundPatterns", containsInAnyOrder(
|
||||
matchNotifyServicePattern("patternA", "itemFilterA", true),
|
||||
matchNotifyServicePattern("patternB", null, false)
|
||||
)),
|
||||
hasJsonPath("$.notifyServiceOutboundPatterns", contains(
|
||||
matchNotifyServicePattern("patternC", "itemFilterC")
|
||||
)))
|
||||
));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -240,6 +268,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
.withName("service name")
|
||||
.withUrl("service url")
|
||||
.withLdnUrl("service ldn url")
|
||||
.isEnabled(false)
|
||||
.build();
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
@@ -256,7 +285,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
.contentType(MediaType.APPLICATION_JSON_PATCH_JSON))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$", matchNotifyService(notifyServiceEntity.getID(), "service name",
|
||||
"add service description", "service url", "service ldn url"))
|
||||
"add service description", "service url", "service ldn url", false))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -314,7 +343,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
.contentType(MediaType.APPLICATION_JSON_PATCH_JSON))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$", matchNotifyService(notifyServiceEntity.getID(), "service name",
|
||||
"service description replaced", "service url", "service ldn url"))
|
||||
"service description replaced", "service url", "service ldn url", false))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -329,6 +358,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
.withDescription("service description")
|
||||
.withUrl("service url")
|
||||
.withLdnUrl("service ldn url")
|
||||
.isEnabled(false)
|
||||
.build();
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
@@ -345,7 +375,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
.contentType(MediaType.APPLICATION_JSON_PATCH_JSON))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$", matchNotifyService(notifyServiceEntity.getID(), "service name",
|
||||
null, "service url", "service ldn url"))
|
||||
null, "service url", "service ldn url", false))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -403,7 +433,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
.contentType(MediaType.APPLICATION_JSON_PATCH_JSON))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$", matchNotifyService(notifyServiceEntity.getID(), "service name",
|
||||
"service description", "add service url", "service ldn url"))
|
||||
"service description", "add service url", "service ldn url", false))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -445,6 +475,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
.withDescription("service description")
|
||||
.withUrl("service url")
|
||||
.withLdnUrl("service ldn url")
|
||||
.isEnabled(true)
|
||||
.build();
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
@@ -461,7 +492,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
.contentType(MediaType.APPLICATION_JSON_PATCH_JSON))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$", matchNotifyService(notifyServiceEntity.getID(), "service name",
|
||||
"service description", "service url replaced", "service ldn url"))
|
||||
"service description", "service url replaced", "service ldn url", true))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -777,10 +808,10 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
List<Operation> ops = new ArrayList<Operation>();
|
||||
AddOperation inboundAddOperationOne = new AddOperation("notifyservices_inbound_patterns/-",
|
||||
AddOperation inboundAddOperationOne = new AddOperation("notifyServiceInboundPatterns/-",
|
||||
"{\"pattern\":\"patternA\",\"constraint\":\"itemFilterA\",\"automatic\":\"false\"}");
|
||||
|
||||
AddOperation inboundAddOperationTwo = new AddOperation("notifyservices_inbound_patterns/-",
|
||||
AddOperation inboundAddOperationTwo = new AddOperation("notifyServiceInboundPatterns/-",
|
||||
"{\"pattern\":\"patternB\",\"constraint\":\"itemFilterB\",\"automatic\":\"true\"}");
|
||||
|
||||
ops.add(inboundAddOperationOne);
|
||||
@@ -822,10 +853,10 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
List<Operation> ops = new ArrayList<Operation>();
|
||||
AddOperation inboundAddOperationOne = new AddOperation("notifyservices_inbound_patterns/-",
|
||||
AddOperation inboundAddOperationOne = new AddOperation("notifyServiceInboundPatterns/-",
|
||||
"{\"pattern\":\"patternA\",\"constraint\":\"itemFilterA\",\"automatic\":\"false\"}");
|
||||
|
||||
AddOperation inboundAddOperationTwo = new AddOperation("notifyservices_inbound_patterns/-",
|
||||
AddOperation inboundAddOperationTwo = new AddOperation("notifyServiceInboundPatterns/-",
|
||||
"{\"pattern\":\"patternB\",\"constraint\":\"itemFilterB\",\"automatic\":\"true\"}");
|
||||
|
||||
ops.add(inboundAddOperationOne);
|
||||
@@ -874,10 +905,10 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
List<Operation> ops = new ArrayList<Operation>();
|
||||
AddOperation outboundAddOperationOne = new AddOperation("notifyservices_outbound_patterns/-",
|
||||
AddOperation outboundAddOperationOne = new AddOperation("notifyServiceOutboundPatterns/-",
|
||||
"{\"pattern\":\"patternA\",\"constraint\":\"itemFilterA\"}");
|
||||
|
||||
AddOperation outboundAddOperationTwo = new AddOperation("notifyservices_outbound_patterns/-",
|
||||
AddOperation outboundAddOperationTwo = new AddOperation("notifyServiceOutboundPatterns/-",
|
||||
"{\"pattern\":\"patternB\",\"constraint\":\"itemFilterB\"}");
|
||||
|
||||
ops.add(outboundAddOperationOne);
|
||||
@@ -919,10 +950,10 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
List<Operation> ops = new ArrayList<Operation>();
|
||||
AddOperation outboundAddOperationOne = new AddOperation("notifyservices_outbound_patterns/-",
|
||||
AddOperation outboundAddOperationOne = new AddOperation("notifyServiceOutboundPatterns/-",
|
||||
"{\"pattern\":\"patternA\",\"constraint\":\"itemFilterA\"}");
|
||||
|
||||
AddOperation outboundAddOperationTwo = new AddOperation("notifyservices_outbound_patterns/-",
|
||||
AddOperation outboundAddOperationTwo = new AddOperation("notifyServiceOutboundPatterns/-",
|
||||
"{\"pattern\":\"patternB\",\"constraint\":\"itemFilterB\"}");
|
||||
|
||||
ops.add(outboundAddOperationOne);
|
||||
@@ -971,10 +1002,10 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
List<Operation> ops = new ArrayList<Operation>();
|
||||
AddOperation inboundAddOperationOne = new AddOperation("notifyservices_inbound_patterns/-",
|
||||
AddOperation inboundAddOperationOne = new AddOperation("notifyServiceInboundPatterns/-",
|
||||
"{\"pattern\":\"patternA\",\"constraint\":\"itemFilterA\",\"automatic\":\"false\"}");
|
||||
|
||||
AddOperation inboundAddOperationTwo = new AddOperation("notifyservices_inbound_patterns/-",
|
||||
AddOperation inboundAddOperationTwo = new AddOperation("notifyServiceInboundPatterns/-",
|
||||
"{\"pattern\":\"patternB\",\"constraint\":\"itemFilterB\",\"automatic\":\"true\"}");
|
||||
|
||||
ops.add(inboundAddOperationOne);
|
||||
@@ -999,7 +1030,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
))
|
||||
)));
|
||||
|
||||
RemoveOperation inboundRemoveOperation = new RemoveOperation("notifyservices_inbound_patterns[0]");
|
||||
RemoveOperation inboundRemoveOperation = new RemoveOperation("notifyServiceInboundPatterns[0]");
|
||||
ops.clear();
|
||||
ops.add(inboundRemoveOperation);
|
||||
patchBody = getPatchContent(ops);
|
||||
@@ -1037,7 +1068,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
List<Operation> ops = new ArrayList<Operation>();
|
||||
AddOperation inboundAddOperation = new AddOperation("notifyservices_inbound_patterns/-",
|
||||
AddOperation inboundAddOperation = new AddOperation("notifyServiceInboundPatterns/-",
|
||||
"{\"pattern\":\"patternA\",\"constraint\":\"itemFilterA\",\"automatic\":\"false\"}");
|
||||
|
||||
ops.add(inboundAddOperation);
|
||||
@@ -1061,7 +1092,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
)));
|
||||
|
||||
// index out of the range
|
||||
RemoveOperation inboundRemoveOperation = new RemoveOperation("notifyservices_inbound_patterns[1]");
|
||||
RemoveOperation inboundRemoveOperation = new RemoveOperation("notifyServiceInboundPatterns[1]");
|
||||
ops.clear();
|
||||
ops.add(inboundRemoveOperation);
|
||||
patchBody = getPatchContent(ops);
|
||||
@@ -1089,10 +1120,10 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
List<Operation> ops = new ArrayList<Operation>();
|
||||
AddOperation outboundAddOperationOne = new AddOperation("notifyservices_outbound_patterns/-",
|
||||
AddOperation outboundAddOperationOne = new AddOperation("notifyServiceOutboundPatterns/-",
|
||||
"{\"pattern\":\"patternA\",\"constraint\":\"itemFilterA\"}");
|
||||
|
||||
AddOperation outboundAddOperationTwo = new AddOperation("notifyservices_outbound_patterns/-",
|
||||
AddOperation outboundAddOperationTwo = new AddOperation("notifyServiceOutboundPatterns/-",
|
||||
"{\"pattern\":\"patternB\",\"constraint\":\"itemFilterB\"}");
|
||||
|
||||
ops.add(outboundAddOperationOne);
|
||||
@@ -1117,7 +1148,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
))
|
||||
)));
|
||||
|
||||
RemoveOperation outboundRemoveOperation = new RemoveOperation("notifyservices_outbound_patterns[0]");
|
||||
RemoveOperation outboundRemoveOperation = new RemoveOperation("notifyServiceOutboundPatterns[0]");
|
||||
ops.clear();
|
||||
ops.add(outboundRemoveOperation);
|
||||
patchBody = getPatchContent(ops);
|
||||
@@ -1155,7 +1186,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
List<Operation> ops = new ArrayList<Operation>();
|
||||
AddOperation outboundAddOperation = new AddOperation("notifyservices_outbound_patterns/-",
|
||||
AddOperation outboundAddOperation = new AddOperation("notifyServiceOutboundPatterns/-",
|
||||
"{\"pattern\":\"patternA\",\"constraint\":\"itemFilterA\"}");
|
||||
|
||||
ops.add(outboundAddOperation);
|
||||
@@ -1179,7 +1210,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
)));
|
||||
|
||||
// index out of the range
|
||||
RemoveOperation outboundRemoveOperation = new RemoveOperation("notifyservices_outbound_patterns[1]");
|
||||
RemoveOperation outboundRemoveOperation = new RemoveOperation("notifyServiceOutboundPatterns[1]");
|
||||
ops.clear();
|
||||
ops.add(outboundRemoveOperation);
|
||||
patchBody = getPatchContent(ops);
|
||||
@@ -1207,10 +1238,10 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
List<Operation> ops = new ArrayList<Operation>();
|
||||
AddOperation inboundAddOperationOne = new AddOperation("notifyservices_inbound_patterns/-",
|
||||
AddOperation inboundAddOperationOne = new AddOperation("notifyServiceInboundPatterns/-",
|
||||
"{\"pattern\":\"patternA\",\"constraint\":null,\"automatic\":\"false\"}");
|
||||
|
||||
AddOperation inboundAddOperationTwo = new AddOperation("notifyservices_inbound_patterns/-",
|
||||
AddOperation inboundAddOperationTwo = new AddOperation("notifyServiceInboundPatterns/-",
|
||||
"{\"pattern\":\"patternB\",\"constraint\":\"itemFilterB\",\"automatic\":\"true\"}");
|
||||
|
||||
ops.add(inboundAddOperationOne);
|
||||
@@ -1235,7 +1266,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
))
|
||||
)));
|
||||
|
||||
AddOperation inboundAddOperation = new AddOperation("notifyservices_inbound_patterns[0]/constraint",
|
||||
AddOperation inboundAddOperation = new AddOperation("notifyServiceInboundPatterns[0]/constraint",
|
||||
"itemFilterA");
|
||||
ops.clear();
|
||||
ops.add(inboundAddOperation);
|
||||
@@ -1275,10 +1306,10 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
List<Operation> ops = new ArrayList<Operation>();
|
||||
AddOperation inboundAddOperationOne = new AddOperation("notifyservices_inbound_patterns/-",
|
||||
AddOperation inboundAddOperationOne = new AddOperation("notifyServiceInboundPatterns/-",
|
||||
"{\"pattern\":\"patternA\",\"constraint\":\"itemFilterA\",\"automatic\":\"false\"}");
|
||||
|
||||
AddOperation inboundAddOperationTwo = new AddOperation("notifyservices_inbound_patterns/-",
|
||||
AddOperation inboundAddOperationTwo = new AddOperation("notifyServiceInboundPatterns/-",
|
||||
"{\"pattern\":\"patternB\",\"constraint\":\"itemFilterB\",\"automatic\":\"true\"}");
|
||||
|
||||
ops.add(inboundAddOperationOne);
|
||||
@@ -1303,7 +1334,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
))
|
||||
)));
|
||||
|
||||
AddOperation inboundAddOperation = new AddOperation("notifyservices_inbound_patterns[0]/constraint",
|
||||
AddOperation inboundAddOperation = new AddOperation("notifyServiceInboundPatterns[0]/constraint",
|
||||
"itemFilterA");
|
||||
ops.clear();
|
||||
ops.add(inboundAddOperation);
|
||||
@@ -1333,10 +1364,10 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
List<Operation> ops = new ArrayList<Operation>();
|
||||
AddOperation inboundAddOperationOne = new AddOperation("notifyservices_inbound_patterns/-",
|
||||
AddOperation inboundAddOperationOne = new AddOperation("notifyServiceInboundPatterns/-",
|
||||
"{\"pattern\":\"patternA\",\"constraint\":\"itemFilterA\",\"automatic\":\"false\"}");
|
||||
|
||||
AddOperation inboundAddOperationTwo = new AddOperation("notifyservices_inbound_patterns/-",
|
||||
AddOperation inboundAddOperationTwo = new AddOperation("notifyServiceInboundPatterns/-",
|
||||
"{\"pattern\":\"patternB\",\"constraint\":\"itemFilterB\",\"automatic\":\"true\"}");
|
||||
|
||||
ops.add(inboundAddOperationOne);
|
||||
@@ -1361,7 +1392,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
))
|
||||
)));
|
||||
|
||||
ReplaceOperation inboundReplaceOperation = new ReplaceOperation("notifyservices_inbound_patterns[0]/constraint",
|
||||
ReplaceOperation inboundReplaceOperation = new ReplaceOperation("notifyServiceInboundPatterns[0]/constraint",
|
||||
"itemFilterC");
|
||||
ops.clear();
|
||||
ops.add(inboundReplaceOperation);
|
||||
@@ -1401,10 +1432,10 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
List<Operation> ops = new ArrayList<Operation>();
|
||||
AddOperation inboundAddOperationOne = new AddOperation("notifyservices_inbound_patterns/-",
|
||||
AddOperation inboundAddOperationOne = new AddOperation("notifyServiceInboundPatterns/-",
|
||||
"{\"pattern\":\"patternA\",\"constraint\":null,\"automatic\":\"false\"}");
|
||||
|
||||
AddOperation inboundAddOperationTwo = new AddOperation("notifyservices_inbound_patterns/-",
|
||||
AddOperation inboundAddOperationTwo = new AddOperation("notifyServiceInboundPatterns/-",
|
||||
"{\"pattern\":\"patternB\",\"constraint\":\"itemFilterB\",\"automatic\":\"true\"}");
|
||||
|
||||
ops.add(inboundAddOperationOne);
|
||||
@@ -1429,7 +1460,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
))
|
||||
)));
|
||||
|
||||
ReplaceOperation inboundReplaceOperation = new ReplaceOperation("notifyservices_inbound_patterns[0]/constraint",
|
||||
ReplaceOperation inboundReplaceOperation = new ReplaceOperation("notifyServiceInboundPatterns[0]/constraint",
|
||||
"itemFilterA");
|
||||
ops.clear();
|
||||
ops.add(inboundReplaceOperation);
|
||||
@@ -1459,10 +1490,10 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
List<Operation> ops = new ArrayList<Operation>();
|
||||
AddOperation inboundAddOperationOne = new AddOperation("notifyservices_inbound_patterns/-",
|
||||
AddOperation inboundAddOperationOne = new AddOperation("notifyServiceInboundPatterns/-",
|
||||
"{\"pattern\":\"patternA\",\"constraint\":\"itemFilterA\",\"automatic\":\"false\"}");
|
||||
|
||||
AddOperation inboundAddOperationTwo = new AddOperation("notifyservices_inbound_patterns/-",
|
||||
AddOperation inboundAddOperationTwo = new AddOperation("notifyServiceInboundPatterns/-",
|
||||
"{\"pattern\":\"patternB\",\"constraint\":\"itemFilterB\",\"automatic\":\"true\"}");
|
||||
|
||||
ops.add(inboundAddOperationOne);
|
||||
@@ -1487,7 +1518,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
))
|
||||
)));
|
||||
|
||||
RemoveOperation inboundRemoveOperation = new RemoveOperation("notifyservices_inbound_patterns[1]/constraint");
|
||||
RemoveOperation inboundRemoveOperation = new RemoveOperation("notifyServiceInboundPatterns[1]/constraint");
|
||||
ops.clear();
|
||||
ops.add(inboundRemoveOperation);
|
||||
patchBody = getPatchContent(ops);
|
||||
@@ -1526,7 +1557,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
List<Operation> ops = new ArrayList<Operation>();
|
||||
AddOperation inboundAddOperation = new AddOperation("notifyservices_inbound_patterns/-",
|
||||
AddOperation inboundAddOperation = new AddOperation("notifyServiceInboundPatterns/-",
|
||||
"{\"pattern\":\"patternA\",\"constraint\":\"itemFilterA\",\"automatic\":\"false\"}");
|
||||
|
||||
ops.add(inboundAddOperation);
|
||||
@@ -1550,7 +1581,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
)));
|
||||
|
||||
// index out of the range
|
||||
RemoveOperation inboundRemoveOperation = new RemoveOperation("notifyservices_inbound_patterns[1]/constraint");
|
||||
RemoveOperation inboundRemoveOperation = new RemoveOperation("notifyServiceInboundPatterns[1]/constraint");
|
||||
ops.clear();
|
||||
ops.add(inboundRemoveOperation);
|
||||
patchBody = getPatchContent(ops);
|
||||
@@ -1578,10 +1609,10 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
List<Operation> ops = new ArrayList<Operation>();
|
||||
AddOperation outboundAddOperationOne = new AddOperation("notifyservices_outbound_patterns/-",
|
||||
AddOperation outboundAddOperationOne = new AddOperation("notifyServiceOutboundPatterns/-",
|
||||
"{\"pattern\":\"patternA\",\"constraint\":null}");
|
||||
|
||||
AddOperation outboundAddOperationTwo = new AddOperation("notifyservices_outbound_patterns/-",
|
||||
AddOperation outboundAddOperationTwo = new AddOperation("notifyServiceOutboundPatterns/-",
|
||||
"{\"pattern\":\"patternB\",\"constraint\":null}");
|
||||
|
||||
ops.add(outboundAddOperationOne);
|
||||
@@ -1606,7 +1637,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
))
|
||||
)));
|
||||
|
||||
AddOperation outboundAddOperation = new AddOperation("notifyservices_outbound_patterns[1]/constraint",
|
||||
AddOperation outboundAddOperation = new AddOperation("notifyServiceOutboundPatterns[1]/constraint",
|
||||
"itemFilterB");
|
||||
ops.clear();
|
||||
ops.add(outboundAddOperation);
|
||||
@@ -1646,10 +1677,10 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
List<Operation> ops = new ArrayList<Operation>();
|
||||
AddOperation outboundAddOperationOne = new AddOperation("notifyservices_outbound_patterns/-",
|
||||
AddOperation outboundAddOperationOne = new AddOperation("notifyServiceOutboundPatterns/-",
|
||||
"{\"pattern\":\"patternA\",\"constraint\":\"itemFilterA\"}");
|
||||
|
||||
AddOperation outboundAddOperationTwo = new AddOperation("notifyservices_outbound_patterns/-",
|
||||
AddOperation outboundAddOperationTwo = new AddOperation("notifyServiceOutboundPatterns/-",
|
||||
"{\"pattern\":\"patternB\",\"constraint\":\"itemFilterB\"}");
|
||||
|
||||
ops.add(outboundAddOperationOne);
|
||||
@@ -1674,7 +1705,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
))
|
||||
)));
|
||||
|
||||
AddOperation outboundAddOperation = new AddOperation("notifyservices_outbound_patterns[1]/constraint",
|
||||
AddOperation outboundAddOperation = new AddOperation("notifyServiceOutboundPatterns[1]/constraint",
|
||||
"itemFilterB");
|
||||
ops.clear();
|
||||
ops.add(outboundAddOperation);
|
||||
@@ -1704,10 +1735,10 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
List<Operation> ops = new ArrayList<Operation>();
|
||||
AddOperation outboundAddOperationOne = new AddOperation("notifyservices_outbound_patterns/-",
|
||||
AddOperation outboundAddOperationOne = new AddOperation("notifyServiceOutboundPatterns/-",
|
||||
"{\"pattern\":\"patternA\",\"constraint\":\"itemFilterA\"}");
|
||||
|
||||
AddOperation outboundAddOperationTwo = new AddOperation("notifyservices_outbound_patterns/-",
|
||||
AddOperation outboundAddOperationTwo = new AddOperation("notifyServiceOutboundPatterns/-",
|
||||
"{\"pattern\":\"patternB\",\"constraint\":\"itemFilterB\"}");
|
||||
|
||||
ops.add(outboundAddOperationOne);
|
||||
@@ -1733,7 +1764,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
)));
|
||||
|
||||
ReplaceOperation outboundReplaceOperation = new ReplaceOperation(
|
||||
"notifyservices_outbound_patterns[1]/constraint", "itemFilterD");
|
||||
"notifyServiceOutboundPatterns[1]/constraint", "itemFilterD");
|
||||
ops.clear();
|
||||
ops.add(outboundReplaceOperation);
|
||||
patchBody = getPatchContent(ops);
|
||||
@@ -1772,10 +1803,10 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
List<Operation> ops = new ArrayList<Operation>();
|
||||
AddOperation outboundAddOperationOne = new AddOperation("notifyservices_outbound_patterns/-",
|
||||
AddOperation outboundAddOperationOne = new AddOperation("notifyServiceOutboundPatterns/-",
|
||||
"{\"pattern\":\"patternA\",\"constraint\":\"itemFilterA\"}");
|
||||
|
||||
AddOperation outboundAddOperationTwo = new AddOperation("notifyservices_outbound_patterns/-",
|
||||
AddOperation outboundAddOperationTwo = new AddOperation("notifyServiceOutboundPatterns/-",
|
||||
"{\"pattern\":\"patternB\",\"constraint\":null}");
|
||||
|
||||
ops.add(outboundAddOperationOne);
|
||||
@@ -1801,7 +1832,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
)));
|
||||
|
||||
ReplaceOperation outboundReplaceOperation = new ReplaceOperation(
|
||||
"notifyservices_outbound_patterns[1]/constraint", "itemFilterB");
|
||||
"notifyServiceOutboundPatterns[1]/constraint", "itemFilterB");
|
||||
ops.clear();
|
||||
ops.add(outboundReplaceOperation);
|
||||
patchBody = getPatchContent(ops);
|
||||
@@ -1830,10 +1861,10 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
List<Operation> ops = new ArrayList<Operation>();
|
||||
AddOperation outboundAddOperationOne = new AddOperation("notifyservices_outbound_patterns/-",
|
||||
AddOperation outboundAddOperationOne = new AddOperation("notifyServiceOutboundPatterns/-",
|
||||
"{\"pattern\":\"patternA\",\"constraint\":\"itemFilterA\"}");
|
||||
|
||||
AddOperation outboundAddOperationTwo = new AddOperation("notifyservices_outbound_patterns/-",
|
||||
AddOperation outboundAddOperationTwo = new AddOperation("notifyServiceOutboundPatterns/-",
|
||||
"{\"pattern\":\"patternB\",\"constraint\":\"itemFilterB\"}");
|
||||
|
||||
ops.add(outboundAddOperationOne);
|
||||
@@ -1858,7 +1889,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
))
|
||||
)));
|
||||
|
||||
RemoveOperation outboundRemoveOperation = new RemoveOperation("notifyservices_outbound_patterns[0]/constraint");
|
||||
RemoveOperation outboundRemoveOperation = new RemoveOperation("notifyServiceOutboundPatterns[0]/constraint");
|
||||
ops.clear();
|
||||
ops.add(outboundRemoveOperation);
|
||||
patchBody = getPatchContent(ops);
|
||||
@@ -1897,7 +1928,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
List<Operation> ops = new ArrayList<Operation>();
|
||||
AddOperation outboundAddOperation = new AddOperation("notifyservices_outbound_patterns/-",
|
||||
AddOperation outboundAddOperation = new AddOperation("notifyServiceOutboundPatterns/-",
|
||||
"{\"pattern\":\"patternA\",\"constraint\":\"itemFilterA\"}");
|
||||
|
||||
ops.add(outboundAddOperation);
|
||||
@@ -1921,7 +1952,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
)));
|
||||
|
||||
// index out of the range
|
||||
RemoveOperation outboundRemoveOperation = new RemoveOperation("notifyservices_outbound_patterns[1]/constraint");
|
||||
RemoveOperation outboundRemoveOperation = new RemoveOperation("notifyServiceOutboundPatterns[1]/constraint");
|
||||
ops.clear();
|
||||
ops.add(outboundRemoveOperation);
|
||||
patchBody = getPatchContent(ops);
|
||||
@@ -1949,10 +1980,10 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
List<Operation> ops = new ArrayList<Operation>();
|
||||
AddOperation inboundAddOperationOne = new AddOperation("notifyservices_inbound_patterns/-",
|
||||
AddOperation inboundAddOperationOne = new AddOperation("notifyServiceInboundPatterns/-",
|
||||
"{\"pattern\":null,\"constraint\":\"itemFilterA\",\"automatic\":\"false\"}");
|
||||
|
||||
AddOperation inboundAddOperationTwo = new AddOperation("notifyservices_inbound_patterns/-",
|
||||
AddOperation inboundAddOperationTwo = new AddOperation("notifyServiceInboundPatterns/-",
|
||||
"{\"pattern\":\"patternB\",\"constraint\":\"itemFilterB\",\"automatic\":\"true\"}");
|
||||
|
||||
ops.add(inboundAddOperationOne);
|
||||
@@ -1977,7 +2008,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
))
|
||||
)));
|
||||
|
||||
AddOperation inboundAddOperation = new AddOperation("notifyservices_inbound_patterns[0]/pattern",
|
||||
AddOperation inboundAddOperation = new AddOperation("notifyServiceInboundPatterns[0]/pattern",
|
||||
"patternA");
|
||||
ops.clear();
|
||||
ops.add(inboundAddOperation);
|
||||
@@ -2017,10 +2048,10 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
List<Operation> ops = new ArrayList<Operation>();
|
||||
AddOperation inboundAddOperationOne = new AddOperation("notifyservices_inbound_patterns/-",
|
||||
AddOperation inboundAddOperationOne = new AddOperation("notifyServiceInboundPatterns/-",
|
||||
"{\"pattern\":\"patternA\",\"constraint\":\"itemFilterA\",\"automatic\":\"false\"}");
|
||||
|
||||
AddOperation inboundAddOperationTwo = new AddOperation("notifyservices_inbound_patterns/-",
|
||||
AddOperation inboundAddOperationTwo = new AddOperation("notifyServiceInboundPatterns/-",
|
||||
"{\"pattern\":\"patternB\",\"constraint\":\"itemFilterB\",\"automatic\":\"true\"}");
|
||||
|
||||
ops.add(inboundAddOperationOne);
|
||||
@@ -2045,7 +2076,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
))
|
||||
)));
|
||||
|
||||
AddOperation inboundAddOperation = new AddOperation("notifyservices_inbound_patterns[0]/pattern",
|
||||
AddOperation inboundAddOperation = new AddOperation("notifyServiceInboundPatterns[0]/pattern",
|
||||
"patternA");
|
||||
ops.clear();
|
||||
ops.add(inboundAddOperation);
|
||||
@@ -2075,10 +2106,10 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
List<Operation> ops = new ArrayList<Operation>();
|
||||
AddOperation inboundAddOperationOne = new AddOperation("notifyservices_inbound_patterns/-",
|
||||
AddOperation inboundAddOperationOne = new AddOperation("notifyServiceInboundPatterns/-",
|
||||
"{\"pattern\":\"patternA\",\"constraint\":\"itemFilterA\",\"automatic\":\"false\"}");
|
||||
|
||||
AddOperation inboundAddOperationTwo = new AddOperation("notifyservices_inbound_patterns/-",
|
||||
AddOperation inboundAddOperationTwo = new AddOperation("notifyServiceInboundPatterns/-",
|
||||
"{\"pattern\":\"patternB\",\"constraint\":\"itemFilterB\",\"automatic\":\"true\"}");
|
||||
|
||||
ops.add(inboundAddOperationOne);
|
||||
@@ -2103,7 +2134,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
))
|
||||
)));
|
||||
|
||||
ReplaceOperation inboundReplaceOperation = new ReplaceOperation("notifyservices_inbound_patterns[0]/pattern",
|
||||
ReplaceOperation inboundReplaceOperation = new ReplaceOperation("notifyServiceInboundPatterns[0]/pattern",
|
||||
"patternC");
|
||||
ops.clear();
|
||||
ops.add(inboundReplaceOperation);
|
||||
@@ -2143,10 +2174,10 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
List<Operation> ops = new ArrayList<Operation>();
|
||||
AddOperation inboundAddOperationOne = new AddOperation("notifyservices_inbound_patterns/-",
|
||||
AddOperation inboundAddOperationOne = new AddOperation("notifyServiceInboundPatterns/-",
|
||||
"{\"pattern\":null,\"constraint\":\"itemFilterA\",\"automatic\":\"false\"}");
|
||||
|
||||
AddOperation inboundAddOperationTwo = new AddOperation("notifyservices_inbound_patterns/-",
|
||||
AddOperation inboundAddOperationTwo = new AddOperation("notifyServiceInboundPatterns/-",
|
||||
"{\"pattern\":\"patternB\",\"constraint\":\"itemFilterB\",\"automatic\":\"true\"}");
|
||||
|
||||
ops.add(inboundAddOperationOne);
|
||||
@@ -2171,7 +2202,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
))
|
||||
)));
|
||||
|
||||
ReplaceOperation inboundReplaceOperation = new ReplaceOperation("notifyservices_inbound_patterns[0]/pattern",
|
||||
ReplaceOperation inboundReplaceOperation = new ReplaceOperation("notifyServiceInboundPatterns[0]/pattern",
|
||||
"patternA");
|
||||
ops.clear();
|
||||
ops.add(inboundReplaceOperation);
|
||||
@@ -2201,10 +2232,10 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
List<Operation> ops = new ArrayList<Operation>();
|
||||
AddOperation inboundAddOperationOne = new AddOperation("notifyservices_inbound_patterns/-",
|
||||
AddOperation inboundAddOperationOne = new AddOperation("notifyServiceInboundPatterns/-",
|
||||
"{\"pattern\":\"patternA\",\"constraint\":\"itemFilterA\",\"automatic\":\"false\"}");
|
||||
|
||||
AddOperation inboundAddOperationTwo = new AddOperation("notifyservices_inbound_patterns/-",
|
||||
AddOperation inboundAddOperationTwo = new AddOperation("notifyServiceInboundPatterns/-",
|
||||
"{\"pattern\":\"patternB\",\"constraint\":\"itemFilterB\",\"automatic\":\"true\"}");
|
||||
|
||||
ops.add(inboundAddOperationOne);
|
||||
@@ -2229,7 +2260,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
))
|
||||
)));
|
||||
|
||||
ReplaceOperation inboundReplaceOperation = new ReplaceOperation("notifyservices_inbound_patterns[0]/automatic",
|
||||
ReplaceOperation inboundReplaceOperation = new ReplaceOperation("notifyServiceInboundPatterns[0]/automatic",
|
||||
"true");
|
||||
ops.clear();
|
||||
ops.add(inboundReplaceOperation);
|
||||
@@ -2269,10 +2300,10 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
List<Operation> ops = new ArrayList<Operation>();
|
||||
AddOperation inboundAddOperationOne = new AddOperation("notifyservices_inbound_patterns/-",
|
||||
AddOperation inboundAddOperationOne = new AddOperation("notifyServiceInboundPatterns/-",
|
||||
"{\"pattern\":\"patternA\",\"constraint\":\"itemFilterA\",\"automatic\":\"false\"}");
|
||||
|
||||
AddOperation inboundAddOperationTwo = new AddOperation("notifyservices_inbound_patterns/-",
|
||||
AddOperation inboundAddOperationTwo = new AddOperation("notifyServiceInboundPatterns/-",
|
||||
"{\"pattern\":\"patternB\",\"constraint\":\"itemFilterB\",\"automatic\":\"true\"}");
|
||||
|
||||
ops.add(inboundAddOperationOne);
|
||||
@@ -2297,7 +2328,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
))
|
||||
)));
|
||||
|
||||
ReplaceOperation inboundReplaceOperation = new ReplaceOperation("notifyservices_inbound_patterns[0]/automatic",
|
||||
ReplaceOperation inboundReplaceOperation = new ReplaceOperation("notifyServiceInboundPatterns[0]/automatic",
|
||||
"test");
|
||||
ops.clear();
|
||||
ops.add(inboundReplaceOperation);
|
||||
@@ -2327,10 +2358,10 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
List<Operation> ops = new ArrayList<Operation>();
|
||||
AddOperation outboundAddOperationOne = new AddOperation("notifyservices_outbound_patterns/-",
|
||||
AddOperation outboundAddOperationOne = new AddOperation("notifyServiceOutboundPatterns/-",
|
||||
"{\"pattern\":\"patternA\",\"constraint\":\"itemFilterA\"}");
|
||||
|
||||
AddOperation outboundAddOperationTwo = new AddOperation("notifyservices_outbound_patterns/-",
|
||||
AddOperation outboundAddOperationTwo = new AddOperation("notifyServiceOutboundPatterns/-",
|
||||
"{\"pattern\":null,\"constraint\":\"itemFilterB\"}");
|
||||
|
||||
ops.add(outboundAddOperationOne);
|
||||
@@ -2355,7 +2386,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
))
|
||||
)));
|
||||
|
||||
AddOperation outboundAddOperation = new AddOperation("notifyservices_outbound_patterns[1]/pattern",
|
||||
AddOperation outboundAddOperation = new AddOperation("notifyServiceOutboundPatterns[1]/pattern",
|
||||
"patternB");
|
||||
ops.clear();
|
||||
ops.add(outboundAddOperation);
|
||||
@@ -2395,10 +2426,10 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
List<Operation> ops = new ArrayList<Operation>();
|
||||
AddOperation outboundAddOperationOne = new AddOperation("notifyservices_outbound_patterns/-",
|
||||
AddOperation outboundAddOperationOne = new AddOperation("notifyServiceOutboundPatterns/-",
|
||||
"{\"pattern\":\"patternA\",\"constraint\":\"itemFilterA\"}");
|
||||
|
||||
AddOperation outboundAddOperationTwo = new AddOperation("notifyservices_outbound_patterns/-",
|
||||
AddOperation outboundAddOperationTwo = new AddOperation("notifyServiceOutboundPatterns/-",
|
||||
"{\"pattern\":\"patternB\",\"constraint\":\"itemFilterB\"}");
|
||||
|
||||
ops.add(outboundAddOperationOne);
|
||||
@@ -2423,7 +2454,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
))
|
||||
)));
|
||||
|
||||
AddOperation outboundAddOperation = new AddOperation("notifyservices_outbound_patterns[1]/pattern",
|
||||
AddOperation outboundAddOperation = new AddOperation("notifyServiceOutboundPatterns[1]/pattern",
|
||||
"patternB");
|
||||
ops.clear();
|
||||
ops.add(outboundAddOperation);
|
||||
@@ -2453,10 +2484,10 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
List<Operation> ops = new ArrayList<Operation>();
|
||||
AddOperation outboundAddOperationOne = new AddOperation("notifyservices_outbound_patterns/-",
|
||||
AddOperation outboundAddOperationOne = new AddOperation("notifyServiceOutboundPatterns/-",
|
||||
"{\"pattern\":\"patternA\",\"constraint\":\"itemFilterA\"}");
|
||||
|
||||
AddOperation outboundAddOperationTwo = new AddOperation("notifyservices_outbound_patterns/-",
|
||||
AddOperation outboundAddOperationTwo = new AddOperation("notifyServiceOutboundPatterns/-",
|
||||
"{\"pattern\":\"patternB\",\"constraint\":\"itemFilterB\"}");
|
||||
|
||||
ops.add(outboundAddOperationOne);
|
||||
@@ -2481,7 +2512,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
))
|
||||
)));
|
||||
|
||||
ReplaceOperation outboundReplaceOperation = new ReplaceOperation("notifyservices_outbound_patterns[1]/pattern",
|
||||
ReplaceOperation outboundReplaceOperation = new ReplaceOperation("notifyServiceOutboundPatterns[1]/pattern",
|
||||
"patternD");
|
||||
ops.clear();
|
||||
ops.add(outboundReplaceOperation);
|
||||
@@ -2521,10 +2552,10 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
List<Operation> ops = new ArrayList<Operation>();
|
||||
AddOperation outboundAddOperationOne = new AddOperation("notifyservices_outbound_patterns/-",
|
||||
AddOperation outboundAddOperationOne = new AddOperation("notifyServiceOutboundPatterns/-",
|
||||
"{\"pattern\":\"patternA\",\"constraint\":\"itemFilterA\"}");
|
||||
|
||||
AddOperation outboundAddOperationTwo = new AddOperation("notifyservices_outbound_patterns/-",
|
||||
AddOperation outboundAddOperationTwo = new AddOperation("notifyServiceOutboundPatterns/-",
|
||||
"{\"pattern\":null,\"constraint\":\"itemFilterB\"}");
|
||||
|
||||
ops.add(outboundAddOperationOne);
|
||||
@@ -2549,7 +2580,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
))
|
||||
)));
|
||||
|
||||
ReplaceOperation outboundReplaceOperation = new ReplaceOperation("notifyservices_outbound_patterns[1]/pattern",
|
||||
ReplaceOperation outboundReplaceOperation = new ReplaceOperation("notifyServiceOutboundPatterns[1]/pattern",
|
||||
"patternB");
|
||||
ops.clear();
|
||||
ops.add(outboundReplaceOperation);
|
||||
@@ -2579,10 +2610,10 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
List<Operation> ops = new ArrayList<Operation>();
|
||||
AddOperation inboundAddOperationOne = new AddOperation("notifyservices_inbound_patterns/-",
|
||||
AddOperation inboundAddOperationOne = new AddOperation("notifyServiceInboundPatterns/-",
|
||||
"{\"pattern\":\"patternA\",\"constraint\":\"itemFilterA\",\"automatic\":\"false\"}");
|
||||
|
||||
AddOperation inboundAddOperationTwo = new AddOperation("notifyservices_inbound_patterns/-",
|
||||
AddOperation inboundAddOperationTwo = new AddOperation("notifyServiceInboundPatterns/-",
|
||||
"{\"pattern\":\"patternB\",\"constraint\":\"itemFilterB\",\"automatic\":\"true\"}");
|
||||
|
||||
ops.add(inboundAddOperationOne);
|
||||
@@ -2607,7 +2638,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
))
|
||||
)));
|
||||
|
||||
ReplaceOperation inboundReplaceOperation = new ReplaceOperation("notifyservices_inbound_patterns",
|
||||
ReplaceOperation inboundReplaceOperation = new ReplaceOperation("notifyServiceInboundPatterns",
|
||||
"[{\"pattern\":\"patternC\",\"constraint\":\"itemFilterC\",\"automatic\":\"true\"}," +
|
||||
"{\"pattern\":\"patternD\",\"constraint\":\"itemFilterD\",\"automatic\":\"true\"}]");
|
||||
ops.clear();
|
||||
@@ -2648,10 +2679,10 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
List<Operation> ops = new ArrayList<Operation>();
|
||||
AddOperation inboundAddOperationOne = new AddOperation("notifyservices_inbound_patterns/-",
|
||||
AddOperation inboundAddOperationOne = new AddOperation("notifyServiceInboundPatterns/-",
|
||||
"{\"pattern\":\"patternA\",\"constraint\":\"itemFilterA\",\"automatic\":\"false\"}");
|
||||
|
||||
AddOperation inboundAddOperationTwo = new AddOperation("notifyservices_inbound_patterns/-",
|
||||
AddOperation inboundAddOperationTwo = new AddOperation("notifyServiceInboundPatterns/-",
|
||||
"{\"pattern\":\"patternB\",\"constraint\":\"itemFilterB\",\"automatic\":\"true\"}");
|
||||
|
||||
ops.add(inboundAddOperationOne);
|
||||
@@ -2677,7 +2708,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
)));
|
||||
|
||||
// empty array will only remove all old patterns
|
||||
ReplaceOperation inboundReplaceOperation = new ReplaceOperation("notifyservices_inbound_patterns", "[]");
|
||||
ReplaceOperation inboundReplaceOperation = new ReplaceOperation("notifyServiceInboundPatterns", "[]");
|
||||
ops.clear();
|
||||
ops.add(inboundReplaceOperation);
|
||||
patchBody = getPatchContent(ops);
|
||||
@@ -2707,10 +2738,10 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
List<Operation> ops = new ArrayList<Operation>();
|
||||
AddOperation inboundAddOperationOne = new AddOperation("notifyservices_inbound_patterns/-",
|
||||
AddOperation inboundAddOperationOne = new AddOperation("notifyServiceInboundPatterns/-",
|
||||
"{\"pattern\":\"patternA\",\"constraint\":\"itemFilterA\",\"automatic\":\"false\"}");
|
||||
|
||||
AddOperation inboundAddOperationTwo = new AddOperation("notifyservices_inbound_patterns/-",
|
||||
AddOperation inboundAddOperationTwo = new AddOperation("notifyServiceInboundPatterns/-",
|
||||
"{\"pattern\":\"patternB\",\"constraint\":\"itemFilterB\",\"automatic\":\"true\"}");
|
||||
|
||||
ops.add(inboundAddOperationOne);
|
||||
@@ -2736,7 +2767,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
)));
|
||||
|
||||
// value must be an array not object
|
||||
ReplaceOperation inboundReplaceOperation = new ReplaceOperation("notifyservices_inbound_patterns",
|
||||
ReplaceOperation inboundReplaceOperation = new ReplaceOperation("notifyServiceInboundPatterns",
|
||||
"{\"pattern\":\"patternB\",\"constraint\":\"itemFilterB\",\"automatic\":\"true\"}");
|
||||
ops.clear();
|
||||
ops.add(inboundReplaceOperation);
|
||||
@@ -2765,10 +2796,10 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
List<Operation> ops = new ArrayList<Operation>();
|
||||
AddOperation outboundAddOperationOne = new AddOperation("notifyservices_outbound_patterns/-",
|
||||
AddOperation outboundAddOperationOne = new AddOperation("notifyServiceOutboundPatterns/-",
|
||||
"{\"pattern\":\"patternA\",\"constraint\":\"itemFilterA\"}");
|
||||
|
||||
AddOperation outboundAddOperationTwo = new AddOperation("notifyservices_outbound_patterns/-",
|
||||
AddOperation outboundAddOperationTwo = new AddOperation("notifyServiceOutboundPatterns/-",
|
||||
"{\"pattern\":\"patternB\",\"constraint\":\"itemFilterB\"}");
|
||||
|
||||
ops.add(outboundAddOperationOne);
|
||||
@@ -2793,7 +2824,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
))
|
||||
)));
|
||||
|
||||
ReplaceOperation outboundReplaceOperation = new ReplaceOperation("notifyservices_outbound_patterns",
|
||||
ReplaceOperation outboundReplaceOperation = new ReplaceOperation("notifyServiceOutboundPatterns",
|
||||
"[{\"pattern\":\"patternC\",\"constraint\":\"itemFilterC\"}," +
|
||||
"{\"pattern\":\"patternD\",\"constraint\":\"itemFilterD\"}]");
|
||||
ops.clear();
|
||||
@@ -2834,10 +2865,10 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
List<Operation> ops = new ArrayList<Operation>();
|
||||
AddOperation outboundAddOperationOne = new AddOperation("notifyservices_outbound_patterns/-",
|
||||
AddOperation outboundAddOperationOne = new AddOperation("notifyServiceOutboundPatterns/-",
|
||||
"{\"pattern\":\"patternA\",\"constraint\":\"itemFilterA\"}");
|
||||
|
||||
AddOperation outboundAddOperationTwo = new AddOperation("notifyservices_outbound_patterns/-",
|
||||
AddOperation outboundAddOperationTwo = new AddOperation("notifyServiceOutboundPatterns/-",
|
||||
"{\"pattern\":\"patternB\",\"constraint\":\"itemFilterB\"}");
|
||||
|
||||
ops.add(outboundAddOperationOne);
|
||||
@@ -2863,7 +2894,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
)));
|
||||
|
||||
// empty array will only remove all old patterns
|
||||
ReplaceOperation outboundReplaceOperation = new ReplaceOperation("notifyservices_outbound_patterns", "[]");
|
||||
ReplaceOperation outboundReplaceOperation = new ReplaceOperation("notifyServiceOutboundPatterns", "[]");
|
||||
ops.clear();
|
||||
ops.add(outboundReplaceOperation);
|
||||
patchBody = getPatchContent(ops);
|
||||
@@ -2893,10 +2924,10 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
List<Operation> ops = new ArrayList<Operation>();
|
||||
AddOperation outboundAddOperationOne = new AddOperation("notifyservices_outbound_patterns/-",
|
||||
AddOperation outboundAddOperationOne = new AddOperation("notifyServiceOutboundPatterns/-",
|
||||
"{\"pattern\":\"patternA\",\"constraint\":\"itemFilterA\"}");
|
||||
|
||||
AddOperation outboundAddOperationTwo = new AddOperation("notifyservices_outbound_patterns/-",
|
||||
AddOperation outboundAddOperationTwo = new AddOperation("notifyServiceOutboundPatterns/-",
|
||||
"{\"pattern\":\"patternB\",\"constraint\":\"itemFilterB\"}");
|
||||
|
||||
ops.add(outboundAddOperationOne);
|
||||
@@ -2922,7 +2953,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
)));
|
||||
|
||||
// value must be an array not object
|
||||
ReplaceOperation outboundReplaceOperation = new ReplaceOperation("notifyservices_outbound_patterns",
|
||||
ReplaceOperation outboundReplaceOperation = new ReplaceOperation("notifyServiceOutboundPatterns",
|
||||
"{\"pattern\":\"patternB\",\"constraint\":\"itemFilterB\"}");
|
||||
ops.clear();
|
||||
ops.add(outboundReplaceOperation);
|
||||
@@ -2951,10 +2982,10 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
List<Operation> ops = new ArrayList<Operation>();
|
||||
AddOperation inboundAddOperationOne = new AddOperation("notifyservices_inbound_patterns/-",
|
||||
AddOperation inboundAddOperationOne = new AddOperation("notifyServiceInboundPatterns/-",
|
||||
"{\"pattern\":\"patternA\",\"constraint\":\"itemFilterA\",\"automatic\":\"false\"}");
|
||||
|
||||
AddOperation inboundAddOperationTwo = new AddOperation("notifyservices_inbound_patterns/-",
|
||||
AddOperation inboundAddOperationTwo = new AddOperation("notifyServiceInboundPatterns/-",
|
||||
"{\"pattern\":\"patternB\",\"constraint\":\"itemFilterB\",\"automatic\":\"true\"}");
|
||||
|
||||
ops.add(inboundAddOperationOne);
|
||||
@@ -2979,7 +3010,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
))
|
||||
)));
|
||||
|
||||
RemoveOperation inboundRemoveOperation = new RemoveOperation("notifyservices_inbound_patterns");
|
||||
RemoveOperation inboundRemoveOperation = new RemoveOperation("notifyServiceInboundPatterns");
|
||||
ops.clear();
|
||||
ops.add(inboundRemoveOperation);
|
||||
patchBody = getPatchContent(ops);
|
||||
@@ -3009,10 +3040,10 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
List<Operation> ops = new ArrayList<Operation>();
|
||||
AddOperation outboundAddOperationOne = new AddOperation("notifyservices_outbound_patterns/-",
|
||||
AddOperation outboundAddOperationOne = new AddOperation("notifyServiceOutboundPatterns/-",
|
||||
"{\"pattern\":\"patternA\",\"constraint\":\"itemFilterA\"}");
|
||||
|
||||
AddOperation outboundAddOperationTwo = new AddOperation("notifyservices_outbound_patterns/-",
|
||||
AddOperation outboundAddOperationTwo = new AddOperation("notifyServiceOutboundPatterns/-",
|
||||
"{\"pattern\":\"patternB\",\"constraint\":\"itemFilterB\"}");
|
||||
|
||||
ops.add(outboundAddOperationOne);
|
||||
@@ -3037,7 +3068,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
))
|
||||
)));
|
||||
|
||||
RemoveOperation outboundRemoveOperation = new RemoveOperation("notifyservices_outbound_patterns");
|
||||
RemoveOperation outboundRemoveOperation = new RemoveOperation("notifyServiceOutboundPatterns");
|
||||
ops.clear();
|
||||
ops.add(outboundRemoveOperation);
|
||||
patchBody = getPatchContent(ops);
|
||||
@@ -3067,10 +3098,10 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
List<Operation> ops = new ArrayList<Operation>();
|
||||
AddOperation inboundAddOperationOne = new AddOperation("notifyservices_inbound_patterns/-",
|
||||
AddOperation inboundAddOperationOne = new AddOperation("notifyServiceInboundPatterns/-",
|
||||
"{\"pattern\":\"patternA\",\"constraint\":\"itemFilterA\",\"automatic\":\"false\"}");
|
||||
|
||||
AddOperation inboundAddOperationTwo = new AddOperation("notifyservices_inbound_patterns/-",
|
||||
AddOperation inboundAddOperationTwo = new AddOperation("notifyServiceInboundPatterns/-",
|
||||
"{\"pattern\":\"patternB\",\"constraint\":\"itemFilterB\",\"automatic\":\"true\"}");
|
||||
|
||||
ops.add(inboundAddOperationOne);
|
||||
@@ -3095,7 +3126,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
))
|
||||
)));
|
||||
|
||||
ReplaceOperation inboundReplaceOperation = new ReplaceOperation("notifyservices_inbound_patterns[1]",
|
||||
ReplaceOperation inboundReplaceOperation = new ReplaceOperation("notifyServiceInboundPatterns[1]",
|
||||
"{\"pattern\":\"patternC\",\"constraint\":\"itemFilterC\",\"automatic\":\"false\"}");
|
||||
ops.clear();
|
||||
ops.add(inboundReplaceOperation);
|
||||
@@ -3135,10 +3166,10 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
List<Operation> ops = new ArrayList<Operation>();
|
||||
AddOperation outboundAddOperationOne = new AddOperation("notifyservices_outbound_patterns/-",
|
||||
AddOperation outboundAddOperationOne = new AddOperation("notifyServiceOutboundPatterns/-",
|
||||
"{\"pattern\":\"patternA\",\"constraint\":\"itemFilterA\"}");
|
||||
|
||||
AddOperation outboundAddOperationTwo = new AddOperation("notifyservices_outbound_patterns/-",
|
||||
AddOperation outboundAddOperationTwo = new AddOperation("notifyServiceOutboundPatterns/-",
|
||||
"{\"pattern\":\"patternB\",\"constraint\":\"itemFilterB\"}");
|
||||
|
||||
ops.add(outboundAddOperationOne);
|
||||
@@ -3163,7 +3194,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
))
|
||||
)));
|
||||
|
||||
ReplaceOperation outboundReplaceOperation = new ReplaceOperation("notifyservices_outbound_patterns[0]",
|
||||
ReplaceOperation outboundReplaceOperation = new ReplaceOperation("notifyServiceOutboundPatterns[0]",
|
||||
"{\"pattern\":\"patternC\",\"constraint\":\"itemFilterC\"}");
|
||||
ops.clear();
|
||||
ops.add(outboundReplaceOperation);
|
||||
@@ -3279,4 +3310,62 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
|
||||
)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void NotifyServiceStatusReplaceOperationTest() throws Exception {
|
||||
|
||||
context.turnOffAuthorisationSystem();
|
||||
NotifyServiceEntity notifyServiceEntity =
|
||||
NotifyServiceBuilder.createNotifyServiceBuilder(context)
|
||||
.withName("service name")
|
||||
.withDescription("service description")
|
||||
.withUrl("service url")
|
||||
.withLdnUrl("service ldn url")
|
||||
.isEnabled(true)
|
||||
.build();
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
List<Operation> ops = new ArrayList<Operation>();
|
||||
ReplaceOperation inboundReplaceOperation = new ReplaceOperation("/enabled", "false");
|
||||
ops.add(inboundReplaceOperation);
|
||||
String patchBody = getPatchContent(ops);
|
||||
|
||||
String authToken = getAuthToken(admin.getEmail(), password);
|
||||
getClient(authToken)
|
||||
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
|
||||
.content(patchBody)
|
||||
.contentType(MediaType.APPLICATION_JSON_PATCH_JSON))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.notifyServiceInboundPatterns", empty()))
|
||||
.andExpect(jsonPath("$.notifyServiceOutboundPatterns", empty()))
|
||||
.andExpect(jsonPath("$", matchNotifyService(notifyServiceEntity.getID(), "service name",
|
||||
"service description", "service url", "service ldn url", false)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void NotifyServiceStatusReplaceOperationTestBadRequestTest() throws Exception {
|
||||
|
||||
context.turnOffAuthorisationSystem();
|
||||
NotifyServiceEntity notifyServiceEntity =
|
||||
NotifyServiceBuilder.createNotifyServiceBuilder(context)
|
||||
.withName("service name")
|
||||
.withDescription("service description")
|
||||
.withUrl("service url")
|
||||
.withLdnUrl("service ldn url")
|
||||
.build();
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
List<Operation> ops = new ArrayList<Operation>();
|
||||
ReplaceOperation inboundReplaceOperation = new ReplaceOperation("/enabled", "test");
|
||||
ops.add(inboundReplaceOperation);
|
||||
String patchBody = getPatchContent(ops);
|
||||
|
||||
String authToken = getAuthToken(admin.getEmail(), password);
|
||||
// patch not boolean value
|
||||
getClient(authToken)
|
||||
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
|
||||
.content(patchBody)
|
||||
.contentType(MediaType.APPLICATION_JSON_PATCH_JSON))
|
||||
.andExpect(status().isBadRequest());
|
||||
}
|
||||
|
||||
}
|
@@ -24,7 +24,7 @@
|
||||
"id": "urn:uuid:94ecae35-dcfd-4182-8550-22c7164fe23f",
|
||||
"inReplyTo": "urn:uuid:0370c0fb-bb78-4a9b-87f5-bed307a509dd",
|
||||
"object": {
|
||||
"id": "https://overlay-journal.com/articles/00001/",
|
||||
"id": "<<object>>",
|
||||
"ietf:cite-as": "https://overlay-journal.com/articles/00001/",
|
||||
"type": [
|
||||
"Page",
|
||||
|
@@ -40,4 +40,11 @@
|
||||
<scope_note>Reviewd by</scope_note>
|
||||
</dc-type>
|
||||
|
||||
<dc-type>
|
||||
<schema>datacite</schema>
|
||||
<element>relation</element>
|
||||
<qualifier>isSupplementedBy</qualifier>
|
||||
<scope_note>Supplemented by</scope_note>
|
||||
</dc-type>
|
||||
|
||||
</dspace-dc-types>
|
||||
|
Reference in New Issue
Block a user