Skip to content

Commit

Permalink
[CST-14906] Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
atarix83 committed Sep 23, 2024
1 parent c8f0725 commit c29abf3
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 67 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public void getAllRelationshipTypesTest() throws Exception {
//We expect a 200 OK status
.andExpect(status().isOk())
//10 relationship types should be created
.andExpect(jsonPath("$.page.totalElements", is(10)))
.andExpect(jsonPath("$.page.totalElements", is(12)))
//There needs to be a self link to this endpoint
.andExpect(jsonPath("$._links.self.href", containsString("api/core/relationshiptypes")))
//We have 10 relationship types, they need to all be present in the embedded section
Expand All @@ -121,7 +121,9 @@ public void getAllRelationshipTypesTest() throws Exception {
RelationshipTypeMatcher.matchRelationshipTypeEntry(relationshipTypes.get(6)),
RelationshipTypeMatcher.matchRelationshipTypeEntry(relationshipTypes.get(7)),
RelationshipTypeMatcher.matchRelationshipTypeEntry(relationshipTypes.get(8)),
RelationshipTypeMatcher.matchRelationshipTypeEntry(relationshipTypes.get(9)))
RelationshipTypeMatcher.matchRelationshipTypeEntry(relationshipTypes.get(9)),
RelationshipTypeMatcher.matchRelationshipTypeEntry(relationshipTypes.get(10)),
RelationshipTypeMatcher.matchRelationshipTypeEntry(relationshipTypes.get(11)))
));

//Verify the left min cardinality of the first relationship type (isAuthorOfPublication) is 0
Expand Down Expand Up @@ -157,7 +159,7 @@ public void updateRelationshipTypesTest() throws Exception {
//We expect a 200 OK status
.andExpect(status().isOk())
//10 relationship types should remain present (no duplicates created)
.andExpect(jsonPath("$.page.totalElements", is(10)))
.andExpect(jsonPath("$.page.totalElements", is(12)))
//There needs to be a self link to this endpoint
.andExpect(jsonPath("$._links.self.href", containsString("api/core/relationshiptypes")))
//We have 10 relationship types, they need to all be present in the embedded section
Expand All @@ -172,7 +174,9 @@ public void updateRelationshipTypesTest() throws Exception {
RelationshipTypeMatcher.matchRelationshipTypeEntry(relationshipTypes.get(6)),
RelationshipTypeMatcher.matchRelationshipTypeEntry(relationshipTypes.get(7)),
RelationshipTypeMatcher.matchRelationshipTypeEntry(relationshipTypes.get(8)),
RelationshipTypeMatcher.matchRelationshipTypeEntry(relationshipTypes.get(9)))
RelationshipTypeMatcher.matchRelationshipTypeEntry(relationshipTypes.get(9)),
RelationshipTypeMatcher.matchRelationshipTypeEntry(relationshipTypes.get(10)),
RelationshipTypeMatcher.matchRelationshipTypeEntry(relationshipTypes.get(11)))
));

//Verify the left min cardinality of the first relationship type (isAuthorOfPublication) has been updated to 10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class SubmissionDefinitionsControllerIT extends AbstractControllerIntegra
// The total number of expected submission definitions is referred to in multiple tests and assertions as
// is the last page (totalDefinitions - 1)
// This integer should be maintained along with any changes to item-submissions.xml
private static final int totalDefinitions = 9;
private static final int totalDefinitions = 11;

@Test
public void findAll() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ public void findAll() throws Exception {
.andExpect(content().contentType(contentType))
//The configuration file for the test env includes 6 forms
.andExpect(jsonPath("$.page.size", is(20)))
.andExpect(jsonPath("$.page.totalElements", equalTo(10)))
.andExpect(jsonPath("$.page.totalElements", equalTo(12)))
.andExpect(jsonPath("$.page.totalPages", equalTo(1)))
.andExpect(jsonPath("$.page.number", is(0)))
.andExpect(
jsonPath("$._links.self.href", Matchers.startsWith(REST_SERVER_URL + "config/submissionforms")))
//The array of submissionforms should have a size of 8
.andExpect(jsonPath("$._embedded.submissionforms", hasSize(equalTo(10))))
.andExpect(jsonPath("$._embedded.submissionforms", hasSize(equalTo(12))))
;
}

Expand All @@ -85,12 +85,12 @@ public void findAllWithNewlyCreatedAccountTest() throws Exception {
.andExpect(status().isOk())
.andExpect(content().contentType(contentType))
.andExpect(jsonPath("$.page.size", is(20)))
.andExpect(jsonPath("$.page.totalElements", equalTo(10)))
.andExpect(jsonPath("$.page.totalElements", equalTo(12)))
.andExpect(jsonPath("$.page.totalPages", equalTo(1)))
.andExpect(jsonPath("$.page.number", is(0)))
.andExpect(jsonPath("$._links.self.href", Matchers.startsWith(REST_SERVER_URL
+ "config/submissionforms")))
.andExpect(jsonPath("$._embedded.submissionforms", hasSize(equalTo(10))));
.andExpect(jsonPath("$._embedded.submissionforms", hasSize(equalTo(12))));
}

