[DS-3762] implemented changes

This commit is contained in:
Raf Ponsaerts
2017-12-11 14:20:45 +01:00
parent 2d537abd7e
commit e61e6e7a1e
2 changed files with 15 additions and 7 deletions

View File

@@ -73,11 +73,20 @@ public class BitstreamFormatRestRepositoryIT extends AbstractControllerIntegrati
@Test
@Ignore
public void findOne() throws Exception {
getClient().perform(get("/api/core/bitstreamformats/1"))
context.turnOffAuthorisationSystem();
BitstreamFormat bitstreamFormat = BitstreamFormatBuilder.createBitstreamFormat(context)
.withMimeType("application/octet-stream")
.withDescription("Description")
.build();
getClient().perform(get("/api/core/bitstreamformats/" + bitstreamFormat.getID()))
.andExpect(status().isOk())
.andExpect(content().contentType(contentType))
.andExpect(jsonPath("$.description", is(bitstreamFormat.getDescription())))
.andExpect(jsonPath("$.mimetype", is(bitstreamFormat.getMIMEType())))
.andExpect(jsonPath("$.type", is("bitstreamformat")))
.andExpect(jsonPath("$._links.self.href", startsWith(REST_SERVER_URL)))
.andExpect(jsonPath("$._links.self.href", endsWith("/api/core/bitstreamformats/1")))
.andExpect(jsonPath("$._links.self.href", endsWith("/api/core/bitstreamformats/"+bitstreamFormat.getID())))
;
}
}

View File

@@ -231,7 +231,6 @@ public class CommunityRestRepositoryIT extends AbstractControllerIntegrationTest
//TODO The test fails, 404 resource not found. remove @Ignore when this is implemented
@Test
@Ignore
public void findAllSubCommunities() throws Exception{
//We turn off the authorization system in order to create the structure as defined below
@@ -263,17 +262,17 @@ public class CommunityRestRepositoryIT extends AbstractControllerIntegrationTest
Collection col1 = CollectionBuilder.createCollection(context, child1).withName("Collection 1").build();
getClient().perform(get("/api/core/communities/search/subCommunities"))
getClient().perform(get("/api/core/communities/search/subCommunities/" + parentCommunity.getID()))
.andExpect(status().isOk())
.andExpect(content().contentType(contentType))
.andExpect(jsonPath("$._embedded.communities", Matchers.containsInAnyOrder(
CommunityMatcher.matchCommunityEntry(child1.getName(), child1.getID(), child1.getHandle()),
CommunityMatcher.matchCommunityEntry(child12.getName(), child12.getID(), child12.getHandle()),
CommunityMatcher.matchCommunityEntry(child2.getName(), child2.getID(), child2.getHandle())
CommunityMatcher.matchCommunityEntry(child12.getName(), child12.getID(), child12.getHandle())
)))
.andExpect(jsonPath("$._embedded.communities", Matchers.not(Matchers.containsInAnyOrder(
CommunityMatcher.matchCommunityEntry(parentCommunity.getName(), parentCommunity.getID(), parentCommunity.getHandle()),
CommunityMatcher.matchCommunityEntry(parentCommunity2.getName(), parentCommunity2.getID(), parentCommunity2.getHandle())
CommunityMatcher.matchCommunityEntry(parentCommunity2.getName(), parentCommunity2.getID(), parentCommunity2.getHandle()),
CommunityMatcher.matchCommunityEntry(child2.getName(), child2.getID(), child2.getHandle())
))))
.andExpect(jsonPath("$._links.self.href", Matchers.containsString("/api/core/communities/search/subCommunities")))
.andExpect(jsonPath("$.page.size", is(20)))