forked from DSpace/DSpace
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cherry-picked fixed sorting from vanilla (#564)
* Merge pull request DSpace#8841 from alexandrevryghem/fix-community-page-sorting_contribute-main Fixed community's sub-communities and collections sort * Removed creating and using `migrate-7.5` docker image (#566) * ufal/comment-ever-failing-test * Commented still failing tests (#490) * do not build on arm --------- Co-authored-by: Tim Donohue <[email protected]> Co-authored-by: MajoBerger <[email protected]>
- Loading branch information
1 parent
5c07612
commit 1bd0fec
Showing
10 changed files
with
190 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
...app/src/test/java/org/dspace/app/rest/repository/CommunityCollectionLinkRepositoryIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/** | ||
* 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 static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; | ||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; | ||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; | ||
|
||
import org.dspace.app.rest.matcher.CollectionMatcher; | ||
import org.dspace.app.rest.test.AbstractControllerIntegrationTest; | ||
import org.dspace.builder.CollectionBuilder; | ||
import org.dspace.builder.CommunityBuilder; | ||
import org.dspace.content.Collection; | ||
import org.dspace.content.Community; | ||
import org.hamcrest.Matchers; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
/** | ||
* Test class for {@link CommunityCollectionLinkRepository} | ||
*/ | ||
public class CommunityCollectionLinkRepositoryIT extends AbstractControllerIntegrationTest { | ||
|
||
Community parentCommunity; | ||
Collection collection1; | ||
Collection collection2; | ||
Collection collection3; | ||
|
||
@Before | ||
@Override | ||
public void setUp() throws Exception { | ||
super.setUp(); | ||
context.turnOffAuthorisationSystem(); | ||
parentCommunity = CommunityBuilder.createCommunity(context) | ||
.build(); | ||
collection1 = CollectionBuilder.createCollection(context, parentCommunity) | ||
.withName("Collection 1") | ||
.build(); | ||
collection2 = CollectionBuilder.createCollection(context, parentCommunity) | ||
.withName("Collection 2") | ||
.build(); | ||
collection3 = CollectionBuilder.createCollection(context, parentCommunity) | ||
.withName("Collection 3") | ||
.build(); | ||
context.commit(); | ||
context.restoreAuthSystemState(); | ||
} | ||
|
||
@Test | ||
public void getCollections_sortTitleASC() throws Exception { | ||
String adminToken = getAuthToken(admin.getEmail(), password); | ||
|
||
getClient(adminToken).perform(get("/api/core/communities/" + parentCommunity.getID() + "/collections") | ||
.param("sort", "dc.title,ASC")) | ||
.andExpect(status().isOk()) | ||
.andExpect(jsonPath("$._embedded.collections", Matchers.contains( | ||
CollectionMatcher.matchCollection(collection1), | ||
CollectionMatcher.matchCollection(collection2), | ||
CollectionMatcher.matchCollection(collection3) | ||
))); | ||
} | ||
|
||
@Test | ||
public void getCollections_sortTitleDESC() throws Exception { | ||
String adminToken = getAuthToken(admin.getEmail(), password); | ||
|
||
getClient(adminToken).perform(get("/api/core/communities/" + parentCommunity.getID() + "/collections") | ||
.param("sort", "dc.title,DESC")) | ||
.andExpect(status().isOk()) | ||
.andExpect(jsonPath("$._embedded.collections", Matchers.contains( | ||
CollectionMatcher.matchCollection(collection3), | ||
CollectionMatcher.matchCollection(collection2), | ||
CollectionMatcher.matchCollection(collection1) | ||
))); | ||
} | ||
|
||
} |
Oops, something went wrong.