@Test
Expand Down Expand Up @@ -697,10 +697,10 @@ public void findAllPaginationTest() throws Exception {
Matchers.containsString("page=1"), Matchers.containsString("size=2"))))
.andExpect(jsonPath("$._links.last.href", Matchers.allOf(
Matchers.containsString("/api/config/submissionforms?"),
Matchers.containsString("page=4"), Matchers.containsString("size=2"))))
Matchers.containsString("page=5"), Matchers.containsString("size=2"))))
.andExpect(jsonPath("$.page.size", is(2)))
.andExpect(jsonPath("$.page.totalElements", equalTo(10)))
.andExpect(jsonPath("$.page.totalPages", equalTo(5)))
.andExpect(jsonPath("$.page.totalElements", equalTo(12)))
.andExpect(jsonPath("$.page.totalPages", equalTo(6)))
.andExpect(jsonPath("$.page.number", is(0)));

getClient(tokenAdmin).perform(get("/api/config/submissionforms")
Expand All @@ -724,10 +724,10 @@ public void findAllPaginationTest() throws Exception {
Matchers.containsString("page=2"), Matchers.containsString("size=2"))))
.andExpect(jsonPath("$._links.last.href", Matchers.allOf(
Matchers.containsString("/api/config/submissionforms?"),
Matchers.containsString("page=4"), Matchers.containsString("size=2"))))
Matchers.containsString("page=5"), Matchers.containsString("size=2"))))
.andExpect(jsonPath("$.page.size", is(2)))
.andExpect(jsonPath("$.page.totalElements", equalTo(10)))
.andExpect(jsonPath("$.page.totalPages", equalTo(5)))
.andExpect(jsonPath("$.page.totalElements", equalTo(12)))
.andExpect(jsonPath("$.page.totalPages", equalTo(6)))
.andExpect(jsonPath("$.page.number", is(1)));

getClient(tokenAdmin).perform(get("/api/config/submissionforms")
Expand All @@ -748,57 +748,57 @@ public void findAllPaginationTest() throws Exception {
Matchers.containsString("page=2"), Matchers.containsString("size=2"))))
.andExpect(jsonPath("$._links.last.href", Matchers.allOf(
Matchers.containsString("/api/config/submissionforms?"),
Matchers.containsString("page=4"), Matchers.containsString("size=2"))))
Matchers.containsString("page=5"), Matchers.containsString("size=2"))))
.andExpect(jsonPath("$.page.size", is(2)))
.andExpect(jsonPath("$.page.totalElements", equalTo(10)))
.andExpect(jsonPath("$.page.totalPages", equalTo(5)))
.andExpect(jsonPath("$.page.totalElements", equalTo(12)))
.andExpect(jsonPath("$.page.totalPages", equalTo(6)))
.andExpect(jsonPath("$.page.number", is(2)));

getClient(tokenAdmin).perform(get("/api/config/submissionforms")
.param("size", "2")
.param("page", "3"))
.andExpect(status().isOk())
.andExpect(content().contentType(contentType))
.andExpect(jsonPath("$._embedded.submissionforms[0].id", is("traditionalpagetwo")))
.andExpect(jsonPath("$._embedded.submissionforms[1].id", is("sampleauthority")))
.andExpect(jsonPath("$._links.first.href", Matchers.allOf(
Matchers.containsString("/api/config/submissionforms?"),
Matchers.containsString("page=0"), Matchers.containsString("size=2"))))
.andExpect(jsonPath("$._links.prev.href", Matchers.allOf(
Matchers.containsString("/api/config/submissionforms?"),
Matchers.containsString("page=2"), Matchers.containsString("size=2"))))
.andExpect(jsonPath("$._links.self.href", Matchers.allOf(
Matchers.containsString("/api/config/submissionforms?"),
Matchers.containsString("page=3"), Matchers.containsString("size=2"))))
.andExpect(jsonPath("$._links.last.href", Matchers.allOf(
Matchers.containsString("/api/config/submissionforms?"),
Matchers.containsString("page=4"), Matchers.containsString("size=2"))))
.andExpect(jsonPath("$.page.size", is(2)))
.andExpect(jsonPath("$.page.totalElements", equalTo(10)))
.andExpect(jsonPath("$.page.totalPages", equalTo(5)))
.andExpect(jsonPath("$.page.number", is(3)));
.param("size", "2")
.param("page", "3"))
.andExpect(status().isOk())
.andExpect(content().contentType(contentType))
.andExpect(jsonPath("$._embedded.submissionforms[0].id", is("patentStep")))
.andExpect(jsonPath("$._embedded.submissionforms[1].id", is("traditionalpagetwo")))
.andExpect(jsonPath("$._links.first.href", Matchers.allOf(
Matchers.containsString("/api/config/submissionforms?"),
Matchers.containsString("page=0"), Matchers.containsString("size=2"))))
.andExpect(jsonPath("$._links.prev.href", Matchers.allOf(
Matchers.containsString("/api/config/submissionforms?"),
Matchers.containsString("page=2"), Matchers.containsString("size=2"))))
.andExpect(jsonPath("$._links.self.href", Matchers.allOf(
Matchers.containsString("/api/config/submissionforms?"),
Matchers.containsString("page=3"), Matchers.containsString("size=2"))))
.andExpect(jsonPath("$._links.last.href", Matchers.allOf(
Matchers.containsString("/api/config/submissionforms?"),
Matchers.containsString("page=5"), Matchers.containsString("size=2"))))
.andExpect(jsonPath("$.page.size", is(2)))
.andExpect(jsonPath("$.page.totalElements", equalTo(12)))
.andExpect(jsonPath("$.page.totalPages", equalTo(6)))
.andExpect(jsonPath("$.page.number", is(3)));

