From 5ccb7f5adf325c704014251ed44406151d891804 Mon Sep 17 00:00:00 2001 From: amontenegro Date: Thu, 3 Aug 2023 11:44:03 -0600 Subject: [PATCH 1/6] Check the source of the element based on the source ids and not the name --- .../java/org/orcid/pojo/summary/AffiliationSummary.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/orcid-core/src/main/java/org/orcid/pojo/summary/AffiliationSummary.java b/orcid-core/src/main/java/org/orcid/pojo/summary/AffiliationSummary.java index aec33d72eff..e8dc27d612d 100644 --- a/orcid-core/src/main/java/org/orcid/pojo/summary/AffiliationSummary.java +++ b/orcid-core/src/main/java/org/orcid/pojo/summary/AffiliationSummary.java @@ -108,7 +108,14 @@ public static AffiliationSummary valueOf(org.orcid.jaxb.model.v3.release.record. form.setType(type); if (as.getSource() != null) { - form.setValidatedOrSelfAsserted(as.getSource().getSourceName().getContent().equals(orcid)); + String sourceId = as.getSource().retrieveSourcePath(); + String assertionOriginSourceId = as.getSource().retrieveAssertionOriginPath(); + // If the affiliation source is the user himself or any member with OBO, then, it is considered self asserted + if(orcid.equals(sourceId) || orcid.equals(assertionOriginSourceId)) { + form.setValidatedOrSelfAsserted(false); + } else { + form.setValidatedOrSelfAsserted(true); + } } } return form; From 3138b77303bce21134313aab7b0673d4042f0543 Mon Sep 17 00:00:00 2001 From: amontenegro Date: Thu, 3 Aug 2023 15:27:02 -0600 Subject: [PATCH 2/6] Apply changes to external identifiers as well --- .../java/org/orcid/core/utils/v3/SourceUtils.java | 11 +++++++++++ .../org/orcid/pojo/summary/AffiliationSummary.java | 10 ++-------- .../pojo/summary/ExternalIdentifiersSummary.java | 3 ++- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/orcid-core/src/main/java/org/orcid/core/utils/v3/SourceUtils.java b/orcid-core/src/main/java/org/orcid/core/utils/v3/SourceUtils.java index 2c9902c8d55..6f89c0ee934 100644 --- a/orcid-core/src/main/java/org/orcid/core/utils/v3/SourceUtils.java +++ b/orcid-core/src/main/java/org/orcid/core/utils/v3/SourceUtils.java @@ -306,4 +306,15 @@ public void setSourceName(ResearchResources rr) { } } } + + public static boolean isSelfAsserted(Source source, String orcid) { + String sourceId = source.retrieveSourcePath(); + String assertionOriginSourceId = source.retrieveAssertionOriginPath(); + // If the affiliation source is the user himself or any member with OBO, then, it is considered self asserted + if(orcid.equals(sourceId) || orcid.equals(assertionOriginSourceId)) { + return false; + } else { + return true; + } + } } diff --git a/orcid-core/src/main/java/org/orcid/pojo/summary/AffiliationSummary.java b/orcid-core/src/main/java/org/orcid/pojo/summary/AffiliationSummary.java index e8dc27d612d..11fab722cda 100644 --- a/orcid-core/src/main/java/org/orcid/pojo/summary/AffiliationSummary.java +++ b/orcid-core/src/main/java/org/orcid/pojo/summary/AffiliationSummary.java @@ -1,5 +1,6 @@ package org.orcid.pojo.summary; +import org.orcid.core.utils.v3.SourceUtils; import org.orcid.jaxb.model.v3.release.common.FuzzyDate; import org.orcid.pojo.ajaxForm.PojoUtil; @@ -108,14 +109,7 @@ public static AffiliationSummary valueOf(org.orcid.jaxb.model.v3.release.record. form.setType(type); if (as.getSource() != null) { - String sourceId = as.getSource().retrieveSourcePath(); - String assertionOriginSourceId = as.getSource().retrieveAssertionOriginPath(); - // If the affiliation source is the user himself or any member with OBO, then, it is considered self asserted - if(orcid.equals(sourceId) || orcid.equals(assertionOriginSourceId)) { - form.setValidatedOrSelfAsserted(false); - } else { - form.setValidatedOrSelfAsserted(true); - } + form.setValidatedOrSelfAsserted(SourceUtils.isSelfAsserted(as.getSource(), orcid)); } } return form; diff --git a/orcid-core/src/main/java/org/orcid/pojo/summary/ExternalIdentifiersSummary.java b/orcid-core/src/main/java/org/orcid/pojo/summary/ExternalIdentifiersSummary.java index 7f4239cd402..cc6ae33e110 100644 --- a/orcid-core/src/main/java/org/orcid/pojo/summary/ExternalIdentifiersSummary.java +++ b/orcid-core/src/main/java/org/orcid/pojo/summary/ExternalIdentifiersSummary.java @@ -1,5 +1,6 @@ package org.orcid.pojo.summary; +import org.orcid.core.utils.v3.SourceUtils; import org.orcid.jaxb.model.v3.release.record.PersonExternalIdentifier; import org.orcid.jaxb.model.v3.release.record.PersonExternalIdentifiers; import org.orcid.pojo.ajaxForm.PojoUtil; @@ -59,7 +60,7 @@ public static ExternalIdentifiersSummary valueOf(PersonExternalIdentifier person } if (personExternalIdentifier.getSource() != null) { - form.setValidatedOrSelfAsserted(personExternalIdentifier.getSource().retrieveSourcePath().equals(orcid)); + form.setValidatedOrSelfAsserted(SourceUtils.isSelfAsserted(personExternalIdentifier.getSource(), orcid)); } } return form; From 82573a44e387211249ba115bb4b0f2169bc2d37b Mon Sep 17 00:00:00 2001 From: amontenegro Date: Thu, 3 Aug 2023 16:30:48 -0600 Subject: [PATCH 3/6] Adding more tests --- .../data/ClientDetailsEntityData.xml | 16 +++--- .../main/resources/data/ProfileEntityData.xml | 31 ++++++++++-- .../data/SourceClientDetailsEntityData.xml | 8 +-- .../PublicRecordControllerTest.java | 50 ++++++++++++------- 4 files changed, 73 insertions(+), 32 deletions(-) diff --git a/orcid-test/src/main/resources/data/ClientDetailsEntityData.xml b/orcid-test/src/main/resources/data/ClientDetailsEntityData.xml index e3de41d55ce..eae55703d4c 100644 --- a/orcid-test/src/main/resources/data/ClientDetailsEntityData.xml +++ b/orcid-test/src/main/resources/data/ClientDetailsEntityData.xml @@ -1,14 +1,14 @@ - - - - - - - - + + + + + + + + diff --git a/orcid-test/src/main/resources/data/ProfileEntityData.xml b/orcid-test/src/main/resources/data/ProfileEntityData.xml index f07c1baf802..3f516a1d61a 100644 --- a/orcid-test/src/main/resources/data/ProfileEntityData.xml +++ b/orcid-test/src/main/resources/data/ProfileEntityData.xml @@ -714,9 +714,34 @@ last_modified="2011-07-02 15:31:00.00" display_index="4" /> - + + + + - - - - + + + + diff --git a/orcid-web/src/test/java/org/orcid/frontend/web/controllers/PublicRecordControllerTest.java b/orcid-web/src/test/java/org/orcid/frontend/web/controllers/PublicRecordControllerTest.java index c091440316e..ca676b71e2a 100644 --- a/orcid-web/src/test/java/org/orcid/frontend/web/controllers/PublicRecordControllerTest.java +++ b/orcid-web/src/test/java/org/orcid/frontend/web/controllers/PublicRecordControllerTest.java @@ -29,6 +29,7 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; @RunWith(OrcidJUnit4ClassRunner.class) @WebAppConfiguration @@ -116,10 +117,19 @@ public void testGetPublicRecord() { assertEquals(Visibility.PUBLIC, record.getEmails().getEmails().get(0).getVisibility()); assertNotNull(record.getExternalIdentifier()); - assertEquals(1, record.getExternalIdentifier().getExternalIdentifiers().size()); - assertEquals(String.valueOf(13), record.getExternalIdentifier().getExternalIdentifiers().get(0).getPutCode()); - assertEquals("http://ext-id/public_ref", record.getExternalIdentifier().getExternalIdentifiers().get(0).getUrl()); + assertEquals(3, record.getExternalIdentifier().getExternalIdentifiers().size()); + // Added by member + assertEquals(String.valueOf(19), record.getExternalIdentifier().getExternalIdentifiers().get(0).getPutCode()); + assertEquals("http://ext-id/self/obo/public", record.getExternalIdentifier().getExternalIdentifiers().get(0).getUrl()); assertEquals(Visibility.PUBLIC.value(), record.getExternalIdentifier().getExternalIdentifiers().get(0).getVisibility().getVisibility().value()); + // Added by user + assertEquals(String.valueOf(18), record.getExternalIdentifier().getExternalIdentifiers().get(1).getPutCode()); + assertEquals("http://ext-id/self/public", record.getExternalIdentifier().getExternalIdentifiers().get(1).getUrl()); + assertEquals(Visibility.PUBLIC.value(), record.getExternalIdentifier().getExternalIdentifiers().get(1).getVisibility().getVisibility().value()); + // User OBO + assertEquals(String.valueOf(13), record.getExternalIdentifier().getExternalIdentifiers().get(2).getPutCode()); + assertEquals("http://ext-id/public_ref", record.getExternalIdentifier().getExternalIdentifiers().get(2).getUrl()); + assertEquals(Visibility.PUBLIC.value(), record.getExternalIdentifier().getExternalIdentifiers().get(2).getVisibility().getVisibility().value()); assertNotNull(record.getWebsite()); assertEquals(1, record.getWebsite().getWebsites().size()); @@ -132,6 +142,7 @@ public void testGetPublicRecord() { public void testGetRecordSummary() { RecordSummary record = publicRecordController.getSummaryRecord(userOrcid); + assertEquals("active", record.getStatus()); assertNotNull(record.getName()); assertEquals("Credit Name", record.getName()); @@ -139,12 +150,25 @@ public void testGetRecordSummary() { assertEquals(1, record.getEmploymentAffiliations().size()); assertEquals(1, record.getEmploymentAffiliationsCount()); - assertEquals("An institution", record.getEmploymentAffiliations().get(0).getOrganizationName()); - - assertEquals(String.valueOf(13), record.getExternalIdentifiers().get(0).getId()); - assertEquals("http://ext-id/public_ref", record.getExternalIdentifiers().get(0).getUrl()); + assertEquals("An institution", record.getEmploymentAffiliations().get(0).getOrganizationName()); + + // Check external identifiers + assertNotNull(record.getExternalIdentifiers()); + assertEquals(3, record.getExternalIdentifiers().size()); + + // Added by member + assertEquals(String.valueOf(19), record.getExternalIdentifiers().get(0).getId()); + assertEquals("http://ext-id/self/obo/public", record.getExternalIdentifiers().get(0).getUrl()); assertFalse(record.getExternalIdentifiers().get(0).isValidatedOrSelfAsserted()); - + // Added by user + assertEquals(String.valueOf(18), record.getExternalIdentifiers().get(1).getId()); + assertEquals("http://ext-id/self/public", record.getExternalIdentifiers().get(1).getUrl()); + assertFalse(record.getExternalIdentifiers().get(1).isValidatedOrSelfAsserted()); + // User OBO + assertEquals(String.valueOf(13), record.getExternalIdentifiers().get(2).getId()); + assertEquals("http://ext-id/public_ref", record.getExternalIdentifiers().get(2).getUrl()); + assertTrue(record.getExternalIdentifiers().get(2).isValidatedOrSelfAsserted()); + assertEquals(1, record.getValidatedWorks()); assertEquals(0, record.getSelfAssertedWorks()); @@ -155,15 +179,7 @@ public void testGetRecordSummary() { assertEquals(0, record.getSelfAssertedFunds()); assertNotNull(record.getProfessionalActivities()); - assertEquals(4, record.getProfessionalActivitiesCount()); - - assertNotNull(record.getExternalIdentifiers()); - assertEquals(1, record.getExternalIdentifiers().size()); - assertEquals(String.valueOf(13), record.getExternalIdentifiers().get(0).getId()); - assertEquals("http://ext-id/public_ref", record.getExternalIdentifiers().get(0).getUrl()); - assertFalse(record.getExternalIdentifiers().get(0).isValidatedOrSelfAsserted()); - - assertEquals("active", record.getStatus()); + assertEquals(4, record.getProfessionalActivitiesCount()); } @Test From 999a3dd4f060d34661efd08ee86aae2bf49a2531 Mon Sep 17 00:00:00 2001 From: amontenegro Date: Thu, 3 Aug 2023 17:09:53 -0600 Subject: [PATCH 4/6] Fixing a batch of tests --- ...viceDelegator_ExternalIdentifiersTest.java | 10 ++++-- ...rV2ApiServiceDelegator_ReadPersonTest.java | 20 +++++++++-- ...rV2ApiServiceDelegator_ReadRecordTest.java | 36 ++++++++++++++++--- ...rV3ApiServiceDelegator_ReadPersonTest.java | 28 ++++++++++++--- ...rV3ApiServiceDelegator_ReadRecordTest.java | 34 +++++++++++++++--- .../ExternalIdentifierManagerTest.java | 14 ++++++-- .../manager/PersonDetailsManagerTest.java | 8 +++-- .../v3/ExternalIdentifierManagerTest.java | 14 ++++++-- .../manager/v3/PersonDetailsManagerTest.java | 8 +++-- 9 files changed, 144 insertions(+), 28 deletions(-) diff --git a/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_ExternalIdentifiersTest.java b/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_ExternalIdentifiersTest.java index b95d9399ee4..87f4fdda96e 100644 --- a/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_ExternalIdentifiersTest.java +++ b/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_ExternalIdentifiersTest.java @@ -403,8 +403,8 @@ public void testReadPublicScope_ExternalIdentifiers() { assertNotNull(p); assertEquals("/0000-0000-0000-0003/external-identifiers", p.getPath()); Utils.verifyLastModified(p.getLastModifiedDate()); - assertEquals(3, p.getExternalIdentifiers().size()); - boolean found13 = false, found14 = false, found15 = false; + assertEquals(5, p.getExternalIdentifiers().size()); + boolean found13 = false, found14 = false, found15 = false, found18 = false, found19 = false; for (PersonExternalIdentifier element : p.getExternalIdentifiers()) { if (element.getPutCode() == 13) { found13 = true; @@ -412,6 +412,10 @@ public void testReadPublicScope_ExternalIdentifiers() { found14 = true; } else if (element.getPutCode() == 15) { found15 = true; + } else if (element.getPutCode() == 18) { + found18 = true; + } else if (element.getPutCode() == 19) { + found19 = true; } else { fail("Invalid put code " + element.getPutCode()); } @@ -420,6 +424,8 @@ public void testReadPublicScope_ExternalIdentifiers() { assertTrue(found13); assertTrue(found14); assertTrue(found15); + assertTrue(found18); + assertTrue(found19); r = serviceDelegator.viewExternalIdentifier(ORCID, 13L); assertNotNull(r); diff --git a/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_ReadPersonTest.java b/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_ReadPersonTest.java index e420837aba5..4cd710318ca 100644 --- a/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_ReadPersonTest.java +++ b/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_ReadPersonTest.java @@ -115,7 +115,7 @@ public void testViewPerson() { Utils.verifyLastModified(a.getLastModifiedDate()); assertEquals(4, a.getAddress().size()); - boolean found1 = false, found2 = false, found3 = false, found4 = false; + boolean found1 = false, found2 = false, found3 = false, found4 = false, found5 = false, found6 = false; for (Address element : a.getAddress()) { Utils.verifyLastModified(element.getLastModifiedDate()); if (element.getPutCode() == 9) { @@ -185,6 +185,8 @@ public void testViewPerson() { found2 = false; found3 = false; found4 = false; + found5 = false; + found6 = false; for (PersonExternalIdentifier element : extIds.getExternalIdentifiers()) { Utils.verifyLastModified(element.getLastModifiedDate()); @@ -196,6 +198,10 @@ public void testViewPerson() { found3 = true; } else if (element.getPutCode() == 16) { found4 = true; + } else if (element.getPutCode() == 18) { + found5 = true; + } else if (element.getPutCode() == 19) { + found6 = true; } else { fail("Invalid put code " + element.getPutCode()); } @@ -205,6 +211,8 @@ public void testViewPerson() { assertTrue(found2); assertTrue(found3); assertTrue(found4); + assertTrue(found5); + assertTrue(found6); // Keywords assertNotNull(p.getKeywords()); @@ -318,7 +326,7 @@ private void testPerson(Person p, String orcid) { Utils.verifyLastModified(a.getLastModifiedDate()); assertEquals(3, a.getAddress().size()); - boolean found1 = false, found2 = false, found3 = false; + boolean found1 = false, found2 = false, found3 = false, found4 = false, found5 = false; for (Address element : a.getAddress()) { Utils.verifyLastModified(element.getLastModifiedDate()); if (element.getPutCode() == 9) { @@ -381,6 +389,8 @@ private void testPerson(Person p, String orcid) { found1 = false; found2 = false; found3 = false; + found4 = false; + found5 = false; for (PersonExternalIdentifier element : extIds.getExternalIdentifiers()) { Utils.verifyLastModified(element.getLastModifiedDate()); if (element.getPutCode() == 13) { @@ -389,6 +399,10 @@ private void testPerson(Person p, String orcid) { found2 = true; } else if (element.getPutCode() == 15) { found3 = true; + } else if (element.getPutCode() == 18) { + found3 = true; + } else if (element.getPutCode() == 19) { + found3 = true; } else { fail("Invalid put code " + element.getPutCode()); } @@ -397,6 +411,8 @@ private void testPerson(Person p, String orcid) { assertTrue(found1); assertTrue(found2); assertTrue(found3); + assertTrue(found4); + assertTrue(found5); // Keywords assertNotNull(p.getKeywords()); diff --git a/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_ReadRecordTest.java b/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_ReadRecordTest.java index 4965ea9e7a9..e3f8e7d6a92 100644 --- a/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_ReadRecordTest.java +++ b/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_ReadRecordTest.java @@ -247,7 +247,7 @@ public void testViewRecord() { assertNotNull(person.getExternalIdentifiers()); Utils.verifyLastModified(person.getExternalIdentifiers().getLastModifiedDate()); assertEquals("/0000-0000-0000-0003/external-identifiers", person.getExternalIdentifiers().getPath()); - assertEquals(4, person.getExternalIdentifiers().getExternalIdentifiers().size()); + assertEquals(6, person.getExternalIdentifiers().getExternalIdentifiers().size()); for (PersonExternalIdentifier extId : person.getExternalIdentifiers().getExternalIdentifiers()) { Utils.verifyLastModified(extId.getLastModifiedDate()); if (extId.getPutCode().equals(Long.valueOf(13))) { @@ -282,6 +282,22 @@ public void testViewRecord() { assertEquals("http://ext-id/self/limited", extId.getUrl().getValue()); assertEquals("self_limited_ref", extId.getValue()); assertEquals(Visibility.LIMITED.value(), extId.getVisibility().value()); + } else if (extId.getPutCode().equals(Long.valueOf(18))) { + assertEquals(Long.valueOf(3), extId.getDisplayIndex()); + assertEquals("/0000-0000-0000-0003/external-identifiers/18", extId.getPath()); + assertEquals("0000-0000-0000-0003", extId.getSource().retrieveSourcePath()); + assertEquals("self_public_type", extId.getType()); + assertEquals("http://ext-id/self/public", extId.getUrl().getValue()); + assertEquals("self_public_ref", extId.getValue()); + assertEquals(Visibility.PUBLIC.value(), extId.getVisibility().value()); + } else if (extId.getPutCode().equals(Long.valueOf(19))) { + assertEquals(Long.valueOf(3), extId.getDisplayIndex()); + assertEquals("/0000-0000-0000-0003/external-identifiers/19", extId.getPath()); + assertEquals("0000-0000-0000-0003", extId.getSource().retrieveSourcePath()); + assertEquals("self_public_user_obo_type", extId.getType()); + assertEquals("http://ext-id/self/obo/public", extId.getUrl().getValue()); + assertEquals("self_public_user_obo_ref", extId.getValue()); + assertEquals(Visibility.LIMITED.value(), extId.getVisibility().value()); } else { fail("Invalid external identifier found: " + extId.getPutCode()); } @@ -796,7 +812,7 @@ private void testPerson(Person p, String orcid) { Utils.verifyLastModified(a.getLastModifiedDate()); assertEquals(3, a.getAddress().size()); - boolean found1 = false, found2 = false, found3 = false; + boolean found1 = false, found2 = false, found3 = false, found4 = false, found5 = false; for (Address element : a.getAddress()) { Utils.verifyLastModified(element.getLastModifiedDate()); if (element.getPutCode() == 9) { @@ -859,6 +875,8 @@ private void testPerson(Person p, String orcid) { found1 = false; found2 = false; found3 = false; + found4 = false; + found5 = false; for (PersonExternalIdentifier element : extIds.getExternalIdentifiers()) { Utils.verifyLastModified(element.getLastModifiedDate()); if (element.getPutCode() == 13) { @@ -867,6 +885,10 @@ private void testPerson(Person p, String orcid) { found2 = true; } else if (element.getPutCode() == 15) { found3 = true; + } else if (element.getPutCode() == 18) { + found3 = true; + } else if (element.getPutCode() == 19) { + found3 = true; } else { fail("Invalid put code " + element.getPutCode()); } @@ -875,6 +897,8 @@ private void testPerson(Person p, String orcid) { assertTrue(found1); assertTrue(found2); assertTrue(found3); + assertTrue(found4); + assertTrue(found5); // Keywords assertNotNull(p.getKeywords()); @@ -1062,9 +1086,13 @@ private void assertAllPublicButEmails(Person p) { PersonExternalIdentifiers extIds = p.getExternalIdentifiers(); assertNotNull(extIds); Utils.verifyLastModified(extIds.getLastModifiedDate()); - assertEquals(1, extIds.getExternalIdentifiers().size()); - assertEquals(Long.valueOf(13), extIds.getExternalIdentifiers().get(0).getPutCode()); + assertEquals(3, extIds.getExternalIdentifiers().size()); + assertEquals(Long.valueOf(19), extIds.getExternalIdentifiers().get(0).getPutCode()); assertEquals(Visibility.PUBLIC, extIds.getExternalIdentifiers().get(0).getVisibility()); + assertEquals(Long.valueOf(18), extIds.getExternalIdentifiers().get(1).getPutCode()); + assertEquals(Visibility.PUBLIC, extIds.getExternalIdentifiers().get(1).getVisibility()); + assertEquals(Long.valueOf(13), extIds.getExternalIdentifiers().get(2).getPutCode()); + assertEquals(Visibility.PUBLIC, extIds.getExternalIdentifiers().get(2).getVisibility()); // Keywords assertNotNull(p.getKeywords()); diff --git a/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_ReadPersonTest.java b/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_ReadPersonTest.java index 81062da4fce..c464a7e7718 100644 --- a/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_ReadPersonTest.java +++ b/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_ReadPersonTest.java @@ -121,7 +121,7 @@ public void testViewPerson() { Utils.verifyLastModified(a.getLastModifiedDate()); assertEquals(4, a.getAddress().size()); - boolean found1 = false, found2 = false, found3 = false, found4 = false; + boolean found1 = false, found2 = false, found3 = false, found4 = false, found5 = false, found6 = false; for (Address element : a.getAddress()) { Utils.verifyLastModified(element.getLastModifiedDate()); if (element.getPutCode() == 9) { @@ -191,6 +191,8 @@ public void testViewPerson() { found2 = false; found3 = false; found4 = false; + found5 = false; + found6 = false; for (PersonExternalIdentifier element : extIds.getExternalIdentifiers()) { Utils.verifyLastModified(element.getLastModifiedDate()); @@ -202,6 +204,10 @@ public void testViewPerson() { found3 = true; } else if (element.getPutCode() == 16) { found4 = true; + } else if (element.getPutCode() == 18) { + found5 = true; + } else if (element.getPutCode() == 19) { + found6 = true; } else { fail("Invalid put code " + element.getPutCode()); } @@ -211,6 +217,8 @@ public void testViewPerson() { assertTrue(found2); assertTrue(found3); assertTrue(found4); + assertTrue(found5); + assertTrue(found6); // Keywords assertNotNull(p.getKeywords()); @@ -324,7 +332,7 @@ private void testPerson(Person p, String orcid) { Utils.verifyLastModified(a.getLastModifiedDate()); assertEquals(3, a.getAddress().size()); - boolean found1 = false, found2 = false, found3 = false; + boolean found1 = false, found2 = false, found3 = false, found4 = false, found5 = false; for (Address element : a.getAddress()) { Utils.verifyLastModified(element.getLastModifiedDate()); if (element.getPutCode() == 9) { @@ -387,6 +395,8 @@ private void testPerson(Person p, String orcid) { found1 = false; found2 = false; found3 = false; + found4 = false; + found5 = false; for (PersonExternalIdentifier element : extIds.getExternalIdentifiers()) { Utils.verifyLastModified(element.getLastModifiedDate()); if (element.getPutCode() == 13) { @@ -395,6 +405,10 @@ private void testPerson(Person p, String orcid) { found2 = true; } else if (element.getPutCode() == 15) { found3 = true; + } else if (element.getPutCode() == 18) { + found4 = true; + } else if (element.getPutCode() == 19) { + found5 = true; } else { fail("Invalid put code " + element.getPutCode()); } @@ -403,6 +417,8 @@ private void testPerson(Person p, String orcid) { assertTrue(found1); assertTrue(found2); assertTrue(found3); + assertTrue(found4); + assertTrue(found5); // Keywords assertNotNull(p.getKeywords()); @@ -586,9 +602,13 @@ private void assertAllPublicButEmails(Person p) { PersonExternalIdentifiers extIds = p.getExternalIdentifiers(); assertNotNull(extIds); Utils.verifyLastModified(extIds.getLastModifiedDate()); - assertEquals(1, extIds.getExternalIdentifiers().size()); - assertEquals(Long.valueOf(13), extIds.getExternalIdentifiers().get(0).getPutCode()); + assertEquals(3, extIds.getExternalIdentifiers().size()); + assertEquals(Long.valueOf(19), extIds.getExternalIdentifiers().get(0).getPutCode()); assertEquals(Visibility.PUBLIC, extIds.getExternalIdentifiers().get(0).getVisibility()); + assertEquals(Long.valueOf(18), extIds.getExternalIdentifiers().get(1).getPutCode()); + assertEquals(Visibility.PUBLIC, extIds.getExternalIdentifiers().get(1).getVisibility()); + assertEquals(Long.valueOf(13), extIds.getExternalIdentifiers().get(2).getPutCode()); + assertEquals(Visibility.PUBLIC, extIds.getExternalIdentifiers().get(2).getVisibility()); // Keywords assertNotNull(p.getKeywords()); diff --git a/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_ReadRecordTest.java b/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_ReadRecordTest.java index 02642e9b7e1..87602b7911e 100644 --- a/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_ReadRecordTest.java +++ b/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_ReadRecordTest.java @@ -294,6 +294,22 @@ public void testViewRecord() { assertEquals("http://ext-id/self/limited", extId.getUrl().getValue()); assertEquals("self_limited_ref", extId.getValue()); assertEquals(Visibility.LIMITED.value(), extId.getVisibility().value()); + } else if (extId.getPutCode().equals(Long.valueOf(18))) { + assertEquals(Long.valueOf(5), extId.getDisplayIndex()); + assertEquals("/0000-0000-0000-0003/external-identifiers/18", extId.getPath()); + assertEquals("0000-0000-0000-0003", extId.getSource().retrieveSourcePath()); + assertEquals("self_public_type", extId.getType()); + assertEquals("http://ext-id/self/public", extId.getUrl().getValue()); + assertEquals("self_public_ref", extId.getValue()); + assertEquals(Visibility.PUBLIC.value(), extId.getVisibility().value()); + } else if (extId.getPutCode().equals(Long.valueOf(19))) { + assertEquals(Long.valueOf(6), extId.getDisplayIndex()); + assertEquals("/0000-0000-0000-0003/external-identifiers/19", extId.getPath()); + assertEquals("0000-0000-0000-0003", extId.getSource().retrieveSourcePath()); + assertEquals("self_public_user_obo_type", extId.getType()); + assertEquals("http://ext-id/self/obo/public", extId.getUrl().getValue()); + assertEquals("self_public_user_obo_ref", extId.getValue()); + assertEquals(Visibility.LIMITED.value(), extId.getVisibility().value()); } else { fail("Invalid external identifier found: " + extId.getPutCode()); } @@ -1004,7 +1020,7 @@ private void testPerson(Person p, String orcid) { Utils.verifyLastModified(a.getLastModifiedDate()); assertEquals(3, a.getAddress().size()); - boolean found1 = false, found2 = false, found3 = false; + boolean found1 = false, found2 = false, found3 = false, found4 = false, found5 = false; for (Address element : a.getAddress()) { Utils.verifyLastModified(element.getLastModifiedDate()); if (element.getPutCode() == 9) { @@ -1063,10 +1079,12 @@ private void testPerson(Person p, String orcid) { PersonExternalIdentifiers extIds = p.getExternalIdentifiers(); assertNotNull(extIds); Utils.verifyLastModified(extIds.getLastModifiedDate()); - assertEquals(3, extIds.getExternalIdentifiers().size()); + assertEquals(5, extIds.getExternalIdentifiers().size()); found1 = false; found2 = false; found3 = false; + found4 = false; + found5 = false; for (PersonExternalIdentifier element : extIds.getExternalIdentifiers()) { Utils.verifyLastModified(element.getLastModifiedDate()); if (element.getPutCode() == 13) { @@ -1075,6 +1093,10 @@ private void testPerson(Person p, String orcid) { found2 = true; } else if (element.getPutCode() == 15) { found3 = true; + } else if (element.getPutCode() == 18) { + found3 = true; + } else if (element.getPutCode() == 19) { + found3 = true; } else { fail("Invalid put code " + element.getPutCode()); } @@ -1270,9 +1292,13 @@ private void assertAllPublicButEmails(Person p) { PersonExternalIdentifiers extIds = p.getExternalIdentifiers(); assertNotNull(extIds); Utils.verifyLastModified(extIds.getLastModifiedDate()); - assertEquals(1, extIds.getExternalIdentifiers().size()); - assertEquals(Long.valueOf(13), extIds.getExternalIdentifiers().get(0).getPutCode()); + assertEquals(3, extIds.getExternalIdentifiers().size()); + assertEquals(Long.valueOf(19), extIds.getExternalIdentifiers().get(0).getPutCode()); assertEquals(Visibility.PUBLIC, extIds.getExternalIdentifiers().get(0).getVisibility()); + assertEquals(Long.valueOf(18), extIds.getExternalIdentifiers().get(1).getPutCode()); + assertEquals(Visibility.PUBLIC, extIds.getExternalIdentifiers().get(1).getVisibility()); + assertEquals(Long.valueOf(13), extIds.getExternalIdentifiers().get(2).getPutCode()); + assertEquals(Visibility.PUBLIC, extIds.getExternalIdentifiers().get(2).getVisibility()); // Keywords assertNotNull(p.getKeywords()); diff --git a/orcid-core/src/test/java/org/orcid/core/manager/ExternalIdentifierManagerTest.java b/orcid-core/src/test/java/org/orcid/core/manager/ExternalIdentifierManagerTest.java index 122d32bdf57..805ae150d2c 100644 --- a/orcid-core/src/test/java/org/orcid/core/manager/ExternalIdentifierManagerTest.java +++ b/orcid-core/src/test/java/org/orcid/core/manager/ExternalIdentifierManagerTest.java @@ -159,7 +159,7 @@ public void getAllTest() { assertNotNull(elements); assertNotNull(elements.getExternalIdentifiers()); assertEquals(5, elements.getExternalIdentifiers().size()); - boolean found1 = false, found2 = false, found3 = false, found4 = false, found5 = false; + boolean found1 = false, found2 = false, found3 = false, found4 = false, found5 = false, found6 = false, found7 = false; for(PersonExternalIdentifier element : elements.getExternalIdentifiers()) { if(13 == element.getPutCode()){ found1 = true; @@ -171,6 +171,10 @@ public void getAllTest() { found4 = true; } else if(17 == element.getPutCode()){ found5 = true; + } else if(18 == element.getPutCode()){ + found6 = true; + } else if(19 == element.getPutCode()){ + found7 = true; } else { fail("Invalid put code found: " + element.getPutCode()); } @@ -180,6 +184,8 @@ public void getAllTest() { assertTrue(found3); assertTrue(found4); assertTrue(found5); + assertTrue(found6); + assertTrue(found7); } @Test @@ -188,8 +194,10 @@ public void getPublicTest() { PersonExternalIdentifiers elements = externalIdentifierManager.getPublicExternalIdentifiers(orcid); assertNotNull(elements); assertNotNull(elements.getExternalIdentifiers()); - assertEquals(1, elements.getExternalIdentifiers().size()); - assertEquals(Long.valueOf(13), elements.getExternalIdentifiers().get(0).getPutCode()); + assertEquals(3, elements.getExternalIdentifiers().size()); + assertEquals(Long.valueOf(19), elements.getExternalIdentifiers().get(0).getPutCode()); + assertEquals(Long.valueOf(18), elements.getExternalIdentifiers().get(1).getPutCode()); + assertEquals(Long.valueOf(13), elements.getExternalIdentifiers().get(2).getPutCode()); } private PersonExternalIdentifier getExternalIdentifier() { diff --git a/orcid-core/src/test/java/org/orcid/core/manager/PersonDetailsManagerTest.java b/orcid-core/src/test/java/org/orcid/core/manager/PersonDetailsManagerTest.java index 0ff18512827..c89c437befe 100644 --- a/orcid-core/src/test/java/org/orcid/core/manager/PersonDetailsManagerTest.java +++ b/orcid-core/src/test/java/org/orcid/core/manager/PersonDetailsManagerTest.java @@ -51,7 +51,7 @@ public void testGetPersonDetails() { assertNotNull(person.getExternalIdentifiers()); assertNotNull(person.getExternalIdentifiers().getExternalIdentifiers()); - assertEquals(5, person.getExternalIdentifiers().getExternalIdentifiers().size()); + assertEquals(7, person.getExternalIdentifiers().getExternalIdentifiers().size()); assertNotNull(person.getResearcherUrls()); assertNotNull(person.getResearcherUrls().getResearcherUrls()); @@ -98,8 +98,10 @@ public void testGetPublicPersonDetails() { assertNotNull(person.getExternalIdentifiers()); assertNotNull(person.getExternalIdentifiers().getExternalIdentifiers()); - assertEquals(1, person.getExternalIdentifiers().getExternalIdentifiers().size()); - assertEquals(Long.valueOf(13), person.getExternalIdentifiers().getExternalIdentifiers().get(0).getPutCode()); + assertEquals(3, person.getExternalIdentifiers().getExternalIdentifiers().size()); + assertEquals(Long.valueOf(19), person.getExternalIdentifiers().getExternalIdentifiers().get(0).getPutCode()); + assertEquals(Long.valueOf(18), person.getExternalIdentifiers().getExternalIdentifiers().get(1).getPutCode()); + assertEquals(Long.valueOf(13), person.getExternalIdentifiers().getExternalIdentifiers().get(2).getPutCode()); assertNotNull(person.getResearcherUrls()); assertNotNull(person.getResearcherUrls().getResearcherUrls()); diff --git a/orcid-core/src/test/java/org/orcid/core/manager/v3/ExternalIdentifierManagerTest.java b/orcid-core/src/test/java/org/orcid/core/manager/v3/ExternalIdentifierManagerTest.java index 61e0b2b371d..068757c63d4 100644 --- a/orcid-core/src/test/java/org/orcid/core/manager/v3/ExternalIdentifierManagerTest.java +++ b/orcid-core/src/test/java/org/orcid/core/manager/v3/ExternalIdentifierManagerTest.java @@ -173,7 +173,7 @@ public void getAllTest() { assertNotNull(elements); assertNotNull(elements.getExternalIdentifiers()); assertEquals(5, elements.getExternalIdentifiers().size()); - boolean found1 = false, found2 = false, found3 = false, found4 = false, found5 = false; + boolean found1 = false, found2 = false, found3 = false, found4 = false, found5 = false, found6 = false, found7 = false; for(PersonExternalIdentifier element : elements.getExternalIdentifiers()) { if(13 == element.getPutCode()){ found1 = true; @@ -185,6 +185,10 @@ public void getAllTest() { found4 = true; } else if(17 == element.getPutCode()){ found5 = true; + } else if(18 == element.getPutCode()){ + found6 = true; + } else if(19 == element.getPutCode()){ + found7 = true; } else { fail("Invalid put code found: " + element.getPutCode()); } @@ -194,6 +198,8 @@ public void getAllTest() { assertTrue(found3); assertTrue(found4); assertTrue(found5); + assertTrue(found6); + assertTrue(found7); } @Test @@ -202,8 +208,10 @@ public void getPublicTest() { PersonExternalIdentifiers elements = externalIdentifierManager.getPublicExternalIdentifiers(orcid); assertNotNull(elements); assertNotNull(elements.getExternalIdentifiers()); - assertEquals(1, elements.getExternalIdentifiers().size()); - assertEquals(Long.valueOf(13), elements.getExternalIdentifiers().get(0).getPutCode()); + assertEquals(3, elements.getExternalIdentifiers().size()); + assertEquals(Long.valueOf(19), elements.getExternalIdentifiers().get(0).getPutCode()); + assertEquals(Long.valueOf(18), elements.getExternalIdentifiers().get(1).getPutCode()); + assertEquals(Long.valueOf(13), elements.getExternalIdentifiers().get(2).getPutCode()); } @Test diff --git a/orcid-core/src/test/java/org/orcid/core/manager/v3/PersonDetailsManagerTest.java b/orcid-core/src/test/java/org/orcid/core/manager/v3/PersonDetailsManagerTest.java index d9158108454..2b369b20501 100644 --- a/orcid-core/src/test/java/org/orcid/core/manager/v3/PersonDetailsManagerTest.java +++ b/orcid-core/src/test/java/org/orcid/core/manager/v3/PersonDetailsManagerTest.java @@ -52,7 +52,7 @@ public void testGetPersonDetails() { assertNotNull(person.getExternalIdentifiers()); assertNotNull(person.getExternalIdentifiers().getExternalIdentifiers()); - assertEquals(5, person.getExternalIdentifiers().getExternalIdentifiers().size()); + assertEquals(7, person.getExternalIdentifiers().getExternalIdentifiers().size()); assertNotNull(person.getResearcherUrls()); assertNotNull(person.getResearcherUrls().getResearcherUrls()); @@ -114,8 +114,10 @@ public void testGetPublicPersonDetails() { assertNotNull(person.getExternalIdentifiers()); assertNotNull(person.getExternalIdentifiers().getExternalIdentifiers()); - assertEquals(1, person.getExternalIdentifiers().getExternalIdentifiers().size()); - assertEquals(Long.valueOf(13), person.getExternalIdentifiers().getExternalIdentifiers().get(0).getPutCode()); + assertEquals(3, person.getExternalIdentifiers().getExternalIdentifiers().size()); + assertEquals(Long.valueOf(19), person.getExternalIdentifiers().getExternalIdentifiers().get(0).getPutCode()); + assertEquals(Long.valueOf(18), person.getExternalIdentifiers().getExternalIdentifiers().get(1).getPutCode()); + assertEquals(Long.valueOf(13), person.getExternalIdentifiers().getExternalIdentifiers().get(2).getPutCode()); assertNotNull(person.getResearcherUrls()); assertNotNull(person.getResearcherUrls().getResearcherUrls()); From 63c22e8fe9c973d86c4e303193d2f81fbb164c13 Mon Sep 17 00:00:00 2001 From: amontenegro Date: Thu, 3 Aug 2023 17:37:13 -0600 Subject: [PATCH 5/6] Fix unit tests --- .../ExternalIdentifierManagerTest.java | 2 +- .../PublicV2ApiServiceDelegatorTest.java | 70 ++++++++++++++++--- .../PublicV3ApiServiceDelegatorTest.java | 64 +++++++++++++++-- .../PublicProfileControllerTest.java | 14 +++- 4 files changed, 134 insertions(+), 16 deletions(-) diff --git a/orcid-core/src/test/java/org/orcid/core/manager/ExternalIdentifierManagerTest.java b/orcid-core/src/test/java/org/orcid/core/manager/ExternalIdentifierManagerTest.java index 805ae150d2c..3950a8b652e 100644 --- a/orcid-core/src/test/java/org/orcid/core/manager/ExternalIdentifierManagerTest.java +++ b/orcid-core/src/test/java/org/orcid/core/manager/ExternalIdentifierManagerTest.java @@ -158,7 +158,7 @@ public void getAllTest() { PersonExternalIdentifiers elements = externalIdentifierManager.getExternalIdentifiers(orcid); assertNotNull(elements); assertNotNull(elements.getExternalIdentifiers()); - assertEquals(5, elements.getExternalIdentifiers().size()); + assertEquals(7, elements.getExternalIdentifiers().size()); boolean found1 = false, found2 = false, found3 = false, found4 = false, found5 = false, found6 = false, found7 = false; for(PersonExternalIdentifier element : elements.getExternalIdentifiers()) { if(13 == element.getPutCode()){ diff --git a/orcid-pub-web/src/test/java/org/orcid/api/publicV2/server/PublicV2ApiServiceDelegatorTest.java b/orcid-pub-web/src/test/java/org/orcid/api/publicV2/server/PublicV2ApiServiceDelegatorTest.java index 9904ea297a5..5440409f162 100644 --- a/orcid-pub-web/src/test/java/org/orcid/api/publicV2/server/PublicV2ApiServiceDelegatorTest.java +++ b/orcid-pub-web/src/test/java/org/orcid/api/publicV2/server/PublicV2ApiServiceDelegatorTest.java @@ -117,6 +117,9 @@ public class PublicV2ApiServiceDelegatorTest extends DBUnitTest { @Resource(name = "publicV2ApiServiceDelegator") PublicV2ApiServiceDelegator serviceDelegator; + @Resource + SchemaOrgMBWriterV2 writerV2; + @BeforeClass public static void initDBUnitData() throws Exception { initDBUnitData(DATA_FILES); @@ -468,11 +471,36 @@ public void testViewExternalIdentifiers() { assertNotNull(extIds.getLastModifiedDate()); assertNotNull(extIds.getLastModifiedDate().getValue()); assertEquals("/0000-0000-0000-0003/external-identifiers", extIds.getPath()); - assertEquals(1, extIds.getExternalIdentifiers().size()); + assertEquals(3, extIds.getExternalIdentifiers().size()); + PersonExternalIdentifier extId = extIds.getExternalIdentifiers().get(0); assertNotNull(extId); assertNotNull(extId.getLastModifiedDate()); assertNotNull(extId.getLastModifiedDate().getValue()); + assertEquals(Long.valueOf(19), extId.getPutCode()); + assertEquals("self_public_user_obo_type", extId.getType()); + assertNotNull(extId.getUrl()); + assertEquals("http://ext-id/self/obo/public", extId.getUrl().getValue()); + assertEquals(Visibility.PUBLIC.value(), extId.getVisibility().value()); + assertEquals("/0000-0000-0000-0003/external-identifiers/19", extId.getPath()); + assertEquals("APP-5555555555555558", extId.getSource().retrieveSourcePath()); + + extId = extIds.getExternalIdentifiers().get(1); + assertNotNull(extId); + assertNotNull(extId.getLastModifiedDate()); + assertNotNull(extId.getLastModifiedDate().getValue()); + assertEquals(Long.valueOf(18), extId.getPutCode()); + assertEquals("self_public_type", extId.getType()); + assertNotNull(extId.getUrl()); + assertEquals("http://ext-id/self/public", extId.getUrl().getValue()); + assertEquals(Visibility.PUBLIC.value(), extId.getVisibility().value()); + assertEquals("/0000-0000-0000-0003/external-identifiers/18", extId.getPath()); + assertEquals("0000-0000-0000-0003", extId.getSource().retrieveSourcePath()); + + extId = extIds.getExternalIdentifiers().get(2); + assertNotNull(extId); + assertNotNull(extId.getLastModifiedDate()); + assertNotNull(extId.getLastModifiedDate().getValue()); assertEquals(Long.valueOf(13), extId.getPutCode()); assertEquals("public_type", extId.getType()); assertNotNull(extId.getUrl()); @@ -1271,8 +1299,36 @@ private void validatePerson(Person person) { assertNotNull(person.getExternalIdentifiers().getLastModifiedDate()); assertNotNull(person.getExternalIdentifiers().getLastModifiedDate().getValue()); assertEquals("/0000-0000-0000-0003/external-identifiers", person.getExternalIdentifiers().getPath()); - assertEquals(1, person.getExternalIdentifiers().getExternalIdentifiers().size()); - PersonExternalIdentifier extId = person.getExternalIdentifiers().getExternalIdentifiers().get(0); + assertEquals(3, person.getExternalIdentifiers().getExternalIdentifiers().size()); + + PersonExternalIdentifiers extIds = person.getExternalIdentifiers(); + + assertNotNull(extIds); + PersonExternalIdentifier extId = extIds.getExternalIdentifiers().get(0); + assertNotNull(extId); + assertNotNull(extId.getLastModifiedDate()); + assertNotNull(extId.getLastModifiedDate().getValue()); + assertEquals(Long.valueOf(19), extId.getPutCode()); + assertEquals("self_public_user_obo_type", extId.getType()); + assertNotNull(extId.getUrl()); + assertEquals("http://ext-id/self/obo/public", extId.getUrl().getValue()); + assertEquals(Visibility.PUBLIC.value(), extId.getVisibility().value()); + assertEquals("/0000-0000-0000-0003/external-identifiers/19", extId.getPath()); + assertEquals("APP-5555555555555558", extId.getSource().retrieveSourcePath()); + + extId = extIds.getExternalIdentifiers().get(1); + assertNotNull(extId); + assertNotNull(extId.getLastModifiedDate()); + assertNotNull(extId.getLastModifiedDate().getValue()); + assertEquals(Long.valueOf(18), extId.getPutCode()); + assertEquals("self_public_type", extId.getType()); + assertNotNull(extId.getUrl()); + assertEquals("http://ext-id/self/public", extId.getUrl().getValue()); + assertEquals(Visibility.PUBLIC.value(), extId.getVisibility().value()); + assertEquals("/0000-0000-0000-0003/external-identifiers/18", extId.getPath()); + assertEquals("0000-0000-0000-0003", extId.getSource().retrieveSourcePath()); + + extId = extIds.getExternalIdentifiers().get(2); assertNotNull(extId); assertNotNull(extId.getLastModifiedDate()); assertNotNull(extId.getLastModifiedDate().getValue()); @@ -1283,6 +1339,7 @@ private void validatePerson(Person person) { assertEquals(Visibility.PUBLIC.value(), extId.getVisibility().value()); assertEquals("/0000-0000-0000-0003/external-identifiers/13", extId.getPath()); assertEquals("APP-5555555555555555", extId.getSource().retrieveSourcePath()); + assertNotNull(person.getKeywords()); assertNotNull(person.getKeywords().getLastModifiedDate()); assertNotNull(person.getKeywords().getLastModifiedDate().getValue()); @@ -1433,9 +1490,6 @@ private void validateRecord(Record record) { assertEquals("0000-0000-0000-0003", id.getPath()); } - @Resource - SchemaOrgMBWriterV2 writerV2; - @Test public void testSchemaOrgMBWriterV2() throws WebApplicationException, IOException{ Response response = serviceDelegator.viewRecord(ORCID); @@ -1460,7 +1514,7 @@ public void testSchemaOrgMBWriterV2() throws WebApplicationException, IOExceptio assertEquals(Sets.newHashSet("WDB","grant_number"),fundingIds); assertEquals("PUBLIC",doc.worksAndFunding.creator.iterator().next().name); assertEquals("http://www.researcherurl.com?id=13",doc.url.get(0)); - assertEquals("public_type",doc.identifier.get(0).propertyID); - assertEquals( "public_ref",doc.identifier.get(0).value); + assertEquals("self_public_user_obo_type",doc.identifier.get(0).propertyID); + assertEquals( "self_public_user_obo_ref",doc.identifier.get(0).value); } } diff --git a/orcid-pub-web/src/test/java/org/orcid/api/publicV3/server/PublicV3ApiServiceDelegatorTest.java b/orcid-pub-web/src/test/java/org/orcid/api/publicV3/server/PublicV3ApiServiceDelegatorTest.java index 0d59e07a00e..b088b09c2c6 100644 --- a/orcid-pub-web/src/test/java/org/orcid/api/publicV3/server/PublicV3ApiServiceDelegatorTest.java +++ b/orcid-pub-web/src/test/java/org/orcid/api/publicV3/server/PublicV3ApiServiceDelegatorTest.java @@ -493,11 +493,36 @@ public void testViewExternalIdentifiers() { assertNotNull(extIds.getLastModifiedDate()); assertNotNull(extIds.getLastModifiedDate().getValue()); assertEquals("/0000-0000-0000-0003/external-identifiers", extIds.getPath()); - assertEquals(1, extIds.getExternalIdentifiers().size()); + assertEquals(3, extIds.getExternalIdentifiers().size()); + PersonExternalIdentifier extId = extIds.getExternalIdentifiers().get(0); assertNotNull(extId); assertNotNull(extId.getLastModifiedDate()); assertNotNull(extId.getLastModifiedDate().getValue()); + assertEquals(Long.valueOf(19), extId.getPutCode()); + assertEquals("self_public_user_obo_type", extId.getType()); + assertNotNull(extId.getUrl()); + assertEquals("http://ext-id/self/obo/public", extId.getUrl().getValue()); + assertEquals(Visibility.PUBLIC.value(), extId.getVisibility().value()); + assertEquals("/0000-0000-0000-0003/external-identifiers/19", extId.getPath()); + assertEquals("APP-5555555555555558", extId.getSource().retrieveSourcePath()); + + extId = extIds.getExternalIdentifiers().get(1); + assertNotNull(extId); + assertNotNull(extId.getLastModifiedDate()); + assertNotNull(extId.getLastModifiedDate().getValue()); + assertEquals(Long.valueOf(18), extId.getPutCode()); + assertEquals("self_public_type", extId.getType()); + assertNotNull(extId.getUrl()); + assertEquals("http://ext-id/self/public", extId.getUrl().getValue()); + assertEquals(Visibility.PUBLIC.value(), extId.getVisibility().value()); + assertEquals("/0000-0000-0000-0003/external-identifiers/18", extId.getPath()); + assertEquals("0000-0000-0000-0003", extId.getSource().retrieveSourcePath()); + + extId = extIds.getExternalIdentifiers().get(2); + assertNotNull(extId); + assertNotNull(extId.getLastModifiedDate()); + assertNotNull(extId.getLastModifiedDate().getValue()); assertEquals(Long.valueOf(13), extId.getPutCode()); assertEquals("public_type", extId.getType()); assertNotNull(extId.getUrl()); @@ -1800,8 +1825,36 @@ private void validatePerson(Person person) { assertNotNull(person.getExternalIdentifiers().getLastModifiedDate()); assertNotNull(person.getExternalIdentifiers().getLastModifiedDate().getValue()); assertEquals("/0000-0000-0000-0003/external-identifiers", person.getExternalIdentifiers().getPath()); - assertEquals(1, person.getExternalIdentifiers().getExternalIdentifiers().size()); - PersonExternalIdentifier extId = person.getExternalIdentifiers().getExternalIdentifiers().get(0); + assertEquals(3, person.getExternalIdentifiers().getExternalIdentifiers().size()); + + PersonExternalIdentifiers extIds = person.getExternalIdentifiers(); + + assertNotNull(extIds); + PersonExternalIdentifier extId = extIds.getExternalIdentifiers().get(0); + assertNotNull(extId); + assertNotNull(extId.getLastModifiedDate()); + assertNotNull(extId.getLastModifiedDate().getValue()); + assertEquals(Long.valueOf(19), extId.getPutCode()); + assertEquals("self_public_user_obo_type", extId.getType()); + assertNotNull(extId.getUrl()); + assertEquals("http://ext-id/self/obo/public", extId.getUrl().getValue()); + assertEquals(Visibility.PUBLIC.value(), extId.getVisibility().value()); + assertEquals("/0000-0000-0000-0003/external-identifiers/19", extId.getPath()); + assertEquals("APP-5555555555555558", extId.getSource().retrieveSourcePath()); + + extId = extIds.getExternalIdentifiers().get(1); + assertNotNull(extId); + assertNotNull(extId.getLastModifiedDate()); + assertNotNull(extId.getLastModifiedDate().getValue()); + assertEquals(Long.valueOf(18), extId.getPutCode()); + assertEquals("self_public_type", extId.getType()); + assertNotNull(extId.getUrl()); + assertEquals("http://ext-id/self/public", extId.getUrl().getValue()); + assertEquals(Visibility.PUBLIC.value(), extId.getVisibility().value()); + assertEquals("/0000-0000-0000-0003/external-identifiers/18", extId.getPath()); + assertEquals("0000-0000-0000-0003", extId.getSource().retrieveSourcePath()); + + extId = extIds.getExternalIdentifiers().get(2); assertNotNull(extId); assertNotNull(extId.getLastModifiedDate()); assertNotNull(extId.getLastModifiedDate().getValue()); @@ -1812,6 +1865,7 @@ private void validatePerson(Person person) { assertEquals(Visibility.PUBLIC.value(), extId.getVisibility().value()); assertEquals("/0000-0000-0000-0003/external-identifiers/13", extId.getPath()); assertEquals("APP-5555555555555555", extId.getSource().retrieveSourcePath()); + assertNotNull(person.getKeywords()); assertNotNull(person.getKeywords().getLastModifiedDate()); assertNotNull(person.getKeywords().getLastModifiedDate().getValue()); @@ -2069,8 +2123,8 @@ public void testSchemaOrgMBWriterV3() throws WebApplicationException, IOExceptio assertEquals(Sets.newHashSet("WDB","grant_number"),fundingIds); assertEquals("PUBLIC",doc.worksAndFunding.creator.iterator().next().name); assertEquals("http://www.researcherurl.com?id=13",doc.url.get(0)); - assertEquals("public_type",doc.identifier.get(0).propertyID); - assertEquals( "public_ref",doc.identifier.get(0).value); + assertEquals("self_public_user_obo_type",doc.identifier.get(0).propertyID); + assertEquals( "self_public_user_obo_ref",doc.identifier.get(0).value); } @Test diff --git a/orcid-web/src/test/java/org/orcid/frontend/web/controllers/PublicProfileControllerTest.java b/orcid-web/src/test/java/org/orcid/frontend/web/controllers/PublicProfileControllerTest.java index b1e2ec1f49b..0d464613eb1 100644 --- a/orcid-web/src/test/java/org/orcid/frontend/web/controllers/PublicProfileControllerTest.java +++ b/orcid-web/src/test/java/org/orcid/frontend/web/controllers/PublicProfileControllerTest.java @@ -190,12 +190,22 @@ public void testGetPersonDetails() { assertNotNull(personDetails.getPublicGroupedPersonExternalIdentifiers()); Map> extIds = personDetails.getPublicGroupedPersonExternalIdentifiers(); assertNotNull(extIds); - assertEquals(1, extIds.keySet().size()); + assertEquals(3, extIds.keySet().size()); assertTrue(extIds.containsKey("public_type:public_ref")); + assertTrue(extIds.containsKey("self_public_type:self_public_ref")); + assertTrue(extIds.containsKey("self_public_user_obo_type:self_public_user_obo_ref")); List publicExternalIdentifiers = extIds.get("public_type:public_ref"); assertEquals(Long.valueOf(13), publicExternalIdentifiers.get(0).getPutCode()); assertEquals("http://ext-id/public_ref", publicExternalIdentifiers.get(0).getUrl().getValue()); - assertEquals(Visibility.PUBLIC, publicExternalIdentifiers.get(0).getVisibility()); + assertEquals(Visibility.PUBLIC, publicExternalIdentifiers.get(0).getVisibility()); + publicExternalIdentifiers = extIds.get("self_public_type:self_public_ref"); + assertEquals(Long.valueOf(18), publicExternalIdentifiers.get(0).getPutCode()); + assertEquals("http://ext-id/self/public", publicExternalIdentifiers.get(0).getUrl().getValue()); + assertEquals(Visibility.PUBLIC, publicExternalIdentifiers.get(0).getVisibility()); + publicExternalIdentifiers = extIds.get("self_public_user_obo_type:self_public_user_obo_ref"); + assertEquals(Long.valueOf(19), publicExternalIdentifiers.get(0).getPutCode()); + assertEquals("http://ext-id/self/obo/public", publicExternalIdentifiers.get(0).getUrl().getValue()); + assertEquals(Visibility.PUBLIC, publicExternalIdentifiers.get(0).getVisibility()); } @Test From 4375c86a6d6cb42e87f9e1cb14edf21a98159262 Mon Sep 17 00:00:00 2001 From: amontenegro Date: Thu, 3 Aug 2023 18:19:02 -0600 Subject: [PATCH 6/6] Fix more tests --- ...mberV2ApiServiceDelegator_ReadPersonTest.java | 16 ++++++++++------ ...mberV2ApiServiceDelegator_ReadRecordTest.java | 14 +++++++------- ...ServiceDelegator_ExternalIdentifiersTest.java | 10 ++++++++-- ...mberV3ApiServiceDelegator_ReadPersonTest.java | 4 ++-- ...mberV3ApiServiceDelegator_ReadRecordTest.java | 6 +++--- .../orcid/core/manager/RecordManagerTest.java | 8 +++++--- .../orcid/core/manager/v3/RecordManagerTest.java | 8 +++++--- .../dao/ExternalIdentifierDaoTest.java | 2 +- 8 files changed, 41 insertions(+), 27 deletions(-) diff --git a/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_ReadPersonTest.java b/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_ReadPersonTest.java index 4cd710318ca..10ffee9214b 100644 --- a/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_ReadPersonTest.java +++ b/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_ReadPersonTest.java @@ -180,7 +180,7 @@ public void testViewPerson() { PersonExternalIdentifiers extIds = p.getExternalIdentifiers(); assertNotNull(extIds); Utils.verifyLastModified(extIds.getLastModifiedDate()); - assertEquals(4, extIds.getExternalIdentifiers().size()); + assertEquals(6, extIds.getExternalIdentifiers().size()); found1 = false; found2 = false; found3 = false; @@ -385,7 +385,7 @@ private void testPerson(Person p, String orcid) { PersonExternalIdentifiers extIds = p.getExternalIdentifiers(); assertNotNull(extIds); Utils.verifyLastModified(extIds.getLastModifiedDate()); - assertEquals(3, extIds.getExternalIdentifiers().size()); + assertEquals(5, extIds.getExternalIdentifiers().size()); found1 = false; found2 = false; found3 = false; @@ -400,9 +400,9 @@ private void testPerson(Person p, String orcid) { } else if (element.getPutCode() == 15) { found3 = true; } else if (element.getPutCode() == 18) { - found3 = true; + found4 = true; } else if (element.getPutCode() == 19) { - found3 = true; + found5 = true; } else { fail("Invalid put code " + element.getPutCode()); } @@ -596,9 +596,13 @@ private void assertAllPublicButEmails(Person p) { PersonExternalIdentifiers extIds = p.getExternalIdentifiers(); assertNotNull(extIds); Utils.verifyLastModified(extIds.getLastModifiedDate()); - assertEquals(1, extIds.getExternalIdentifiers().size()); - assertEquals(Long.valueOf(13), extIds.getExternalIdentifiers().get(0).getPutCode()); + assertEquals(3, extIds.getExternalIdentifiers().size()); + assertEquals(Long.valueOf(19), extIds.getExternalIdentifiers().get(0).getPutCode()); assertEquals(Visibility.PUBLIC, extIds.getExternalIdentifiers().get(0).getVisibility()); + assertEquals(Long.valueOf(18), extIds.getExternalIdentifiers().get(1).getPutCode()); + assertEquals(Visibility.PUBLIC, extIds.getExternalIdentifiers().get(1).getVisibility()); + assertEquals(Long.valueOf(13), extIds.getExternalIdentifiers().get(2).getPutCode()); + assertEquals(Visibility.PUBLIC, extIds.getExternalIdentifiers().get(2).getVisibility()); // Keywords assertNotNull(p.getKeywords()); diff --git a/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_ReadRecordTest.java b/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_ReadRecordTest.java index e3f8e7d6a92..a188cc5fe4e 100644 --- a/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_ReadRecordTest.java +++ b/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_ReadRecordTest.java @@ -283,7 +283,7 @@ public void testViewRecord() { assertEquals("self_limited_ref", extId.getValue()); assertEquals(Visibility.LIMITED.value(), extId.getVisibility().value()); } else if (extId.getPutCode().equals(Long.valueOf(18))) { - assertEquals(Long.valueOf(3), extId.getDisplayIndex()); + assertEquals(Long.valueOf(5), extId.getDisplayIndex()); assertEquals("/0000-0000-0000-0003/external-identifiers/18", extId.getPath()); assertEquals("0000-0000-0000-0003", extId.getSource().retrieveSourcePath()); assertEquals("self_public_type", extId.getType()); @@ -291,13 +291,13 @@ public void testViewRecord() { assertEquals("self_public_ref", extId.getValue()); assertEquals(Visibility.PUBLIC.value(), extId.getVisibility().value()); } else if (extId.getPutCode().equals(Long.valueOf(19))) { - assertEquals(Long.valueOf(3), extId.getDisplayIndex()); + assertEquals(Long.valueOf(6), extId.getDisplayIndex()); assertEquals("/0000-0000-0000-0003/external-identifiers/19", extId.getPath()); - assertEquals("0000-0000-0000-0003", extId.getSource().retrieveSourcePath()); + assertEquals("APP-5555555555555558", extId.getSource().retrieveSourcePath()); assertEquals("self_public_user_obo_type", extId.getType()); assertEquals("http://ext-id/self/obo/public", extId.getUrl().getValue()); assertEquals("self_public_user_obo_ref", extId.getValue()); - assertEquals(Visibility.LIMITED.value(), extId.getVisibility().value()); + assertEquals(Visibility.PUBLIC.value(), extId.getVisibility().value()); } else { fail("Invalid external identifier found: " + extId.getPutCode()); } @@ -871,7 +871,7 @@ private void testPerson(Person p, String orcid) { PersonExternalIdentifiers extIds = p.getExternalIdentifiers(); assertNotNull(extIds); Utils.verifyLastModified(extIds.getLastModifiedDate()); - assertEquals(3, extIds.getExternalIdentifiers().size()); + assertEquals(5, extIds.getExternalIdentifiers().size()); found1 = false; found2 = false; found3 = false; @@ -886,9 +886,9 @@ private void testPerson(Person p, String orcid) { } else if (element.getPutCode() == 15) { found3 = true; } else if (element.getPutCode() == 18) { - found3 = true; + found4 = true; } else if (element.getPutCode() == 19) { - found3 = true; + found5 = true; } else { fail("Invalid put code " + element.getPutCode()); } diff --git a/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_ExternalIdentifiersTest.java b/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_ExternalIdentifiersTest.java index 8faba408cf9..bc9e95cef52 100644 --- a/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_ExternalIdentifiersTest.java +++ b/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_ExternalIdentifiersTest.java @@ -409,8 +409,8 @@ public void testReadPublicScope_ExternalIdentifiers() { assertNotNull(p); assertEquals("/0000-0000-0000-0003/external-identifiers", p.getPath()); Utils.verifyLastModified(p.getLastModifiedDate()); - assertEquals(3, p.getExternalIdentifiers().size()); - boolean found13 = false, found14 = false, found15 = false; + assertEquals(5, p.getExternalIdentifiers().size()); + boolean found13 = false, found14 = false, found15 = false, found18 = false, found19 = false; for (PersonExternalIdentifier element : p.getExternalIdentifiers()) { if (element.getPutCode() == 13) { found13 = true; @@ -418,6 +418,10 @@ public void testReadPublicScope_ExternalIdentifiers() { found14 = true; } else if (element.getPutCode() == 15) { found15 = true; + } else if (element.getPutCode() == 18) { + found18 = true; + } else if (element.getPutCode() == 19) { + found19 = true; } else { fail("Invalid put code " + element.getPutCode()); } @@ -426,6 +430,8 @@ public void testReadPublicScope_ExternalIdentifiers() { assertTrue(found13); assertTrue(found14); assertTrue(found15); + assertTrue(found18); + assertTrue(found19); r = serviceDelegator.viewExternalIdentifier(ORCID, 13L); assertNotNull(r); diff --git a/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_ReadPersonTest.java b/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_ReadPersonTest.java index c464a7e7718..982a3b7bf78 100644 --- a/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_ReadPersonTest.java +++ b/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_ReadPersonTest.java @@ -186,7 +186,7 @@ public void testViewPerson() { PersonExternalIdentifiers extIds = p.getExternalIdentifiers(); assertNotNull(extIds); Utils.verifyLastModified(extIds.getLastModifiedDate()); - assertEquals(4, extIds.getExternalIdentifiers().size()); + assertEquals(6, extIds.getExternalIdentifiers().size()); found1 = false; found2 = false; found3 = false; @@ -391,7 +391,7 @@ private void testPerson(Person p, String orcid) { PersonExternalIdentifiers extIds = p.getExternalIdentifiers(); assertNotNull(extIds); Utils.verifyLastModified(extIds.getLastModifiedDate()); - assertEquals(3, extIds.getExternalIdentifiers().size()); + assertEquals(5, extIds.getExternalIdentifiers().size()); found1 = false; found2 = false; found3 = false; diff --git a/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_ReadRecordTest.java b/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_ReadRecordTest.java index 87602b7911e..ca2c7d55282 100644 --- a/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_ReadRecordTest.java +++ b/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_ReadRecordTest.java @@ -259,7 +259,7 @@ public void testViewRecord() { assertNotNull(person.getExternalIdentifiers()); Utils.verifyLastModified(person.getExternalIdentifiers().getLastModifiedDate()); assertEquals("/0000-0000-0000-0003/external-identifiers", person.getExternalIdentifiers().getPath()); - assertEquals(4, person.getExternalIdentifiers().getExternalIdentifiers().size()); + assertEquals(6, person.getExternalIdentifiers().getExternalIdentifiers().size()); for (PersonExternalIdentifier extId : person.getExternalIdentifiers().getExternalIdentifiers()) { Utils.verifyLastModified(extId.getLastModifiedDate()); if (extId.getPutCode().equals(Long.valueOf(13))) { @@ -305,11 +305,11 @@ public void testViewRecord() { } else if (extId.getPutCode().equals(Long.valueOf(19))) { assertEquals(Long.valueOf(6), extId.getDisplayIndex()); assertEquals("/0000-0000-0000-0003/external-identifiers/19", extId.getPath()); - assertEquals("0000-0000-0000-0003", extId.getSource().retrieveSourcePath()); + assertEquals("APP-5555555555555558", extId.getSource().retrieveSourcePath()); assertEquals("self_public_user_obo_type", extId.getType()); assertEquals("http://ext-id/self/obo/public", extId.getUrl().getValue()); assertEquals("self_public_user_obo_ref", extId.getValue()); - assertEquals(Visibility.LIMITED.value(), extId.getVisibility().value()); + assertEquals(Visibility.PUBLIC.value(), extId.getVisibility().value()); } else { fail("Invalid external identifier found: " + extId.getPutCode()); } diff --git a/orcid-core/src/test/java/org/orcid/core/manager/RecordManagerTest.java b/orcid-core/src/test/java/org/orcid/core/manager/RecordManagerTest.java index 6d814e2ad3f..1ca728e4e01 100644 --- a/orcid-core/src/test/java/org/orcid/core/manager/RecordManagerTest.java +++ b/orcid-core/src/test/java/org/orcid/core/manager/RecordManagerTest.java @@ -55,7 +55,7 @@ public void testGetRecord() { Person person = record.getPerson(); assertNotNull(person.getExternalIdentifiers()); assertNotNull(person.getExternalIdentifiers().getExternalIdentifiers()); - assertEquals(5, person.getExternalIdentifiers().getExternalIdentifiers().size()); + assertEquals(7, person.getExternalIdentifiers().getExternalIdentifiers().size()); assertNotNull(person.getResearcherUrls()); assertNotNull(person.getResearcherUrls().getResearcherUrls()); @@ -125,8 +125,10 @@ public void testGetPublicRecord() { assertNotNull(person.getExternalIdentifiers()); assertNotNull(person.getExternalIdentifiers().getExternalIdentifiers()); - assertEquals(1, person.getExternalIdentifiers().getExternalIdentifiers().size()); - assertEquals(Long.valueOf(13), person.getExternalIdentifiers().getExternalIdentifiers().get(0).getPutCode()); + assertEquals(3, person.getExternalIdentifiers().getExternalIdentifiers().size()); + assertEquals(Long.valueOf(19), person.getExternalIdentifiers().getExternalIdentifiers().get(0).getPutCode()); + assertEquals(Long.valueOf(18), person.getExternalIdentifiers().getExternalIdentifiers().get(1).getPutCode()); + assertEquals(Long.valueOf(13), person.getExternalIdentifiers().getExternalIdentifiers().get(2).getPutCode()); assertNotNull(person.getResearcherUrls()); assertNotNull(person.getResearcherUrls().getResearcherUrls()); diff --git a/orcid-core/src/test/java/org/orcid/core/manager/v3/RecordManagerTest.java b/orcid-core/src/test/java/org/orcid/core/manager/v3/RecordManagerTest.java index e42d93d7096..527478472bb 100644 --- a/orcid-core/src/test/java/org/orcid/core/manager/v3/RecordManagerTest.java +++ b/orcid-core/src/test/java/org/orcid/core/manager/v3/RecordManagerTest.java @@ -56,7 +56,7 @@ public void testGetRecord() { Person person = record.getPerson(); assertNotNull(person.getExternalIdentifiers()); assertNotNull(person.getExternalIdentifiers().getExternalIdentifiers()); - assertEquals(5, person.getExternalIdentifiers().getExternalIdentifiers().size()); + assertEquals(7, person.getExternalIdentifiers().getExternalIdentifiers().size()); assertNotNull(person.getResearcherUrls()); assertNotNull(person.getResearcherUrls().getResearcherUrls()); @@ -152,8 +152,10 @@ public void testGetPublicRecord() { assertNotNull(person.getExternalIdentifiers()); assertNotNull(person.getExternalIdentifiers().getExternalIdentifiers()); - assertEquals(1, person.getExternalIdentifiers().getExternalIdentifiers().size()); - assertEquals(Long.valueOf(13), person.getExternalIdentifiers().getExternalIdentifiers().get(0).getPutCode()); + assertEquals(3, person.getExternalIdentifiers().getExternalIdentifiers().size()); + assertEquals(Long.valueOf(19), person.getExternalIdentifiers().getExternalIdentifiers().get(0).getPutCode()); + assertEquals(Long.valueOf(18), person.getExternalIdentifiers().getExternalIdentifiers().get(1).getPutCode()); + assertEquals(Long.valueOf(13), person.getExternalIdentifiers().getExternalIdentifiers().get(2).getPutCode()); assertNotNull(person.getResearcherUrls()); assertNotNull(person.getResearcherUrls().getResearcherUrls()); diff --git a/orcid-persistence/src/test/java/org/orcid/persistence/dao/ExternalIdentifierDaoTest.java b/orcid-persistence/src/test/java/org/orcid/persistence/dao/ExternalIdentifierDaoTest.java index 9033d1e5fa6..c3620693acd 100644 --- a/orcid-persistence/src/test/java/org/orcid/persistence/dao/ExternalIdentifierDaoTest.java +++ b/orcid-persistence/src/test/java/org/orcid/persistence/dao/ExternalIdentifierDaoTest.java @@ -142,7 +142,7 @@ public void removeAllTest() { long initialNumber = dao.countAll(); long elementThatBelogsToUser = dao.getExternalIdentifiers(USER_ORCID, 0L).size(); long otherUserElements = dao.getExternalIdentifiers(OTHER_USER_ORCID, 0L).size(); - assertEquals(5, elementThatBelogsToUser); + assertEquals(7, elementThatBelogsToUser); assertTrue(elementThatBelogsToUser < initialNumber); assertEquals(3, otherUserElements); //Remove all elements that belongs to USER_ORCID