From c29abf376569f74eaa34708c254eacc029386e95 Mon Sep 17 00:00:00 2001 From: Giuseppe Digilio Date: Mon, 23 Sep 2024 20:30:15 +0200 Subject: [PATCH] [CST-14906] Fix tests --- .../dspace/app/rest/InitializeEntitiesIT.java | 12 +- .../SubmissionDefinitionsControllerIT.java | 2 +- .../app/rest/SubmissionFormsControllerIT.java | 112 +++++++++--------- dspace/config/modules/orcid.cfg | 6 - 4 files changed, 65 insertions(+), 67 deletions(-) diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/InitializeEntitiesIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/InitializeEntitiesIT.java index 4daf6819829..d3c0cc4b1f5 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/InitializeEntitiesIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/InitializeEntitiesIT.java @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/SubmissionDefinitionsControllerIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/SubmissionDefinitionsControllerIT.java index 1a1a4576dc8..b8c783a56bc 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/SubmissionDefinitionsControllerIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/SubmissionDefinitionsControllerIT.java @@ -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 { diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/SubmissionFormsControllerIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/SubmissionFormsControllerIT.java index 006c22dae11..56b2b02fb28 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/SubmissionFormsControllerIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/SubmissionFormsControllerIT.java @@ -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)))) ; } @@ -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 @@ -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") @@ -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") @@ -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))); } } diff --git a/dspace/config/modules/orcid.cfg b/dspace/config/modules/orcid.cfg index 13eb85f3c58..bc8d2a5e64e 100644 --- a/dspace/config/modules/orcid.cfg +++ b/dspace/config/modules/orcid.cfg @@ -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!