getClient(tokenAdmin).perform(get("/api/config/submissionforms")
.param("size", "2")
.param("page", "4"))
.andExpect(status().isOk())
.andExpect(content().contentType(contentType))
.andExpect(jsonPath("$._embedded.submissionforms[0].id", is("traditionalpageone")))
.andExpect(jsonPath("$._links.first.href", Matchers.allOf(
Matchers.containsString("/api/config/submissionforms?"),
Matchers.containsString("page=0"), Matchers.containsString("size=2"))))
.andExpect(jsonPath("$._links.prev.href", Matchers.allOf(
Matchers.containsString("/api/config/submissionforms?"),
Matchers.containsString("page=3"), Matchers.containsString("size=2"))))
.andExpect(jsonPath("$._links.self.href", Matchers.allOf(
Matchers.containsString("/api/config/submissionforms?"),
Matchers.containsString("page=4"), Matchers.containsString("size=2"))))
.andExpect(jsonPath("$._links.last.href", Matchers.allOf(
Matchers.containsString("/api/config/submissionforms?"),
Matchers.containsString("page=4"), Matchers.containsString("size=2"))))
.andExpect(jsonPath("$.page.size", is(2)))
.andExpect(jsonPath("$.page.totalElements", equalTo(10)))
.andExpect(jsonPath("$.page.totalPages", equalTo(5)))
.andExpect(jsonPath("$.page.number", is(4)));
.param("size", "2")
.param("page", "4"))
.andExpect(status().isOk())
.andExpect(content().contentType(contentType))
.andExpect(jsonPath("$._embedded.submissionforms[0].id", is("sampleauthority")))
.andExpect(jsonPath("$._links.first.href", Matchers.allOf(
Matchers.containsString("/api/config/submissionforms?"),
Matchers.containsString("page=0"), Matchers.containsString("size=2"))))
.andExpect(jsonPath("$._links.prev.href", Matchers.allOf(
Matchers.containsString("/api/config/submissionforms?"),
Matchers.containsString("page=3"), Matchers.containsString("size=2"))))
.andExpect(jsonPath("$._links.self.href", Matchers.allOf(
Matchers.containsString("/api/config/submissionforms?"),
Matchers.containsString("page=4"), Matchers.containsString("size=2"))))
.andExpect(jsonPath("$._links.last.href", Matchers.allOf(
Matchers.containsString("/api/config/submissionforms?"),
Matchers.containsString("page=5"), Matchers.containsString("size=2"))))
.andExpect(jsonPath("$.page.size", is(2)))
.andExpect(jsonPath("$.page.totalElements", equalTo(12)))
.andExpect(jsonPath("$.page.totalPages", equalTo(6)))
.andExpect(jsonPath("$.page.number", is(4)));
}
}
6 changes: 0 additions & 6 deletions dspace/config/modules/orcid.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,6 @@ orcid.mapping.work.external-ids = $simple-handle::handle
orcid.mapping.work.external-ids = dc.identifier.isi::wosuid
orcid.mapping.work.external-ids = dc.identifier.issn::issn

orcid.mapping.work.funding = dc.relation.funding
orcid.mapping.work.funding.external-id.type = grant_number
orcid.mapping.work.funding.external-id.value = dc.relation.grantno
orcid.mapping.work.funding.external-id.entity-value = oairecerif.funding.identifier
orcid.mapping.work.funding.url = crisfund.award.url

### Work (Product) mapping ###
# where is differs from publication mapping above
# see orcid-services.xml for properties being changed here!
Expand Down

0 comments on commit c29abf3

Please sign in to comment.