diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/Application.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/WebApplication.java
similarity index 86%
rename from dspace-server-webapp/src/main/java/org/dspace/app/rest/Application.java
rename to dspace-server-webapp/src/main/java/org/dspace/app/rest/WebApplication.java
index b7903c558277..684cbbdc1d7a 100644
--- a/dspace-server-webapp/src/main/java/org/dspace/app/rest/Application.java
+++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/WebApplication.java
@@ -18,8 +18,6 @@
import org.dspace.app.rest.parameter.resolver.SearchFilterResolver;
import org.dspace.app.rest.utils.ApplicationConfig;
import org.dspace.app.rest.utils.DSpaceAPIRequestLoggingFilter;
-import org.dspace.app.rest.utils.DSpaceConfigurationInitializer;
-import org.dspace.app.rest.utils.DSpaceKernelInitializer;
import org.dspace.app.sitemap.GenerateSitemaps;
import org.dspace.app.solrdatabaseresync.SolrDatabaseResyncCli;
import org.dspace.app.util.DSpaceContextListener;
@@ -28,11 +26,9 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.builder.SpringApplicationBuilder;
-import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.hateoas.server.LinkRelationProvider;
import org.springframework.lang.NonNull;
@@ -48,24 +44,18 @@
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
- * Define the Spring Boot Application settings itself. This class takes the place
- * of a web.xml file, and configures all Filters/Listeners as methods (see below).
- *
- * NOTE: Requires a Servlet 3.0 container, e.g. Tomcat 7.0 or above.
- *
- * NOTE: This extends SpringBootServletInitializer in order to allow us to build
- * a deployable WAR file with Spring Boot. See:
- * http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto-create-a-deployable-war-file
+ * Main configuration for the dspace web module.
*
* @author Andrea Bollini (andrea.bollini at 4science.it)
* @author Tim Donohue
+ * @author Luca Giamminonni (luca.giamminonni at 4science.it)
*/
-@SpringBootApplication
@EnableScheduling
@EnableCaching
-public class Application extends SpringBootServletInitializer {
+@Configuration
+public class WebApplication {
- private static final Logger log = LoggerFactory.getLogger(Application.class);
+ private static final Logger log = LoggerFactory.getLogger(WebApplication.class);
@Autowired
private ApplicationConfig configuration;
@@ -88,26 +78,6 @@ public void sendGoogleAnalyticsEvents() {
googleAsyncEventListener.sendCollectedEvents();
}
- /**
- * Override the default SpringBootServletInitializer.configure() method,
- * passing it this Application class.
- *
- * This is necessary to allow us to build a deployable WAR, rather than
- * always relying on embedded Tomcat.
- *
- * See: http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto-create-a-deployable-war-file
- *
- * @param application
- * @return
- */
- @Override
- protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
- // Pass this Application class, and our initializers for DSpace Kernel and Configuration
- // NOTE: Kernel must be initialized before Configuration
- return application.sources(Application.class)
- .initializers(new DSpaceKernelInitializer(), new DSpaceConfigurationInitializer());
- }
-
/**
* Register the "DSpaceContextListener" so that it is loaded
* for this Application.
@@ -279,7 +249,7 @@ public void addResourceHandlers(ResourceHandlerRegistry registry) {
// Make all other Webjars available off the /webjars path
registry
.addResourceHandler("/webjars/**")
- .addResourceLocations("/webjars/");
+ .addResourceLocations("/webjars/", "classpath:/META-INF/resources/webjars/");
}
@Override
diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/link/DSpaceResourceHalLinkFactory.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/link/DSpaceResourceHalLinkFactory.java
index c306691eb352..30404e030ab6 100644
--- a/dspace-server-webapp/src/main/java/org/dspace/app/rest/link/DSpaceResourceHalLinkFactory.java
+++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/link/DSpaceResourceHalLinkFactory.java
@@ -21,6 +21,8 @@
import org.dspace.app.rest.model.hateoas.DSpaceResource;
import org.dspace.app.rest.utils.Utils;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.Ordered;
+import org.springframework.core.annotation.Order;
import org.springframework.data.domain.Pageable;
import org.springframework.hateoas.IanaLinkRelations;
import org.springframework.hateoas.Link;
@@ -33,6 +35,7 @@
* @author Tom Desair (tom dot desair at atmire dot com)
*/
@Component
+@Order(Ordered.HIGHEST_PRECEDENCE)
public class DSpaceResourceHalLinkFactory extends HalLinkFactory {
@Autowired
diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/handler/ExternalSourceItemUriListHandler.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/handler/ExternalSourceItemUriListHandler.java
index d619100bf67a..201a7ba1633d 100644
--- a/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/handler/ExternalSourceItemUriListHandler.java
+++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/handler/ExternalSourceItemUriListHandler.java
@@ -30,16 +30,19 @@
@Component
public class ExternalSourceItemUriListHandler extends ExternalSourceEntryItemUriListHandler- {
+ private Pattern pattern = Pattern.compile("\\/api\\/core\\/items\\/(.*)");
+
@Autowired
private ItemService itemService;
@Override
@SuppressWarnings("rawtypes")
public boolean supports(List uriList, String method,Class clazz) {
- if (clazz != Item.class) {
+ if (clazz != Item.class || uriList.size() != 1) {
return false;
}
- return true;
+
+ return pattern.matcher(uriList.get(0)).find();
}
@Override
@@ -61,7 +64,6 @@ public boolean validate(Context context, HttpServletRequest request, List uriList) {
Item item = null;
String url = uriList.get(0);
- Pattern pattern = Pattern.compile("\\/api\\/core\\/items\\/(.*)");
Matcher matcher = pattern.matcher(url);
if (!matcher.find()) {
throw new DSpaceBadRequestException("The uri: " + url + " doesn't resolve to an item");
diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/AdminRestPermissionEvaluatorPlugin.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/AdminRestPermissionEvaluatorPlugin.java
index 0d251f6400f7..338eed4a7340 100644
--- a/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/AdminRestPermissionEvaluatorPlugin.java
+++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/AdminRestPermissionEvaluatorPlugin.java
@@ -20,6 +20,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.Ordered;
+import org.springframework.core.annotation.Order;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Component;
@@ -29,6 +31,7 @@
* the authenticated EPerson is allowed to perform the requested action.
*/
@Component
+@Order(value = Ordered.HIGHEST_PRECEDENCE)
public class AdminRestPermissionEvaluatorPlugin extends RestObjectPermissionEvaluatorPlugin {
private static final Logger log = LoggerFactory.getLogger(RestObjectPermissionEvaluatorPlugin.class);
diff --git a/dspace-server-webapp/src/main/resources/application.properties b/dspace-server-webapp/src/main/resources/application.properties
index a10e0f98a00d..0c26d530b74c 100644
--- a/dspace-server-webapp/src/main/resources/application.properties
+++ b/dspace-server-webapp/src/main/resources/application.properties
@@ -37,6 +37,12 @@
# NOTE: this configuration is filled out by Apache Ant during the DSpace install/update process. It does NOT
# interact with or read its configuration from dspace.cfg.
dspace.dir=${dspace.dir}
+
+########################
+# Servlet context path configuration for spring boot application running with embedded tomcat
+#
+server.servlet.context-path=/server
+
########################
# Jackson serialization settings
#
diff --git a/dspace-server-webapp/src/main/webapp/index.html b/dspace-server-webapp/src/main/resources/static/index.html
similarity index 100%
rename from dspace-server-webapp/src/main/webapp/index.html
rename to dspace-server-webapp/src/main/resources/static/index.html
diff --git a/dspace-server-webapp/src/main/webapp/js/hal/http/client.js b/dspace-server-webapp/src/main/resources/static/js/hal/http/client.js
similarity index 100%
rename from dspace-server-webapp/src/main/webapp/js/hal/http/client.js
rename to dspace-server-webapp/src/main/resources/static/js/hal/http/client.js
diff --git a/dspace-server-webapp/src/main/webapp/js/vendor/CustomPostForm.js b/dspace-server-webapp/src/main/resources/static/js/vendor/CustomPostForm.js
similarity index 100%
rename from dspace-server-webapp/src/main/webapp/js/vendor/CustomPostForm.js
rename to dspace-server-webapp/src/main/resources/static/js/vendor/CustomPostForm.js
diff --git a/dspace-server-webapp/src/main/webapp/login.html b/dspace-server-webapp/src/main/resources/static/login.html
similarity index 100%
rename from dspace-server-webapp/src/main/webapp/login.html
rename to dspace-server-webapp/src/main/resources/static/login.html
diff --git a/dspace-server-webapp/src/main/webapp/styles.css b/dspace-server-webapp/src/main/resources/static/styles.css
similarity index 100%
rename from dspace-server-webapp/src/main/webapp/styles.css
rename to dspace-server-webapp/src/main/resources/static/styles.css
diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/TestApplication.java b/dspace-server-webapp/src/test/java/org/dspace/app/TestApplication.java
new file mode 100644
index 000000000000..8db55b6dedd1
--- /dev/null
+++ b/dspace-server-webapp/src/test/java/org/dspace/app/TestApplication.java
@@ -0,0 +1,22 @@
+/**
+ * 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;
+
+import org.dspace.app.rest.WebApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+/**
+ * Spring boot application for integration tests.
+ *
+ * @author Luca Giamminonni (luca.giamminonni at 4science.it)
+ *
+ */
+@SpringBootApplication(scanBasePackageClasses = WebApplication.class)
+public class TestApplication {
+
+}
diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/authorization/GenericAuthorizationFeatureIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/authorization/GenericAuthorizationFeatureIT.java
index a93a964d36de..0ac7eea4250d 100644
--- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/authorization/GenericAuthorizationFeatureIT.java
+++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/authorization/GenericAuthorizationFeatureIT.java
@@ -37,6 +37,7 @@
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.web.servlet.ResultActions;
/**
* Test for the following authorization features:
@@ -52,6 +53,8 @@
*/
public class GenericAuthorizationFeatureIT extends AbstractControllerIntegrationTest {
+ private static final int SIZE = 100;
+
@Autowired
ConfigurationService configurationService;
@@ -208,215 +211,163 @@ private void testAdminsHavePermissionsAllDso(String feature) throws Exception {
String siteId = ContentServiceFactory.getInstance().getSiteService().findSite(context).getID().toString();
// Verify the general admin has this feature on the site
- getClient(adminToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/sites/" + siteId))
+ getAuthorizationFeatures(adminToken, "http://localhost/api/core/sites/" + siteId)
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify community A admin doesn’t have this feature on the site
- getClient(communityAAdminToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/sites/" + siteId))
+ getAuthorizationFeatures(communityAAdminToken, "http://localhost/api/core/sites/" + siteId)
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
// Verify the general admin has this feature on community A
- getClient(adminToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/communities/" + communityA.getID()))
+ getAuthorizationFeatures(adminToken,"http://localhost/api/core/communities/" + communityA.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify community A admin has this feature on community A
- getClient(communityAAdminToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/communities/" + communityA.getID()))
+ getAuthorizationFeatures(communityAAdminToken, "http://localhost/api/core/communities/" + communityA.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify community A admin has this feature on community AA
- getClient(communityAAdminToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/communities/" + communityAA.getID()))
+ getAuthorizationFeatures(communityAAdminToken, "http://localhost/api/core/communities/" + communityAA.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify collection X admin doesn’t have this feature on community A
- getClient(collectionXAdminToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/communities/" + communityA.getID()))
+ getAuthorizationFeatures(collectionXAdminToken, "http://localhost/api/core/communities/" + communityA.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
// Verify community A admin doesn’t have this feature on community B
- getClient(communityAAdminToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/communities/" + communityB.getID()))
+ getAuthorizationFeatures(communityAAdminToken, "http://localhost/api/core/communities/" + communityB.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
// Verify the general admin has this feature on collection X
- getClient(adminToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/collections/" + collectionX.getID()))
+ getAuthorizationFeatures(adminToken, "http://localhost/api/core/collections/" + collectionX.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify community A admin has this feature on collection X
- getClient(communityAAdminToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/collections/" + collectionX.getID()))
+ getAuthorizationFeatures(communityAAdminToken, "http://localhost/api/core/collections/" + collectionX.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify collection X admin has this feature on collection X
- getClient(collectionXAdminToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/collections/" + collectionX.getID()))
+ getAuthorizationFeatures(collectionXAdminToken, "http://localhost/api/core/collections/" + collectionX.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify item 1 admin doesn’t have this feature on collection X
- getClient(item1AdminToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/collections/" + collectionX.getID()))
+ getAuthorizationFeatures(item1AdminToken, "http://localhost/api/core/collections/" + collectionX.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
// Verify collection X admin doesn’t have this feature on collection Y
- getClient(collectionXAdminToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/collections/" + collectionY.getID()))
+ getAuthorizationFeatures(collectionXAdminToken, "http://localhost/api/core/collections/" + collectionY.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
// Verify the general admin has this feature on item 1
- getClient(adminToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/items/" + item1.getID()))
+ getAuthorizationFeatures(adminToken, "http://localhost/api/core/items/" + item1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify community A admin has this feature on item 1
- getClient(communityAAdminToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/items/" + item1.getID()))
+ getAuthorizationFeatures(communityAAdminToken, "http://localhost/api/core/items/" + item1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify collection X admin has this feature on item 1
- getClient(collectionXAdminToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/items/" + item1.getID()))
+ getAuthorizationFeatures(collectionXAdminToken, "http://localhost/api/core/items/" + item1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify item 1 admin has this feature on item 1
- getClient(item1AdminToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/items/" + item1.getID()))
+ getAuthorizationFeatures(item1AdminToken, "http://localhost/api/core/items/" + item1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify item 1 admin doesn’t have this feature on item 2
- getClient(item1AdminToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/items/" + item2.getID()))
+ getAuthorizationFeatures(item1AdminToken, "http://localhost/api/core/items/" + item2.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
// Verify the general admin has this feature on the bundle in item 1
- getClient(adminToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bundles/" + bundle1.getID()))
+ getAuthorizationFeatures(adminToken, "http://localhost/api/core/bundles/" + bundle1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify community A admin has this feature on the bundle in item 1
- getClient(communityAAdminToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bundles/" + bundle1.getID()))
+ getAuthorizationFeatures(communityAAdminToken, "http://localhost/api/core/bundles/" + bundle1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify collection X admin has this feature on the bundle in item 1
- getClient(collectionXAdminToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bundles/" + bundle1.getID()))
+ getAuthorizationFeatures(collectionXAdminToken, "http://localhost/api/core/bundles/" + bundle1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify item 1 admin has this feature on the bundle in item 1
- getClient(item1AdminToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bundles/" + bundle1.getID()))
+ getAuthorizationFeatures(item1AdminToken, "http://localhost/api/core/bundles/" + bundle1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify item 1 admin doesn’t have this feature on the bundle in item 2
- getClient(item1AdminToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bundles/" + bundle2.getID()))
+ getAuthorizationFeatures(item1AdminToken, "http://localhost/api/core/bundles/" + bundle2.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
// Verify the general admin has this feature on the bitstream in item 1
- getClient(adminToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bitstreams/" + bitstream1.getID()))
+ getAuthorizationFeatures(adminToken, "http://localhost/api/core/bitstreams/" + bitstream1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify community A admin has this feature on the bitstream in item 1
- getClient(communityAAdminToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bitstreams/" + bitstream1.getID()))
+ getAuthorizationFeatures(communityAAdminToken, "http://localhost/api/core/bitstreams/" + bitstream1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify collection X admin has this feature on the bitstream in item 1
- getClient(collectionXAdminToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bitstreams/" + bitstream1.getID()))
+ getAuthorizationFeatures(collectionXAdminToken, "http://localhost/api/core/bitstreams/" + bitstream1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify item 1 admin has this feature on the bitstream in item 1
- getClient(item1AdminToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bitstreams/" + bitstream1.getID()))
+ getAuthorizationFeatures(item1AdminToken, "http://localhost/api/core/bitstreams/" + bitstream1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify item 1 admin doesn’t have this feature on the bitstream in item 2
- getClient(item1AdminToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bitstreams/" + bitstream2.getID()))
+ getAuthorizationFeatures(item1AdminToken, "http://localhost/api/core/bitstreams/" + bitstream2.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
@@ -429,41 +380,31 @@ private void testAdminsHavePermissionsItem(String feature) throws Exception {
String item1AdminToken = getAuthToken(item1Admin.getEmail(), password);
// Verify the general admin has this feature on item 1
- getClient(adminToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/items/" + item1.getID()))
+ getAuthorizationFeatures(adminToken, "http://localhost/api/core/items/" + item1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify community A admin has this feature on item 1
- getClient(communityAAdminToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/items/" + item1.getID()))
+ getAuthorizationFeatures(communityAAdminToken, "http://localhost/api/core/items/" + item1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify collection X admin has this feature on item 1
- getClient(collectionXAdminToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/items/" + item1.getID()))
+ getAuthorizationFeatures(collectionXAdminToken, "http://localhost/api/core/items/" + item1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify item 1 admin has this feature on item 1
- getClient(item1AdminToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/items/" + item1.getID()))
+ getAuthorizationFeatures(item1AdminToken, "http://localhost/api/core/items/" + item1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify community A admin doesn’t have this feature on item 2
- getClient(communityAAdminToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/items/" + item2.getID()))
+ getAuthorizationFeatures(communityAAdminToken, "http://localhost/api/core/items/" + item2.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
@@ -478,73 +419,55 @@ private void testWriteUsersHavePermissionsAllDso(String feature, boolean hasDSOA
// Verify community A write has this feature on community A if the boolean parameter is true
// (or doesn’t have access otherwise)
if (hasDSOAccess) {
- getClient(communityAWriterToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/communities/" + communityA.getID()))
+ getAuthorizationFeatures(communityAWriterToken, "http://localhost/api/core/communities/" + communityA.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
} else {
- getClient(communityAWriterToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/communities/" + communityA.getID()))
+ getAuthorizationFeatures(communityAWriterToken, "http://localhost/api/core/communities/" + communityA.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
}
// Verify community A write doesn’t have this feature on community AA
- getClient(communityAWriterToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/communities/" + communityAA.getID()))
+ getAuthorizationFeatures(communityAWriterToken, "http://localhost/api/core/communities/" + communityAA.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
// Verify community A write doesn’t have this feature on collection X
- getClient(communityAWriterToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/collections/" + collectionX.getID()))
+ getAuthorizationFeatures(communityAWriterToken, "http://localhost/api/core/collections/" + collectionX.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
// Verify community A write doesn’t have this feature on item 1
- getClient(communityAWriterToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/items/" + item1.getID()))
+ getAuthorizationFeatures(communityAWriterToken, "http://localhost/api/core/items/" + item1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
// Verify community A write doesn’t have this feature on the bundle in item 1
- getClient(communityAWriterToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bundles/" + bundle1.getID()))
+ getAuthorizationFeatures(communityAWriterToken, "http://localhost/api/core/bundles/" + bundle1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
// Verify community A write doesn’t have this feature on the bitstream in item 1
- getClient(communityAWriterToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/items/" + item1.getID()))
+ getAuthorizationFeatures(communityAWriterToken, "http://localhost/api/core/items/" + item1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
// Verify collection X write doesn’t have this feature on community A
- getClient(collectionXWriterToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/communities/" + communityA.getID()))
+ getAuthorizationFeatures(collectionXWriterToken, "http://localhost/api/core/communities/" + communityA.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
// Verify collection X write doesn’t have this feature on community AA
- getClient(collectionXWriterToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/communities/" + communityAA.getID()))
+ getAuthorizationFeatures(collectionXWriterToken, "http://localhost/api/core/communities/" + communityAA.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
@@ -552,65 +475,49 @@ private void testWriteUsersHavePermissionsAllDso(String feature, boolean hasDSOA
// Verify collection X write has this feature on collection X if the boolean parameter is true
// (or doesn’t have access otherwise)
if (hasDSOAccess) {
- getClient(collectionXWriterToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/collections/" + collectionX.getID()))
+ getAuthorizationFeatures(collectionXWriterToken, "http://localhost/api/core/collections/" + collectionX.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
} else {
- getClient(collectionXWriterToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/collections/" + collectionX.getID()))
+ getAuthorizationFeatures(collectionXWriterToken, "http://localhost/api/core/collections/" + collectionX.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
}
// Verify collection X write doesn’t have this feature on item 1
- getClient(collectionXWriterToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/items/" + item1.getID()))
+ getAuthorizationFeatures(collectionXWriterToken, "http://localhost/api/core/items/" + item1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
// Verify collection X write doesn’t have this feature on the bundle in item 1
- getClient(collectionXWriterToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bundles/" + bundle1.getID()))
+ getAuthorizationFeatures(collectionXWriterToken, "http://localhost/api/core/bundles/" + bundle1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
// Verify collection X write doesn’t have this feature on the bitstream in item 1
- getClient(collectionXWriterToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bitstreams/" + bitstream1.getID()))
+ getAuthorizationFeatures(collectionXWriterToken, "http://localhost/api/core/bitstreams/" + bitstream1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
// Verify item 1 write doesn’t have this feature on community A
- getClient(item1WriterToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/communities/" + communityA.getID()))
+ getAuthorizationFeatures(item1WriterToken, "http://localhost/api/core/communities/" + communityA.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
// Verify item 1 write doesn’t have this feature on community AA
- getClient(item1WriterToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/communities/" + communityAA.getID()))
+ getAuthorizationFeatures(item1WriterToken, "http://localhost/api/core/communities/" + communityAA.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
// Verify item 1 write doesn’t have this feature on collection X
- getClient(item1WriterToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/collections/" + collectionX.getID()))
+ getAuthorizationFeatures(item1WriterToken, "http://localhost/api/core/collections/" + collectionX.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
@@ -618,57 +525,43 @@ private void testWriteUsersHavePermissionsAllDso(String feature, boolean hasDSOA
// Verify item 1 write has this feature on item 1 if the boolean parameter is true
// (or doesn’t have access otherwise)
if (hasDSOAccess) {
- getClient(item1WriterToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/items/" + item1.getID()))
+ getAuthorizationFeatures(item1WriterToken, "http://localhost/api/core/items/" + item1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
} else {
- getClient(item1WriterToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/items/" + item1.getID()))
+ getAuthorizationFeatures(item1WriterToken, "http://localhost/api/core/items/" + item1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
}
// Verify item 1 write doesn’t have this feature on the bundle in item 1
- getClient(item1WriterToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bundles/" + bundle1.getID()))
+ getAuthorizationFeatures(item1WriterToken, "http://localhost/api/core/bundles/" + bundle1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
// Verify item 1 write doesn’t have this feature on the bitstream in item 1
- getClient(item1WriterToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bitstreams/" + bitstream1.getID()))
+ getAuthorizationFeatures(item1WriterToken, "http://localhost/api/core/bitstreams/" + bitstream1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
// Verify community A write doesn’t have this feature on community B
- getClient(communityAWriterToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/communities/" + communityB.getID()))
+ getAuthorizationFeatures(communityAWriterToken, "http://localhost/api/core/communities/" + communityB.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
// Verify collection X write doesn’t have this feature on collection Y
- getClient(collectionXWriterToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/collections/" + collectionY.getID()))
+ getAuthorizationFeatures(collectionXWriterToken, "http://localhost/api/core/collections/" + collectionY.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
// Verify item 1 write doesn’t have this feature on item 2
- getClient(item1WriterToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/items/" + item2.getID()))
+ getAuthorizationFeatures(item1WriterToken, "http://localhost/api/core/items/" + item2.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
@@ -680,17 +573,13 @@ private void testWriteUsersHavePermissionsItem(String feature, boolean hasDSOAcc
String item1WriterToken = getAuthToken(item1Writer.getEmail(), password);
// Verify community A write doesn’t have this feature on item 1
- getClient(communityAWriterToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/items/" + item1.getID()))
+ getAuthorizationFeatures(communityAWriterToken, "http://localhost/api/core/items/" + item1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
// Verify collection X write doesn’t have this feature on item 1
- getClient(collectionXWriterToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/items/" + item1.getID()))
+ getAuthorizationFeatures(collectionXWriterToken, "http://localhost/api/core/items/" + item1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
@@ -698,25 +587,19 @@ private void testWriteUsersHavePermissionsItem(String feature, boolean hasDSOAcc
// Verify item 1 write has this feature on item 1 if the boolean parameter is true
// (or doesn’t have access otherwise)
if (hasDSOAccess) {
- getClient(item1WriterToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/items/" + item1.getID()))
+ getAuthorizationFeatures(item1WriterToken, "http://localhost/api/core/items/" + item1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
} else {
- getClient(item1WriterToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/items/" + item1.getID()))
+ getAuthorizationFeatures(item1WriterToken, "http://localhost/api/core/items/" + item1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
}
// Verify item 1 write doesn’t have this feature on item 2
- getClient(item1WriterToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/items/" + item2.getID()))
+ getAuthorizationFeatures(item1WriterToken, "http://localhost/api/core/items/" + item2.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
@@ -754,42 +637,31 @@ public void testCanMoveAdmin() throws Exception {
final String feature = "canMove";
// Verify the general admin has this feature on item 1
- getClient(adminToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/items/" + item1.getID())
- .param("size", "30"))
+ getAuthorizationFeatures(adminToken, "http://localhost/api/core/items/" + item1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify community A admin has this feature on item 1
- getClient(communityAAdminToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/items/" + item1.getID()))
+ getAuthorizationFeatures(communityAAdminToken, "http://localhost/api/core/items/" + item1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify collection X admin has this feature on item 1
- getClient(collectionXAdminToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/items/" + item1.getID()))
+ getAuthorizationFeatures(collectionXAdminToken, "http://localhost/api/core/items/" + item1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify item 1 admin doesn’t have this feature on item 1
- getClient(item1AdminToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/items/" + item1.getID()))
+ getAuthorizationFeatures(item1AdminToken, "http://localhost/api/core/items/" + item1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
// Verify community A admin doesn’t have this feature on item 2
- getClient(communityAAdminToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/items/" + item2.getID()))
+ getAuthorizationFeatures(communityAAdminToken, "http://localhost/api/core/items/" + item2.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
@@ -806,9 +678,7 @@ public void testCanMoveAdmin() throws Exception {
context.restoreAuthSystemState();
// verify item 1 write has this feature on item 1
- getClient(item1WriterToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/items/" + item1.getID()))
+ getAuthorizationFeatures(item1WriterToken, "http://localhost/api/core/items/" + item1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='canMove')]")
.exists());
@@ -829,9 +699,7 @@ public void testCanMoveWriter() throws Exception {
String item1WriterToken = getAuthToken(item1Writer.getEmail(), password);
// verify item 1 write has this feature on item 1
- getClient(item1WriterToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/items/" + item1.getID()))
+ getAuthorizationFeatures(item1WriterToken, "http://localhost/api/core/items/" + item1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='canMove')]")
.exists());
@@ -867,29 +735,25 @@ public void testCanDeleteAdmin() throws Exception {
final String feature = "canDelete";
// Verify the general admin doesn’t have this feature on the site
- getClient(adminToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/sites/" + siteId))
+ getAuthorizationFeatures(adminToken, "http://localhost/api/core/sites/" + siteId)
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
// Verify the general admin has this feature on community A
- getClient(adminToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/communities/" + communityA.getID()))
+ getAuthorizationFeatures(adminToken, "http://localhost/api/core/communities/" + communityA.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify community A admin has this feature on community A
- getClient(communityAAdminToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/communities/" + communityA.getID()))
+ getAuthorizationFeatures(communityAAdminToken, "http://localhost/api/core/communities/" + communityA.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify community A admin has this feature on community AA
- getClient(communityAAdminToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/communities/" + communityAA.getID()))
+ getAuthorizationFeatures(communityAAdminToken, "http://localhost/api/core/communities/" + communityAA.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
@@ -908,162 +772,139 @@ public void testCanDeleteAdmin() throws Exception {
.build();
context.restoreAuthSystemState();
String communityAAAdminToken = getAuthToken(communityAAAdmin.getEmail(), password);
- getClient(communityAAAdminToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/communities/" + communityAA.getID()))
+ getAuthorizationFeatures(communityAAAdminToken, "http://localhost/api/core/communities/" + communityAA.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
// Verify collection X admin doesn’t have this feature on community A
- getClient(collectionXAdminToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/communities/" + communityA.getID()))
+ getAuthorizationFeatures(collectionXAdminToken, "http://localhost/api/core/communities/" + communityA.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
// Verify community A admin doesn’t have this feature on community B
- getClient(communityAAdminToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/communities/" + communityB.getID()))
+ getAuthorizationFeatures(communityAAdminToken, "http://localhost/api/core/communities/" + communityB.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
// Verify the general admin has this feature on collection X
- getClient(adminToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/collections/" + collectionX.getID()))
+ getAuthorizationFeatures(adminToken, "http://localhost/api/core/collections/" + collectionX.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify community A admin has this feature on collection X
- getClient(communityAAdminToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/collections/" + collectionX.getID()))
+ getAuthorizationFeatures(communityAAdminToken, "http://localhost/api/core/collections/" + collectionX.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify collection X admin doesn’t have this feature on collection X
- getClient(collectionXAdminToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/collections/" + collectionX.getID()))
+ getAuthorizationFeatures(collectionXAdminToken, "http://localhost/api/core/collections/" + collectionX.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
// Verify item 1 admin doesn’t have this feature on collection X
- getClient(item1AdminToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/collections/" + collectionX.getID()))
+ getAuthorizationFeatures(item1AdminToken, "http://localhost/api/core/collections/" + collectionX.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
// Verify collection X admin doesn’t have this feature on collection Y
- getClient(collectionXAdminToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/collections/" + collectionY.getID()))
+ getAuthorizationFeatures(collectionXAdminToken, "http://localhost/api/core/collections/" + collectionY.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
// Verify the general admin has this feature on item 1
- getClient(adminToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/items/" + item1.getID()))
+ getAuthorizationFeatures(adminToken, "http://localhost/api/core/items/" + item1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify community A admin has this feature on item 1
- getClient(communityAAdminToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/items/" + item1.getID()))
+ getAuthorizationFeatures(communityAAdminToken,"http://localhost/api/core/items/" + item1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify collection X admin has this feature on item 1
- getClient(collectionXAdminToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/items/" + item1.getID()))
+ getAuthorizationFeatures(collectionXAdminToken,"http://localhost/api/core/items/" + item1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify item 1 admin doesn’t have this feature on item 1
- getClient(item1AdminToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/items/" + item1.getID()))
+ getAuthorizationFeatures(item1AdminToken, "http://localhost/api/core/items/" + item1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
// Verify item 1 admin doesn’t have this feature on item 2
- getClient(item1AdminToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/items/" + item2.getID()))
+ getAuthorizationFeatures(item1AdminToken, "http://localhost/api/core/items/" + item2.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
// Verify the general admin has this feature on the bundle in item 1
- getClient(adminToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/items/" + item1.getID()))
+ getAuthorizationFeatures(adminToken, "http://localhost/api/core/items/" + item1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify community A admin has this feature on the bundle in item 1
- getClient(communityAAdminToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/items/" + item1.getID()))
+ getAuthorizationFeatures(communityAAdminToken, "http://localhost/api/core/items/" + item1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify collection X admin has this feature on the bundle in item 1
- getClient(collectionXAdminToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/items/" + item1.getID()))
+ getAuthorizationFeatures(collectionXAdminToken, "http://localhost/api/core/items/" + item1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify item 1 admin has this feature on the bundle in item 1
- getClient(item1AdminToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bundles/" + bundle1.getID()))
+ getAuthorizationFeatures(item1AdminToken, "http://localhost/api/core/bundles/" + bundle1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify item 1 admin doesn’t have this feature on the bundle in item 2
- getClient(item1AdminToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bundles/" + bundle2.getID()))
+ getAuthorizationFeatures(item1AdminToken, "http://localhost/api/core/bundles/" + bundle2.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
// Verify the general admin has this feature on the bitstream in item 1
- getClient(adminToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bitstreams/" + bitstream1.getID()))
+ getAuthorizationFeatures(adminToken, "http://localhost/api/core/bitstreams/" + bitstream1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify community A admin has this feature on the bitstream in item 1
- getClient(communityAAdminToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bitstreams/" + bitstream1.getID()))
+ getAuthorizationFeatures(communityAAdminToken, "http://localhost/api/core/bitstreams/" + bitstream1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify collection X admin has this feature on the bitstream in item 1
- getClient(collectionXAdminToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bitstreams/" + bitstream1.getID()))
+ getAuthorizationFeatures(collectionXAdminToken, "http://localhost/api/core/bitstreams/" + bitstream1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify item 1 admin has this feature on the bitstream in item 1
- getClient(item1AdminToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bitstreams/" + bitstream1.getID()))
+ getAuthorizationFeatures(item1AdminToken, "http://localhost/api/core/bitstreams/" + bitstream1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify item 1 admin doesn’t have this feature on the bitstream in item 2
- getClient(item1AdminToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bitstreams/" + bitstream2.getID()))
+ getAuthorizationFeatures(item1AdminToken, "http://localhost/api/core/bitstreams/" + bitstream2.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
@@ -1090,8 +931,7 @@ public void testCanDeleteAdminParent() throws Exception {
context.restoreAuthSystemState();
String communityAAAdminToken = getAuthToken(communityAAAdmin.getEmail(), password);
//verify the community AA admin has this feature on community AA
- getClient(communityAAAdminToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/communities/" + communityAA.getID()))
+ getAuthorizationFeatures(communityAAAdminToken, "http://localhost/api/core/communities/" + communityAA.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
@@ -1105,8 +945,7 @@ public void testCanDeleteAdminParent() throws Exception {
.build();
context.restoreAuthSystemState();
// verify collection X admin has this feature on collection X
- getClient(collectionXAdminToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/collections/" + collectionX.getID()))
+ getAuthorizationFeatures(collectionXAdminToken, "http://localhost/api/core/collections/" + collectionX.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
@@ -1120,8 +959,7 @@ public void testCanDeleteAdminParent() throws Exception {
.build();
context.restoreAuthSystemState();
// verify item 1 admin has this feature on item 1
- getClient(item1AdminToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/items/" + item1.getID()))
+ getAuthorizationFeatures(item1AdminToken, "http://localhost/api/core/items/" + item1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
@@ -1151,14 +989,12 @@ public void testCanDeleteMinimalPermissions() throws Exception {
context.restoreAuthSystemState();
String communityADeleterToken = getAuthToken(communityADeleter.getEmail(), password);
// Verify the user has this feature on community A
- getClient(communityADeleterToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/communities/" + communityA.getID()))
+ getAuthorizationFeatures(communityADeleterToken, "http://localhost/api/core/communities/" + communityA.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify this user doesn’t have this feature on community AA
- getClient(communityADeleterToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/communities/" + communityAA.getID()))
+ getAuthorizationFeatures(communityADeleterToken, "http://localhost/api/core/communities/" + communityAA.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
@@ -1179,20 +1015,17 @@ public void testCanDeleteMinimalPermissions() throws Exception {
context.restoreAuthSystemState();
String communityARemoverToken = getAuthToken(communityARemover.getEmail(), password);
// Verify the user has this feature on community AA
- getClient(communityARemoverToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/communities/" + communityAA.getID()))
+ getAuthorizationFeatures(communityARemoverToken, "http://localhost/api/core/communities/" + communityAA.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify this user doesn’t have this feature on community A
- getClient(communityARemoverToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/communities/" + communityA.getID()))
+ getAuthorizationFeatures(communityARemoverToken, "http://localhost/api/core/communities/" + communityA.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
// Verify this user doesn’t have this feature on collection X
- getClient(communityARemoverToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/collections/" + collectionX.getID()))
+ getAuthorizationFeatures(communityARemoverToken, "http://localhost/api/core/collections/" + collectionX.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
@@ -1212,20 +1045,17 @@ public void testCanDeleteMinimalPermissions() throws Exception {
context.restoreAuthSystemState();
String communityAARemoverToken = getAuthToken(communityAARemover.getEmail(), password);
// Verify the user has this feature on collection X
- getClient(communityAARemoverToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/collections/" + collectionX.getID()))
+ getAuthorizationFeatures(communityAARemoverToken, "http://localhost/api/core/collections/" + collectionX.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify this user doesn’t have this feature on community AA
- getClient(communityAARemoverToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/communities/" + communityAA.getID()))
+ getAuthorizationFeatures(communityAARemoverToken, "http://localhost/api/core/communities/" + communityAA.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
// Verify this user doesn’t have this feature on item 1
- getClient(communityAARemoverToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/items/" + item1.getID()))
+ getAuthorizationFeatures(communityAARemoverToken, "http://localhost/api/core/items/" + item1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
@@ -1245,8 +1075,7 @@ public void testCanDeleteMinimalPermissions() throws Exception {
context.restoreAuthSystemState();
String collectionXRemoverToken = getAuthToken(collectionXRemover.getEmail(), password);
// Verify the user doesn’t have this feature on item 1
- getClient(collectionXRemoverToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/items/" + item1.getID()))
+ getAuthorizationFeatures(collectionXRemoverToken, "http://localhost/api/core/items/" + item1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
@@ -1266,8 +1095,7 @@ public void testCanDeleteMinimalPermissions() throws Exception {
context.restoreAuthSystemState();
String item1DeleterToken = getAuthToken(item1Deleter.getEmail(), password);
// Verify the user doesn’t have this feature on item 1
- getClient(item1DeleterToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/items/" + item1.getID()))
+ getAuthorizationFeatures(item1DeleterToken, "http://localhost/api/core/items/" + item1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
@@ -1292,23 +1120,17 @@ public void testCanDeleteMinimalPermissions() throws Exception {
context.restoreAuthSystemState();
String collectionXRemoverItem1DeleterToken = getAuthToken(collectionXRemoverItem1Deleter.getEmail(), password);
// Verify the user has this feature on item 1
- getClient(collectionXRemoverItem1DeleterToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/items/" + item1.getID()))
+ getAuthorizationFeatures(collectionXRemoverItem1DeleterToken, "http://localhost/api/core/items/" + item1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify this user doesn’t have this feature on collection X
- getClient(collectionXRemoverItem1DeleterToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/collections/" + collectionX.getID()))
+ getAuthorizationFeatures(collectionXRemoverItem1DeleterToken, "http://localhost/api/core/collections/" + collectionX.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
// Verify this user doesn’t have this feature on the bundle in item 1
- getClient(collectionXRemoverItem1DeleterToken).perform(
- get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bundles/" + bundle1.getID()))
+ getAuthorizationFeatures(collectionXRemoverItem1DeleterToken, "http://localhost/api/core/bundles/" + bundle1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
@@ -1328,20 +1150,17 @@ public void testCanDeleteMinimalPermissions() throws Exception {
context.restoreAuthSystemState();
String item1RemoverToken = getAuthToken(item1Remover.getEmail(), password);
// Verify the user has this feature on the bundle in item 1
- getClient(item1RemoverToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bundles/" + bundle1.getID()))
+ getAuthorizationFeatures(item1RemoverToken, "http://localhost/api/core/bundles/" + bundle1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify this user doesn’t have this feature on item 1
- getClient(item1RemoverToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/items/" + item1.getID()))
+ getAuthorizationFeatures(item1RemoverToken, "http://localhost/api/core/items/" + item1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
// Verify this user doesn’t have this feature on the bitstream in item 1
- getClient(item1RemoverToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bitstreams/" + bitstream1.getID()))
+ getAuthorizationFeatures(item1RemoverToken, "http://localhost/api/core/bitstreams/" + bitstream1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
@@ -1361,8 +1180,7 @@ public void testCanDeleteMinimalPermissions() throws Exception {
context.restoreAuthSystemState();
String bundle1RemoverToken = getAuthToken(bundle1Remover.getEmail(), password);
// Verify the user doesn’t have this feature on the bitstream in item 1
- getClient(bundle1RemoverToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bitstreams/" + bitstream1.getID()))
+ getAuthorizationFeatures(bundle1RemoverToken, "http://localhost/api/core/bitstreams/" + bitstream1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
@@ -1388,8 +1206,7 @@ public void testCanDeleteMinimalPermissions() throws Exception {
context.restoreAuthSystemState();
String bundle1item1RemoverToken = getAuthToken(bundle1item1Remover.getEmail(), password);
// Verify the user has this feature on the bitstream in item 1
- getClient(bundle1item1RemoverToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bitstreams/" + bitstream1.getID()))
+ getAuthorizationFeatures(bundle1item1RemoverToken, "http://localhost/api/core/bitstreams/" + bitstream1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
@@ -1404,36 +1221,31 @@ public void testCanReorderBitstreamsAdmin() throws Exception {
final String feature = "canReorderBitstreams";
// Verify the general admin has this feature on the bundle in item 1
- getClient(adminToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bundles/" + bundle1.getID()))
+ getAuthorizationFeatures(adminToken, "http://localhost/api/core/bundles/" + bundle1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify community A admin has this feature on the bundle in item 1
- getClient(communityAAdminToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bundles/" + bundle1.getID()))
+ getAuthorizationFeatures(communityAAdminToken, "http://localhost/api/core/bundles/" + bundle1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify collection X admin has this feature on the bundle in item 1
- getClient(collectionXAdminToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bundles/" + bundle1.getID()))
+ getAuthorizationFeatures(collectionXAdminToken, "http://localhost/api/core/bundles/" + bundle1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify item 1 admin has this feature on the bundle in item 1
- getClient(item1AdminToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bundles/" + bundle1.getID()))
+ getAuthorizationFeatures(item1AdminToken, "http://localhost/api/core/bundles/" + bundle1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify community A admin doesn’t have this feature on the bundle in item 2
- getClient(communityAAdminToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bundles/" + bundle2.getID()))
+ getAuthorizationFeatures(communityAAdminToken, "http://localhost/api/core/bundles/" + bundle2.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
@@ -1447,28 +1259,24 @@ public void testCanReorderBitstreamsWriter() throws Exception {
final String feature = "canReorderBitstreams";
// Verify community A write doesn’t have this feature on the bundle in item 1
- getClient(communityAWriterToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bundles/" + bundle1.getID()))
+ getAuthorizationFeatures(communityAWriterToken, "http://localhost/api/core/bundles/" + bundle1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
// Verify collection X write doesn’t have this feature on the bundle in item 1
- getClient(collectionXWriterToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bundles/" + bundle1.getID()))
+ getAuthorizationFeatures(collectionXWriterToken, "http://localhost/api/core/bundles/" + bundle1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
// Verify item 1 write doesn’t have this feature on the bundle in item 1
- getClient(item1WriterToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bundles/" + bundle1.getID()))
+ getAuthorizationFeatures(item1WriterToken, "http://localhost/api/core/bundles/" + bundle1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
// Create a new user, grant WRITE permissions on the bundle in item 1 to this user
// Verify the user has this feature on the bundle in item 1
- getClient(communityAWriterToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bundles/" + bundle1.getID()))
+ getAuthorizationFeatures(communityAWriterToken, "http://localhost/api/core/bundles/" + bundle1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
@@ -1483,36 +1291,31 @@ public void testCanCreateBitstreamAdmin() throws Exception {
final String feature = "canCreateBitstream";
// Verify the general admin has this feature on the bundle in item 1
- getClient(adminToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bundles/" + bundle1.getID()))
+ getAuthorizationFeatures(adminToken, "http://localhost/api/core/bundles/" + bundle1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify community A admin has this feature on the bundle in item 1
- getClient(communityAAdminToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bundles/" + bundle1.getID()))
+ getAuthorizationFeatures(communityAAdminToken, "http://localhost/api/core/bundles/" + bundle1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify collection X admin has this feature on the bundle in item 1
- getClient(collectionXAdminToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bundles/" + bundle1.getID()))
+ getAuthorizationFeatures(collectionXAdminToken, "http://localhost/api/core/bundles/" + bundle1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify item 1 admin has this feature on the bundle in item 1
- getClient(item1AdminToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bundles/" + bundle1.getID()))
+ getAuthorizationFeatures(item1AdminToken, "http://localhost/api/core/bundles/" + bundle1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
// Verify community A admin doesn’t have this feature on the bundle in item 2
- getClient(communityAAdminToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bundles/" + bundle2.getID()))
+ getAuthorizationFeatures(communityAAdminToken, "http://localhost/api/core/bundles/" + bundle2.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
@@ -1526,22 +1329,19 @@ public void testCanCreateBitstreamWriter() throws Exception {
final String feature = "canCreateBitstream";
// Verify community A write doesn’t have this feature on the bundle in item 1
- getClient(communityAWriterToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bundles/" + bundle1.getID()))
+ getAuthorizationFeatures(communityAWriterToken, "http://localhost/api/core/bundles/" + bundle1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
// Verify collection X write doesn’t have this feature on the bundle in item 1
- getClient(collectionXWriterToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bundles/" + bundle1.getID()))
+ getAuthorizationFeatures(collectionXWriterToken, "http://localhost/api/core/bundles/" + bundle1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
// Verify item 1 write doesn’t have this feature on the bundle in item 1
- getClient(item1WriterToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bundles/" + bundle1.getID()))
+ getAuthorizationFeatures(item1WriterToken, "http://localhost/api/core/bundles/" + bundle1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
@@ -1561,8 +1361,7 @@ public void testCanCreateBitstreamWriter() throws Exception {
context.restoreAuthSystemState();
String bundle1WriterToken = getAuthToken(bundle1Writer.getEmail(), password);
// Verify the user doesn’t have this feature on the bundle in item 1
- getClient(bundle1WriterToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bundles/" + bundle1.getID()))
+ getAuthorizationFeatures(bundle1WriterToken, "http://localhost/api/core/bundles/" + bundle1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
@@ -1582,8 +1381,7 @@ public void testCanCreateBitstreamWriter() throws Exception {
context.restoreAuthSystemState();
String bundle1AdderToken = getAuthToken(bundle1Adder.getEmail(), password);
// Verify the user doesn’t have this feature on the bundle in item 1
- getClient(bundle1AdderToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bundles/" + bundle1.getID()))
+ getAuthorizationFeatures(bundle1AdderToken, "http://localhost/api/core/bundles/" + bundle1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
@@ -1619,8 +1417,7 @@ public void testCanCreateBitstreamWriter() throws Exception {
context.restoreAuthSystemState();
String bundle1WriterAdderToken = getAuthToken(bundle1WriterAdder.getEmail(), password);
// Verify the user has this feature on the bundle in item 1
- getClient(bundle1WriterAdderToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/bundles/" + bundle1.getID()))
+ getAuthorizationFeatures(bundle1WriterAdderToken, "http://localhost/api/core/bundles/" + bundle1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
@@ -1639,22 +1436,19 @@ public void testCanCreateBundleWriter() throws Exception {
final String feature = "canCreateBundle";
// Verify community A write doesn’t have this feature on item 1
- getClient(communityAWriterToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/items/" + item1.getID()))
+ getAuthorizationFeatures(communityAWriterToken, "http://localhost/api/core/items/" + item1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
// Verify collection X write doesn’t have this feature on item 1
- getClient(collectionXWriterToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/items/" + item1.getID()))
+ getAuthorizationFeatures(collectionXWriterToken, "http://localhost/api/core/items/" + item1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
// Verify item 1 write doesn’t have this feature on item 1
- getClient(item1WriterToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/items/" + item1.getID()))
+ getAuthorizationFeatures(item1WriterToken, "http://localhost/api/core/items/" + item1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").doesNotExist());
@@ -1679,10 +1473,22 @@ public void testCanCreateBundleWriter() throws Exception {
context.restoreAuthSystemState();
String item1AdderWriterToken = getAuthToken(item1AdderWriter.getEmail(), password);
// Verify the user has this feature on item 1
- getClient(item1AdderWriterToken).perform(get("/api/authz/authorizations/search/object?embed=feature&uri="
- + "http://localhost/api/core/items/" + item1.getID()))
+ getAuthorizationFeatures(item1AdderWriterToken, "http://localhost/api/core/items/" + item1.getID())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.authorizations[?(@._embedded.feature.id=='"
+ feature + "')]").exists());
}
+
+ private ResultActions getAuthorizationFeatures(String adminToken, String uri) throws Exception {
+ return getAuthorizationFeatures(adminToken, uri, SIZE);
+ }
+
+ private ResultActions getAuthorizationFeatures(String adminToken, String uri, int size) throws Exception {
+ return getClient(adminToken)
+ .perform(
+ get(
+ "/api/authz/authorizations/search/object?size=" + size + "&embed=feature&uri=" + uri
+ )
+ );
+ }
}
\ No newline at end of file
diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/test/AbstractControllerIntegrationTest.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/test/AbstractControllerIntegrationTest.java
index 00339ba2e482..4ec66fb00081 100644
--- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/test/AbstractControllerIntegrationTest.java
+++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/test/AbstractControllerIntegrationTest.java
@@ -23,7 +23,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.lang3.StringUtils;
import org.dspace.AbstractIntegrationTestWithDatabase;
-import org.dspace.app.rest.Application;
+import org.dspace.app.TestApplication;
import org.dspace.app.rest.model.patch.Operation;
import org.dspace.app.rest.utils.DSpaceConfigurationInitializer;
import org.dspace.app.rest.utils.DSpaceKernelInitializer;
@@ -68,7 +68,7 @@
// Specify main class to use to load Spring ApplicationContext
// NOTE: By default, Spring caches and reuses ApplicationContext for each integration test (to speed up tests)
// See: https://docs.spring.io/spring/docs/current/spring-framework-reference/testing.html#integration-testing
-@SpringBootTest(classes = Application.class)
+@SpringBootTest(classes = TestApplication.class)
// Load DSpace initializers in Spring ApplicationContext (to initialize DSpace Kernel & Configuration)
@ContextConfiguration(initializers = { DSpaceKernelInitializer.class, DSpaceConfigurationInitializer.class })
// Tell Spring to make ApplicationContext an instance of WebApplicationContext (for web-based tests)
diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/test/AbstractWebClientIntegrationTest.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/test/AbstractWebClientIntegrationTest.java
index 6556624c6b11..be0a27b4ebd1 100644
--- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/test/AbstractWebClientIntegrationTest.java
+++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/test/AbstractWebClientIntegrationTest.java
@@ -9,7 +9,7 @@
import org.apache.commons.lang3.StringUtils;
import org.dspace.AbstractIntegrationTestWithDatabase;
-import org.dspace.app.rest.Application;
+import org.dspace.app.TestApplication;
import org.dspace.app.rest.utils.DSpaceConfigurationInitializer;
import org.dspace.app.rest.utils.DSpaceKernelInitializer;
import org.junit.runner.RunWith;
@@ -46,7 +46,7 @@
// ALSO tell Spring to start a web server on a random port
// NOTE: By default, Spring caches and reuses ApplicationContext for each integration test (to speed up tests)
// See: https://docs.spring.io/spring/docs/current/spring-framework-reference/testing.html#integration-testing
-@SpringBootTest(classes = Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
// Load DSpace initializers in Spring ApplicationContext (to initialize DSpace Kernel & Configuration)
@ContextConfiguration(initializers = { DSpaceKernelInitializer.class, DSpaceConfigurationInitializer.class })
// Load our src/test/resources/application-test.properties to override some settings in default application.properties
diff --git a/dspace-server-webapp/src/test/resources/application-test.properties b/dspace-server-webapp/src/test/resources/application-test.properties
index 9a396cf8e5b1..bd9e2ea4a17b 100644
--- a/dspace-server-webapp/src/test/resources/application-test.properties
+++ b/dspace-server-webapp/src/test/resources/application-test.properties
@@ -14,4 +14,7 @@
## Log4j2 configuration for test environment
## This file is found on classpath at src/test/resources/log4j2-test.xml
-logging.config = classpath:log4j2-test.xml
\ No newline at end of file
+logging.config = classpath:log4j2-test.xml
+
+# Our integration tests expect application to be deployed at the root path (/)
+server.servlet.context-path=/
\ No newline at end of file
diff --git a/dspace/modules/pom.xml b/dspace/modules/pom.xml
index af44a7efc2e7..00f691235bc4 100644
--- a/dspace/modules/pom.xml
+++ b/dspace/modules/pom.xml
@@ -64,5 +64,16 @@
server
+
+ dspace-server-webapp-boot
+
+
+ server-boot/pom.xml
+
+
+
+ server-boot
+
+
diff --git a/dspace/modules/server-boot/pom.xml b/dspace/modules/server-boot/pom.xml
new file mode 100644
index 000000000000..ee23c8ee7bc7
--- /dev/null
+++ b/dspace/modules/server-boot/pom.xml
@@ -0,0 +1,123 @@
+
+ 4.0.0
+ org.dspace
+ server-boot
+ DSpace Server Webapp:: Executable JAR
+
+
+
+ modules
+ org.dspace
+ cris-2023.02.02-SNAPSHOT
+ ..
+
+
+
+
+ ${basedir}/../../..
+
+
+
+
+
+ org.dspace.modules
+ additions
+
+
+ org.dspace
+ dspace-server-webapp
+
+
+ org.apache.solr
+ solr-solrj
+
+
+
+
+ org.dspace
+ dspace-api
+ test-jar
+ test
+
+
+ org.dspace
+ dspace-server-webapp
+ test-jar
+ test
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ org.springframework.security
+ spring-security-test
+ ${spring-security.version}
+ test
+
+
+ com.jayway.jsonpath
+ json-path-assert
+ ${json-path.version}
+ test
+
+
+ junit
+ junit
+ test
+
+
+ com.h2database
+ h2
+ test
+
+
+ org.mockito
+ mockito-inline
+ test
+
+
+
+
+ org.apache.solr
+ solr-core
+ ${solr.client.version}
+ test
+
+
+
+ org.apache.commons
+ commons-text
+
+
+
+
+ org.apache.lucene
+ lucene-analyzers-icu
+ test
+
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+ ${spring-boot.version}
+
+
+
+ repackage
+
+
+
+
+
+
+
+
diff --git a/dspace/modules/server-boot/src/main/java/org/dspace/app/ServerBootApplication.java b/dspace/modules/server-boot/src/main/java/org/dspace/app/ServerBootApplication.java
new file mode 100644
index 000000000000..5efa79a02aca
--- /dev/null
+++ b/dspace/modules/server-boot/src/main/java/org/dspace/app/ServerBootApplication.java
@@ -0,0 +1,33 @@
+/**
+ * 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;
+
+import org.dspace.app.rest.WebApplication;
+import org.dspace.app.rest.utils.DSpaceConfigurationInitializer;
+import org.dspace.app.rest.utils.DSpaceKernelInitializer;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+
+/**
+ * Define the Spring Boot Application settings itself to be runned using an
+ * embedded application server.
+ *
+ * @author Luca Giamminonni (luca.giamminonni at 4science.it)
+ *
+ */
+@SuppressWarnings({ "checkstyle:hideutilityclassconstructor" })
+@SpringBootApplication(scanBasePackageClasses = WebApplication.class)
+public class ServerBootApplication {
+
+ public static void main(String[] args) {
+ new SpringApplicationBuilder(ServerBootApplication.class)
+ .initializers(new DSpaceKernelInitializer(), new DSpaceConfigurationInitializer())
+ .run(args);
+ }
+
+}
diff --git a/dspace/modules/server/pom.xml b/dspace/modules/server/pom.xml
index e8a714dfd25e..3797e809dca5 100644
--- a/dspace/modules/server/pom.xml
+++ b/dspace/modules/server/pom.xml
@@ -3,13 +3,7 @@
org.dspace.modules
server
war
- DSpace Server Webapp:: Local Customizations
- Overlay customizations.
-This is probably a temporary solution to the build problems. We like to investigate about
-the possibility to remove the overlays enable a more flexible extension mechanism.
-The use of web-fragment and spring mvc technology allow us to add request handlers
-just adding new jar in the classloader
-
+ DSpace Server Webapp:: Tomcat deployable WAR
modules
org.dspace
@@ -18,6 +12,7 @@ just adding new jar in the classloader