Fixed headers and checkstyle for parentCommunity link functionality

This commit is contained in:
Raf Ponsaerts
2020-02-14 09:27:21 +01:00
parent 61400e1145
commit 6447176f02
3 changed files with 73 additions and 52 deletions

View File

@@ -1,3 +1,10 @@
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.dspace.app.rest.repository;
import java.sql.SQLException;

View File

@@ -1,3 +1,10 @@
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.dspace.app.rest.repository;
import java.sql.SQLException;

View File

@@ -7,16 +7,15 @@
*/
package org.dspace.app.rest;
import java.sql.SQLException;
import java.util.Map;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.not;
import static org.junit.Assert.assertThat;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import java.sql.SQLException;
import java.util.Map;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.dspace.app.rest.builder.CollectionBuilder;
import org.dspace.app.rest.builder.CommunityBuilder;
@@ -108,7 +107,8 @@ public class CommunityCollectionParentIT extends AbstractControllerIntegrationTe
ObjectMapper mapper = new ObjectMapper();
String token = getAuthToken(admin.getEmail(), password);
MvcResult mvcResult = getClient(token).perform(get("/api/core/items/" + itemX.getID() + "/owningCollection")).andReturn();
MvcResult mvcResult = getClient(token).perform(get("/api/core/items/" + itemX.getID() + "/owningCollection"))
.andReturn();
String content = mvcResult.getResponse().getContentAsString();
Map<String, Object> map = mapper.readValue(content, Map.class);
@@ -131,7 +131,8 @@ public class CommunityCollectionParentIT extends AbstractControllerIntegrationTe
ObjectMapper mapper = new ObjectMapper();
String token = getAuthToken(admin.getEmail(), password);
MvcResult mvcResult = getClient(token).perform(get("/api/core/items/" + itemY.getID() + "/owningCollection")).andReturn();
MvcResult mvcResult = getClient(token).perform(get("/api/core/items/" + itemY.getID() + "/owningCollection"))
.andReturn();
String content = mvcResult.getResponse().getContentAsString();
Map<String, Object> map = mapper.readValue(content, Map.class);
@@ -154,7 +155,8 @@ public class CommunityCollectionParentIT extends AbstractControllerIntegrationTe
ObjectMapper mapper = new ObjectMapper();
String token = getAuthToken(admin.getEmail(), password);
MvcResult mvcResult = getClient(token).perform(get("/api/core/items/" + itemZ.getID() + "/owningCollection")).andReturn();
MvcResult mvcResult = getClient(token).perform(get("/api/core/items/" + itemZ.getID() + "/owningCollection"))
.andReturn();
String content = mvcResult.getResponse().getContentAsString();
Map<String, Object> map = mapper.readValue(content, Map.class);
@@ -177,7 +179,8 @@ public class CommunityCollectionParentIT extends AbstractControllerIntegrationTe
ObjectMapper mapper = new ObjectMapper();
String token = getAuthToken(admin.getEmail(), password);
MvcResult mvcResult = getClient(token).perform(get("/api/core/collections/" + col1.getID() + "/parentCommunity")).andReturn();
MvcResult mvcResult = getClient(token)
.perform(get("/api/core/collections/" + col1.getID() + "/parentCommunity")).andReturn();
String content = mvcResult.getResponse().getContentAsString();
Map<String, Object> map = mapper.readValue(content, Map.class);
@@ -201,7 +204,8 @@ public class CommunityCollectionParentIT extends AbstractControllerIntegrationTe
ObjectMapper mapper = new ObjectMapper();
String token = getAuthToken(admin.getEmail(), password);
MvcResult mvcResult = getClient(token).perform(get("/api/core/collections/" + col2.getID() + "/parentCommunity")).andReturn();
MvcResult mvcResult = getClient(token)
.perform(get("/api/core/collections/" + col2.getID() + "/parentCommunity")).andReturn();
String content = mvcResult.getResponse().getContentAsString();
Map<String, Object> map = mapper.readValue(content, Map.class);
@@ -225,7 +229,8 @@ public class CommunityCollectionParentIT extends AbstractControllerIntegrationTe
ObjectMapper mapper = new ObjectMapper();
String token = getAuthToken(admin.getEmail(), password);
MvcResult mvcResult = getClient(token).perform(get("/api/core/collections/" + col3.getID() + "/parentCommunity")).andReturn();
MvcResult mvcResult = getClient(token)
.perform(get("/api/core/collections/" + col3.getID() + "/parentCommunity")).andReturn();
String content = mvcResult.getResponse().getContentAsString();
Map<String, Object> map = mapper.readValue(content, Map.class);
@@ -249,7 +254,8 @@ public class CommunityCollectionParentIT extends AbstractControllerIntegrationTe
ObjectMapper mapper = new ObjectMapper();
String token = getAuthToken(admin.getEmail(), password);
MvcResult mvcResult = getClient(token).perform(get("/api/core/communities/" + communityAA.getID() + "/parentCommunity")).andReturn();
MvcResult mvcResult = getClient(token)
.perform(get("/api/core/communities/" + communityAA.getID() + "/parentCommunity")).andReturn();
String content = mvcResult.getResponse().getContentAsString();
Map<String, Object> map = mapper.readValue(content, Map.class);
@@ -273,7 +279,8 @@ public class CommunityCollectionParentIT extends AbstractControllerIntegrationTe
ObjectMapper mapper = new ObjectMapper();
String token = getAuthToken(admin.getEmail(), password);
MvcResult mvcResult = getClient(token).perform(get("/api/core/communities/" + communityAB.getID() + "/parentCommunity")).andReturn();
MvcResult mvcResult = getClient(token)
.perform(get("/api/core/communities/" + communityAB.getID() + "/parentCommunity")).andReturn();
String content = mvcResult.getResponse().getContentAsString();
Map<String, Object> map = mapper.readValue(content, Map.class);