From e305df8e0ef4cca935bb150ebaf1f3b015fdc461 Mon Sep 17 00:00:00 2001 From: andrej romanov <50377758+auumgn@users.noreply.github.com> Date: Wed, 20 Nov 2024 19:02:26 +0200 Subject: [PATCH] update tests --- ...rV2ApiServiceDelegator_ReadRecordTest.java | 13 +++++++++-- .../main/java/org/orcid/test/DBUnitTest.java | 3 ++- .../main/resources/data/ProfileEntityData.xml | 23 +++++++++++++++++-- 3 files changed, 34 insertions(+), 5 deletions(-) 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 5f42ab91375..db65c7b9882 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 @@ -73,7 +73,7 @@ public class MemberV2ApiServiceDelegator_ReadRecordTest extends DBUnitTest { "/data/Oauth2TokenDetailsData.xml", "/data/OrgsEntityData.xml", "/data/ProfileFundingEntityData.xml", "/data/OrgAffiliationEntityData.xml", "/data/PeerReviewEntityData.xml", "/data/GroupIdRecordEntityData.xml", "/data/RecordNameEntityData.xml", "/data/BiographyEntityData.xml"); - // Now on, for any new test, PLAESE USER THIS ORCID ID + // Now on, for any new test, PLEASE USER THIS ORCID ID protected final String ORCID = "0000-0000-0000-0003"; @Resource(name = "memberV2ApiServiceDelegator") @@ -223,21 +223,30 @@ public void testViewRecord() { assertNotNull(person.getEmails()); Utils.verifyLastModified(person.getEmails().getLastModifiedDate()); assertEquals("/0000-0000-0000-0003/email", person.getEmails().getPath()); - assertEquals(4, person.getEmails().getEmails().size()); + assertEquals(5, person.getEmails().getEmails().size()); for (Email email : person.getEmails().getEmails()) { Utils.verifyLastModified(email.getLastModifiedDate()); if (email.getEmail().equals("public_0000-0000-0000-0003@test.orcid.org")) { assertEquals("APP-5555555555555555", email.getSource().retrieveSourcePath()); assertEquals(Visibility.PUBLIC.value(), email.getVisibility().value()); + assertEquals("Source Client 1", email.getSource().getSourceName().getContent()); } else if (email.getEmail().equals("limited_0000-0000-0000-0003@test.orcid.org")) { assertEquals("APP-5555555555555555", email.getSource().retrieveSourcePath()); assertEquals(Visibility.LIMITED.value(), email.getVisibility().value()); + assertEquals("Source Client 1", email.getSource().getSourceName().getContent()); } else if (email.getEmail().equals("private_0000-0000-0000-0003@test.orcid.org")) { assertEquals("APP-5555555555555555", email.getSource().retrieveSourcePath()); assertEquals(Visibility.PRIVATE.value(), email.getVisibility().value()); + assertEquals("Source Client 1", email.getSource().getSourceName().getContent()); } else if (email.getEmail().equals("self_limited_0000-0000-0000-0003@test.orcid.org")) { assertEquals("0000-0000-0000-0003", email.getSource().retrieveSourcePath()); assertEquals(Visibility.LIMITED.value(), email.getVisibility().value()); + assertEquals("Credit Name", email.getSource().getSourceName().getContent()); + } else if (email.getEmail().equals("public_0000-0000-0000-0003@orcid.org")) { + assertEquals("0000-0000-0000-0000", email.getSource().retrieveSourcePath()); + assertNull(email.getSource().getSourceOrcid()); + assertEquals(Visibility.PUBLIC.value(), email.getVisibility().value()); + assertEquals("ORCID email validation", email.getSource().getSourceName().getContent()); } else { fail("Invalid email found: " + email.getEmail()); } diff --git a/orcid-test/src/main/java/org/orcid/test/DBUnitTest.java b/orcid-test/src/main/java/org/orcid/test/DBUnitTest.java index 470ba8ab1ae..14f3160ca27 100644 --- a/orcid-test/src/main/java/org/orcid/test/DBUnitTest.java +++ b/orcid-test/src/main/java/org/orcid/test/DBUnitTest.java @@ -39,7 +39,7 @@ public class DBUnitTest { private static final String TEST_CORE_CONTEXT = "classpath:test-core-context.xml"; private static final String[] tables = new String[] { "profile", "orcid_social", "profile_event", "work", "researcher_url", - "given_permission_to", "external_identifier", "email", "email_event", "biography", "record_name", "other_name", "profile_keyword", "profile_patent", + "given_permission_to", "external_identifier", "email", "email_domain", "email_event", "biography", "record_name", "other_name", "profile_keyword", "profile_patent", "org_disambiguated", "org_disambiguated_external_identifier", "org", "org_affiliation_relation", "profile_funding", "funding_external_identifier", "address", "institution", "affiliation", "notification", "client_details", "client_secret", "oauth2_token_detail", "custom_email", "webhook", "granted_authority", "orcid_props", "peer_review", "peer_review_subject", "shibboleth_account", "group_id_record", "invalid_record_data_changes", @@ -134,6 +134,7 @@ private static void cleanClientSourcedProfiles(IDatabaseConnection connection) t dataSet.addTable("profile_event"); dataSet.addTable("researcher_url"); dataSet.addTable("email"); + dataSet.addTable("email_domain"); dataSet.addTable("email_event"); dataSet.addTable("external_identifier"); dataSet.addTable("org"); diff --git a/orcid-test/src/main/resources/data/ProfileEntityData.xml b/orcid-test/src/main/resources/data/ProfileEntityData.xml index c2efa79aed1..11c74d195ba 100644 --- a/orcid-test/src/main/resources/data/ProfileEntityData.xml +++ b/orcid-test/src/main/resources/data/ProfileEntityData.xml @@ -1826,7 +1826,7 @@ client_source_id="APP-5555555555555555" date_created="2016-01-01 00:00:00.00" last_modified="2016-01-01 00:00:00.00" - /> + /> + /> + + + +