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.
Rest api for handle resolution with metadata
* decoded rawvalues and response json modification * used static extractMetadata funct in HandlePlugin * return dict: * removed property for test from local
- Loading branch information
1 parent
659d14e
commit 68fb203
Showing
3 changed files
with
116 additions
and
11 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
|
||
import static org.hamcrest.Matchers.allOf; | ||
import static org.hamcrest.Matchers.containsInAnyOrder; | ||
import static org.hamcrest.Matchers.is; | ||
import static org.hamcrest.Matchers.not; | ||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; | ||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; | ||
|
@@ -84,7 +85,36 @@ public void givenMappedIdentifierWhenCallHdlresolverThenReturnsMappedURL() throw | |
getClient() | ||
.perform(get("/wrongController/" + publicItem1.getHandle())) | ||
.andExpect(status().isNotFound()); | ||
} | ||
|
||
@Test | ||
public void givenMappedIdentifierWhenCallHdlresolverThenReturnsMappedParams() throws Exception { | ||
context.turnOffAuthorisationSystem(); | ||
|
||
// ** START GIVEN ** | ||
parentCommunity = CommunityBuilder.createCommunity(context).withName("Parent Community").build(); | ||
|
||
Collection col1 = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection 1") | ||
.withLogo("TestingContentForLogo").build(); | ||
|
||
Item publicItem1 = ItemBuilder.createItem(context, col1).withTitle("Public item 1").withIssueDate("2017-10-17") | ||
.withAuthor("Smith, Donald").withAuthor("Doe, John").withSubject("ExtraEntry") | ||
.withHandle("123456789/testHdlResolver").build(); | ||
|
||
context.restoreAuthSystemState(); | ||
|
||
// ** END GIVEN ** | ||
getClient() | ||
.perform(get(HdlResolverRestController.RESOLVE + publicItem1.getHandle()) | ||
.param("metadata", "true")) | ||
.andExpect(status().isOk()) | ||
.andExpect(jsonPath("$.URL", | ||
StringContains.containsString("123456789/testHdlResolver"))) | ||
.andExpect(jsonPath("$.TITLE", StringContains.containsString("Public item 1"))) | ||
.andExpect(jsonPath("$.REPOSITORY", is(configurationService.getProperty("dspace.name")))) | ||
.andExpect(jsonPath("$.REPORTEMAIL", | ||
StringContains.containsString("[email protected]"))) | ||
.andExpect(jsonPath("$.SUBMITDATE").exists()); | ||
} | ||
|
||
@Test | ||
|