mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-17 15:03:18 +00:00
Fixed headers and checkstyle for parentCommunity link functionality
This commit is contained in:
@@ -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;
|
package org.dspace.app.rest.repository;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
@@ -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;
|
package org.dspace.app.rest.repository;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
@@ -7,16 +7,15 @@
|
|||||||
*/
|
*/
|
||||||
package org.dspace.app.rest;
|
package org.dspace.app.rest;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import static org.hamcrest.CoreMatchers.equalTo;
|
import static org.hamcrest.CoreMatchers.equalTo;
|
||||||
import static org.hamcrest.CoreMatchers.not;
|
import static org.hamcrest.CoreMatchers.not;
|
||||||
import static org.junit.Assert.assertThat;
|
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.get;
|
||||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
|
|
||||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
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 com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import org.dspace.app.rest.builder.CollectionBuilder;
|
import org.dspace.app.rest.builder.CollectionBuilder;
|
||||||
import org.dspace.app.rest.builder.CommunityBuilder;
|
import org.dspace.app.rest.builder.CommunityBuilder;
|
||||||
@@ -108,10 +107,11 @@ public class CommunityCollectionParentIT extends AbstractControllerIntegrationTe
|
|||||||
|
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
String token = getAuthToken(admin.getEmail(), password);
|
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();
|
String content = mvcResult.getResponse().getContentAsString();
|
||||||
Map<String,Object> map = mapper.readValue(content, Map.class);
|
Map<String, Object> map = mapper.readValue(content, Map.class);
|
||||||
String collectionUuidString = String.valueOf(map.get("uuid"));
|
String collectionUuidString = String.valueOf(map.get("uuid"));
|
||||||
String collectionName = String.valueOf(map.get("name"));
|
String collectionName = String.valueOf(map.get("name"));
|
||||||
|
|
||||||
@@ -131,10 +131,11 @@ public class CommunityCollectionParentIT extends AbstractControllerIntegrationTe
|
|||||||
|
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
String token = getAuthToken(admin.getEmail(), password);
|
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();
|
String content = mvcResult.getResponse().getContentAsString();
|
||||||
Map<String,Object> map = mapper.readValue(content, Map.class);
|
Map<String, Object> map = mapper.readValue(content, Map.class);
|
||||||
String collectionUuidString = String.valueOf(map.get("uuid"));
|
String collectionUuidString = String.valueOf(map.get("uuid"));
|
||||||
String collectionName = String.valueOf(map.get("name"));
|
String collectionName = String.valueOf(map.get("name"));
|
||||||
|
|
||||||
@@ -154,10 +155,11 @@ public class CommunityCollectionParentIT extends AbstractControllerIntegrationTe
|
|||||||
|
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
String token = getAuthToken(admin.getEmail(), password);
|
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();
|
String content = mvcResult.getResponse().getContentAsString();
|
||||||
Map<String,Object> map = mapper.readValue(content, Map.class);
|
Map<String, Object> map = mapper.readValue(content, Map.class);
|
||||||
String collectionUuidString = String.valueOf(map.get("uuid"));
|
String collectionUuidString = String.valueOf(map.get("uuid"));
|
||||||
String collectionName = String.valueOf(map.get("name"));
|
String collectionName = String.valueOf(map.get("name"));
|
||||||
|
|
||||||
@@ -177,10 +179,11 @@ public class CommunityCollectionParentIT extends AbstractControllerIntegrationTe
|
|||||||
|
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
String token = getAuthToken(admin.getEmail(), password);
|
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();
|
String content = mvcResult.getResponse().getContentAsString();
|
||||||
Map<String,Object> map = mapper.readValue(content, Map.class);
|
Map<String, Object> map = mapper.readValue(content, Map.class);
|
||||||
String communityUuidString = String.valueOf(map.get("uuid"));
|
String communityUuidString = String.valueOf(map.get("uuid"));
|
||||||
String communityName = String.valueOf(map.get("name"));
|
String communityName = String.valueOf(map.get("name"));
|
||||||
|
|
||||||
@@ -201,10 +204,11 @@ public class CommunityCollectionParentIT extends AbstractControllerIntegrationTe
|
|||||||
|
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
String token = getAuthToken(admin.getEmail(), password);
|
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();
|
String content = mvcResult.getResponse().getContentAsString();
|
||||||
Map<String,Object> map = mapper.readValue(content, Map.class);
|
Map<String, Object> map = mapper.readValue(content, Map.class);
|
||||||
String communityUuidString = String.valueOf(map.get("uuid"));
|
String communityUuidString = String.valueOf(map.get("uuid"));
|
||||||
String communityName = String.valueOf(map.get("name"));
|
String communityName = String.valueOf(map.get("name"));
|
||||||
|
|
||||||
@@ -225,10 +229,11 @@ public class CommunityCollectionParentIT extends AbstractControllerIntegrationTe
|
|||||||
|
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
String token = getAuthToken(admin.getEmail(), password);
|
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();
|
String content = mvcResult.getResponse().getContentAsString();
|
||||||
Map<String,Object> map = mapper.readValue(content, Map.class);
|
Map<String, Object> map = mapper.readValue(content, Map.class);
|
||||||
String communityUuidString = String.valueOf(map.get("uuid"));
|
String communityUuidString = String.valueOf(map.get("uuid"));
|
||||||
String communityName = String.valueOf(map.get("name"));
|
String communityName = String.valueOf(map.get("name"));
|
||||||
|
|
||||||
@@ -249,10 +254,11 @@ public class CommunityCollectionParentIT extends AbstractControllerIntegrationTe
|
|||||||
|
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
String token = getAuthToken(admin.getEmail(), password);
|
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();
|
String content = mvcResult.getResponse().getContentAsString();
|
||||||
Map<String,Object> map = mapper.readValue(content, Map.class);
|
Map<String, Object> map = mapper.readValue(content, Map.class);
|
||||||
String communityUuidString = String.valueOf(map.get("uuid"));
|
String communityUuidString = String.valueOf(map.get("uuid"));
|
||||||
String communityName = String.valueOf(map.get("name"));
|
String communityName = String.valueOf(map.get("name"));
|
||||||
|
|
||||||
@@ -273,10 +279,11 @@ public class CommunityCollectionParentIT extends AbstractControllerIntegrationTe
|
|||||||
|
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
String token = getAuthToken(admin.getEmail(), password);
|
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();
|
String content = mvcResult.getResponse().getContentAsString();
|
||||||
Map<String,Object> map = mapper.readValue(content, Map.class);
|
Map<String, Object> map = mapper.readValue(content, Map.class);
|
||||||
String communityUuidString = String.valueOf(map.get("uuid"));
|
String communityUuidString = String.valueOf(map.get("uuid"));
|
||||||
String communityName = String.valueOf(map.get("name"));
|
String communityName = String.valueOf(map.get("name"));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user